Commit 4cc07854 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'riri' into 'master'

on upload

See merge request !701
parents 59120c2e 71684786
......@@ -276,6 +276,7 @@ const create = (type = "") => {
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body)
const checkUploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/check_import', body)
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -412,6 +413,7 @@ const create = (type = "") => {
createMonthlyReportPL,
createMonthlyReportFAM,
createMonthlyReportOI,
checkUploadMonthlyReportPL,
getSubmission,
checkUploadMB,
getAllOperatingInd,
......
......@@ -72,6 +72,7 @@ export default class ProfitLossMR extends Component {
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id
}
api.create().getHierarkiMontlyReportPL(payload).then(response => {
console.log(response);
let dataTable = []
......@@ -238,6 +239,7 @@ export default class ProfitLossMR extends Component {
}
fileHandler = (event) => {
console.log(event);
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
console.log(resp)
......@@ -252,12 +254,13 @@ export default class ProfitLossMR extends Component {
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
notes: i[2] === undefined ? "" : String(i[2]).trim(),
actual: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
mtd_vs_mb: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
mtd_vs_rb: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
orders: i[0] === undefined ? "" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
notes: i[3] === undefined ? "" : String(i[3]).trim(),
actual: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
})
}
})
......@@ -265,6 +268,7 @@ export default class ProfitLossMR extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
months: this.props.month.month_id,
profit_loss: payload
}
console.log(body)
......@@ -274,52 +278,50 @@ export default class ProfitLossMR extends Component {
}
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
api.create().checkUploadMonthlyReportPL(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.item_report,
item.notes,
item.total_actual_before,
item.january,
item.february,
item.march,
item.april,
item.may,
item.june,
item.july,
item.august,
item.september,
item.october,
item.november,
item.december,
item.total_current_year,
item.total_next_year,
item.total_more_year,
item.orders,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[24].length > 0) {
// console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.buttonError)
})
}
}
// if (response.data) {
// if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
// let dataTable = response.data.data.map((item, index) => {
// return [
// item.item_report_id,
// item.type_report_id,
// item.item_report,
// item.parent,
// item.formula,
// item.level,
// item.notes,
// item.rolling_outlook,
// item.master_budget,
// item.rolling_budget,
// item.actual,
// item.ytd_actual,
// item.actual_previous_month,
// item.amount_act_vs_previous_month,
// item.percent_act_vs_previous_month,
// item.amount_act_vs_mb,
// item.percent_act_vs_mb,
// item.amount_act_vs_rb,
// item.percent_act_vs_rb,
// item.mtd_vs_previous_month,
// item.mtd_vs_mb,
// item.mtd_vs_rb,
// item.orders
// ]
// })
// this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
// this.state.dataTable.map(item => {
// if (item[24].length > 0) {
// // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true, editable: true })
// }
// })
// // console.log(this.state.buttonError)
// })
// }
// }
})
}
......
......@@ -3844,7 +3844,7 @@ export default class BalanceSheetOLPA extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "OUTLOOK PA - BALANCE SHEET" ?
String(this.state.judul).includes("OUTLOOK PA - BALANCE SHEET") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
......@@ -2951,7 +2951,7 @@ export default class ProfitLossOLPA extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "OUTLOOK PA - PROFIT LOSS" ?
String(this.state.judul).includes("OUTLOOK PA - PROFIT LOSS") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
......@@ -3898,7 +3898,7 @@ export default class TaxPlanningOLPA extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "OUTLOOK PA - TAX PLANNING" ?
String(this.state.judul).includes("OUTLOOK PA - TAX PLANNING") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
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