Commit 9800dcfe authored by rifkaki's avatar rifkaki

olpa & ro tp

parent 344c5b7e
......@@ -397,7 +397,7 @@ export default class TaxPlanningOLPA extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
console.log(resp)
if (err) {
// console.log(err);
}
......@@ -413,75 +413,75 @@ export default class TaxPlanningOLPA extends Component {
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
january: {
tbc: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
// tbc: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
// fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
tbf: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
},
february: {
tbc: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
tbf: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
// tbc: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
// fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
tbf: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
},
march: {
tbc: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
tbf: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
// tbc: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
// fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
},
april: {
tbc: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
tbf: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
// tbc: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
// fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
tbf: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
},
may: {
tbc: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
tbf: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
// tbc: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
// fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
tbf: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
},
june: {
tbc: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
tbf: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(),
// tbc: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
// fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
tbf: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
},
july: {
tbc: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
tbf: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[22]).trim(),
// tbc: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
// fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
tbf: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
},
august: {
tbc: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
tbf: i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[25]).trim(),
// tbc: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
// fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
tbf: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
},
september: {
tbc: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(),
fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
tbf: i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[28]).trim(),
// tbc: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(),
// fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
tbf: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
},
october: {
tbc: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(),
fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
tbf: i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[31]).trim(),
// tbc: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(),
// fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
tbf: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
},
november: {
tbc: i[32] === undefined ? "0" : reg.test(String(i[32])) === false ? "0" : String(i[32]).trim(),
fcp: i[33] === undefined ? "0" : reg.test(String(i[33])) === false ? "0" : String(i[33]).trim(),
tbf: i[34] === undefined ? "0" : reg.test(String(i[34])) === false ? "0" : String(i[34]).trim(),
tbc: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
fcp: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
tbf: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
},
december: {
tbc: i[35] === undefined ? "0" : reg.test(String(i[35])) === false ? "0" : String(i[35]).trim(),
fcp: i[36] === undefined ? "0" : reg.test(String(i[36])) === false ? "0" : String(i[36]).trim(),
tbf: i[37] === undefined ? "0" : reg.test(String(i[37])) === false ? "0" : String(i[37]).trim(),
tbc: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
fcp: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
tbf: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
},
total_current_year: i[38] === undefined ? "" : String(i[38]).trim(),
total_current_year: i[18] === undefined ? "" : String(i[18]).trim(),
total_next_year: {
tbc: i[39] === undefined ? "0" : reg.test(String(i[39])) === false ? "0" : String(i[39]).trim(),
fcp: i[40] === undefined ? "0" : reg.test(String(i[40])) === false ? "0" : String(i[40]).trim(),
tbf: i[41] === undefined ? "0" : reg.test(String(i[41])) === false ? "0" : String(i[41]).trim(),
tbc: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(),
fcp: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
tbf: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
},
total_more_year: {
tbc: i[42] === undefined ? "0" : reg.test(String(i[42])) === false ? "0" : String(i[42]).trim(),
fcp: i[43] === undefined ? "0" : reg.test(String(i[43])) === false ? "0" : String(i[43]).trim(),
tbf: i[44] === undefined ? "0" : reg.test(String(i[44])) === false ? "0" : String(i[44]).trim(),
tbc: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[22]).trim(),
fcp: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
tbf: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
}
})
}
......@@ -518,44 +518,44 @@ export default class TaxPlanningOLPA extends Component {
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level,
item.item_report,
{ tbc: Number(item.type_report_id.tbc) === 3 && item.january.tbc === "" ? "0" : item.january.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.january.fcp === "" ? "0" : item.january.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.january.tbf === "" ? "0" : item.january.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.february.tbc === "" ? "0" : item.february.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.february.fcp === "" ? "0" : item.february.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.february.tbf === "" ? "0" : item.february.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.march.tbc === "" ? "0" : item.march.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.march.fcp === "" ? "0" : item.march.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.march.tbf === "" ? "0" : item.march.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.april.tbc === "" ? "0" : item.april.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.april.fcp === "" ? "0" : item.april.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.april.tbf === "" ? "0" : item.april.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.may.tbc === "" ? "0" : item.may.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.may.fcp === "" ? "0" : item.may.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.may.tbf === "" ? "0" : item.may.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.june.tbc === "" ? "0" : item.june.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.june.fcp === "" ? "0" : item.june.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.june.tbf === "" ? "0" : item.june.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.july.tbc === "" ? "0" : item.july.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.july.fcp === "" ? "0" : item.july.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.july.tbf === "" ? "0" : item.july.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.august.tbc === "" ? "0" : item.august.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.august.fcp === "" ? "0" : item.august.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.august.tbf === "" ? "0" : item.august.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.september.tbc === "" ? "0" : item.september.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.september.fcp === "" ? "0" : item.september.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.september.tbf === "" ? "0" : item.september.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.october.tbc === "" ? "0" : item.october.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.october.fcp === "" ? "0" : item.october.fcp,
{ tbc: 0,
fcp: 0,
tbf: Number(item.type_report_id.tbf) === 3 && item.october.tbf === "" ? "0" : item.october.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.november.tbc === "" ? "0" : item.november.tbc,
......@@ -567,26 +567,20 @@ export default class TaxPlanningOLPA extends Component {
tbf: Number(item.type_report_id.tbf) === 3 && item.december.tbf === "" ? "0" : item.december.tbf
},
item.total_current_year,
{ tbc: Number(item.type_report_id.tbc) === 3 && item.total_next_year.tbc === "" ? "0" : item.total_next_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_next_year.fcp === "" ? "0" : item.total_next_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_next_year.tbf === "" ? "0" : item.total_next_year.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.total_more_year.tbc === "" ? "0" : item.total_more_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_more_year.fcp === "" ? "0" : item.total_more_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_more_year.tbf === "" ? "0" : item.total_more_year.tbf
},
0,
0,
item.orders,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[25].length > 0) {
// console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.dataTable);
// this.state.dataTable.map(item => {
// if (item[25].length > 0) {
// console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true, editable: true })
// }
// })
console.log(this.state.dataTable);
})
}
}
......@@ -599,53 +593,53 @@ export default class TaxPlanningOLPA extends Component {
data.push({
item_report_id: i[4],
january: {
tbc: String(Number(i[9].tbc).toFixed(1)),
fcp: String(Number(i[9].fcp).toFixed(1)),
// tbc: String(Number(i[9].tbc).toFixed(1)),
// fcp: String(Number(i[9].fcp).toFixed(1)),
tbf: String(Number(i[9].tbf).toFixed(1))
},
february: {
tbc: String(Number(i[10].tbc).toFixed(1)),
fcp: String(Number(i[10].fcp).toFixed(1)),
// tbc: String(Number(i[10].tbc).toFixed(1)),
// fcp: String(Number(i[10].fcp).toFixed(1)),
tbf: String(Number(i[10].tbf).toFixed(1))
},
march: {
tbc: String(Number(i[11].tbc).toFixed(1)),
fcp: String(Number(i[11].fcp).toFixed(1)),
// tbc: String(Number(i[11].tbc).toFixed(1)),
// fcp: String(Number(i[11].fcp).toFixed(1)),
tbf: String(Number(i[11].tbf).toFixed(1))
},
april: {
tbc: String(Number(i[12].tbc).toFixed(1)),
fcp: String(Number(i[12].fcp).toFixed(1)),
// tbc: String(Number(i[12].tbc).toFixed(1)),
// fcp: String(Number(i[12].fcp).toFixed(1)),
tbf: String(Number(i[12].tbf).toFixed(1))
},
may: {
tbc: String(Number(i[13].tbc).toFixed(1)),
fcp: String(Number(i[13].fcp).toFixed(1)),
// tbc: String(Number(i[13].tbc).toFixed(1)),
// fcp: String(Number(i[13].fcp).toFixed(1)),
tbf: String(Number(i[13].tbf).toFixed(1))
},
june: {
tbc: String(Number(i[14].tbc).toFixed(1)),
fcp: String(Number(i[14].fcp).toFixed(1)),
// tbc: String(Number(i[14].tbc).toFixed(1)),
// fcp: String(Number(i[14].fcp).toFixed(1)),
tbf: String(Number(i[14].tbf).toFixed(1))
},
july: {
tbc: String(Number(i[15].tbc).toFixed(1)),
fcp: String(Number(i[15].fcp).toFixed(1)),
// tbc: String(Number(i[15].tbc).toFixed(1)),
// fcp: String(Number(i[15].fcp).toFixed(1)),
tbf: String(Number(i[15].tbf).toFixed(1))
},
august: {
tbc: String(Number(i[16].tbc).toFixed(1)),
fcp: String(Number(i[16].fcp).toFixed(1)),
// tbc: String(Number(i[16].tbc).toFixed(1)),
// fcp: String(Number(i[16].fcp).toFixed(1)),
tbf: String(Number(i[16].tbf).toFixed(1))
},
september: {
tbc: String(Number(i[17].tbc).toFixed(1)),
fcp: String(Number(i[17].fcp).toFixed(1)),
// tbc: String(Number(i[17].tbc).toFixed(1)),
// fcp: String(Number(i[17].fcp).toFixed(1)),
tbf: String(Number(i[17].tbf).toFixed(1))
},
october: {
tbc: String(Number(i[18].tbc).toFixed(1)),
fcp: String(Number(i[18].fcp).toFixed(1)),
// tbc: String(Number(i[18].tbc).toFixed(1)),
// fcp: String(Number(i[18].fcp).toFixed(1)),
tbf: String(Number(i[18].tbf).toFixed(1))
},
november: {
......@@ -658,17 +652,7 @@ export default class TaxPlanningOLPA extends Component {
fcp: String(Number(i[20].fcp).toFixed(1)),
tbf: String(Number(i[20].tbf).toFixed(1))
},
total_current_year: String(Number(i[21]).toFixed(1)),
total_next_year: {
tbc: String(Number(i[22].tbc).toFixed(1)),
fcp: String(Number(i[22].fcp).toFixed(1)),
tbf: String(Number(i[22].tbf).toFixed(1))
},
total_more_year: {
tbc: String(Number(i[23].tbc).toFixed(1)),
fcp: String(Number(i[23].fcp).toFixed(1)),
tbf: String(Number(i[23].tbf).toFixed(1))
}
total_current_year: String(Number(i[21]).toFixed(1))
})
})
let body = {
......
......@@ -66,25 +66,25 @@ export default class TaxPlanning extends Component {
componentDidMount() {
// this.getLatestUpdate()
this.getSettingControl()
console.log(this.props.isApprover);
console.log(this.props.quarter);
}
getSettingControl() {
let body = {
group: 'THRESHOLD_CONTROL',
company_id: this.props.company.company_id,
type: 'TAX_PLANNING'
}
// let body = {
// group: 'THRESHOLD_CONTROL',
// company_id: this.props.company.company_id,
// type: 'TAX_PLANNING'
// }
api.create().getAllSettingByType(body).then(response => {
console.log(response);
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
// api.create().getAllSettingByType(body).then(response => {
// console.log(response);
// this.setState({
// minValue: response.data.data[0] ? response.data.data[0].min_value : null,
// maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
// }, () => {
this.getItemHierarki()
})
})
// })
// })
}
getLatestUpdate() {
......@@ -284,22 +284,23 @@ export default class TaxPlanning extends Component {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[4],
january: {
rotp_detail_id : null,
jan: {
tbc: i[1] === 3 && i[9].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[9].tbc.value) : String(i[9].tbc),
fcp: i[2] === 3 && i[9].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[9].fcp.value) : String(i[9].fcp),
tbf: i[3] === 3 && i[9].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[9].tbf.value) : String(i[9].tbf)
},
february: {
feb: {
tbc: i[1] === 3 && i[10].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[10].tbc.value) : String(i[10].tbc),
fcp: i[2] === 3 && i[10].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[10].fcp.value) : String(i[10].fcp),
tbf: i[3] === 3 && i[10].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[10].tbf.value) : String(i[10].tbf)
},
march: {
mar: {
tbc: i[1] === 3 && i[11].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[11].tbc.value) : String(i[11].tbc),
fcp: i[2] === 3 && i[11].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[11].fcp.value) : String(i[11].fcp),
tbf: i[3] === 3 && i[11].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[11].tbf.value) : String(i[11].tbf)
},
april: {
apr: {
tbc: i[1] === 3 && i[12].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[12].tbc.value) : String(i[12].tbc),
fcp: i[2] === 3 && i[12].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[12].fcp.value) : String(i[12].fcp),
tbf: i[3] === 3 && i[12].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[12].tbf.value) : String(i[12].tbf)
......@@ -309,67 +310,91 @@ export default class TaxPlanning extends Component {
fcp: i[2] === 3 && i[13].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[13].fcp.value) : String(i[13].fcp),
tbf: i[3] === 3 && i[13].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[13].tbf.value) : String(i[13].tbf)
},
june: {
jun: {
tbc: i[1] === 3 && i[14].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[14].tbc.value) : String(i[14].tbc),
fcp: i[2] === 3 && i[14].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[14].fcp.value) : String(i[14].fcp),
tbf: i[3] === 3 && i[14].tbc === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[14].tbf.value) : String(i[14].tbf)
},
july: {
jul: {
tbc: i[1] === 3 && i[15].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[15].tbc.value) : String(i[15].tbc),
fcp: i[2] === 3 && i[15].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[15].fcp.value) : String(i[15].fcp),
tbf: i[3] === 3 && i[15].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[15].tbf.value) : String(i[15].tbf)
},
august: {
aug: {
tbc: i[1] === 3 && i[16].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[16].tbc.value) : String(i[16].tbc),
fcp: i[2] === 3 && i[16].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[16].fcp.value) : String(i[16].fcp),
tbf: i[3] === 3 && i[16].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[16].tbf.value) : String(i[16].tbf)
},
september: {
sep: {
tbc: i[1] === 3 && i[17].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[17].tbc.value) : String(i[17].tbc),
fcp: i[2] === 3 && i[17].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[17].fcp.value) : String(i[17].fcp),
tbf: i[3] === 3 && i[17].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[17].tbf.value) : String(i[17].tbf)
},
october: {
oct: {
tbc: i[1] === 3 && i[18].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[18].tbc.value) : String(i[18].tbc),
fcp: i[2] === 3 && i[18].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[18].fcp.value) : String(i[18].fcp),
tbf: i[3] === 3 && i[18].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[18].tbf.value) : String(i[18].tbf)
},
november: {
nop: {
tbc: i[1] === 3 && i[19].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[19].tbc.value) : String(i[19].tbc),
fcp: i[2] === 3 && i[19].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[19].fcp.value) : String(i[19].fcp),
tbf: i[3] === 3 && i[19].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
},
december: {
dec: {
tbc: i[1] === 3 && i[20].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[20].tbc.value) : String(i[20].tbc),
fcp: i[2] === 3 && i[20].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[20].fcp.value) : String(i[20].fcp),
tbf: i[3] === 3 && i[20].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf)
},
total_current_year: String(Number(i[21]).toFixed(1)),
total_next_year: {
tbc: String(Number(i[22].tbc).toFixed(1)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[22].fcp).toFixed(1)) : String(Number(i[22].fcp).toFixed(1)),
// fcp: String(Number(i[22].fcp).toFixed(1)),
tbf: String(Number(i[22].tbf).toFixed(1))
},
total_more_year: {
tbc: String(Number(i[23].tbc).toFixed(1)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[23].fcp).toFixed(1)) : String(Number(i[23].fcp).toFixed(1)),
// fcp: String(Number(i[23].fcp).toFixed(1)),
tbf: String(Number(i[23].tbf).toFixed(1))
}
tb_total: String(Number(i[21]).toFixed(1)),
// total_next_year: {
// tbc: String(Number(i[22].tbc).toFixed(1)),
// fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[22].fcp).toFixed(1)) : String(Number(i[22].fcp).toFixed(1)),
// // fcp: String(Number(i[22].fcp).toFixed(1)),
// tbf: String(Number(i[22].tbf).toFixed(1))
// },
// total_more_year: {
// tbc: String(Number(i[23].tbc).toFixed(1)),
// fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[23].fcp).toFixed(1)) : String(Number(i[23].fcp).toFixed(1)),
// // fcp: String(Number(i[23].fcp).toFixed(1)),
// tbf: String(Number(i[23].tbf).toFixed(1))
// }
})
})
let payload = {
"submission_id": this.props.submissionID,
"rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"tax_planning": data
"revision": 0,
"raw": data
}
// console.log(payload);
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
// this.props.saveToMasterBudget(payload)
// this.props.onClickClose()
api.create('UPLOAD').createRollingOutlookTP(payload).then(response => {
console.log(payload);
console.log(response);
if (response.data) {
if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
// this.props.saveToMonthlyReport()
this.props.onClickClose()
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
fileHandler = (event) => {
......@@ -753,7 +778,8 @@ export default class TaxPlanning extends Component {
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/rolling_outlook/tax_planning/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
......@@ -761,7 +787,7 @@ export default class TaxPlanning extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Master Budget Tax Planning.xlsx';
a.download = 'Template Rolling Outlook Tax Planning.xlsx';
a.click();
}
}
......@@ -779,7 +805,7 @@ export default class TaxPlanning extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Master Budget Tax Planning.xlsx';
a.download = 'Rolling Outlook Tax Planning.xlsx';
a.click();
}
}
......@@ -1041,8 +1067,9 @@ export default class TaxPlanning extends Component {
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
console.log(value);
let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
// console.log(data);
console.log(data);
let indexID = data.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = data.formula[indexID].value
......@@ -1382,7 +1409,7 @@ export default class TaxPlanning extends Component {
<div className="">
<div style={{ textAlign: 'right' }}>
{
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null
:
this.state.get_for == 'view' ?
......@@ -1392,7 +1419,7 @@ export default class TaxPlanning extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(444).toFixed(1)}
value={Number(value.tbf).toFixed(1)}
/>
:
tableMeta.rowData[3] === 3 ?
......@@ -1819,7 +1846,7 @@ export default class TaxPlanning extends Component {
<div className="col-1">
<div style={{ textAlign: 'right' }}>
{
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
tableMeta.rowData[1] === 4 || tableMeta.rowData[1] === 1?
null
:
this.state.get_for == 'view' ?
......@@ -1936,7 +1963,7 @@ export default class TaxPlanning extends Component {
<div className="col-2">
<div style={{ textAlign: 'right' }}>
{
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
tableMeta.rowData[2] === 4 || tableMeta.rowData[2] === 1?
null
:
this.state.get_for == 'view' ?
......@@ -1949,7 +1976,7 @@ export default class TaxPlanning extends Component {
value={Number(value.fcp).toFixed(1)}
/>
:
tableMeta.rowData[0] === 3 ?
tableMeta.rowData[2] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1971,7 +1998,7 @@ export default class TaxPlanning extends Component {
/>
</div>
:
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[2] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -2073,7 +2100,7 @@ export default class TaxPlanning extends Component {
<div className="col-3">
<div style={{ textAlign: 'right' }}>
{
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null
:
this.state.get_for == 'view' ?
......@@ -5481,7 +5508,7 @@ export default class TaxPlanning extends Component {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
<Typography style={{ fontSize: '16px', color: 'white' }}>Rolling Outlook Submission</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
......@@ -5493,7 +5520,7 @@ export default class TaxPlanning extends Component {
{this.state.visibleTP === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Tax Planning</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Tax Planning</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
......
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