Commit 91ff426f authored by Deni Rinaldi's avatar Deni Rinaldi

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

parents bea4a209 743ba1e8
...@@ -275,6 +275,7 @@ const create = (type = "") => { ...@@ -275,6 +275,7 @@ const create = (type = "") => {
const createMonthlyReportTP = (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 createMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/create_monthly_report', body) const createMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/create_monthly_report', body)
const createMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/create_monthly_report', body) const createMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/create_monthly_report', body)
const createMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/create_monthly_report', body)
const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body) const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
const checkUploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/check_import', body) const checkUploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/check_import', body)
const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body) const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body)
...@@ -285,7 +286,9 @@ const create = (type = "") => { ...@@ -285,7 +286,9 @@ const create = (type = "") => {
const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body) const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body) const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
const uploadMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/import_monthly_report', body) const uploadMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/import_monthly_report', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report_bs/validate_save', body) const validateSubmitReportBS = (body) => api.post('transaction/monthly_report_bs/validate_save', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report/validate_save', body)
const validateSubmitReportMRTP = (body) => api.post('transaction/monthly_report_tp/validate_save', 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)
...@@ -428,6 +431,7 @@ const create = (type = "") => { ...@@ -428,6 +431,7 @@ const create = (type = "") => {
createMonthlyReportPL, createMonthlyReportPL,
createMonthlyReportFAM, createMonthlyReportFAM,
createMonthlyReportOI, createMonthlyReportOI,
createMonthlyReportCAT,
checkUploadMonthlyReportPL, checkUploadMonthlyReportPL,
getSubmission, getSubmission,
checkUploadMB, checkUploadMB,
...@@ -514,7 +518,9 @@ const create = (type = "") => { ...@@ -514,7 +518,9 @@ const create = (type = "") => {
uploadMonthlyReportOI, uploadMonthlyReportOI,
uploadMonthlyReportCAT, uploadMonthlyReportCAT,
getHierarkiMontlyReportCF, getHierarkiMontlyReportCF,
validateSubmitReportMR validateSubmitReportMR,
validateSubmitReportMRTP,
validateSubmitReportBS
} }
} }
......
...@@ -496,7 +496,7 @@ export default class BalanceSheetMR extends Component { ...@@ -496,7 +496,7 @@ export default class BalanceSheetMR extends Component {
"balance_sheet": data "balance_sheet": data
} }
console.log(JSON.stringify(payload)); console.log(JSON.stringify(payload));
api.create().validateSubmitReportMR(payload).then((response) => { api.create().validateSubmitReportBS(payload).then((response) => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
......
...@@ -11,6 +11,7 @@ import Constant from '../../library/Constant'; ...@@ -11,6 +11,7 @@ import Constant from '../../library/Constant';
import { Alert, Autocomplete } from '@material-ui/lab'; import { Alert, Autocomplete } from '@material-ui/lab';
import UploadFile from '../../library/Upload'; import UploadFile from '../../library/Upload';
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { PropagateLoader } from 'react-spinners';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -118,16 +119,44 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -118,16 +119,44 @@ export default class CorporateAnnualTargetMR extends Component {
api.create().getHierarkiMontlyReportCAT(payload).then(response => { api.create().getHierarkiMontlyReportCAT(payload).then(response => {
let dataTable = [] let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
console.log(payload); console.log(payload);
console.log(response); console.log(response);
if (response.data) { if (response.data) {
let res = response.data.data if (response.data.status === 'success') {
const handlePushChild = (item) => { let res = response.data.data
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) const handlePushChild = (item) => {
if (indexIDzz === -1) { let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.corporate_annual_target.weight).indexOf(".") == -1 ? item.corporate_annual_target.weight : `${Number(item.weight) * 100}%`),
parentTrue ? item.corporate_annual_target.uom : item.uom,
parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -135,11 +164,11 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -135,11 +164,11 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.corporate_annual_target.weight).indexOf(".") == -1 ? item.corporate_annual_target.weight : `${Number(item.weight) * 100}%`), item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.weight,
parentTrue ? item.corporate_annual_target.uom : item.uom, item.corporate_annual_target.uom,
parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type }, item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) }, item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd }, item.formula == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1), item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly, item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly, item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
...@@ -147,46 +176,28 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -147,46 +176,28 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight, item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes, item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
]) ])
} if (item.children !== null) {
if (item.children !== null) { if (item.children.length > 0) {
if (item.children.length > 0) { item.children.map((items, indexs) => {
item.children.map((items, indexs) => { handlePushChild(items)
handlePushChild(items) })
}) }
} }
} })
} // console.log(dataTable);
res.map((item, index) => { this.setState({ dataTable, loading: false })
dataTable.push([ } else {
item.type_report_id, this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
item.id, if (response.data.message.includes("Someone Logged In")) {
item.parent, setTimeout(() => {
item.formula, localStorage.removeItem(Constant.TOKEN)
item.level, window.location.reload();
item.description, }, 1000);
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.weight,
item.corporate_annual_target.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
} }
} })
}) }
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => { } else {
// console.log(dataCustomerPrs) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
})
} }
console.log(dataTable); console.log(dataTable);
}) })
...@@ -431,6 +442,60 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -431,6 +442,60 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
} }
backToMonthlyReport(type) {
this.setState({ loading: true })
console.log(this.state.dataTable);
let data = []
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"weight": i[6],
"uom": i[7],
"jenis_kpi": i[8],
"max_ach": i[9],
"formula_ytd": i[10],
"actual_monthly": i[11],
"target_monthly": i[12],
"achivement_monthly": i[13],
"score": i[14],
"score_x_weight": i[15],
"notes": i[16]
})
})
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
"corporate_annual_target": data
}
console.log(JSON.stringify(payload));
api.create('UPLOAD').createMonthlyReportCAT(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.saveToMonthlyReport()
} else {
this.setState({ loading: false }, () => {
this.props.saveToMonthlyReport()
})
}
} else {
this.setState({ loading: false }, () => {
this.getSubmission()
document.body.style.overflow = 'unset';
})
}
})
}
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let dataDelete = this.state.dataDelete let dataDelete = this.state.dataDelete
...@@ -473,10 +538,10 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -473,10 +538,10 @@ export default class CorporateAnnualTargetMR extends Component {
} }
const handleValueDropdown = (value, type, tableMeta) => { const handleValueDropdown = (value, type, tableMeta) => {
console.log(value,type, tableMeta); // console.log(value,type, tableMeta);
console.log(this.state.maxAchList.options); // console.log(this.state.maxAchList.options);
let data = type == 'KPI' ? this.state.kpiTypeList.options : (type == 'MAX' ? this.state.maxAchList.options : this.state.formulaYtdList.options) let data = type == 'KPI' ? this.state.kpiTypeList.options : (type == 'MAX' ? this.state.maxAchList.options : this.state.formulaYtdList.options)
console.log(data); // console.log(data);
let index = 0 let index = 0
if (value == null) { if (value == null) {
console.log("masuk"); console.log("masuk");
...@@ -1192,112 +1257,323 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1192,112 +1257,323 @@ export default class CorporateAnnualTargetMR 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)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
{this.state.loading && loadingComponent}
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div> </div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> {this.state.visibleCATMR ?
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Corporate Annual Target - Performance</Typography> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
</div> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Corporate Annual Target - Performance</Typography>
<div style={{ padding: 20 }}> </div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate() }
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<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>
{this.props.isApprover === true ?
<div className="col-2"></div>
:
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
}
</div>
</Paper> :
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Corporate Annual Target - Performance</Typography>
</div>
<div style={{ padding: 20 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> { console.log(this.state.loading) }
<a data-tip={'Download Template'} data-for="template"> {!this.state.loading && (
<button <MuiThemeProvider theme={getMuiTheme()}>
style={{ <MUIDataTable
backgroundColor: 'transparent', data={dataTable2}
cursor: 'pointer', columns={columns}
borderColor: 'transparent', options={options}
margin: 5 />
}} </MuiThemeProvider>
onClick={() => this.downloadTemplate() } )}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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> </div>
</div> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <button
{!this.state.loading && ( type="button"
<MuiThemeProvider theme={getMuiTheme()}> onClick={() => this.setState({ loading: true }, () => {
<MUIDataTable setTimeout(() => {
data={dataTable2} this.props.onClickClose()
columns={columns} }, 100);
options={options} })}
/> style={{
</MuiThemeProvider> backgroundColor: 'transparent',
)} cursor: 'pointer',
</div> borderColor: 'transparent',
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> outline: 'none'
</div> }}
<div className="grid grid-2x" style={{ marginTop: 20 }}> >
<div className="col-1"> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<button <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
type="button" </div>
onClick={() => this.setState({ loading: true }, () => { </button>
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> </div>
</button> {/* {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%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadCATMR('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadCATMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div>
</div> </div>
</div> </Paper>
</Paper> }
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
<div className="test app-popup-show"> <div className="test app-popup-show">
......
...@@ -1454,25 +1454,22 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1454,25 +1454,22 @@ export default class FixedAssetsMovementMR extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div>
<div> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> </div>
</div> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <MuiThemeProvider theme={getMuiTheme()}>
{!this.state.loading && ( <MUIDataTable
<MuiThemeProvider theme={getMuiTheme()}> data={dataTable2}
<MUIDataTable columns={columns}
data={dataTable2} options={options}
columns={columns} />
options={options} </MuiThemeProvider>
/> )}
</MuiThemeProvider> </div>
)}
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1">
<button <button
......
...@@ -62,7 +62,6 @@ export default class TaxPlanningMR extends Component { ...@@ -62,7 +62,6 @@ export default class TaxPlanningMR extends Component {
this.getSettingControl() this.getSettingControl()
// this.getItemHierarki() // this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
console.log(this.props.isApprover)
} }
getSettingControl() { getSettingControl() {
...@@ -93,7 +92,6 @@ export default class TaxPlanningMR extends Component { ...@@ -93,7 +92,6 @@ export default class TaxPlanningMR extends Component {
"months": this.props.month.month_id "months": this.props.month.month_id
} }
api.create().getLastestUpdateMR(payload).then(response => { api.create().getLastestUpdateMR(payload).then(response => {
console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -115,7 +113,7 @@ export default class TaxPlanningMR extends Component { ...@@ -115,7 +113,7 @@ export default class TaxPlanningMR extends Component {
"months": 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);
// console.log(payload); // console.log(payload);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
...@@ -200,7 +198,7 @@ export default class TaxPlanningMR extends Component { ...@@ -200,7 +198,7 @@ export default class TaxPlanningMR extends Component {
} else { } else {
this.setState({ dataTable, loading: false, editable: true }) this.setState({ dataTable, loading: false, editable: true })
} }
// console.log(this.state.dataTable) console.log(this.state.dataTable)
}) })
} }
...@@ -229,10 +227,10 @@ export default class TaxPlanningMR extends Component { ...@@ -229,10 +227,10 @@ export default class TaxPlanningMR extends Component {
data.push({ data.push({
item_report_id: i[4], item_report_id: i[4],
trial_balance_commercial: String(Number(i[9].tbc).toFixed(1)), trial_balance_commercial: String(Number(i[9].tbc).toFixed(1)),
fiscal_correction: String(Number(i[9].fcp).toFixed(1)), fiscal_correction: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].fcp).toFixed(2)) : String(Number(i[9].fcp).toFixed(1)),
trial_balance_fiscal: String(Number(i[9].tbf).toFixed(1)), trial_balance_fiscal: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].tbf).toFixed(2)) : String(Number(i[9].tbf).toFixed(1)),
trial_balance_fiscal_actual: String(Number(i[10]).toFixed(1)), trial_balance_fiscal_actual: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[10]).toFixed(2)) : String(Number(i[10]).toFixed(1)),
trial_balance_fiscal_mb: String(Number(i[11]).toFixed(1)) trial_balance_fiscal_mb: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[11]).toFixed(2)) : String(Number(i[11]).toFixed(1))
}) })
}) })
let payload = { let payload = {
...@@ -289,7 +287,7 @@ export default class TaxPlanningMR extends Component { ...@@ -289,7 +287,7 @@ export default class TaxPlanningMR extends Component {
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(), item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report_name: i[2] === undefined ? "" : String(i[2]).trim(), item_report_name: i[2] === undefined ? "" : String(i[2]).trim(),
trial_balance_commercial: "", trial_balance_commercial: "",
fiscal_correction: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(), fiscal_correction: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[2]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(String(i[3]).trim()).toFixed(2)) :String(Number(String(i[3]).trim()).toFixed(1)),
trial_balance_fiscal: "", trial_balance_fiscal: "",
trial_balance_fiscal_actual: "", trial_balance_fiscal_actual: "",
trial_balance_fiscal_mb: "", trial_balance_fiscal_mb: "",
...@@ -330,11 +328,11 @@ export default class TaxPlanningMR extends Component { ...@@ -330,11 +328,11 @@ export default class TaxPlanningMR extends Component {
item.item_report, item.item_report,
{ {
tbc: item.trial_balance_commercial === null ? "0.0" : item.trial_balance_commercial === "" ? "0.0" : item.trial_balance_commercial, tbc: item.trial_balance_commercial === null ? "0.0" : item.trial_balance_commercial === "" ? "0.0" : item.trial_balance_commercial,
fcp: item.fiscal_correction === null ? "0.0" : item.fiscal_correction === "" ? "0.0" : item.fiscal_correction, fcp: item.fiscal_correction === null ? "0.0" : item.fiscal_correction === "" ? "0.0" : String(item.item_report).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(item.fiscal_correction).toFixed(2) : Number(item.fiscal_correction).toFixed(1),
tbf: item.trial_balance_fiscal === null ? "0.0" : item.trial_balance_fiscal === "" ? "0.0" : item.trial_balance_fiscal, tbf: item.trial_balance_fiscal === null ? "0.0" : item.trial_balance_fiscal === "" ? "0.0" : String(item.item_report).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(item.trial_balance_fiscal).toFixed(2) : Number(item.trial_balance_fiscal).toFixed(1),
}, },
item.trial_balance_fiscal_actual === null ? "0.0" : item.trial_balance_fiscal_actual === "" ? "0.0" : item.trial_balance_fiscal_actual, item.trial_balance_fiscal_actual === null ? "0.0" : item.trial_balance_fiscal_actual === "" ? "0.0" : String(item.item_report).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(item.trial_balance_fiscal_actual).toFixed(2) : Number(item.trial_balance_fiscal_actual).toFixed(1),
item.trial_balance_fiscal_mb === null ? "0.0" : item.trial_balance_fiscal_mb === "" ? "0.0" : item.trial_balance_fiscal_mb, item.trial_balance_fiscal_mb === null ? "0.0" : item.trial_balance_fiscal_mb === "" ? "0.0" : String(item.item_report).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(item.trial_balance_fiscal_mb).toFixed(2) : Number(item.trial_balance_fiscal_mb).toFixed(1),
item.actual_formula, item.actual_formula,
item.orders, item.orders,
{ tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf }, { tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf },
...@@ -362,10 +360,10 @@ export default class TaxPlanningMR extends Component { ...@@ -362,10 +360,10 @@ export default class TaxPlanningMR extends Component {
data.push({ data.push({
item_report_id: i[4], item_report_id: i[4],
trial_balance_commercial: String(Number(i[9].tbc).toFixed(1)), trial_balance_commercial: String(Number(i[9].tbc).toFixed(1)),
fiscal_correction: String(Number(i[9].fcp).toFixed(1)), fiscal_correction: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].fcp).toFixed(2)) : String(Number(i[9].fcp).toFixed(1)),
trial_balance_fiscal: String(Number(i[9].tbf).toFixed(1)), trial_balance_fiscal: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].tbf).toFixed(2)) : String(Number(i[9].tbf).toFixed(1)),
trial_balance_fiscal_actual: String(Number(i[10]).toFixed(1)), trial_balance_fiscal_actual: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[10]).toFixed(2)) : String(Number(i[10]).toFixed(1)),
trial_balance_fiscal_mb: String(Number(i[11]).toFixed(1)) trial_balance_fiscal_mb: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[11]).toFixed(2)) : String(Number(i[11]).toFixed(1))
}) })
}) })
let body = { let body = {
...@@ -408,32 +406,46 @@ export default class TaxPlanningMR extends Component { ...@@ -408,32 +406,46 @@ export default class TaxPlanningMR extends Component {
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[4],
trial_balance_commercial: String(Number(i[6].tbc).toFixed(1)), trial_balance_commercial: String(Number(i[9].tbc).toFixed(1)),
fiscal_correction: String(Number(i[6].fcp).toFixed(1)), fiscal_correction: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].fcp).toFixed(2)) : String(Number(i[9].fcp).toFixed(1)),
trial_balance_fiscal: String(Number(i[6].tbf).toFixed(1)), trial_balance_fiscal: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].tbf).toFixed(2)) : String(Number(i[9].tbf).toFixed(1)),
trial_balance_fiscal_actual: String(Number(i[7]).toFixed(1)), trial_balance_fiscal_actual: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[10]).toFixed(2)) : String(Number(i[10]).toFixed(1)),
trial_balance_fiscal_mb: String(Number(i[8]).toFixed(1)) trial_balance_fiscal_mb: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[11]).toFixed(2)) : String(Number(i[11]).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,
"tax_planning": data, "status": "submitted",
"status": "submitted" "months": this.props.month.month_id,
"tax_planning": data
} }
// console.log(JSON.stringify(payload)); api.create().validateSubmitReportMRTP(payload).then((response) => {
// api.create().validateSubmitReport(payload).then((response) => { console.log(response)
// // console.log(response) if (response.data) {
// if (response.data.data.result) { if (response.data.status === "success") {
// this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false }) if (response.data.data.result) {
// // alert("Type Input Can't be Empty") this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// } else { } else {
this.setState({ loading: false, editable: true, saveDraft: false, buttonError: false }) this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
// } }
// }) } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
} }
downloadTemplate = async () => { downloadTemplate = async () => {
...@@ -565,12 +577,8 @@ export default class TaxPlanningMR extends Component { ...@@ -565,12 +577,8 @@ export default class TaxPlanningMR extends Component {
if (dataTable2[indexID][13] == tableMeta.rowData[13]) { if (dataTable2[indexID][13] == tableMeta.rowData[13]) {
anjay.push(0) anjay.push(0)
} else { } else {
// console.log(dataTable2[indexID][tableMeta.columnIndex]);
let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
let valuezz = data.value == undefined ? data : data.value let valuezz = data.value == undefined ? data : data.value
// console.log(data);
// console.log(data.value);
// console.log(valuezz);
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} }
...@@ -658,19 +666,7 @@ export default class TaxPlanningMR extends Component { ...@@ -658,19 +666,7 @@ export default class TaxPlanningMR extends Component {
} }
total = R.equals(total, NaN) ? "0.0" : total total = R.equals(total, NaN) ? "0.0" : total
// console.log(tableMeta.rowData[8])
// if (xntd !== undefined && tableMeta.rowData[8] == "Under payment /(Over Payment ) Income Tax Art. 29") {
// console.log(tableMeta.rowData[8])
// // console.log(splitFormula)
// console.log(xntd)
// console.log(baru)
// console.log(anjay)
// console.log(total)
// console.log(total2)
// console.log(opt)
// }
// let dataSub = dex == 1? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc : dex == 2? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp : dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf
if (dex == 1) { if (dex == 1) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total).toFixed(1)
...@@ -684,7 +680,14 @@ export default class TaxPlanningMR extends Component { ...@@ -684,7 +680,14 @@ export default class TaxPlanningMR extends Component {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
} }
} else { } else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) { if (tableMeta.rowData[8] == "Corporate Income Tax") {
if (total < 0) {
total = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
}
} else if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1)
} else { } else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1)
...@@ -969,7 +972,7 @@ export default class TaxPlanningMR extends Component { ...@@ -969,7 +972,7 @@ export default class TaxPlanningMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
value={Number(value.fcp).toFixed(1)} value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 1) handleChange(event.target.value, tableMeta, 1)
// console.log(dataTable2) // console.log(dataTable2)
...@@ -1028,8 +1031,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1028,8 +1031,7 @@ export default class TaxPlanningMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={true} value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 2) handleChange(event.target.value, tableMeta, 2)
// console.log(dataTable2) // console.log(dataTable2)
...@@ -1037,7 +1039,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1037,7 +1039,7 @@ export default class TaxPlanningMR extends Component {
/> />
} }
/> />
</div> </div>
: :
// tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ? // tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
// <NumberFormat // <NumberFormat
...@@ -1060,7 +1062,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1060,7 +1062,7 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> />
} }
/> />
...@@ -1084,7 +1086,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1084,7 +1086,7 @@ export default class TaxPlanningMR extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> : /> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow> <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})` } arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1129,10 +1131,10 @@ export default class TaxPlanningMR extends Component { ...@@ -1129,10 +1131,10 @@ export default class TaxPlanningMR extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null null
: :
tableMeta.rowData[0] === 2 ? tableMeta.rowData[3] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -1144,48 +1146,49 @@ export default class TaxPlanningMR extends Component { ...@@ -1144,48 +1146,49 @@ export default class TaxPlanningMR extends Component {
/> />
</span> </span>
: :
tableMeta.rowData[0] === 3 ? // tableMeta.rowData[3] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="input" // placeholder="input"
disabled={true} // disabled={true}
value={Number(value).toFixed(1)} // value={Number(value).toFixed(1)}
onBlur={(event) => { // onBlur={(event) => {
handleChange(event.target.value, tableMeta, 3) // handleChange(event.target.value, tableMeta, 3)
// console.log(dataTable2) // // console.log(dataTable2)
}} // }}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? // tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<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(value).toFixed(1)} // value={Number(value).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[0] === 7 ? tableMeta.rowData[3] === 7 ?
(Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
(Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ style={{
...@@ -1200,7 +1203,8 @@ export default class TaxPlanningMR extends Component { ...@@ -1200,7 +1203,8 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={Number(value).toFixed(1)}
/> : /> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow> <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat <NumberFormat
...@@ -1217,7 +1221,8 @@ export default class TaxPlanningMR extends Component { ...@@ -1217,7 +1221,8 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 4)).toFixed(1)}
value={Number(value).toFixed(1)}
/> />
</LightTooltip> </LightTooltip>
: :
...@@ -1232,7 +1237,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1232,7 +1237,7 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value).toFixed(1)} value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value).toFixed(2) : Number(value).toFixed(1)}
/> />
} }
/> />
...@@ -1260,10 +1265,10 @@ export default class TaxPlanningMR extends Component { ...@@ -1260,10 +1265,10 @@ export default class TaxPlanningMR extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null null
: :
tableMeta.rowData[0] === 2 ? tableMeta.rowData[3] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -1275,82 +1280,85 @@ export default class TaxPlanningMR extends Component { ...@@ -1275,82 +1280,85 @@ export default class TaxPlanningMR extends Component {
/> />
</span> </span>
: :
tableMeta.rowData[0] === 3 ? // tableMeta.rowData[3] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder="input"
// disabled={true}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta, 3)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
// :
// tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value).toFixed(1)}
// />
// }
// />
// </div>
// :
tableMeta.rowData[3] === 7 ?
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
(Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={Number(value).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{
type="text" fontSize: 12,
placeholder="input" textAlign: 'right',
disabled={true} borderColor: 'transparent',
value={Number(value).toFixed(1)} margin: 0,
onBlur={(event) => { width: 96,
handleChange(event.target.value, tableMeta, 3) backgroundColor: 'transparent',
// console.log(dataTable2) color: 'red'
}} }}
/>
}
/>
</div>
:
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
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, 4)).toFixed(1)}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
/> />
} </LightTooltip>
/>
</div>
:
tableMeta.rowData[0] === 7 ? null
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
// </LightTooltip>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1363,7 +1371,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1363,7 +1371,7 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value).toFixed(1)} value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value).toFixed(2) : Number(value).toFixed(1)}
/> />
} }
/> />
...@@ -1611,7 +1619,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1611,7 +1619,7 @@ export default class TaxPlanningMR extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
......
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