Commit 55cb53a9 authored by Riri Novita's avatar Riri Novita

Update Banyak

parent ab9fa1c1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -165,7 +165,6 @@ export default class FixedAssetsMovement extends Component {
}
}
res.map((item, index) => {
console.log(item);
dataTable.push([
item.type_report_id,
item.id,
......@@ -911,24 +910,26 @@ export default class FixedAssetsMovement extends Component {
const handleForecast = (tableMeta, periode) => {
let total = 0
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
console.log('cek forcast 1');
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
console.log('cek forcast 2');
let indexID = dataTable2.findIndex((val, index) => String(val[5]).toLocaleLowerCase() == 'ending balance' && dataTable2[index - 1][2] == tableMeta.rowData[2])
if (indexID !== -1) {
console.log('cek forcast 3');
// console.log(dataTable2)
total = tableMeta.columnIndex == 21 ? dataTable2[indexID][20] : dataTable2[indexID][18].value
}
} else {
let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
// simulasi
let indexID = dataTable2[tableMeta.rowIndex][25].findIndex((val) => val.periode == periode)
// Asli
// let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
if (indexID !== -1) {
total = dataTable2[tableMeta.rowIndex][23][indexID].value
// simulasi
total = dataTable2[tableMeta.rowIndex][25][indexID].value
// Asli
// total = dataTable2[tableMeta.rowIndex][23][indexID].value
}
}
} else {
total = handleValueFormula(tableMeta.columnIndex, tableMeta)
console.log('cek forcast 4');
}
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return total
......@@ -2608,44 +2609,44 @@ export default class FixedAssetsMovement extends Component {
return (
<div style={{ textAlign: 'right' }}>
{
this.props.status === 'CLOSED' ?
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
/>
}
/>
</div> :
<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>
:
// this.props.status === 'CLOSED' ?
// tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
// null
// :
// tableMeta.rowData[0] === 3 ?
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value).toFixed(1)}
// />
// }
// />
// </div> :
// <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[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -2715,44 +2716,44 @@ export default class FixedAssetsMovement extends Component {
return (
<div style={{ textAlign: 'right' }}>
{
this.props.status === 'CLOSED' ?
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
/>
}
/>
</div> :
<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>
:
// this.props.status === 'CLOSED' ?
// tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
// null
// :
// tableMeta.rowData[0] === 3 ?
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value).toFixed(1)}
// />
// }
// />
// </div> :
// <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[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......
......@@ -496,7 +496,7 @@ export default class BalanceSheetMR extends Component {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBSMR: false, loading: true, visibleButtonUpload: true })
this.setState({ visibleUploadSimulasi: false, visibleBSMR: false, loading: true, visibleButtonUpload: true })
let err = false
let dataTable = response.data.data.map((item, index) => {
if (item.type_report_id === 3) {
......@@ -885,6 +885,129 @@ export default class BalanceSheetMR extends Component {
})
}
handleValidateSimulasi() {
let data = []
let err = false
let errorContrl = false
let editAble = this.state.editAble
let dataTable = this.state.dataTable
let kansas = this.state.kansas
console.log(dataTable[dataTable.length - 1])
dataTable.map((i, index) => {
if (i[0] === 3) {
// console.log(i);
// if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
// console.log('msk 1');
// // console.log(i);
// err = true
// } else
if (i[18] === "" && (Number(i[14]).toFixed(1) < this.state.minValue || Number(i[14]).toFixed(1) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
if (String(i[5]) == "Control (should be nil)") {
if (Number(i[9]).toFixed(1) < this.state.minValue || Number(i[9]).toFixed(1) > this.state.maxValue) {
errorContrl = true
editAble = true
}
}
data.push({
"item_report_id": i[1],
"rolling_outlook": i[6],
"master_budget": i[7],
"rolling_budget": i[8],
"actual": i[9],
"actual_previous_month": i[10],
"amount_act_vs_previous_month": i[11],
"percent_act_vs_previous_month": i[12],
"amount_act_vs_mb": i[13],
"percent_act_vs_mb": i[14],
"amount_act_vs_rb": i[15],
"percent_act_vs_rb": i[16],
"mtd_vs_previous_month": i[17],
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
})
})
// console.log(JSON.stringify(data));
// data.map(i => {
// if (i.mtd_vs_previous_month === "" && (Number(i.percent_act_vs_previous_month) < this.state.minValue || Number(i.percent_act_vs_previous_month) > this.state.maxValue)) {
// console.log('msk 1');
// console.log(i);
// err = true
// } else if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
// console.log('msk 2');
// err = true
// } else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
// console.log('msk 3');
// err = true
// }
// })
// if (err === true) {
// console.log('error');
// this.setState({ loading: false, buttonError: true, saveDraft: false })
// } else {
// console.log('g error');
// this.setState({ loading: false, buttonError: false, saveDraft: false })
// }
// console.log(JSON.stringify(data))
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,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"months": this.props.month.month_id,
"balance_sheet": data
}
// console.log(JSON.stringify(payload));
// console.log(this.state.dataTable)
api.create().validateSubmitReportBS(payload).then((response) => {
console.log(response.data.data.result)
console.log(err);
console.log(errorContrl);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false && errorContrl === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
if (kansas == 0) {
this.setState({ kansas: 1, loading: true }, () => {
this.handleValidate()
})
} else {
this.setState({ kansas: 0 })
}
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
if (kansas == 0) {
this.setState({ kansas: 1, loading: true }, () => {
this.handleValidate()
})
} else {
this.setState({ kansas: 0 })
}
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
......@@ -2778,90 +2901,91 @@ export default class BalanceSheetMR extends Component {
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<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 : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Upload Simulasi'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
>
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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">
{this.state.visibleBSMR ?
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<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 : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true || this.state.get_for == 'view' ?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <a data-tip={'Download'} data-for="download">
// <button
// style={{
// backgroundColor: 'transparent',
// cursor: 'pointer',
// borderColor: 'transparent',
// margin: 5
// }}
// onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })}
// >
// <img src={Images.download} />
// </button>
// </a>
// <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Upload Simulasi'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
>
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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',
......@@ -2880,196 +3004,13 @@ export default class BalanceSheetMR extends Component {
</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>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
)
}) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
}
</div>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, textDecorationLine: 'underline' }}>Notes:</Typography>
</div>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, fontWeight: 'bold' }}>Rolling Outlook (Full Year) or Rolling Budget (RB)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jan-Mar = MB figures</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Apr-Jun = OL Q1 figures or MB figures (if OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jul-Sep = OL Q2 figures or OL Q1 (if OL Q2 not available) or MB (if OL Q2 and OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Oct-Dec = OL Q3 figures or OL Q2 (if OL Q3 not available) and consecutive to the MB</Typography>
</div>
</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="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<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%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.handleGetFor('edit')
})
}}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
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>}
{this.state.get_for === 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
})
</div>
}
>
<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>}
{this.state.get_for === 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/* : null
} */}
</Paper> :
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && !this.state.loading && (
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -3079,21 +3020,59 @@ export default class BalanceSheetMR extends Component {
</MuiThemeProvider>
)}
</div>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
)
}) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
}
</div>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, textDecorationLine: 'underline' }}>Notes:</Typography>
</div>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, fontWeight: 'bold' }}>Rolling Outlook (Full Year) or Rolling Budget (RB)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jan-Mar = MB figures</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Apr-Jun = OL Q1 figures or MB figures (if OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jul-Sep = OL Q2 figures or OL Q1 (if OL Q2 not available) or MB (if OL Q2 and OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Oct-Dec = OL Q3 figures or OL Q2 (if OL Q3 not available) and consecutive to the MB</Typography>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}>
{/* {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="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.getItemHierarki()
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
outline: 'none',
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......@@ -3101,78 +3080,318 @@ export default class BalanceSheetMR extends Component {
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
{this.props.isApprover === true ?
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.handleGetFor('edit')
})
}}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
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>}
{this.state.get_for === 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
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>}
{this.state.get_for === 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/* : null
} */}
</Paper>
:
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && !this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
setTimeout(() => {
this.handleValidate()
this.getItemHierarki()
}, 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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('draft')
})
})}
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%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</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 - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
>
<div 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 Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && !this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
</div>
</div>
</Paper>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('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 Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
}
</div>
{this.state.visibleUpload && (
......@@ -3252,7 +3471,7 @@ export default class BalanceSheetMR extends Component {
}}
/>
</div>
{this.state.visibleButtonUpload &&
{/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div>
<button
......@@ -3276,7 +3495,7 @@ export default class BalanceSheetMR extends Component {
</button>
</div>
</div>
}
} */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div>
</div>
......
......@@ -1074,6 +1074,236 @@ export default class CorporateAnnualTargetMR extends Component {
}
handleCalculateSimulasi(datatable2) {
// console.log(datatable2)
this.setState({ loading: true }, () => {
let total = 0
let perfomanceScore = ''
let totalWeight = 0
// console.log(datatable2)
let datatable3 = datatable2.map((item, index) => {
// console.log(item[6])
//total weight
if (item[0] !== 1 && item[0] !== 4) {
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalWeight += Number(0)
} else {
totalWeight += Number(item[6])
}
}
//ach
let totalAch = 0
if (item[8] == 'HIB') {
let actual = item[11] == "" ? 0 : Number(item[11])
let target = item[12] == "" ? 0 : Number(item[12])
// if (item[5] == "Striping Ratio (SR) YTD") {
// console.log(actual)
// console.log(target)
// console.log(actual/target)
// }
if (target < 0) {
if (actual > target) {
totalAch = (actual / target) - 1
} else {
totalAch = (actual / target)
}
} else if (target == 0) {
if (target >= actual) {
totalAch = 1.26
} else {
totalAch = 0
}
} else {
if (actual == target) {
totalAch = (actual / target)
} else {
totalAch = 2 - (actual / target)
}
}
// if (item[5] == "Striping Ratio (SR) YTD") {
// console.log(actual)
// console.log(target)
// console.log(actual/target)
// }
} else {
let actual = item[11] == "" ? 0 : Number(item[11])
let target = item[12] == "" ? 0 : Number(item[12])
if (target < 0) {
if (actual >= target) {
totalAch = ((target - actual) / target) + 1
} else {
totalAch = (target - actual) / target
}
} else if (target == 0) {
if (target <= actual) {
totalAch = 1.26
} else {
totalAch = 0
}
} else {
// if (actual <= target) {
totalAch = (actual / target)
// } else {
// totalAch = 1 - (actual / target)
// }
}
}
totalAch = String(totalAch) == 'NaN' || String(totalAch) == 'Infinity' || String(totalAch) == '-Infinity' ? 0 : totalAch
totalAch = this.props.lastStatus == 'APPROVED' ? item[13] : Number(totalAch) * 100
//score
let listParameter = this.state.parameterScore
let parameterKpi = item[8]
let parameterAch = String(item[9]).includes('%') ? `MAX${String(item[9]).substr(0, String(item[9]).length - 1)}` : String(item[9])
let parameterMix = `${parameterKpi}_${parameterAch}`
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase())
let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0
let achx100 = item[9] == '100%' && (item[8] == 'HIB' || item[8] == 'HIG') ? (Number(totalAch) / 100 > 1 ? 1 : Number(totalAch) / 100) : Number(totalAch) / 100
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(listParameterFilter)
// console.log(listParameterFilterCompany)
// // console.log(Number(item.min_value))
// console.log(Number(item.max_value))
// }
if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((items, index) => {
if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(items.value)
}
})
} else {
listParameterFilterCompany.map((items, index) => {
if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(items.value)
}
})
}
let totalScorez = this.props.lastStatus == 'APPROVED' ? item[14] : Number(totalScore).toFixed(0)
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(totalScorez)
// }
//Score X Weight
let totalSW = 0
let handlePercent = ''
if (String(item[6]).includes('%')) {
handlePercent = String(item[6]).substr(0, String(item[6]).length - 1)
} else {
handlePercent = String(item[6])
}
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalSW = 0
} else {
totalSW = (Number(totalScorez) * Number(handlePercent) / 100)
}
totalSW = this.props.lastStatus == 'APPROVED' ? item[15] : Number(totalSW).toFixed(2)
if (item[0] !== 1 && item[0] !== 4) {
total += Number(totalSW)
}
// console.log(item[5])
// console.log(totalAch);
// console.log(achx100);
// console.log(listParameterFilter);
// console.log(listParameterFilterCompany);
// console.log(totalScorez)
// console.log(totalSW)
// console.log(item[12])
// console.log(item[5])
// console.log(total)
return [
item[0],
item[1],
item[2],
item[3],
item[4],
item[5],
item[6],
item[7],
item[8],
item[9],
item[10],
item[11],
item[12],
totalAch,
totalScorez,
totalSW,
item[16],
item[17],
item[18],
// item[19],
// ]
]
})
// console.log(totalWeight)
// console.log(total)
// console.log(datatable3);
let totalWeightz = Number(totalWeight) / 100
let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)
console.log(totalz)
let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz
if (R.equals(totalz, NaN) || R.equals(totalz, "NaN")) {
lastTotal = 0.0
} else {
lastTotal = totalz
}
console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id)
let listPerfomanceDefault = []
if (indexPerform == -1) {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => String(val.company_name).toLocaleLowerCase() == "default")
} else {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => val.company_id == this.props.company.company_id)
}
let performanceScore = ''
let perfomanceScoreColor = '#fff'
if (listPerfomanceDefault.length > 0) {
listPerfomanceDefault.map((item, index) => {
console.log(Number(lastTotal))
console.log(Number(item.min_value))
console.log(Number(item.max_value))
if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) {
console.log('masuk')
perfomanceScore = item.description
perfomanceScoreColor = item.value
}
})
}
// console.log(Number(lastTotal))
console.log(this.state.parameterPerfom)
console.log(listPerfomanceDefault)
console.log(perfomanceScore)
console.log(perfomanceScoreColor)
console.log(datatable3)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
// perfomanceScore = 'C'
// } else if (lastTotal >= 2.76 && lastTotal <= 3.00) {
// perfomanceScore = 'B-'
// } else if (lastTotal >= 3.01 && lastTotal <= 3.75) {
// perfomanceScore = 'B'
// } else if (lastTotal >= 3.76 && lastTotal <= 4.00) {
// perfomanceScore = 'B+'
// } else if (lastTotal >= 4.01 && lastTotal <= 4.75) {
// perfomanceScore = 'BS'
// } else if (lastTotal >= 4.76 && lastTotal <= 5.00) {
// perfomanceScore = 'IST'
// }
setTimeout(() => {
this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor }, () => {
this.setState({ loading: true })
setTimeout(() => {
this.setState({ loading: false })
}, 500);
})
}, 500);
})
}
handleBackgroundPerf(total) {
// console.log(total)
let color = 'white'
......@@ -2484,7 +2714,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => {
setTimeout(() => {
// this.handleValidate()
this.handleCalculate(dataTable2)
this.handleCalculateSimulasi(dataTable2)
}, 100);
})
}}
......
......@@ -405,7 +405,7 @@ export default class FixedAssetsMovementMR extends Component {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, loading: true, visibleFAMMR: false, refresh: true, visibleButtonUpload: true })
this.setState({ visibleUploadSimulasi: false, loading: true, visibleFAMMR: false, refresh: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
......@@ -670,6 +670,62 @@ export default class FixedAssetsMovementMR extends Component {
})
}
handleValidateSimulasi() {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
data.push({
"item_report_id": i[1],
"mtd_mb": i[6],
"mtd_rb": i[7],
"mtd_actual": i[8],
"act_vs_mb_amount": String(i[9]) === 'NaN' || String(i[9]) === 'Infinity' || String(i[9]) === '-Infinity' ? '0.0' : String(i[9]),
"act_vs_mb_percent": String(i[10]) === 'NaN' || String(i[10]) === 'Infinity' || String(i[10]) === '-Infinity' ? '0.0' : String(i[10]),
"act_vs_rb_amount": String(i[11]) === 'NaN' || String(i[11]) === 'Infinity' || String(i[11]) === '-Infinity' ? '0.0' : String(i[11]),
"act_vs_rb_percent": String(i[12]) === 'NaN' || String(i[12]) === 'Infinity' || String(i[12]) === '-Infinity' ? '0.0' : String(i[12])
})
})
// console.log(JSON.stringify(data))
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,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"months": this.props.month.month_id,
"fixed_asset_movement": data
}
// console.log(JSON.stringify(payload));
api.create().validateSubmitReportFAM(payload).then((response) => {
console.log(response.data.data.result)
console.log(err);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
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") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
......@@ -1738,129 +1794,227 @@ export default class FixedAssetsMovementMR extends Component {
</div>
}
</div>
</Paper> :
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</Paper>
:
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.refresh && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.refresh && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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 || 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%', paddingRight: 5 }}>
<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.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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>
</Paper>
:
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{/* {this.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%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.refresh && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => {
setTimeout(() => {
// this.setState({ loading: false })
this.handleValidate()
this.getItemHierarki()
}, 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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick === 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadFAMMR('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: 'error' })
:
this.state.handleDoubleClick === 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadFAMMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
})}
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 || 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%', paddingRight: 5 }}>
<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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick === 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadFAMMR('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: 'error' })
:
this.state.handleDoubleClick === 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadFAMMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
</Paper>
</Paper>
}
</div>
{this.state.visibleUpload && (
......@@ -1940,7 +2094,7 @@ export default class FixedAssetsMovementMR extends Component {
}}
/>
</div>
{this.state.visibleButtonUpload &&
{/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div>
<button
......@@ -1964,7 +2118,7 @@ export default class FixedAssetsMovementMR extends Component {
</button>
</div>
</div>
}
} */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div>
</div>
......
......@@ -605,7 +605,7 @@ export default class ProfitLossMR extends Component {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visiblePLMR: false, loading: true, visibleButtonUpload: true })
this.setState({ visibleUploadSimulasi: false, visiblePLMR: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
......@@ -868,6 +868,86 @@ export default class ProfitLossMR extends Component {
})
}
handleValidateSimulasi() {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
if (i[0] === 3) {
// console.log(i);
if (i[19] === "" && (Number(i[16]).toFixed(1) < this.state.minValue || Number(i[16]).toFixed(1) > this.state.maxValue)) {
console.log('msk 1');
// console.log(i);
err = true
}
// else if ( i[20] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
// console.log('msk 2');
// err = true
// } else if ( i[21] === "" && (Number(i[18]) < this.state.minValue || Number(i[18]) > this.state.maxValue)) {
// console.log('msk 3');
// err = true
// }
}
data.push({
"item_report_id": i[1],
"notes": i[6],
"rolling_outlook": i[7],
"master_budget": i[8],
"rolling_budget": i[9],
"actual": i[10],
"ytd_actual": i[11],
"actual_previous_month": i[12],
"amount_act_vs_previous_month": i[13],
"percent_act_vs_previous_month": i[14],
"amount_act_vs_mb": i[15],
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_mb": i[19],
"mtd_vs_rb": i[20],
"mtd_vs_previous_month": i[21],
})
})
console.log(this.state.dataTable);
// console.log(JSON.stringify(data))
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": "submitted",
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"profit_loss": data
}
console.log(JSON.stringify(payload));
api.create().validateSubmitReportPL(payload).then((response) => {
console.log(response)
console.log(err);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
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") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
......@@ -2385,7 +2465,7 @@ export default class ProfitLossMR extends Component {
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly &&
{this.state.get_for == 'view' && this.state.viewOnly &&
<button
className="button"
type="button"
......@@ -2482,126 +2562,221 @@ export default class ProfitLossMR extends Component {
} */}
</Paper>
:
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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%', paddingRight: 5 }}>
<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.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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>
</Paper>
:
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => {
setTimeout(() => {
// this.setState({ loading: false })
this.handleValidate()
this.getItemHierarki()
}, 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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossMR('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 Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
})}
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%', paddingRight: 5 }}>
<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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossMR('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 Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
</Paper>}
</Paper>}
</div>
{this.state.visibleUpload && (
......@@ -2681,7 +2856,7 @@ export default class ProfitLossMR extends Component {
}}
/>
</div>
{this.state.visibleButtonUpload &&
{/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div>
<button
......@@ -2705,7 +2880,7 @@ export default class ProfitLossMR extends Component {
</button>
</div>
</div>
}
} */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div>
</div>
......
......@@ -504,7 +504,7 @@ export default class TaxPlanningMR extends Component {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true, visibleButtonUpload: true })
this.setState({ visibleUploadSimulasi: false, visibleTP: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => {
return [
0,
......@@ -714,6 +714,77 @@ export default class TaxPlanningMR extends Component {
})
}
handleValidateSimulasi(dataTable2) {
let data = []
let errorContrl = this.state.buttonError
let editAble = this.state.editAble
console.log(this.state.dataTable)
console.log(dataTable2)
dataTable2.map(i => {
console.log(i)
// this.setState({ loading: false })
console.log(i[9].tbf)
if (String(i[8]) === "Control (should be nil)") {
console.log(i[9].tbf)
console.log(this.state.minValue)
console.log(this.state.maxValue)
if (Number(i[9].tbf) < Number(this.state.minValue) || Number(i[9].tbf) > Number(this.state.maxValue)) {
errorContrl = true
editAble = true
} else {
errorContrl = false
editAble = false
}
}
data.push({
item_report_id: i[4],
trial_balance_commercial: String(Number(i[9].tbc).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(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(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[10]).toFixed(2)) : String(Number(i[10]).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))
})
})
// this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
console.log(errorContrl)
let i = this.state.dataTable
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": "submitted",
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data
}
api.create().validateSubmitReportMRTP(payload).then((response) => {
console.log(payload)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && errorContrl === false && editAble === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
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") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&currency_id=${this.props.defaultCurrency.id}`
......@@ -1911,123 +1982,214 @@ export default class TaxPlanningMR extends Component {
</div>
</Paper>
:
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()}, {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
this.state.visibleButtonUpload === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()}, {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true, visibleTP: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20, marginLeft: 10 }}
>
<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>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</div>
</button>
)}
</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.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true, visibleTP: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate(dataTable2)
this.getItemHierarki()
}, 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
type="button"
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
})}
style={{ marginRight: 20, marginLeft: 10 }}
>
<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"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => {
this.uploadTP('draft')
this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidateSimulasi(dataTable2)
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
>
<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}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div>
</Paper>
:
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()}, {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</div>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true, visibleTP: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20, marginLeft: 10 }}
>
<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"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => {
this.uploadTP('submitted')
this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate(dataTable2)
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 10 }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
})
}}
>
<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
type="button"
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
setTimeout(() => {
this.uploadTP('draft')
}, 100);
})}
>
<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}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
setTimeout(() => {
this.uploadTP('submitted')
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 10 }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
</Paper>
</Paper>
}
</div>
{this.state.visibleUpload && (
......@@ -2107,7 +2269,7 @@ export default class TaxPlanningMR extends Component {
}}
/>
</div>
{this.state.visibleButtonUpload &&
{/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div>
<button
......@@ -2131,7 +2293,7 @@ export default class TaxPlanningMR extends Component {
</button>
</div>
</div>
}
} */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div>
</div>
......
......@@ -602,7 +602,7 @@ export default class ProfitLossROO extends Component {
console.log("checkUpload Response", response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visiblePLRO: false, loading: true, visibleButtonUpload: true })
this.setState({ visibleUploadSimulasi: false, visiblePLRO: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
......@@ -850,6 +850,10 @@ export default class ProfitLossROO extends Component {
// })
}
handleValidateSimulasi() {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false, handleDoubleClick: 0 })
}
closeAlert() {
this.setState({ alert: false })
}
......@@ -2742,127 +2746,222 @@ export default class ProfitLossROO extends Component {
} */}
</Paper>
:
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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%', paddingRight: 5 }}>
<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.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 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>
</Paper>
:
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => {
setTimeout(() => {
// this.setState({ loading: false })
this.handleValidate()
this.getItemHierarki()
}, 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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossRO('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 Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossRO('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div>
</button>
})}
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%', paddingRight: 5 }}>
<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: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossRO('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 Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossRO('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div>
</button>
</div>
</div>
</div>
</div>
</Paper>}
</Paper>}
</div>
{this.state.visibleUpload && (
......@@ -2944,7 +3043,7 @@ export default class ProfitLossROO extends Component {
}}
/>
</div>
{this.state.visibleButtonUpload &&
{/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div>
<button
......@@ -2968,7 +3067,7 @@ export default class ProfitLossROO extends Component {
</button>
</div>
</div>
}
} */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div>
</div>
......
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