Commit bea4a209 authored by Deni Rinaldi's avatar Deni Rinaldi

bs

parent 34609fcd
......@@ -285,7 +285,7 @@ const create = (type = "") => {
const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
const uploadMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/import_monthly_report', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report/validate_save', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report_bs/validate_save', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......
......@@ -49,7 +49,8 @@ export default class BalanceSheetMR extends Component {
valueThreshold: 0,
minValue: 0,
maxValue: 0,
updateBy: '-'
updateBy: '-',
notes: ""
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -73,7 +74,8 @@ export default class BalanceSheetMR extends Component {
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -460,59 +462,63 @@ export default class BalanceSheetMR extends Component {
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
})
if (i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
})
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[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
} 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[19] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
} 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
}
})
console.log(JSON.stringify(data));
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 })
}
// 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,
// "status": "submitted",
// "months": this.props.month.month_id,
// "balance_sheet": data
// }
// api.create().validateSubmitReportMR(payload).then((response) => {
// console.log(response)
// if (response.data) {
// if (response.data.status === "success") {
// if (response.data.data.result) {
// 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")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// })
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,
"balance_sheet": data
}
console.log(JSON.stringify(payload));
api.create().validateSubmitReportMR(payload).then((response) => {
console.log(response)
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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
render() {
......@@ -1792,6 +1798,7 @@ export default class BalanceSheetMR extends Component {
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
......
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