Commit 7236b2ae authored by Riri Novita's avatar Riri Novita

onupload

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