Commit 00221fd1 authored by r.kurnia's avatar r.kurnia

tptptptp

parent 0a55af29
...@@ -262,6 +262,8 @@ const create = (type = "") => { ...@@ -262,6 +262,8 @@ const create = (type = "") => {
const importRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/import_rolling_outlook', body) const importRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/import_rolling_outlook', body)
const getRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/get_report_hierarki', body) const getRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/get_report_hierarki', body)
const createRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/create_rolling_outlook', body) const createRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/create_rolling_outlook', body)
const checkImportRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/check_import', body)
const importRollingOutlookTP = (body) => api.post('transaction/tax_planning/rolling_outlook/import_rolling_outlook', body)
const getRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/get_report_hierarki', body) const getRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/get_report_hierarki', body)
const createRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/create_rolling_outlook', body) const createRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/create_rolling_outlook', body)
const checkImportRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/check_import', body) const checkImportRollingOutlookCAT = (body) => api.post('transaction/cat/rolling_outlook/check_import', body)
...@@ -730,6 +732,8 @@ const create = (type = "") => { ...@@ -730,6 +732,8 @@ const create = (type = "") => {
createRollingOutlookBS, createRollingOutlookBS,
getRollingOutlookTP, getRollingOutlookTP,
createRollingOutlookTP, createRollingOutlookTP,
checkImportRollingOutlookTP,
importRollingOutlookTP,
getAllMasterDataCat, getAllMasterDataCat,
getParentItemReport, getParentItemReport,
saveMasterDataCat, saveMasterDataCat,
......
...@@ -441,7 +441,7 @@ export default class TaxPlanning extends Component { ...@@ -441,7 +441,7 @@ export default class TaxPlanning extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp) console.log(resp)
if (err) { if (err) {
// console.log(err); // console.log(err);
} }
...@@ -454,79 +454,80 @@ export default class TaxPlanning extends Component { ...@@ -454,79 +454,80 @@ export default class TaxPlanning extends Component {
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), order: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report_id: i[0] === undefined ? "" : String(i[1]).trim(),
item_report: i[1] === undefined ? "" : String(i[2]).trim(),
january: { january: {
tbc: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).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[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[3]).trim()).toFixed(1)) : String(Number(String(i[3]).trim()).toFixed(1)), // fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[3]).trim()).toFixed(1)) : String(Number(String(i[3]).trim()).toFixed(1)),
tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(), tbf: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
}, },
february: { february: {
tbc: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).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[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[6]).trim()).toFixed(1)) : String(Number(String(i[6]).trim()).toFixed(1)), // fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[6]).trim()).toFixed(1)) : String(Number(String(i[6]).trim()).toFixed(1)),
tbf: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(), tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
}, },
march: { march: {
tbc: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).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[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[9]).trim()).toFixed(1)) : String(Number(String(i[9]).trim()).toFixed(1)), // fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[9]).trim()).toFixed(1)) : String(Number(String(i[9]).trim()).toFixed(1)),
tbf: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(), tbf: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
}, },
april: { april: {
tbc: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(), tbc: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[12]).trim()).toFixed(1)) : String(Number(String(i[12]).trim()).toFixed(1)), fcp: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[7]).trim()).toFixed(2)) : String(Number(String(i[7]).trim()).toFixed(1)),
tbf: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(), tbf: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
}, },
may: { may: {
tbc: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(), tbc: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[15]).trim()).toFixed(1)) : String(Number(String(i[15]).trim()).toFixed(1)), fcp: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[10]).trim()).toFixed(2)) : String(Number(String(i[10]).trim()).toFixed(1)),
tbf: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(), tbf: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
}, },
june: { june: {
tbc: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(), tbc: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[18]).trim()).toFixed(1)) : String(Number(String(i[18]).trim()).toFixed(1)), fcp: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[13]).trim()).toFixed(2)) : String(Number(String(i[13]).trim()).toFixed(1)),
tbf: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(), tbf: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
}, },
july: { july: {
tbc: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(), tbc: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[21]).trim()).toFixed(1)) : String(Number(String(i[21]).trim()).toFixed(1)), fcp: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[16]).trim()).toFixed(2)) : String(Number(String(i[16]).trim()).toFixed(1)),
tbf: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[22]).trim(), tbf: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
}, },
august: { august: {
tbc: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(), tbc: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[24]).trim()).toFixed(1)) : String(Number(String(i[24]).trim()).toFixed(1)), fcp: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[19]).trim()).toFixed(2)) : String(Number(String(i[19]).trim()).toFixed(1)),
tbf: i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[25]).trim(), tbf: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
}, },
september: { september: {
tbc: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(), tbc: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[27]).trim()).toFixed(1)) : String(Number(String(i[27]).trim()).toFixed(1)), fcp: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[22]).trim()).toFixed(2)) : String(Number(String(i[22]).trim()).toFixed(1)),
tbf: i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[28]).trim(), tbf: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
}, },
october: { october: {
tbc: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(), tbc: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[30]).trim()).toFixed(1)) : String(Number(String(i[30]).trim()).toFixed(1)), fcp: i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[25]).trim()).toFixed(2)) : String(Number(String(i[25]).trim()).toFixed(1)),
tbf: i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[31]).trim(), tbf: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(),
}, },
november: { november: {
tbc: i[32] === undefined ? "0" : reg.test(String(i[32])) === false ? "0" : String(i[32]).trim(), tbc: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
fcp: i[33] === undefined ? "0" : reg.test(String(i[33])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[33]).trim()).toFixed(1)) : String(Number(String(i[33]).trim()).toFixed(1)), fcp: i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[28]).trim()).toFixed(2)) : String(Number(String(i[28]).trim()).toFixed(1)),
tbf: i[34] === undefined ? "0" : reg.test(String(i[34])) === false ? "0" : String(i[34]).trim(), tbf: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(),
}, },
december: { december: {
tbc: i[35] === undefined ? "0" : reg.test(String(i[35])) === false ? "0" : String(i[35]).trim(), tbc: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
fcp: i[36] === undefined ? "0" : reg.test(String(i[36])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[36]).trim()).toFixed(1)) : String(Number(String(i[36]).trim()).toFixed(1)), fcp: i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[31]).trim()).toFixed(2)) : String(Number(String(i[31]).trim()).toFixed(1)),
tbf: i[37] === undefined ? "0" : reg.test(String(i[37])) === false ? "0" : String(i[37]).trim(), tbf: i[32] === undefined ? "0" : reg.test(String(i[32])) === false ? "0" : String(i[32]).trim(),
}, },
total_current_year: i[38] === undefined ? "" : String(i[38]).trim(), total_current_year: i[33] === undefined ? "" : String(i[33]).trim(),
total_next_year: { // total_next_year: {
tbc: i[39] === undefined ? "0" : reg.test(String(i[39])) === false ? "0" : String(i[39]).trim(), // 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[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[40]).trim()).toFixed(1)) : String(Number(String(i[40]).trim()).toFixed(1)), // fcp: i[40] === undefined ? "0" : reg.test(String(i[40])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[40]).trim()).toFixed(1)) : String(Number(String(i[40]).trim()).toFixed(1)),
tbf: i[41] === undefined ? "0" : reg.test(String(i[41])) === false ? "0" : String(i[41]).trim(), // tbf: i[41] === undefined ? "0" : reg.test(String(i[41])) === false ? "0" : String(i[41]).trim(),
}, // },
total_more_year: { // total_more_year: {
tbc: i[42] === undefined ? "0" : reg.test(String(i[42])) === false ? "0" : String(i[42]).trim(), // 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[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[43]).trim()).toFixed(1)) : String(Number(String(i[43]).trim()).toFixed(1)), // fcp: i[43] === undefined ? "0" : reg.test(String(i[43])) === false ? "0" : String(i[1]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[43]).trim()).toFixed(1)) : String(Number(String(i[43]).trim()).toFixed(1)),
tbf: i[44] === undefined ? "0" : reg.test(String(i[44])) === false ? "0" : String(i[44]).trim(), // tbf: i[44] === undefined ? "0" : reg.test(String(i[44])) === false ? "0" : String(i[44]).trim(),
} // }
}) })
} }
}) })
...@@ -534,6 +535,9 @@ export default class TaxPlanning extends Component { ...@@ -534,6 +535,9 @@ export default class TaxPlanning extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
rolling_outlook_id: this.props.rollingOutlookID,
quartal: this.props.quarter,
status: this.props.status,
tax_planning: payload tax_planning: payload
} }
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
...@@ -542,9 +546,9 @@ export default class TaxPlanning extends Component { ...@@ -542,9 +546,9 @@ export default class TaxPlanning extends Component {
} }
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkImportRollingOutlookTP(this.state.payload).then(response => {
// console.log(this.state.payload); console.log(this.state.payload);
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true }) this.setState({ visibleUpload: false, visibleTP: false, loading: true })
...@@ -574,16 +578,18 @@ export default class TaxPlanning extends Component { ...@@ -574,16 +578,18 @@ export default class TaxPlanning extends Component {
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.november.tbc, formula: item.november_formula } : item.november.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.november.fcp, formula: item.november_formula } : item.november.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.november.tbf, formula: item.november_formula } : item.november.tbf }, { tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.november.tbc, formula: item.november_formula } : item.november.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.november.fcp, formula: item.november_formula } : item.november.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.november.tbf, formula: item.november_formula } : item.november.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.december.tbc, formula: item.december_formula } : item.december.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.december.fcp, formula: item.december_formula } : item.december.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.december.tbf, formula: item.december_formula } : item.december.tbf }, { tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.december.tbc, formula: item.december_formula } : item.december.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.december.fcp, formula: item.december_formula } : item.december.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.december.tbf, formula: item.december_formula } : item.december.tbf },
item.total_current_year, item.total_current_year,
{ 0,
tbc: Number(item.type_report_id.tbc) === 3 && item.total_next_year.tbc === "" ? "0" : item.total_next_year.tbc, 0,
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_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 // 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
// },
item.orders, item.orders,
{ tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf }, { tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf },
{ tbc: item.condition_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf }, { tbc: item.condition_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf },
...@@ -694,7 +700,7 @@ export default class TaxPlanning extends Component { ...@@ -694,7 +700,7 @@ export default class TaxPlanning extends Component {
status: type status: type
} }
// console.log(data); // console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').importRollingOutlookTP(body).then(response => {
// console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -822,8 +828,8 @@ export default class TaxPlanning extends Component { ...@@ -822,8 +828,8 @@ export default class TaxPlanning extends Component {
// `${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/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`
) )
console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`)
res = await res.blob() res = await res.blob()
// console.log(res)
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -834,9 +840,9 @@ export default class TaxPlanning extends Component { ...@@ -834,9 +840,9 @@ export default class TaxPlanning extends Component {
} }
async downloadAllData() { async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/export_rolling_outlook?rolling_outlook_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
// console.log(url); console.log(url);
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? sub_null : url this.props.submissionID == null ? sub_null : url
) )
...@@ -861,177 +867,6 @@ export default class TaxPlanning extends Component { ...@@ -861,177 +867,6 @@ export default class TaxPlanning extends Component {
let id = 0 let id = 0
let double = false let double = false
const handleNewFormula = (tableMeta, dex, newFormula) => {
let splitFormula = String(newFormula).split('@')
let baru = []
let anjay = []
splitFormula.map((item) => {
let re = /^[a-zA-Z0-9_]+$/;
let items = String(item).substr(Number(String(item).length) - 1, 1)
let subForm = String(item).substr(0, Number(String(item).length) - 1)
// if (tableMeta.rowData[24] === 96) {
// console.log(item, items);
// }
if (item !== "") {
if (!re.test(items)) {
if (items === '(') {
baru.push(String(item).substr(0, Number(String(item).length) - 2))
baru.push(String(item).substr(Number(String(item).length) - 2, 1))
baru.push(items)
} else {
baru.push(subForm)
baru.push(items)
}
} else {
baru.push(String(item))
}
}
})
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
anjay.push(item)
} else {
if (String(item).includes('#')) {
let splitform = String(item).split('#')
if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') {
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
if (indexID !== -1) {
let data = dataTable2[indexID][20].fcp
// console.log(dataTable2[indexID][20]);
// let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// let valuezz = data.value == undefined ? data : data.value
anjay.push(data == "" ? 0 : data)
}
}
// else {
// if (forecast !== undefined) {
// forecast.map((item, index) => {
// if (periode == item.periode) {
// totalShldBeNil += Number(item.value)
// }
// })
// anjay.push(totalShldBeNil)
// } else if (String(item).includes('[M-1]')) {
// let tst = String(item).replace('[M-1]', '')
// let data = tableMeta.columnIndex == 9 ? 20 : tableMeta.columnIndex - 1
// let dataSub = dex == 1 ? tableMeta.rowData[data].tbc : dex == 2 ? tableMeta.rowData[data].fcp : tableMeta.rowData[data].tbf
// let period = data == 20 ? Number(this.props.periode) - 1 : this.props.periode
// let indexID = dataSub.formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// if (indexID !== -1) {
// let valuezz = tableMeta.rowData[data].formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
// } else {
// let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
// // 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
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
// }
// }
} else {
let indexID = dataTable2.findIndex((val) => val[24] == item)
if (indexID !== -1) {
if (dataTable2[indexID][24] == tableMeta.rowData[24]) {
anjay.push(0)
} else {
let data = dataTable2[indexID][tableMeta.columnIndex]
// let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// let valuezz = data == undefined ? data : data.value
anjay.push(data == "" ? 0 : data)
}
}
}
}
})
let total = 0
let total2 = 0
let opt = ""
let opt2 = ""
let prio = false
let simpen2 = ""
anjay.map((item, index) => {
if (item == "+") {
if (prio) {
opt2 = "tambah"
} else {
opt = "tambah"
}
} else if (item == "-") {
if (prio) {
opt2 = "kurang"
} else {
opt = "kurang"
}
} else if (item == "*") {
if (prio) {
opt2 = "kali"
} else {
opt = "kali"
}
} else if (item == "/") {
if (prio) {
opt2 = "bagi"
} else {
opt = "bagi"
}
} else if (item == "(") {
prio = true
simpen2 = "active"
} else if (item == ")") {
prio = false
}
else {
if (prio) {
if (opt2 == "tambah") {
total2 = Number(total2) + Number(item)
} else if (opt2 == "kurang") {
total2 = Number(total2) - Number(item)
} else if (opt2 == "kali") {
total2 = Number(total2) * Number(item)
} else if (opt2 == "bagi") {
total2 = Number(total2) / Number(item) == NaN ? 0 : Number(total2) / Number(item)
} else {
total2 += Number(item)
}
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
}
})
if (simpen2 == "active") {
if (opt == "tambah") {
total = Number(total) + Number(total2)
} else if (opt == "kurang") {
total = Number(total) - Number(total2)
} else if (opt == "kali") {
total = Number(total) * Number(total2)
} else if (opt == "bagi") {
total = Number(total) / Number(total2) == NaN ? 0 : Number(total) / Number(total2)
}
}
// console.log(tableMeta.rowData[8], baru, anjay, total);
total = R.equals(total, NaN) ? "0.0" : Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return total
}
const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => { const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
// console.log(xntd) // console.log(xntd)
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf
...@@ -6743,7 +6578,8 @@ export default class TaxPlanning extends Component { ...@@ -6743,7 +6578,8 @@ export default class TaxPlanning extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => { onUpload={() => {
this.state.judul === "MASTER BUDGET - TAX PLANNING" ? "ROLLING OUTLOOK - TAX PLANNING (in IDR mn)"
String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
this.checkUpload() : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}} }}
......
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