Commit cfe47d0a authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Update Simulasi Upload

See merge request !1863
parents 9a34c80b 3f5f34c6
......@@ -209,6 +209,7 @@ const create = (type = "") => {
const createSubmitReport = (body) => api.post('transaction/master_budget/create_submission_report', body)
const getSubmission = (body) => api.post('transaction/master_budget/get_submission_id', body)
const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body)
const checkUploadMBSimulasi = (body) => api.post('transaction/master_budget/import_master_budget/other_currency_existing', body)
const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body)
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
const countingFormula = (body) => api.post('transaction/counting_formula', body)
......@@ -872,7 +873,8 @@ const create = (type = "") => {
createDownloadFile,
getListDownload,
downloadZipReport,
sendEmail
sendEmail,
checkUploadMBSimulasi
}
}
......
......@@ -57,6 +57,7 @@ const Images = {
dotOpen: require('./dot-open.svg'),
zip: require('./zip.png'),
warning: require('./warning.png'),
simulasiUpload: require('./upload-simulasi.png'),
}
export default Images
\ No newline at end of file
......@@ -436,6 +436,128 @@ export default class CorporateAnnualTarget extends Component {
});
}
fileHandlerSimulasi = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// // // // // console.log(resp)
if (err) {
// // // // console.log(err);
}
else {
let isi = resp.rows.slice(3)
// // console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
let newValidate = false
isi.map((i, index) => {
if (i.length > 0) {
let total = 0
let lastValz = 0
let nilaiTotal = 0
if (i[6] !== undefined) {
if (i[6] == 'SUM' || i[6] == 'AVG' || i[6] == 'LAST') {
i.map((items, indexs) => {
if (indexs >= 8 && indexs <= 19) {
let valItem = items == undefined || items == "" ? 0 : items
total += Number(valItem)
if (index == 19) {
lastValz += Number(valItem)
}
}
})
}
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
}
if (String(i[1]).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") {
newValidate = true
}
if (String(i[1]).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") {
newValidate = false
}
if (i[0] === undefined || i[0] === null) {
if (newValidate) {
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : (String(i[2]).includes('%') ? Number(String(i[2]).substr(0, String(i[2]).length - 1)) : String(Number(i[2] * 100).toFixed(1)) + '%'),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? (String(i[5]).includes('%') ? String(i[5].trim()) : String(Number(i[5] * 100) + '%')) : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(roundMath(Number(i[7]), 1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(roundMath(Number(i[8]), 1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(roundMath(Number(i[9]), 1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(roundMath(Number(i[10]), 1)).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(roundMath(Number(i[11]), 1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(roundMath(Number(i[12]), 1)).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(roundMath(Number(i[13]), 1)).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(roundMath(Number(i[14]), 1)).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(roundMath(Number(i[15]), 1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(roundMath(Number(i[16]), 1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(roundMath(Number(i[17]), 1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(roundMath(Number(i[18]), 1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(roundMath(Number(i[19]), 1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(roundMath(Number(i[20]), 1)).trim(),
total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(roundMath(Number(i[21]), 1)).trim(),
total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(roundMath(Number(i[22]), 1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
})
}
} else {
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : (String(i[2]).includes('%') ? Number(String(i[2]).substr(0, String(i[2]).length - 1)) : String(Number(i[2] * 100).toFixed(1)) + '%'),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? (String(i[5]).includes('%') ? String(i[5].trim()) : String(Number(i[5] * 100) + '%')) : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(roundMath(Number(i[7]), 1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(roundMath(Number(i[8]), 1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(roundMath(Number(i[9]), 1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(roundMath(Number(i[10]), 1)).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(roundMath(Number(i[11]), 1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(roundMath(Number(i[12]), 1)).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(roundMath(Number(i[13]), 1)).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(roundMath(Number(i[14]), 1)).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(roundMath(Number(i[15]), 1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(roundMath(Number(i[16]), 1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(roundMath(Number(i[17]), 1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(roundMath(Number(i[18]), 1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(roundMath(Number(i[19]), 1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(roundMath(Number(i[20]), 1)).trim(),
total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(roundMath(Number(i[21]), 1)).trim(),
total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(roundMath(Number(i[22]), 1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
})
}
// // console.log(i[2])
// // // console.log(Number(i[2] * 100))
// // // // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
}
})
// // console.log(payload)
let body = {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
status: '',
cat: payload,
status: 'submitted'
}
// // // // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] })
}
});
}
checkUpload() {
let payload = {
...this.state.payload,
......@@ -585,6 +707,44 @@ export default class CorporateAnnualTarget extends Component {
})
}
uploadSimulasi() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
this.setState({ loading: true, dataTable: [] })
// let dataDelete = this.state.dataDelete
// api.create().getIdDeleteFromExcel(payload).then((response) => {
// if (response.data) {
// // // // // // console.log(response.data)
// let idDelete = response.data.data.item_report_id
// if (idDelete.length > 0) {
// idDelete.map((item, index) => {
// dataDelete.push(item)
// })
// this.setState({ dataDelete })
// }
// }
// })
console.log(payload)
api.create().checkUploadMBSimulasi(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.setState({ dataLoaded: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success', loading: false, visibleUploadSimulasi: false }, () => this.getItemHierarki())
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
}
})
}
uploadCAT(type) {
// let dataDelete = this.state.dataDelete
// // // // console.log(dataDelete)
......@@ -667,7 +827,7 @@ export default class CorporateAnnualTarget extends Component {
} else {
this.props.getReport(body)
}
this.setState({ loading: false})
this.setState({ loading: false })
// this.props.onClickClose()
// this.props.getReport()
} else {
......@@ -3787,29 +3947,23 @@ export default class CorporateAnnualTarget extends Component {
<div style={{ width: '50%' }}>
{this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload Simulasi'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
>
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3}} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{((!this.props.truelyApprover) && (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <a data-tip={'Download Template'} data-for="template">
<button
style={{
......@@ -4104,7 +4258,8 @@ export default class CorporateAnnualTarget extends Component {
</Paper>}
</div>
{this.state.visibleUpload && (
{
this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
......@@ -4144,9 +4299,55 @@ export default class CorporateAnnualTarget extends Component {
</div>
</div>
)}
)
}
{
this.state.visibleUploadSimulasi && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File Simulasi</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUploadSimulasi: false })}
>
<img src={Images.close} />
</button>
</div>
</div>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatusSimulasi}
percentage={this.state.percentageSimulasi}
result={this.state.resultSimulasi}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandlerSimulasi(dt)
this.setState({ uploadStatusSimulasi: 'idle', percentageSimulasi: '0' })
}}
onUpload={() => {
String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("CAT") ?
this.uploadSimulasi() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
</div>
<div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> (Simulasi) Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
</div>
</div>
)
}
{this.state.visibleAlertSave && (
{
this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
......@@ -4180,8 +4381,9 @@ export default class CorporateAnnualTarget extends Component {
</div>
</div>
</div>
)}
</div>
)
}
</div >
);
}
}
......@@ -3304,7 +3304,7 @@ export default class ProfitLoss extends Component {
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0, loading: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
......
......@@ -822,7 +822,7 @@ export default class CreateParameter extends Component {
<TextField
style={{ width: '100%' }}
id="value"
label="Value"
label= {this.state.enableReportName ? "Value IDR mn" : "Value"}
value={this.state.tempData === null ? '' : this.state.tempData.value}
inputProps={{
min: 0,
......@@ -1259,7 +1259,7 @@ export default class CreateParameter extends Component {
<TextField
style={{ width: '100%' }}
id="value"
label="Value"
label= {this.state.enableReportName ? "Value IDR mn" : "Value"}
value={this.state.value}
inputProps={{
min: 0,
......
......@@ -57,8 +57,6 @@ export default class TaxPlanning extends Component {
alert: false,
get_for: "view",
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -172,8 +170,7 @@ export default class TaxPlanning extends Component {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID,
"quartal": this.props.quarter,
"currency_id": this.props.defaultCurrency.id
"quartal": this.props.quarter
}
api.create().getRollingOutlookTP(payload).then(response => {
console.log(payload);
......@@ -409,7 +406,6 @@ export default class TaxPlanning extends Component {
"status": type,
"revision": 0,
"quartal": this.props.quarter,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data
}
// this.props.saveToMasterBudget(payload)
......@@ -422,9 +418,6 @@ export default class TaxPlanning extends Component {
// this.props.saveToMonthlyReport()
this.props.onClickClose()
this.props.refresh()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
document.body.style.overflow = 'unset';
......@@ -439,7 +432,6 @@ export default class TaxPlanning extends Component {
this.props.refresh()
})
}
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
......@@ -483,37 +475,37 @@ export default class TaxPlanning extends Component {
},
april: {
tbc: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
fcp: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[7]).trim()), 2)) : String(roundMath(Number(String(i[7]).trim()), 1)),
fcp: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[7]).trim()),2)) : String(roundMath(Number(String(i[7]).trim()),1)),
tbf: this.props.quarter === "q2" || this.props.quarter === "q3" ? (i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim()) : (i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim()),
},
may: {
tbc: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
fcp: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[10]).trim()), 2)) : String(roundMath(Number(String(i[10]).trim()), 1)),
fcp: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[10]).trim()),2)) : String(roundMath(Number(String(i[10]).trim()),1)),
tbf: this.props.quarter === "q2" || this.props.quarter === "q3" ? (i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim()) : (i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim()),
},
june: {
tbc: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
fcp: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[13]).trim()), 2)) : String(roundMath(Number(String(i[13]).trim()), 1)),
fcp: this.props.quarter === "q2" || this.props.quarter === "q3" ? null : i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[13]).trim()),2)) : String(roundMath(Number(String(i[13]).trim()),1)),
tbf: this.props.quarter === "q2" || this.props.quarter === "q3" ? (i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim()) : (i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim()),
},
july: {
tbc: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim()) : (i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim()),
fcp: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[10]).trim()), 2)) : String(roundMath(Number(String(i[10]).trim()), 1))) :
(i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[16]).trim()), 2)) : String(roundMath(Number(String(i[16]).trim()), 1))),
fcp: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[10]).trim()),2)) : String(roundMath(Number(String(i[10]).trim()),1))) :
(i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[16]).trim()),2)) : String(roundMath(Number(String(i[16]).trim()),1))),
tbf: this.props.quarter === "q3" ? (i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim()) :
this.props.quarter === "q2" ? (i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim()) : (i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()),
},
august: {
tbc: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim()) : (i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim()),
fcp: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[13]).trim()), 2)) : String(roundMath(Number(String(i[13]).trim()), 1))) :
(i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[19]).trim()), 2)) : String(roundMath(Number(String(i[19]).trim()), 1))),
fcp: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[13]).trim()),2)) : String(roundMath(Number(String(i[13]).trim()),1))) :
(i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[19]).trim()),2)) : String(roundMath(Number(String(i[19]).trim()),1))),
tbf: this.props.quarter === "q3" ? (i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim()) :
this.props.quarter === "q2" ? (i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim()) : i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
},
september: {
tbc: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim()) : (i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim()),
fcp: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[16]).trim()), 2)) : String(roundMath(Number(String(i[16]).trim()), 1))) :
(i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[22]).trim()), 2)) : String(roundMath(Number(String(i[22]).trim()), 1))),
fcp: this.props.quarter === "q3" ? null : this.props.quarter === "q2" ? (i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[16]).trim()),2)) : String(roundMath(Number(String(i[16]).trim()),1))) :
(i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[22]).trim()),2)) : String(roundMath(Number(String(i[22]).trim()),1))),
tbf: this.props.quarter === "q3" ? (i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim()) :
this.props.quarter === "q2" ? (i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()) : (i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim()),
},
......@@ -521,8 +513,8 @@ export default class TaxPlanning extends Component {
tbc: this.props.quarter === "q3" ? (i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim()) :
this.props.quarter === "q2" ? (i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim()) : (i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim()),
fcp: this.props.quarter === "q3" ? (i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim()) :
this.props.quarter === "q2" ? (i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[19]).trim()), 2)) : String(roundMath(Number(String(i[19]).trim()), 1))) :
(i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[25]).trim()), 2)) : String(roundMath(Number(String(i[25]).trim()), 1))),
this.props.quarter === "q2" ? (i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[19]).trim()),2)) : String(roundMath(Number(String(i[19]).trim()),1))) :
(i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[25]).trim()),2)) : String(roundMath(Number(String(i[25]).trim()),1))),
tbf: this.props.quarter === "q3" ? (i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim()) :
this.props.quarter === "q2" ? (i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim()) : (i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim()),
},
......@@ -530,8 +522,8 @@ export default class TaxPlanning extends Component {
tbc: this.props.quarter === "q3" ? (i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim()) :
this.props.quarter === "q2" ? (i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim()) : (i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim()),
fcp: this.props.quarter === "q3" ? (i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim()) :
this.props.quarter === "q2" ? (i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[22]).trim()), 2)) : String(roundMath(Number(String(i[22]).trim()), 1))) :
(i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[28]).trim()), 2)) : String(roundMath(Number(String(i[28]).trim()), 1))),
this.props.quarter === "q2" ? (i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[22]).trim()),2)) : String(roundMath(Number(String(i[22]).trim()),1))) :
(i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[28]).trim()),2)) : String(roundMath(Number(String(i[28]).trim()),1))),
tbf: this.props.quarter === "q3" ? (i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()) :
this.props.quarter === "q2" ? (i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim()) : (i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim()),
},
......@@ -539,8 +531,8 @@ export default class TaxPlanning extends Component {
tbc: this.props.quarter === "q3" ? (i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim()) :
this.props.quarter === "q2" ? (i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim()) : (i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim()),
fcp: this.props.quarter === "q3" ? (i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim()) :
this.props.quarter === "q2" ? (i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[25]).trim()), 2)) : String(roundMath(Number(String(i[25]).trim()), 1))) :
(i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[31]).trim()), 2)) : String(roundMath(Number(String(i[31]).trim()), 1))),
this.props.quarter === "q2" ? (i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[25]).trim()),2)) : String(roundMath(Number(String(i[25]).trim()),1))) :
(i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(roundMath(Number(String(i[31]).trim()),2)) : String(roundMath(Number(String(i[31]).trim()),1))),
tbf: this.props.quarter === "q3" ? (i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim()) :
this.props.quarter === "q2" ? (i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim()) : (i[32] === undefined ? "0" : reg.test(String(i[32])) === false ? "0" : String(i[32]).trim()),
},
......@@ -565,11 +557,7 @@ export default class TaxPlanning extends Component {
}
checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkImportRollingOutlookTP(payload).then(response => {
api.create().checkImportRollingOutlookTP(this.state.payload).then(response => {
console.log(this.state.payload);
console.log(response)
if (response.data) {
......@@ -642,64 +630,64 @@ export default class TaxPlanning extends Component {
data.push({
item_report_id: i[4],
january: {
tbc: i[1] === 3 && i[9].tbc === "" || i[9].tbc === null ? "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 === "" || i[9].fcp === null ? "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 === "" || i[9].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[9].tbf.value) : String(i[9].tbf)
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: {
tbc: i[1] === 3 && i[10].tbc === "" || i[10].tbc === null ? "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 === "" || i[10].fcp === null ? "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 === "" || i[10].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[10].tbf.value) : String(i[10].tbf)
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 === "" || i[11].tbc === null ? "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 === "" || i[11].fcp === null ? "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 === "" || i[11].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[11].tbf.value) : String(i[11].tbf)
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 === "" || i[12].tbc === null ? "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 === "" || i[12].fcp === null ? "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 === "" || i[12].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[12].tbf.value) : String(i[12].tbf)
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 === "" || i[13].tbc === null ? "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 === "" || i[13].fcp === null ? "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 === "" || i[13].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[13].tbf.value) : String(i[13].tbf)
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 === "" || i[14].tbc === null ? "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 === "" || i[14].fcp === null ? "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 === "" || i[14].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[14].tbf.value) : String(i[14].tbf)
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 === "" || i[15].tbc === null ? "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 === "" || i[15].fcp === null ? "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 === "" || i[15].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[15].tbf.value) : String(i[15].tbf)
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 === "" || i[16].tbc === null ? "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 === "" || i[16].fcp === null ? "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 === "" || i[16].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[16].tbf.value) : String(i[16].tbf)
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 === "" || i[17].tbc === null ? "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 === "" || i[17].fcp === null ? "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 === "" || i[17].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[17].tbf.value) : String(i[17].tbf)
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 === "" || i[18].tbc === null ? "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 === "" || i[18].fcp === null ? "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 === "" || i[18].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[18].tbf.value) : String(i[18].tbf)
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 === "" || i[19].tbc === null ? "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 === "" || i[19].fcp === null ? "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 === "" || i[19].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
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 === "" || i[20].tbc === null ? "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 === "" || i[20].fcp === null ? "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 === "" || i[20].tbf === null ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf)
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: {
......@@ -721,7 +709,6 @@ export default class TaxPlanning extends Component {
report_id: this.props.report_id,
quartal: this.props.quarter,
status: type,
currency_id: this.state.defaultCurrencyUpload?.id,
tax_planning: data,
}
console.log(data);
......@@ -732,9 +719,6 @@ export default class TaxPlanning extends Component {
this.props.onClickClose()
// this.props.getReport()
this.props.refresh()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -746,7 +730,6 @@ export default class TaxPlanning extends Component {
this.props.onClickClose()
this.props.refresh()
})
}
// alert(response.data.status)
}
} else {
......@@ -762,10 +745,9 @@ export default class TaxPlanning extends Component {
// console.log(this.state.dataTable)
this.state.dataTable.map((i, index) => {
if (String(i[8]) == "Control (should be nil)") {
// this.setState({ loading: true })
this.setState({ loading: true })
let n = 0
for (n = (this.props.quarter == 'q1' ? 12 : (this.props.quarter == 'q2' ? 15 : 18)); n <= 20; n++) {
console.log(i[n].tbf.value)
for ( n = (this.props.quarter == 'q1' ? 12 : (this.props.quarter == 'q2' ? 15 : 18)) ; n <= 20; n++) {
if ((Number(i[n].tbf.value) < Number(this.state.minValue) || Number(i[n].tbf.value) > Number(this.state.maxValue))) {
errorContrl = true
editAble = true
......@@ -788,11 +770,11 @@ export default class TaxPlanning extends Component {
}
downloadTemplate = async () => {
let url = `${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}&&currency_id=${this.props.defaultCurrency.id}`
let url = `${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(url);
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/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}&&currency_id=${this.props.defaultCurrency.id}`
`${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()
if (res.size > 0) {
......@@ -5797,25 +5779,17 @@ export default class TaxPlanning extends Component {
name: `${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
// <div style={{ ...style2, top: 0, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 200, borderRight: "1px solid rgb(255, 255, 255)" }} >
// {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell> */}
// <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
// <div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
// <div style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
// <span>{"Trial Balance (Fiscal)"}</span>
// </div>
// </div>
// </div>
<th style={{ ...style2, top: 0, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div style={{ ...style2, top: 0, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 200, borderRight: "1px solid rgb(255, 255, 255)" }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */}
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
<div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
<div style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Trial Balance (Fiscal)"}</span>
</div>
</div>
</th>
</div>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
......@@ -6024,37 +5998,31 @@ export default class TaxPlanning extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -6084,7 +6052,7 @@ export default class TaxPlanning extends Component {
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{/* <a data-tip={'Download'} data-for="download">
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -6102,7 +6070,7 @@ export default class TaxPlanning extends Component {
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
}
</div>
......@@ -6122,10 +6090,10 @@ export default class TaxPlanning extends Component {
</div>
{/* <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> */}
<div style={{ display: 'flex' }}>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{this.state.updateBy.reverse().map((item, index) => {
<div style={{marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10}}>
{this.state.updateBy.reverse().map((item,index) => {
return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>{item.latest_update}</Typography>
)
......@@ -6195,7 +6163,6 @@ export default class TaxPlanning extends Component {
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate()
}, 100);
})
......@@ -6262,11 +6229,7 @@ export default class TaxPlanning extends Component {
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
......@@ -6314,7 +6277,6 @@ export default class TaxPlanning extends Component {
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate()
}, 100);
})
......@@ -6396,7 +6358,6 @@ export default class TaxPlanning extends Component {
</button>
</div>
</div>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
......@@ -6414,44 +6375,6 @@ export default class TaxPlanning extends Component {
}}
/>
</div>
<div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
</div>
</div>
)}
{this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div>
......
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