Commit 10579c37 authored by Riri Novita's avatar Riri Novita

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

parents 684805f4 b555d8ab
......@@ -265,8 +265,10 @@ const create = (type = "") => {
const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body)
const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`)
const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body)
const createTaxPlanningMR = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const createMonthlyReportTP = (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 checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......@@ -402,6 +404,7 @@ const create = (type = "") => {
deleteDocument,
createSubmitReport,
createMonthlyReportBS,
createMonthlyReportTP,
getSubmission,
checkUploadMB,
getAllOperatingInd,
......@@ -434,7 +437,6 @@ const create = (type = "") => {
uploadAttachmentMonthly,
getMontlyReportAtt,
deleteAttachmentMonthly,
createTaxPlanningMR,
getSubmitMasterBudget,
createPeriodeRevision,
getLastestUpdateOI,
......@@ -471,7 +473,8 @@ const create = (type = "") => {
getDetailHierarkiCF,
getHierarkiMontlyReportPL,
getHierarkiMontlyReportLOCF,
getHierarkiMontlyReportFAM
getHierarkiMontlyReportFAM,
checkUploadMonthlyReportTP
}
}
......
......@@ -480,6 +480,8 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
}, ()=> {
this.getMonthlyReportID()
})
}
......@@ -1083,9 +1085,9 @@ export default class MonthlyReport extends Component {
periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
// saveToMasterBudget={this.saveToMasterBudget.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleMonthlyReport: true })}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
{this.state.visibleFAM && (
......
......@@ -249,9 +249,40 @@ export default class BalanceSheetMR extends Component {
}
})
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
// console.log(indexParent);
return a
return total
}
const handleVariance = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
total = Number(tableMeta.rowData[9]) - Number(tableMeta.rowData[10])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 2) {
total = Number(tableMeta.rowData[9]) - Number(tableMeta.rowData[7])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 3) {
total = Number(tableMeta.rowData[9]) - Number(tableMeta.rowData[8])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
}
const handleVariancePercent = (tableMeta, dex, type) => {
let total = 0
// if (tableMeta.rowData[5] === "Cash and cash equivalent") {
// console.log(dataTable2);
// console.log(tableMeta);
// }
if (dex === 1) {
total = Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])
} else if (dex === 2) {
total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])
} else if (dex === 3) {
total = Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])
}
return total
}
let columns = [
......@@ -328,10 +359,14 @@ export default class BalanceSheetMR extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
setCellProps: () => ({
style: {
paddingRight: 0
}
}),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null :
val
......@@ -357,7 +392,7 @@ export default class BalanceSheetMR extends Component {
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', height: '100%' }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', height: '100%', display: 'grid', alignContent: 'center' }}>
<span>{"Actual"}</span>
</div>
</div>
......@@ -510,10 +545,14 @@ export default class BalanceSheetMR extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
setCellProps: () => ({
style: {
paddingRight: 0
}
}),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
......@@ -601,7 +640,7 @@ export default class BalanceSheetMR extends Component {
setCellProps: () => ({
style: {
paddingLeft: 0,
paddingRight: 0
paddingRight: 10
}
}),
customBodyRender: (val, tableMeta, updateValue) => {
......@@ -612,20 +651,9 @@ export default class BalanceSheetMR extends Component {
<div className="column-1">
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -637,7 +665,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
......@@ -646,20 +674,9 @@ export default class BalanceSheetMR extends Component {
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 3)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -670,8 +687,9 @@ export default class BalanceSheetMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)}
/>
}
/>
......@@ -684,20 +702,9 @@ export default class BalanceSheetMR extends Component {
<div className="column-2">
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 4)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -709,7 +716,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[13]).toFixed(1)}
value={Number(handleVariance(tableMeta, 2, 4)).toFixed(1)}
/>
}
/>
......@@ -718,20 +725,9 @@ export default class BalanceSheetMR extends Component {
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 5)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -743,7 +739,8 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[14]).toFixed(1)}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 2, 5)).toFixed(1)}
/>
}
/>
......@@ -756,20 +753,9 @@ export default class BalanceSheetMR extends Component {
<div className="column-3">
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 6)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -781,7 +767,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[15]).toFixed(1)}
value={Number(handleVariance(tableMeta, 3, 6)).toFixed(1)}
/>
}
/>
......@@ -790,20 +776,9 @@ export default class BalanceSheetMR extends Component {
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -815,7 +790,8 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[16]).toFixed(1)}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 3, 7)).toFixed(1)}
/>
}
/>
......@@ -1037,7 +1013,7 @@ export default class BalanceSheetMR extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
......@@ -1102,6 +1078,7 @@ export default class BalanceSheetMR extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTable}
......@@ -1109,10 +1086,32 @@ export default class BalanceSheetMR extends Component {
options={options}
/>
</MuiThemeProvider>
)}
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(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') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', marginTop: 20 }}>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
......@@ -1182,6 +1181,7 @@ export default class BalanceSheetMR extends Component {
</div>
</button>
</div>
</div>
{/* : null
} */}
</div>
......
......@@ -226,16 +226,13 @@ export default class TaxPlanningMR extends Component {
"months": this.props.month.month_id,
"tax_planning": data
}
console.log(JSON.stringify(payload));
console.log(payload);
// this.props.saveToMasterBudget(payload)
// this.props.onClickClose()
api.create('UPLOAD').createTaxPlanningMR(payload).then(response => {
api.create('UPLOAD').createMonthlyReportTP(payload).then(response => {
console.log(payload);
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.saveToMonthlyReport()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', submissionID: null, loading: false }, () => {
document.body.style.overflow = 'unset';
......@@ -245,10 +242,11 @@ export default class TaxPlanningMR extends Component {
window.location.reload();
}, 1000);
}
this.props.saveToMonthlyReport()
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -271,77 +269,11 @@ export default class TaxPlanningMR extends Component {
payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
january: {
tbc: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
},
february: {
tbc: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
tbf: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
},
march: {
tbc: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
tbf: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
},
april: {
tbc: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
tbf: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
},
may: {
tbc: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
tbf: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
},
june: {
tbc: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
tbf: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(),
},
july: {
tbc: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
tbf: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[22]).trim(),
},
august: {
tbc: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
tbf: i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[25]).trim(),
},
september: {
tbc: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(),
fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
tbf: i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[28]).trim(),
},
october: {
tbc: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(),
fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
tbf: i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[31]).trim(),
},
november: {
tbc: i[32] === undefined ? "0" : reg.test(String(i[32])) === false ? "0" : String(i[32]).trim(),
fcp: i[33] === undefined ? "0" : reg.test(String(i[33])) === false ? "0" : String(i[33]).trim(),
tbf: i[34] === undefined ? "0" : reg.test(String(i[34])) === false ? "0" : String(i[34]).trim(),
},
december: {
tbc: i[35] === undefined ? "0" : reg.test(String(i[35])) === false ? "0" : String(i[35]).trim(),
fcp: i[36] === undefined ? "0" : reg.test(String(i[36])) === false ? "0" : String(i[36]).trim(),
tbf: i[37] === undefined ? "0" : reg.test(String(i[37])) === false ? "0" : String(i[37]).trim(),
},
total_current_year: i[38] === undefined ? "" : String(i[38]).trim(),
total_next_year: {
tbc: i[39] === undefined ? "0" : reg.test(String(i[39])) === false ? "0" : String(i[39]).trim(),
fcp: i[40] === undefined ? "0" : reg.test(String(i[40])) === false ? "0" : String(i[40]).trim(),
tbf: i[41] === undefined ? "0" : reg.test(String(i[41])) === false ? "0" : String(i[41]).trim(),
},
total_more_year: {
tbc: i[42] === undefined ? "0" : reg.test(String(i[42])) === false ? "0" : String(i[42]).trim(),
fcp: i[43] === undefined ? "0" : reg.test(String(i[43])) === false ? "0" : String(i[43]).trim(),
tbf: i[44] === undefined ? "0" : reg.test(String(i[44])) === false ? "0" : String(i[44]).trim(),
}
trial_balance_commercial: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
fiscal_correction: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
trial_balance_fiscal: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
trial_balance_fiscal_actual: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
trial_balance_fiscal_mb: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
})
}
})
......@@ -349,6 +281,7 @@ export default class TaxPlanningMR extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
months: this.props.month.month_id,
tax_planning: payload
}
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
......@@ -358,7 +291,7 @@ export default class TaxPlanningMR extends Component {
}
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
api.create().checkUploadMonthlyReportTP(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if (response.data) {
......@@ -366,52 +299,28 @@ export default class TaxPlanningMR extends Component {
this.setState({ visibleUpload: false, visibleTP: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
// item.type_report_id,
0,
Number(item.type_report_id.tbc),
Number(item.type_report_id.fcp),
Number(item.type_report_id.tbf),
item.item_report_id,
item.parent,
item.formula,
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level,
item.item_report,
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.january.tbc, formula: item.january_formula } : item.january.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 || item.type_report_id.fcp == 7 ? { value: item.january.fcp, formula: item.january_formula } : item.january.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 || item.type_report_id.tbf == 7 ? { value: item.january.tbf, formula: item.january_formula } : item.january.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.february.tbc, formula: item.february_formula } : item.february.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.february.fcp, formula: item.february_formula } : item.february.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.february.tbf, formula: item.february_formula } : item.february.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.march.tbc, formula: item.march_formula } : item.march.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.march.fcp, formula: item.march_formula } : item.march.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.march.tbf, formula: item.march_formula } : item.march.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.april.tbc, formula: item.april_formula } : item.april.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.april.fcp, formula: item.april_formula } : item.april.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.april.tbf, formula: item.april_formula } : item.april.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.may.tbc, formula: item.may_formula } : item.may.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.may.fcp, formula: item.may_formula } : item.may.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.may.tbf, formula: item.may_formula } : item.may.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.june.tbc, formula: item.june_formula } : item.june.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.june.fcp, formula: item.june_formula } : item.june.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.june.tbf, formula: item.june_formula } : item.june.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.july.tbc, formula: item.july_formula } : item.july.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.july.fcp, formula: item.july_formula } : item.july.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.july.tbf, formula: item.july_formula } : item.july.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.august.tbc, formula: item.august_formula } : item.august.tbc === null ? "0" : item.august.tbc === "" ? "0" : item.august.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.august.fcp, formula: item.august_formula } : item.august.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.august.tbf, formula: item.august_formula } : item.august.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.september.tbc, formula: item.september_formula } : item.september.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.september.fcp, formula: item.september_formula } : item.september.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.september.tbf, formula: item.september_formula } : item.september.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.october.tbc, formula: item.october_formula } : item.october.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.october.fcp, formula: item.october_formula } : item.october.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.october.tbf, formula: item.october_formula } : item.october.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 },
item.total_current_year,
{
tbc: Number(item.type_report_id.tbc) === 3 && item.total_next_year.tbc === "" ? "0" : item.total_next_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_next_year.fcp === "" ? "0" : item.total_next_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_next_year.tbf === "" ? "0" : item.total_next_year.tbf
},
{
tbc: Number(item.type_report_id.tbc) === 3 && item.total_more_year.tbc === "" ? "0" : item.total_more_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_more_year.fcp === "" ? "0" : item.total_more_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_more_year.tbf === "" ? "0" : item.total_more_year.tbf
tbc: item.trial_balance_commercial === "" ? "0" : item.trial_balance_commercial,
fcp: item.fiscal_correction === "" ? "0" : item.fiscal_correction,
tbf: item.trial_balance_fiscal === "" ? "0" : item.trial_balance_fiscal
},
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_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf },
item.forecast_tbc_formula,
item.forecast_fcp_formula,
item.forecast_tbf_formula,
item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual,
item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb,
item.order,
item.condition_it_should_be,
item.condition_if_wrong,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
this.state.dataTable.map(item => {
if (item[27].length > 0) {
if (item[12].length > 0) {
// console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
}
......@@ -537,15 +446,13 @@ export default class TaxPlanningMR extends Component {
let data = []
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
// console.log(i[0])
data.push({
item_report_id: i[4],
january: {
tbc: i[1] === 3 && i[9].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[9].tbc.value).toFixed(1)) : String(Number(i[9].tbc).toFixed(1)),
fcp: i[2] === 3 && i[9].fcp === "" ? "0.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))
},
total_current_year: i[2] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
item_report_id: i[1],
trial_balance_commercial: String(Number(i[6].tbc).toFixed(1)),
fiscal_correction: String(Number(i[6].fcp).toFixed(1)),
trial_balance_fiscal: String(Number(i[6].tbf).toFixed(1)),
trial_balance_fiscal_actual: String(Number(i[7]).toFixed(1)),
trial_balance_fiscal_mb: String(Number(i[8]).toFixed(1))
})
})
let payload = {
......@@ -1401,8 +1308,9 @@ export default class TaxPlanningMR extends Component {
}
},
]
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
......@@ -1472,10 +1380,7 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
// null
this.downloadTemplate()
}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
......@@ -1493,8 +1398,8 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null
// this.setState({ visibleUpload: true })
onClick={() =>
this.setState({ visibleUpload: true })
}
>
<img src={Images.upload} />
......@@ -1512,7 +1417,6 @@ export default class TaxPlanningMR extends Component {
margin: 5
}}
onClick={() =>
// null
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
......@@ -1565,7 +1469,7 @@ export default class TaxPlanningMR extends Component {
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(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') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', marginTop: 20 }}>
<button
className="button"
type="button"
......@@ -1577,9 +1481,7 @@ export default class TaxPlanningMR extends Component {
marginRight: 20
}}
onClick={() =>
// null
{
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => {
// this.setState({ loading: false, buttonError: false, editable: true })
......@@ -1621,9 +1523,8 @@ export default class TaxPlanningMR extends Component {
</button>
<button
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick={() =>
// null
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
......@@ -1793,7 +1694,7 @@ export default class TaxPlanningMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MASTER BUDGET - TAX PLANNING" ?
this.state.judul === "TAX PLANNING - MONTHLY REPORT" ?
this.checkUpload() :
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