Commit 8699b5d9 authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

validasi tp bs

See merge request !885
parents cbe17f11 7033beb3
......@@ -493,6 +493,9 @@ export default class BalanceSheetMR extends Component {
handleValidate() {
let data = []
let err = false
let errorContrl = this.state.buttonError
let editAble = this.state.editAble
console.log(this.state.dataTable)
this.state.dataTable.map((i, index) => {
if(i[0] === 3) {
// console.log(i);
......@@ -508,6 +511,19 @@ export default class BalanceSheetMR extends Component {
err = true
}
}
if (String(i[5]) == "Control (should be nil)") {
i.map((j, indexj) => {
if (indexj >= 6 && indexj <= 16) {
if (Number(j) < this.state.minValue || Number(j) > this.state.maxValue ) {
console.log("masuk error")
errorContrl = true
editAble = true
}
}
})
}
data.push({
"item_report_id": i[1],
"rolling_outlook": i[6],
......@@ -559,13 +575,14 @@ export default class BalanceSheetMR extends Component {
"balance_sheet": data
}
// console.log(JSON.stringify(payload));
console.log(this.state.dataTable)
// 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) {
if (response.data.data.result && err === false && errorContrl === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: true })
......
......@@ -420,6 +420,8 @@ export default class TaxPlanningMR extends Component {
handleValidate() {
let data = []
let errorContrl = this.state.buttonError
let editAble = this.state.editAble
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
......@@ -430,7 +432,20 @@ export default class TaxPlanningMR extends Component {
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))
})
if (String(i[8]) == "Control (should be nil)") {
if (i[9].tbf < this.state.minValue || i[9].tbf > this.state.maxValue || i[10] < this.state.minValue || i[10] > this.state.maxValue) {
errorContrl = true
editAble = true
} else {
errorContrl = false
editAble = false
}
}
})
this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
let i = this.state.dataTable
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
......@@ -440,29 +455,29 @@ export default class TaxPlanningMR extends Component {
"months": this.props.month.month_id,
"tax_planning": data
}
api.create().validateSubmitReportMRTP(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 })
}
})
// api.create().validateSubmitReportMRTP(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 })
// }
// })
}
downloadTemplate = async () => {
......
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