Commit 60d009df authored by Deni Rinaldi's avatar Deni Rinaldi

+_+

parent b315698d
...@@ -101,7 +101,7 @@ export default class BalanceSheet extends Component { ...@@ -101,7 +101,7 @@ export default class BalanceSheet extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before, item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
Number(item.balance_sheet.january).toFixed(1), Number(item.balance_sheet.january).toFixed(1),
Number(item.balance_sheet.february).toFixed(1), Number(item.balance_sheet.february).toFixed(1),
Number(item.balance_sheet.march).toFixed(1), Number(item.balance_sheet.march).toFixed(1),
...@@ -138,7 +138,7 @@ export default class BalanceSheet extends Component { ...@@ -138,7 +138,7 @@ export default class BalanceSheet extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before, item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
Number(item.balance_sheet.january).toFixed(1), Number(item.balance_sheet.january).toFixed(1),
Number(item.balance_sheet.february).toFixed(1), Number(item.balance_sheet.february).toFixed(1),
Number(item.balance_sheet.march).toFixed(1), Number(item.balance_sheet.march).toFixed(1),
...@@ -309,11 +309,11 @@ export default class BalanceSheet extends Component { ...@@ -309,11 +309,11 @@ export default class BalanceSheet extends Component {
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false, saveDraft: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[25].length > 0) { if (item[25].length > 0) {
console.log('error') console.log('error')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
} }
}) })
// console.log(this.state.dataTable); // console.log(this.state.dataTable);
...@@ -395,21 +395,21 @@ export default class BalanceSheet extends Component { ...@@ -395,21 +395,21 @@ export default class BalanceSheet extends Component {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(Number(i[6]).toFixed(1)), total_actual_before: String(Number(i[6]).toFixed(1)),
january: i[0] === 3 && i[7] === "" ? "0" : String(Number(i[7]).toFixed(1)), january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
february: i[0] === 3 && i[8] === "" ? "0" : String(Number(i[8]).toFixed(1)), february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
march: i[0] === 3 && i[9] === "" ? "0" : String(Number(i[9]).toFixed(1)), march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
april: i[0] === 3 && i[10] === "" ? "0" : String(Number(i[10]).toFixed(1)), april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
may: i[0] === 3 && i[11] === "" ? "0" : String(Number(i[11]).toFixed(1)), may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
june: i[0] === 3 && i[12] === "" ? "0" : String(Number(i[12]).toFixed(1)), june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
july: i[0] === 3 && i[13] === "" ? "0" : String(Number(i[13]).toFixed(1)), july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
august: i[0] === 3 && i[14] === "" ? "0" : String(Number(i[14]).toFixed(1)), august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
september: i[0] === 3 && i[15] === "" ? "0" : String(Number(i[15]).toFixed(1)), september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
october: i[0] === 3 && i[16] === "" ? "0" : String(Number(i[16]).toFixed(1)), october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0" : String(Number(i[17]).toFixed(1)), november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
december: i[0] === 3 && i[18] === "" ? "0" : String(Number(i[18]).toFixed(1)), december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(Number(i[19]).toFixed(1)), total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(Number(i[20]).toFixed(1)), total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20]).toFixed(1)),
total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(Number(i[21]).toFixed(1)), total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
}) })
}) })
console.log(JSON.stringify(data)) console.log(JSON.stringify(data))
...@@ -3105,13 +3105,13 @@ export default class BalanceSheet extends Component { ...@@ -3105,13 +3105,13 @@ export default class BalanceSheet extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.errorPreview !== true ? 'pointer' : 'default', cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.errorPreview === true ? this.state.saveDraft === true ?
null : null :
this.setState({ loading: true }, () => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
......
...@@ -51,7 +51,8 @@ export default class TaxPlanning extends Component { ...@@ -51,7 +51,8 @@ export default class TaxPlanning extends Component {
judulColumn: null, judulColumn: null,
updateBy: '-', updateBy: '-',
buttonDraft: true, buttonDraft: true,
handleTekTekTek: 0 handleTekTekTek: 0,
saveDraft: true
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
...@@ -460,11 +461,11 @@ export default class TaxPlanning extends Component { ...@@ -460,11 +461,11 @@ export default class TaxPlanning extends Component {
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[27].length > 0) { if (item[27].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
} }
}) })
console.log(this.state.dataTable); console.log(this.state.dataTable);
...@@ -585,79 +586,78 @@ export default class TaxPlanning extends Component { ...@@ -585,79 +586,78 @@ export default class TaxPlanning extends Component {
data.push({ data.push({
item_report_id: i[4], item_report_id: i[4],
january: { january: {
tbc: i[1] === 3 && i[9].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[9].tbc.value).toFixed(1)) : String(Number(i[9].tbc).toFixed(1)), tbc: i[1] === 3 && i[9].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[9].tbc.value).toFixed(1)) : String(Number(i[9].tbc).toFixed(1)),
fcp: i[2] === 3 && i[9].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[9].fcp.value).toFixed(1)) : String(Number(i[9].fcp).toFixed(1)), fcp: i[2] === 3 && i[9].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[9].fcp.value).toFixed(1)) : String(Number(i[9].fcp).toFixed(1)),
tbf: i[3] === 3 && i[9].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[9].tbf.value).toFixed(1)) : String(Number(i[9].tbf).toFixed(1)) tbf: i[3] === 3 && i[9].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[9].tbf.value).toFixed(1)) : String(Number(i[9].tbf).toFixed(1))
}, },
february: { february: {
tbc: i[1] === 3 && i[10].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[10].tbc.value).toFixed(1)) : String(Number(i[10].tbc).toFixed(1)), tbc: i[1] === 3 && i[10].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[10].tbc.value).toFixed(1)) : String(Number(i[10].tbc).toFixed(1)),
fcp: i[2] === 3 && i[10].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[10].fcp.value).toFixed(1)) : String(Number(i[10].fcp).toFixed(1)), fcp: i[2] === 3 && i[10].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[10].fcp.value).toFixed(1)) : String(Number(i[10].fcp).toFixed(1)),
tbf: i[3] === 3 && i[10].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[10].tbf.value).toFixed(1)) : String(Number(i[10].tbf).toFixed(1)) tbf: i[3] === 3 && i[10].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[10].tbf.value).toFixed(1)) : String(Number(i[10].tbf).toFixed(1))
}, },
march: { march: {
tbc: i[1] === 3 && i[11].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[11].tbc.value).toFixed(1)) : String(Number(i[11].tbc).toFixed(1)), tbc: i[1] === 3 && i[11].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[11].tbc.value).toFixed(1)) : String(Number(i[11].tbc).toFixed(1)),
fcp: i[2] === 3 && i[11].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[11].fcp.value).toFixed(1)) : String(Number(i[11].fcp).toFixed(1)), fcp: i[2] === 3 && i[11].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[11].fcp.value).toFixed(1)) : String(Number(i[11].fcp).toFixed(1)),
tbf: i[3] === 3 && i[11].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[11].tbf.value).toFixed(1)) : String(Number(i[11].tbf).toFixed(1)) tbf: i[3] === 3 && i[11].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[11].tbf.value).toFixed(1)) : String(Number(i[11].tbf).toFixed(1))
}, },
april: { april: {
tbc: i[1] === 3 && i[12].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[12].tbc.value).toFixed(1)) : String(Number(i[12].tbc).toFixed(1)), tbc: i[1] === 3 && i[12].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[12].tbc.value).toFixed(1)) : String(Number(i[12].tbc).toFixed(1)),
fcp: i[2] === 3 && i[12].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[12].fcp.value).toFixed(1)) : String(Number(i[12].fcp).toFixed(1)), fcp: i[2] === 3 && i[12].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[12].fcp.value).toFixed(1)) : String(Number(i[12].fcp).toFixed(1)),
tbf: i[3] === 3 && i[12].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[12].tbf.value).toFixed(1)) : String(Number(i[12].tbf).toFixed(1)) tbf: i[3] === 3 && i[12].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[12].tbf.value).toFixed(1)) : String(Number(i[12].tbf).toFixed(1))
}, },
may: { may: {
tbc: i[1] === 3 && i[13].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[13].tbc.value).toFixed(1)) : String(Number(i[13].tbc).toFixed(1)), tbc: i[1] === 3 && i[13].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[13].tbc.value).toFixed(1)) : String(Number(i[13].tbc).toFixed(1)),
fcp: i[2] === 3 && i[13].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[13].fcp.value).toFixed(1)) : String(Number(i[13].fcp).toFixed(1)), fcp: i[2] === 3 && i[13].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[13].fcp.value).toFixed(1)) : String(Number(i[13].fcp).toFixed(1)),
tbf: i[3] === 3 && i[13].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[13].tbf.value).toFixed(1)) : String(Number(i[13].tbf).toFixed(1)) tbf: i[3] === 3 && i[13].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[13].tbf.value).toFixed(1)) : String(Number(i[13].tbf).toFixed(1))
}, },
june: { june: {
tbc: i[1] === 3 && i[14].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[14].tbc.value).toFixed(1)) : String(Number(i[14].tbc).toFixed(1)), tbc: i[1] === 3 && i[14].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[14].tbc.value).toFixed(1)) : String(Number(i[14].tbc).toFixed(1)),
fcp: i[2] === 3 && i[14].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[14].fcp.value).toFixed(1)) : String(Number(i[14].fcp).toFixed(1)), fcp: i[2] === 3 && i[14].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[14].fcp.value).toFixed(1)) : String(Number(i[14].fcp).toFixed(1)),
tbf: i[3] === 3 && i[14].tbc === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[14].tbf.value).toFixed(1)) : String(Number(i[14].tbf).toFixed(1)) tbf: i[3] === 3 && i[14].tbc === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[14].tbf.value).toFixed(1)) : String(Number(i[14].tbf).toFixed(1))
}, },
july: { july: {
tbc: i[1] === 3 && i[15].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[15].tbc.value).toFixed(1)) : String(Number(i[15].tbc).toFixed(1)), tbc: i[1] === 3 && i[15].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[15].tbc.value).toFixed(1)) : String(Number(i[15].tbc).toFixed(1)),
fcp: i[2] === 3 && i[15].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[15].fcp.value).toFixed(1)) : String(Number(i[15].fcp).toFixed(1)), fcp: i[2] === 3 && i[15].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[15].fcp.value).toFixed(1)) : String(Number(i[15].fcp).toFixed(1)),
tbf: i[3] === 3 && i[15].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[15].tbf.value).toFixed(1)) : String(Number(i[15].tbf).toFixed(1)) tbf: i[3] === 3 && i[15].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[15].tbf.value).toFixed(1)) : String(Number(i[15].tbf).toFixed(1))
}, },
august: { august: {
tbc: i[1] === 3 && i[16].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[16].tbc.value).toFixed(1)) : String(Number(i[16].tbc).toFixed(1)), tbc: i[1] === 3 && i[16].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[16].tbc.value).toFixed(1)) : String(Number(i[16].tbc).toFixed(1)),
fcp: i[2] === 3 && i[16].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[16].fcp.value).toFixed(1)) : String(Number(i[16].fcp).toFixed(1)), fcp: i[2] === 3 && i[16].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[16].fcp.value).toFixed(1)) : String(Number(i[16].fcp).toFixed(1)),
tbf: i[3] === 3 && i[16].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[16].tbf.value).toFixed(1)) : String(Number(i[16].tbf).toFixed(1)) tbf: i[3] === 3 && i[16].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[16].tbf.value).toFixed(1)) : String(Number(i[16].tbf).toFixed(1))
}, },
september: { september: {
tbc: i[1] === 3 && i[17].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[17].tbc.value).toFixed(1)) : String(Number(i[17].tbc).toFixed(1)), tbc: i[1] === 3 && i[17].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[17].tbc.value).toFixed(1)) : String(Number(i[17].tbc).toFixed(1)),
fcp: i[2] === 3 && i[17].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[17].fcp.value).toFixed(1)) : String(Number(i[17].fcp).toFixed(1)), fcp: i[2] === 3 && i[17].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[17].fcp.value).toFixed(1)) : String(Number(i[17].fcp).toFixed(1)),
tbf: i[3] === 3 && i[17].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[17].tbf.value).toFixed(1)) : String(Number(i[17].tbf).toFixed(1)) tbf: i[3] === 3 && i[17].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[17].tbf.value).toFixed(1)) : String(Number(i[17].tbf).toFixed(1))
}, },
october: { october: {
tbc: i[1] === 3 && i[18].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[18].tbc.value).toFixed(1)) : String(Number(i[18].tbc).toFixed(1)), tbc: i[1] === 3 && i[18].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[18].tbc.value).toFixed(1)) : String(Number(i[18].tbc).toFixed(1)),
fcp: i[2] === 3 && i[18].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[18].fcp.value).toFixed(1)) : String(Number(i[18].fcp).toFixed(1)), fcp: i[2] === 3 && i[18].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[18].fcp.value).toFixed(1)) : String(Number(i[18].fcp).toFixed(1)),
tbf: i[3] === 3 && i[18].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[18].tbf.value).toFixed(1)) : String(Number(i[18].tbf).toFixed(1)) tbf: i[3] === 3 && i[18].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[18].tbf.value).toFixed(1)) : String(Number(i[18].tbf).toFixed(1))
}, },
november: { november: {
tbc: i[1] === 3 && i[19].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[19].tbc.value).toFixed(1)) : String(Number(i[19].tbc).toFixed(1)), tbc: i[1] === 3 && i[19].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[19].tbc.value).toFixed(1)) : String(Number(i[19].tbc).toFixed(1)),
fcp: i[2] === 3 && i[19].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[19].fcp.value).toFixed(1)) : String(Number(i[19].fcp).toFixed(1)), fcp: i[2] === 3 && i[19].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[19].fcp.value).toFixed(1)) : String(Number(i[19].fcp).toFixed(1)),
tbf: i[3] === 3 && i[19].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[19].tbf.value).toFixed(1)) : String(Number(i[19].tbf).toFixed(1)) tbf: i[3] === 3 && i[19].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[19].tbf.value).toFixed(1)) : String(Number(i[19].tbf).toFixed(1))
}, },
december: { december: {
tbc: i[1] === 3 && i[20].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[20].tbc.value).toFixed(1)) : String(Number(i[20].tbc).toFixed(1)), tbc: i[1] === 3 && i[20].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[20].tbc.value).toFixed(1)) : String(Number(i[20].tbc).toFixed(1)),
fcp: i[2] === 3 && i[20].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[20].fcp.value).toFixed(1)) : String(Number(i[20].fcp).toFixed(1)), fcp: i[2] === 3 && i[20].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[20].fcp.value).toFixed(1)) : String(Number(i[20].fcp).toFixed(1)),
tbf: i[3] === 3 && i[20].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[20].tbf.value).toFixed(1)) : String(Number(i[20].tbf).toFixed(1)) tbf: i[3] === 3 && i[20].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[20].tbf.value).toFixed(1)) : String(Number(i[20].tbf).toFixed(1))
}, },
total_current_year: i[2] === 3 && i[21] === "" ? "0" : String(i[21]), total_current_year: i[2] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
total_next_year: { total_next_year: {
tbc: i[1] === 3 && i[22].tbc === "" ? "0" : String(Number(i[22].tbc).toFixed(1)), tbc: i[1] === 3 && i[22].tbc === "" ? "0.0" : String(Number(i[22].tbc).toFixed(1)),
fcp: i[2] === 3 && i[22].fcp === "" ? "0" : String(Number(i[22].fcp).toFixed(1)), fcp: i[2] === 3 && i[22].fcp === "" ? "0.0" : String(Number(i[22].fcp).toFixed(1)),
tbf: i[3] === 3 && i[22].tbf === "" ? "0" : String(Number(i[22].tbf).toFixed(1)) tbf: i[3] === 3 && i[22].tbf === "" ? "0.0" : String(Number(i[22].tbf).toFixed(1))
}, },
total_more_year: { total_more_year: {
tbc: i[1] === 3 && i[23].tbc === "" ? "0" : String(Number(i[23].tbc).toFixed(1)), tbc: i[1] === 3 && i[23].tbc === "" ? "0.0" : String(Number(i[23].tbc).toFixed(1)),
fcp: i[2] === 3 && i[23].fcp === "" ? "0" : String(Number(i[23].fcp).toFixed(1)), fcp: i[2] === 3 && i[23].fcp === "" ? "0.0" : String(Number(i[23].fcp).toFixed(1)),
tbf: i[3] === 3 && i[23].tbf === "" ? "0" : String(Number(i[23].tbf).toFixed(1)) tbf: i[3] === 3 && i[23].tbf === "" ? "0.0" : String(Number(i[23].tbf).toFixed(1))
} }
}) })
}) })
console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -666,13 +666,14 @@ export default class TaxPlanning extends Component { ...@@ -666,13 +666,14 @@ export default class TaxPlanning extends Component {
"tax_planning": data, "tax_planning": data,
"status": "submitted" "status": "submitted"
} }
console.log(JSON.stringify(payload));
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false }) this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// alert("Type Input Can't be Empty") // alert("Type Input Can't be Empty")
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
} }
}) })
} }
...@@ -1027,13 +1028,13 @@ export default class TaxPlanning extends Component { ...@@ -1027,13 +1028,13 @@ export default class TaxPlanning extends Component {
// } // }
// console.log(item[4]) // console.log(item[4])
// console.log(tableMeta.rowData[5]) // console.log(tableMeta.rowData[5])
total += Number(type == 1? total += Number(type == 1 ?
item[tableMeta.columnIndex].tbc.value == undefined? Number(item[tableMeta.columnIndex].tbc == "" || item[tableMeta.columnIndex].tbc == "0.0"? 0 : item[tableMeta.columnIndex].tbc) : Number(item[tableMeta.columnIndex].tbc.value == "" || item[tableMeta.columnIndex].tbc.value == "0.0"? 0 : item[tableMeta.columnIndex].tbc.value) item[tableMeta.columnIndex].tbc.value == undefined ? Number(item[tableMeta.columnIndex].tbc == "" || item[tableMeta.columnIndex].tbc == "0.0" ? 0 : item[tableMeta.columnIndex].tbc) : Number(item[tableMeta.columnIndex].tbc.value == "" || item[tableMeta.columnIndex].tbc.value == "0.0" ? 0 : item[tableMeta.columnIndex].tbc.value)
: :
(type == 2? (type == 2 ?
item[tableMeta.columnIndex].fcp.value == undefined? Number(item[tableMeta.columnIndex].fcp == "" || item[tableMeta.columnIndex].fcp == "0.0"? 0 : item[tableMeta.columnIndex].fcp) : Number(item[tableMeta.columnIndex].fcp.value == "" || item[tableMeta.columnIndex].fcp.value == "0.0"? 0 : item[tableMeta.columnIndex].fcp.value) item[tableMeta.columnIndex].fcp.value == undefined ? Number(item[tableMeta.columnIndex].fcp == "" || item[tableMeta.columnIndex].fcp == "0.0" ? 0 : item[tableMeta.columnIndex].fcp) : Number(item[tableMeta.columnIndex].fcp.value == "" || item[tableMeta.columnIndex].fcp.value == "0.0" ? 0 : item[tableMeta.columnIndex].fcp.value)
: :
item[tableMeta.columnIndex].tbf.value == undefined? Number(item[tableMeta.columnIndex].tbf == "" || item[tableMeta.columnIndex].tbf == "0.0"? 0 : item[tableMeta.columnIndex].tbf) : Number(item[tableMeta.columnIndex].tbf.value == "" || item[tableMeta.columnIndex].tbf.value == "0.0"? 0 : item[tableMeta.columnIndex].tbf.value) item[tableMeta.columnIndex].tbf.value == undefined ? Number(item[tableMeta.columnIndex].tbf == "" || item[tableMeta.columnIndex].tbf == "0.0" ? 0 : item[tableMeta.columnIndex].tbf) : Number(item[tableMeta.columnIndex].tbf.value == "" || item[tableMeta.columnIndex].tbf.value == "0.0" ? 0 : item[tableMeta.columnIndex].tbf.value)
) )
) )
} }
...@@ -7101,8 +7102,9 @@ export default class TaxPlanning extends Component { ...@@ -7101,8 +7102,9 @@ export default class TaxPlanning extends Component {
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => { setTimeout(() => {
...@@ -7112,7 +7114,7 @@ export default class TaxPlanning extends Component { ...@@ -7112,7 +7114,7 @@ export default class TaxPlanning extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -7190,7 +7192,6 @@ export default class TaxPlanning extends Component { ...@@ -7190,7 +7192,6 @@ export default class TaxPlanning extends Component {
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
...@@ -7199,9 +7200,10 @@ export default class TaxPlanning extends Component { ...@@ -7199,9 +7200,10 @@ export default class TaxPlanning extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { // this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false }) this.handleValidate()
}, 100); }, 100);
}) })
}} }}
...@@ -7215,12 +7217,12 @@ export default class TaxPlanning extends Component { ...@@ -7215,12 +7217,12 @@ export default class TaxPlanning extends Component {
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.state.editable === true ? onClick={() => this.state.saveDraft === true ?
null null
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment