Commit bea4a209 authored by Deni Rinaldi's avatar Deni Rinaldi

bs

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