Commit 42164f69 authored by Riri Novita's avatar Riri Novita

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents bdbad4ac 2a04849b
...@@ -263,8 +263,9 @@ const create = (type = "") => { ...@@ -263,8 +263,9 @@ const create = (type = "") => {
const getMontlyReportAtt = (body) => api.post('transaction/monthly_report/get_report_attachment', body) const getMontlyReportAtt = (body) => api.post('transaction/monthly_report/get_report_attachment', body)
const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body) const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body)
const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`) const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`)
const createTaxPlanningMR = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body) const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
// MonthlyPL // MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body) const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
...@@ -430,6 +431,7 @@ const create = (type = "") => { ...@@ -430,6 +431,7 @@ const create = (type = "") => {
uploadAttachmentMonthly, uploadAttachmentMonthly,
getMontlyReportAtt, getMontlyReportAtt,
deleteAttachmentMonthly, deleteAttachmentMonthly,
createTaxPlanningMR,
getSubmitMasterBudget, getSubmitMasterBudget,
createPeriodeRevision, createPeriodeRevision,
getLastestUpdateOI, getLastestUpdateOI,
......
...@@ -91,7 +91,7 @@ export default class TaxPlanningMR extends Component { ...@@ -91,7 +91,7 @@ export default class TaxPlanningMR extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"month": this.props.month.month_id "months": this.props.month.month_id
} }
api.create().getHierarkiMontlyReportTP(payload).then(response => { api.create().getHierarkiMontlyReportTP(payload).then(response => {
console.log(response); console.log(response);
...@@ -209,91 +209,37 @@ export default class TaxPlanningMR extends Component { ...@@ -209,91 +209,37 @@ export default class TaxPlanningMR extends Component {
let data = [] let data = []
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[4], item_report_id: i[1],
january: { trial_balance_commercial: String(Number(i[6].tbc).toFixed(1)),
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), fiscal_correction: String(Number(i[6].fcp).toFixed(1)),
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), trial_balance_fiscal: String(Number(i[6].tbf).toFixed(1)),
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) trial_balance_fiscal_actual: String(Number(i[7]).toFixed(1)),
}, trial_balance_fiscal_mb: String(Number(i[8]).toFixed(1))
february: {
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: {
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: {
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)
},
may: {
tbc: i[1] === 3 && i[13].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[13].tbc.value) : String(i[13].tbc),
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: {
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: {
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: {
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: {
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: {
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: {
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: {
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(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))
}
}) })
}) })
let payload = { let payload = {
"submission_id": this.props.submissionID, "monthly_report_id": this.props.monthlyReportId,
"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,
"status": type, "status": type,
"months": this.props.month.month_id,
"tax_planning": data "tax_planning": data
} }
// console.log(JSON.stringify(payload)); console.log(JSON.stringify(payload));
this.props.saveToMasterBudget(payload) console.log(payload);
this.props.onClickClose() // this.props.saveToMasterBudget(payload)
// this.props.onClickClose()
api.create('UPLOAD').createTaxPlanningMR(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
alert("draft saved")
this.props.onClickClose()
}
}
})
} }
fileHandler = (event) => { fileHandler = (event) => {
...@@ -588,72 +534,7 @@ export default class TaxPlanningMR extends Component { ...@@ -588,72 +534,7 @@ export default class TaxPlanningMR extends Component {
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)), 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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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: {
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.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.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.0" : String(Number(i[21]).toFixed(1)), total_current_year: i[2] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
total_next_year: {
tbc: i[1] === 3 && i[22].tbc === "" ? "0.0" : String(Number(i[22].tbc).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.0" : String(Number(i[22].tbf).toFixed(1))
},
total_more_year: {
tbc: i[1] === 3 && i[23].tbc === "" ? "0.0" : String(Number(i[23].tbc).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.0" : String(Number(i[23].tbf).toFixed(1))
}
}) })
}) })
let payload = { let payload = {
...@@ -665,20 +546,20 @@ export default class TaxPlanningMR extends Component { ...@@ -665,20 +546,20 @@ export default class TaxPlanningMR extends Component {
"status": "submitted" "status": "submitted"
} }
// console.log(JSON.stringify(payload)); // 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, saveDraft: 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, saveDraft: false }) this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
} // }
}) // })
} }
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_tp/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
) )
res = await res.blob() res = await res.blob()
// console.log(res) // console.log(res)
...@@ -686,17 +567,17 @@ export default class TaxPlanningMR extends Component { ...@@ -686,17 +567,17 @@ export default class TaxPlanningMR extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Template Master Budget Tax Planning.xlsx'; a.download = 'Template Monthly Report Tax Planning.xlsx';
a.click(); a.click();
} }
} }
async downloadAllData() { async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/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 urls = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_tp/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let sub_null = `https://tia.eksad.com/tia-reporting-dev/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 url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_tp/export_monthly_report?monthly_report_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
// console.log(url); // console.log(url);
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? sub_null : url this.props.monthlyReportId == null ? url : urls
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -704,7 +585,7 @@ export default class TaxPlanningMR extends Component { ...@@ -704,7 +585,7 @@ export default class TaxPlanningMR extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Master Budget Tax Planning.xlsx'; a.download = 'Monthly Report Tax Planning.xlsx';
a.click(); a.click();
} }
} }
...@@ -990,36 +871,44 @@ export default class TaxPlanningMR extends Component { ...@@ -990,36 +871,44 @@ export default class TaxPlanningMR extends Component {
} }
} else { } else {
if (indexChilds == 0) { if (indexChilds == 0) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val).toFixed(1)
} }
else if (indexChilds == 1) { else if (indexChilds == 1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val).toFixed(1)
} }
else if (indexChilds == 2) { else if (indexChilds == 2) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val).toFixed(1)
} }
} }
} }
const handleTotal = (tableMeta, dex) => { const handleTotal = (tableMeta, dex) => {
let total = 0 let total = 0
// dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index == 9) {
// if ( tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ) {
// let valItem = item.tbf.value == undefined || item.tbf.value == "" || item.tbf.value == "undefined" ? 0.0 : item.tbf.value
// total += Number(valItem)
// } else {
// if (tableMeta.rowData[8] === "Fiscal Correction positive / (negative) Year To Date"){
// let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
// total += Number(valItem)
// } else {
// let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
// total += Number(valItem)
// }
// }
// }
// })
dataTable2[tableMeta.rowIndex].map((item, index) => { dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index == 9) { if (index == 6) {
if ( tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ) { let valItemTBC = item.tbc == undefined || item.tbc == "" || item.tbc == "undefined" ? 0.0 : item.tbc
let valItem = item.tbf.value == undefined || item.tbf.value == "" || item.tbf.value == "undefined" ? 0.0 : item.tbf.value let valItemFCP = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
total += Number(valItem) total = Number(valItemTBC) + Number(valItemFCP)
} else {
if (tableMeta.rowData[8] === "Fiscal Correction positive / (negative) Year To Date"){
let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
total += Number(valItem)
} else {
let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
total += Number(valItem)
}
}
} }
}) })
dataTable2[tableMeta.rowIndex][21] = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][6].tbf = Number(total).toFixed(1)
return total return total
} }
const handleValue = (data) => { const handleValue = (data) => {
...@@ -1375,13 +1264,21 @@ export default class TaxPlanningMR extends Component { ...@@ -1375,13 +1264,21 @@ export default class TaxPlanningMR extends Component {
/> />
</LightTooltip> </LightTooltip>
: :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} value={Number(handleTotal(tableMeta, 6)).toFixed(1)}
/> />
} }
</div> </div>
...@@ -1564,8 +1461,9 @@ export default class TaxPlanningMR extends Component { ...@@ -1564,8 +1461,9 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null onClick={() =>
// this.downloadTemplate() // null
this.downloadTemplate()
} }
> >
<img src={Images.template} /> <img src={Images.template} />
...@@ -1602,12 +1500,13 @@ export default class TaxPlanningMR extends Component { ...@@ -1602,12 +1500,13 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null onClick={() =>
// this.setState({ loading: true }, () => { // null
// setTimeout(() => { this.setState({ loading: true }, () => {
// this.downloadAllData() setTimeout(() => {
// }, 100); this.downloadAllData()
// }) }, 100);
})
} }
> >
<img src={Images.download} /> <img src={Images.download} />
...@@ -1666,16 +1565,17 @@ export default class TaxPlanningMR extends Component { ...@@ -1666,16 +1565,17 @@ export default class TaxPlanningMR extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => null onClick={() =>
// { // null
// // this.forceUpdate() {
// this.setState({ loading: true, buttonDraft: false }, () => { // this.forceUpdate()
// setTimeout(() => { this.setState({ loading: true, buttonDraft: false }, () => {
// // this.setState({ loading: false, buttonError: false, editable: true }) setTimeout(() => {
// this.handleValidate() // this.setState({ loading: false, buttonError: false, editable: true })
// }, 100); this.handleValidate()
// }) }, 100);
// } })
}
} }
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
...@@ -1685,15 +1585,16 @@ export default class TaxPlanningMR extends Component { ...@@ -1685,15 +1585,16 @@ export default class TaxPlanningMR extends Component {
<button <button
className="button" className="button"
type="button" type="button"
onClick={() => null onClick={() =>
// null
// this.state.saveDraft === true ? // this.state.saveDraft === true ?
// null : // 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(() => {
// this.backToMasterBudget('draft') this.backToMasterBudget('draft')
// }, 100); }, 100);
// }) })
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1710,16 +1611,17 @@ export default class TaxPlanningMR extends Component { ...@@ -1710,16 +1611,17 @@ export default class TaxPlanningMR extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => null onClick={() =>
// this.state.buttonError ? // null
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.state.buttonError ?
// : this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// this.state.handleTekTekTek == 1 ? null : :
// this.setState({ handleTekTekTek: 1, loading: true }, () => { this.state.handleTekTekTek == 1 ? null :
// setTimeout(() => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
// this.backToMasterBudget('submitted') setTimeout(() => {
// }, 100); this.backToMasterBudget('submitted')
// }) }, 100);
})
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
......
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