import React, { Component } from 'react'; import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles, Snackbar } from '@material-ui/core'; import MUIDataTable from 'mui-datatables'; import NumberFormat from 'react-number-format'; import api from '../../api'; import PropagateLoader from "react-spinners/PropagateLoader" import Images from '../../assets/Images'; import ReactTooltip from 'react-tooltip'; import UploadFile from "../../library/Upload"; import { ExcelRenderer } from 'react-excel-renderer'; import { Alert, Autocomplete } from '@material-ui/lab'; import * as R from 'ramda'; import Constant from '../../library/Constant'; import { fixNumber, titleCase } from '../../library/Utils'; const LightTooltip = withStyles((theme) => ({ tooltip: { backgroundColor: theme.palette.common.white, color: 'rgba(0, 0, 0, 0.87)', boxShadow: theme.shadows[1], fontSize: 11, }, }))(Tooltip); var ct = require("../../library/CustomTable"); const getMuiTheme = () => createMuiTheme(ct.customTable3()); const options = ct.customOptionsFixedColumn(); const style = { position: "sticky", left: 0, zIndex: 101, background: "white", }; const style2 = { position: "sticky", background: "white", zIndex: 100 }; const stylenotes = { position: "sticky", background: "white", zIndex: 101, left: 350 }; const styleNotesEmpty = { position: "sticky", background: "white", zIndex: 99, left: 0 } export default class ProfitLoss extends Component { constructor(props) { super(props) this.state = { dataTable: [], visibleProfitLoss: true, disabledSave: true, editable: false, buttonError: false, judulColumn: null, updateBy: [], buttonDraft: true, handleDoubleClick: 0, fromUpload: false, defaultCurrencyUpload: this.props.defaultCurrency, visibleAlertSave: false, previewUpload: false } this.handleValue = this.handleValue.bind(this) this.fileHandler = this.fileHandler.bind(this); } componentDidMount() { this.getItemHierarki() this.getLatestUpdate() this.getSettingControlCurrency() console.log(this.props); } getSettingControlCurrency() { let body = { group: 'CURRENCY_MONEY_FORMAT', company_id: this.props.company.company_id, type: this.props.defaultCurrency.value } console.log(body); api.create().getAllSettingByType(body).then(response => { console.log(response); // // this.setState({ // // minValue: response.data.data[0] ? response.data.data[0].min_value : null, // // maxValue: response.data.data[0] ? response.data.data[0].max_value : null, // // }, () => { // // this.getItemHierarki() // // }) }) } getLatestUpdate() { let payload = { "report_id": this.props.report_id, "revision": Number(this.props.revision), "periode": this.props.periode, "company_id": this.props.company.company_id, "submission_id": this.props.submissionID, // "currency_id": this.props.defaultCurrency.id } api.create().getLastestUpdateMB(payload).then(response => { if (response.data) { if (response.data.status === "success") { this.setState({ updateBy: response.data.data.detail === null ? [] : response.data.data.detail }) } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { setTimeout(() => { localStorage.removeItem(Constant.TOKEN) window.location.reload(); }, 1000); } }) } } }) } getItemHierarki() { console.log(this.props); this.setState({ loading: true, judulColumn: null }) let payload = { "report_id": this.props.report_id, "revision": Number(this.props.revision), "periode": this.props.periode, "company_id": this.props.company.company_id, "submission_id": this.props.submissionID, "currency_id": this.props.defaultCurrency.id } api.create().getDetailReportMB(payload).then(response => { console.log(response); let dataTable = [] this.setState({ visibleProfitLoss: true }) if (response.data) { if (response.ok) { if (response.data.status === 'success') { let res = response.data.data const handlePushChild = (item) => { let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) if (indexIDzz === -1) { dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, item.description, item.profit_loss.notes === "" ? null : item.profit_loss.notes, item.profit_loss.total_actual_before === null ? "0.0" : item.profit_loss.total_actual_before === "" ? "0.0" : item.profit_loss.total_actual_before, item.profit_loss.january == '0' ? "0.0" : item.profit_loss.january == '' ? "0.0" : item.profit_loss.january, item.profit_loss.february == '0' ? "0.0" : item.profit_loss.february == '' ? "0.0" : item.profit_loss.february, item.profit_loss.march == '0' ? "0.0" : item.profit_loss.march == '' ? "0.0" : item.profit_loss.march, item.profit_loss.april == '0' ? "0.0" : item.profit_loss.april == '' ? "0.0" : item.profit_loss.april, item.profit_loss.may == '0' ? "0.0" : item.profit_loss.may == '' ? "0.0" : item.profit_loss.may, item.profit_loss.june == '0' ? "0.0" : item.profit_loss.june == '' ? "0.0" : item.profit_loss.june, item.profit_loss.july == '0' ? "0.0" : item.profit_loss.july == '' ? "0.0" : item.profit_loss.july, item.profit_loss.august == '0' ? "0.0" : item.profit_loss.august == '' ? "0.0" : item.profit_loss.august, item.profit_loss.september == '0' ? "0.0" : item.profit_loss.september == '' ? "0.0" : item.profit_loss.september, item.profit_loss.october == '0' ? "0.0" : item.profit_loss.october == '' ? "0.0" : item.profit_loss.october, item.profit_loss.november == '0' ? "0.0" : item.profit_loss.november == '' ? "0.0" : item.profit_loss.november, item.profit_loss.december == '0' ? "0.0" : item.profit_loss.december == '' ? "0.0" : item.profit_loss.december, item.profit_loss.total_current_year == '0' ? "0.0" : item.profit_loss.total_current_year == '' ? "0.0" : item.profit_loss.total_current_year, item.profit_loss.total_next_year == '0' ? "0.0" : item.profit_loss.total_next_year == '' ? "0.0" : item.profit_loss.total_next_year, item.profit_loss.total_more_year == '0' ? "0.0" : item.profit_loss.total_more_year == '' ? "0.0" : item.profit_loss.total_more_year, item.order ]) } // if (item.id === 20092) { // console.log(item); // console.log(dataTable); // } if (item.children !== null) { if (item.children.length > 0) { item.children.map((items, indexs) => { handlePushChild(items) }) } } } res.map((item, index) => { dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, item.description, item.profit_loss.notes === "" ? null : item.profit_loss.notes, item.profit_loss.total_actual_before === null ? "0.0" : item.profit_loss.total_actual_before === "" ? "0.0" : item.profit_loss.total_actual_before, item.profit_loss.january == '0' ? "0.0" : item.profit_loss.january == '' ? "0.0" : item.profit_loss.january, item.profit_loss.february == '0' ? "0.0" : item.profit_loss.february == '' ? "0.0" : item.profit_loss.february, item.profit_loss.march == '0' ? "0.0" : item.profit_loss.march == '' ? "0.0" : item.profit_loss.march, item.profit_loss.april == '0' ? "0.0" : item.profit_loss.april == '' ? "0.0" : item.profit_loss.april, item.profit_loss.may == '0' ? "0.0" : item.profit_loss.may == '' ? "0.0" : item.profit_loss.may, item.profit_loss.june == '0' ? "0.0" : item.profit_loss.june == '' ? "0.0" : item.profit_loss.june, item.profit_loss.july == '0' ? "0.0" : item.profit_loss.july == '' ? "0.0" : item.profit_loss.july, item.profit_loss.august == '0' ? "0.0" : item.profit_loss.august == '' ? "0.0" : item.profit_loss.august, item.profit_loss.september == '0' ? "0.0" : item.profit_loss.september == '' ? "0.0" : item.profit_loss.september, item.profit_loss.october == '0' ? "0.0" : item.profit_loss.october == '' ? "0.0" : item.profit_loss.october, item.profit_loss.november == '0' ? "0.0" : item.profit_loss.november == '' ? "0.0" : item.profit_loss.november, item.profit_loss.december == '0' ? "0.0" : item.profit_loss.december == '' ? "0.0" : item.profit_loss.december, item.profit_loss.total_current_year == '0' ? "0.0" : item.profit_loss.total_current_year == '' ? "0.0" : item.profit_loss.total_current_year, item.profit_loss.total_next_year == '0' ? "0.0" : item.profit_loss.total_next_year == '' ? "0.0" : item.profit_loss.total_next_year, item.profit_loss.total_more_year == '0' ? "0.0" : item.profit_loss.total_more_year == '' ? "0.0" : item.profit_loss.total_more_year, item.order ]) if (item.children !== null) { if (item.children.length > 0) { item.children.map((items, indexs) => { handlePushChild(items) }) } } }) console.log(dataTable) this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => { }) } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { setTimeout(() => { localStorage.removeItem(Constant.TOKEN) window.location.reload(); }, 1000); } }) } } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) } } else { this.setState({ alert: true, messageAlert: 'Connection Timeout, please check your Connection', tipeAlert: 'error', loading: false }) } }) } handleValue(data) { let total = 0 this.state.dataTable.map((item, index) => { if (data.rowData[1] == item[2]) { total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) } }) let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total // console.log(indexParent); return a } handleChange(value, tableMeta) { console.log(value); let val = String(value).split(",").join("") let data = this.state.dataTable let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) if (indexParent > 0) { // console.log(indexParent) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let jagain = data[indexParent][tableMeta.columnIndex] a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) } else { data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) } } backToMasterBudget(type) { // tambahin currency let data = [] this.state.dataTable.map(i => { data.push({ item_report_id: i[1], notes: i[6] == null || i[6] == "" ? "" : String(i[6]), total_actual_before: this.props.defaultCurrency.id == 2 ? String(Number(i[7])) : String(fixNumber(Number(i[7]), 1)), january: this.props.defaultCurrency.id == 2 ? String(Number(i[8])) : String(fixNumber(Number(i[8]), 1)), february: this.props.defaultCurrency.id == 2 ? String(Number(i[9])) : String(fixNumber(Number(i[9]), 1)), march: this.props.defaultCurrency.id == 2 ? String(Number(i[10])) : String(fixNumber(Number(i[10]), 1)), april: this.props.defaultCurrency.id == 2 ? String(Number(i[11])) : String(fixNumber(Number(i[11]), 1)), may: this.props.defaultCurrency.id == 2 ? String(Number(i[12])) : String(fixNumber(Number(i[12]), 1)), june: this.props.defaultCurrency.id == 2 ? String(Number(i[13])) : String(fixNumber(Number(i[13]), 1)), july: this.props.defaultCurrency.id == 2 ? String(Number(i[14])) : String(fixNumber(Number(i[14]), 1)), august: this.props.defaultCurrency.id == 2 ? String(Number(i[15])) : String(fixNumber(Number(i[15]), 1)), september: this.props.defaultCurrency.id == 2 ? String(Number(i[16])) : String(fixNumber(Number(i[16]), 1)), october: this.props.defaultCurrency.id == 2 ? String(Number(i[17])) : String(fixNumber(Number(i[17]), 1)), november: this.props.defaultCurrency.id == 2 ? String(Number(i[18])) : String(fixNumber(Number(i[18]), 1)), december: this.props.defaultCurrency.id == 2 ? String(Number(i[19])) : String(fixNumber(Number(i[19]), 1)), total_current_year: this.props.defaultCurrency.id == 2 ? String(Number(i[20])) : String(fixNumber(Number(i[20]), 1)), total_next_year: this.props.defaultCurrency.id == 2 ? String(Number(i[21])) : String(fixNumber(Number(i[21]), 1)), total_more_year: this.props.defaultCurrency.id == 2 ? String(Number(i[22])) : String(fixNumber(Number(i[22]), 1)) }) }) // if (this.props.defaultCurrency.id == 2) { // } else { // this.state.dataTable.map(i => { // data.push({ // item_report_id: i[1], // notes: i[6] == null || i[6] == "" ? "" : String(i[6]), // total_actual_before: String(fixNumber(Number(i[7]), 1)), // january: String(fixNumber(Number(i[8]), 1)), // february: String(fixNumber(Number(i[9]), 1)), // march: String(fixNumber(Number(i[10]), 1)), // april: String(fixNumber(Number(i[11]), 1)), // may: String(fixNumber(Number(i[12]), 1)), // june: String(fixNumber(Number(i[13]), 1)), // july: String(fixNumber(Number(i[14]), 1)), // august: String(fixNumber(Number(i[15]), 1)), // september: String(fixNumber(Number(i[16]), 1)), // october: String(fixNumber(Number(i[17]), 1)), // november: String(fixNumber(Number(i[18]), 1)), // december: String(fixNumber(Number(i[19]), 1)), // total_current_year: String(fixNumber(Number(i[20]), 1)), // total_next_year: String(fixNumber(Number(i[21]), 1)), // total_more_year: String(fixNumber(Number(i[22]), 1)) // }) // }) // } let payload = { "submission_id": this.props.submissionID, "company_id": this.props.company.company_id, "periode": this.props.periode, "report_id": this.props.report_id, "currency_id": this.props.defaultCurrency.id, "status": type, "profit_loss": data } console.log(payload); this.setState({ loading: false }) if (type == 'submitted') { this.props.saveToMasterBudget(payload, 'PL') } else { this.props.saveToMasterBudget(payload, 'DraftPL') } this.props.onClickClose() } downloadTemplate = async () => { let res = await fetch( `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&¤cy_id=${this.props.defaultCurrency.id}` ) res = await res.blob() // console.log(res) if (res.size > 0) { let url = window.URL.createObjectURL(res); let a = document.createElement('a'); a.href = url; a.download = 'Template Master Budget Profit & Loss.xlsx'; a.click(); } } fileHandler = (event) => { let fileObj = event ExcelRenderer(fileObj, (err, resp) => { console.log(resp) if (err) { // console.log(err); } else { let isi = resp.rows.slice(3) // console.log(resp.rows[2]); console.log(isi); let payload = [] let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; 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(), total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(), january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(), february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(), march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(), april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(), may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(), june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(), july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(), august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(), september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(), october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(), november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(), december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(), total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(), total_next_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(), total_more_year: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim() }) } }) let body = { company_id: this.props.company.company_id, periode: this.props.periode, report_id: this.props.report_id, profit_loss: payload, status: 'submitted' } console.log(body) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] }) } }); } checkUpload() { let payload = { ...this.state.payload, currency_id: this.state.defaultCurrencyUpload?.id } api.create().checkUploadMB(payload).then(response => { console.log(response); // console.log(JSON.stringify(this.state.payload)); console.log(this.state.defaultCurrencyUpload.id) if (response.data) { if (response.data.status === 'success') { this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true }) let dataTable = response.data.data.map((item, index) => { if (this.state.defaultCurrencyUpload.id == 2) { return [ item.type_report_id, item.item_report_id, item.parent, item.formula, item.level, item.item_report, item.notes, item.total_actual_before == 0 ? "0.0" : item.total_actual_before, item.january == 0 ? "0.0" : item.january, item.february == 0 ? "0.0" : item.february, item.march == 0 ? "0.0" : item.march, item.april == 0 ? "0.0" : item.april, item.may == 0 ? "0.0" : item.may, item.june == 0 ? "0.0" : item.june, item.july == 0 ? "0.0" : item.july, item.august == 0 ? "0.0" : item.august, item.september == 0 ? "0.0" : item.september, item.october == 0 ? "0.0" : item.october, item.november == 0 ? "0.0" : item.november, item.december == 0 ? "0.0" : item.december, item.total_current_year == 0 ? "0.0" : item.total_current_year, item.total_next_year == 0 ? "0.0" : item.total_next_year, item.total_more_year == 0 ? "0.0" : item.total_more_year, item.orders, item.error ] } else { return [ item.type_report_id, item.item_report_id, item.parent, item.formula, item.level, item.item_report, item.notes, fixNumber(Number(item.total_actual_before), 1), fixNumber(Number(item.january), 1), fixNumber(Number(item.february), 1), fixNumber(Number(item.march), 1), fixNumber(Number(item.april), 1), fixNumber(Number(item.may), 1), fixNumber(Number(item.june), 1), fixNumber(Number(item.july), 1), fixNumber(Number(item.august), 1), fixNumber(Number(item.september), 1), fixNumber(Number(item.october), 1), fixNumber(Number(item.november), 1), fixNumber(Number(item.december), 1), fixNumber(Number(item.total_current_year), 1), fixNumber(Number(item.total_next_year), 1), fixNumber(Number(item.total_more_year), 1), item.orders, item.error ] } }) console.log(dataTable); this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, fromUpload: true, previewUpload: 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) }) } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { setTimeout(() => { localStorage.removeItem(Constant.TOKEN) window.location.reload(); }, 1000); } }) } } }) } uploadProfitLoss(type) { let data = [] this.state.dataTable.map(i => { data.push({ item_report_id: i[1], notes: String(i[6]), total_actual_before: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[7])) : String(fixNumber(Number(i[7]), 1)), january: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[8])) : String(fixNumber(Number(i[8]), 1)), february: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[9])) : String(fixNumber(Number(i[9]), 1)), march: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[10])) : String(fixNumber(Number(i[10]), 1)), april: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[11])) : String(fixNumber(Number(i[11]), 1)), may: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[12])) : String(fixNumber(Number(i[12]), 1)), june: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[13])) : String(fixNumber(Number(i[13]), 1)), july: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[14])) : String(fixNumber(Number(i[14]), 1)), august: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[15])) : String(fixNumber(Number(i[15]), 1)), september: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[16])) : String(fixNumber(Number(i[16]), 1)), october: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[17])) : String(fixNumber(Number(i[17]), 1)), november: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[18])) : String(fixNumber(Number(i[18]), 1)), december: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[19])) : String(fixNumber(Number(i[19]), 1)), total_current_year: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[20])) : String(fixNumber(Number(i[20]), 1)), total_next_year: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[21])) : String(fixNumber(Number(i[21]), 1)), total_more_year: this.state.defaultCurrencyUpload.id == 2 ? String(Number(i[22])) : String(fixNumber(Number(i[22]), 1)), }) }) // if (this.state.defaultCurrencyUpload.id == 2) { // } else { // this.state.dataTable.map(i => { // data.push({ // item_report_id: i[1], // notes: String(i[6]), // total_actual_before: String(fixNumber(Number(i[7]), 1)), // january: String(fixNumber(Number(i[8]), 1)), // february: String(fixNumber(Number(i[9]), 1)), // march: String(fixNumber(Number(i[10]), 1)), // april: String(fixNumber(Number(i[11]), 1)), // may: String(fixNumber(Number(i[12]), 1)), // june: String(fixNumber(Number(i[13]), 1)), // july: String(fixNumber(Number(i[14]), 1)), // august: String(fixNumber(Number(i[15]), 1)), // september: String(fixNumber(Number(i[16]), 1)), // october: String(fixNumber(Number(i[17]), 1)), // november: String(fixNumber(Number(i[18]), 1)), // december: String(fixNumber(Number(i[19]), 1)), // total_current_year: String(fixNumber(Number(i[20]), 1)), // total_next_year: String(fixNumber(Number(i[21]), 1)), // total_more_year: String(fixNumber(Number(i[22]), 1)), // }) // }) // } let body = { submission_id: this.props.submissionID, company_id: this.props.company.company_id, periode: this.props.periode, report_id: this.props.report_id, currency_id: this.state.defaultCurrencyUpload?.id, profit_loss: data, status: type } console.log(body); // console.log(this.state.dataTable); // console.log(JSON.stringify(body)); api.create('UPLOAD').uploadMasterBudget(body).then(response => { console.log(response); if (response.data) { if (response.ok) { if (response.data.status === "success") { this.props.onClickClose() if (type == 'submitted') { this.props.getReport('PL') } else { this.props.getReport() } } else { if (response.data.message == "Please Set Up Rate Currency First") { this.setState({ visibleAlertSave: true }) } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { setTimeout(() => { localStorage.removeItem(Constant.TOKEN) window.location.reload(); }, 1000); } }) } // alert(response.data.status) } } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) } } else { this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false }) } }) } async downloadAllData() { let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` // console.log(url); let res = await fetch( this.props.submissionID == null ? sub_null : url ) res = await res.blob() this.setState({ loading: false }) if (res.size > 0) { let url = window.URL.createObjectURL(res); let a = document.createElement('a'); a.href = url; a.download = 'Master Budget Profit & Loss.xlsx'; a.click(); } } handleValidate() { console.log(this.state.dataTable); let data = [] // console.log(JSON.stringify(this.state.dataTable)) this.state.dataTable.map(i => { data.push({ item_report_id: i[1], notes: i[6] == null || i[6] == "" ? "" : String(i[6]), total_actual_before: String(i[7]), january: i[0] === 3 && i[8] === "" ? "0.0" : String(i[8]), february: i[0] === 3 && i[9] === "" ? "0.0" : String(i[9]), march: i[0] === 3 && i[10] === "" ? "0.0" : String(i[10]), april: i[0] === 3 && i[11] === "" ? "0.0" : String(i[11]), may: i[0] === 3 && i[12] === "" ? "0.0" : String(i[12]), june: i[0] === 3 && i[13] === "" ? "0.0" : String(i[13]), july: i[0] === 3 && i[14] === "" ? "0.0" : String(i[14]), august: i[0] === 3 && i[15] === "" ? "0.0" : String(i[15]), september: i[0] === 3 && i[16] === "" ? "0.0" : String(i[16]), october: i[0] === 3 && i[17] === "" ? "0.0" : String(i[17]), november: i[0] === 3 && i[18] === "" ? "0.0" : String(i[18]), december: i[0] === 3 && i[19] === "" ? "0.0" : String(i[19]), total_current_year: i[0] === 3 && i[20] === "" ? "0.0" : String(i[20]), total_next_year: i[0] === 3 && i[21] === "" ? "0.0" : String(i[21]), total_more_year: i[0] === 3 && i[22] === "" ? "0.0" : String(i[22]) }) }) let payload = { "submission_id": this.props.submissionID, "company_id": this.props.company.company_id, "periode": this.props.periode, "report_id": this.props.report_id, "currency_id": this.props.defaultCurrency.id, "profit_loss": data, "status": "submitted" } console.log(payload) api.create().validateSubmitReport(payload).then((response) => { console.log(response) if (response.data.data.result) { this.setState({ loading: false, buttonError: false, editable: false }) } else { this.setState({ loading: false, buttonError: true, editable: true }) } }) } closeAlert() { this.setState({ alert: false }) } render() { let dataTable2 = this.state.dataTable const handleChange = (value, tableMeta, type) => { let val = String(value).split(",").join("") dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) } const handleTotal = (tableMeta) => { let total = 0 dataTable2[tableMeta.rowIndex].map((item, index) => { if (index >= 8 && index <= 19) { let valItem = item == undefined || item == "" ? 0 : item total += Number(valItem) } }) // if (tableMeta.rowData[1] === 20092) { // console.log(total); // console.log(dataTable2[tableMeta.rowIndex]); // } let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2]) if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") { let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20]) dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value)) return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value)) } else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") { let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19] return totalTMP } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") { return handleFormula(0, tableMeta, 0) } else { dataTable2[tableMeta.rowIndex][20] = total return total } // console.log(total); } const handleNotes = (value, tableMeta) => { // console.log(value) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value // console.log(dataTable2[tableMeta.rowIndex]); } const handleValue = (value, data) => { let total = 0 dataTable2.map((item, index) => { if (data.rowData[1] == item[2]) { total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(String(item[data.columnIndex]).includes('-') ? Number(String(item[data.columnIndex]).substr(1, String(item[data.columnIndex]).length)) * -1 : Number(item[data.columnIndex]))) } }) let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2]) let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total) // let a = dataTable2[data.rowIndex][data.columnIndex] = Number(value) // console.log(indexParent); return a } const handleFormula = (data, tableMeta, month) => { let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayJumlah = [] let tambahan = false let opet = "" arrayFormula.map((item, indexs) => { if (item == 'X') { tambahan = true } else if (item == '-' || item == '+' || item == '/' || item == '*') { arrayJumlah.push(item) } else { let index = dataTable2.findIndex((val) => val[23] == item) if (tambahan) { if (item == '-' || item == '+' || item == '/' || item == '*') { opet = item } else { arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item)))) tambahan = false opet = "" } } else { if (index != -1) { if (item === String(tableMeta.rowData[23])) { arrayJumlah.push(0) } else { arrayJumlah.push(dataTable2[index][tableMeta.columnIndex]) } } } } // if (indexs % 2 !== 0) { // operator.push(item) // } }) // if (String(tableMeta.rowData[5]) == "Net Income for the year (NPAT)") { // console.log(tableMeta.rowData[3]) // console.log(arrayFormula) // console.log(arrayJumlah) // } let array = arrayJumlah let total = 0 let opt = "" array.map((item, index) => { if (item == "+") { opt = "tambah" } else if (item == "-") { opt = "kurang" } else if (item == "*") { opt = "kali" } else if (item == "/") { opt = "bagi" } else { if (opt == "tambah") { total = Number(total) + Number(item) } else if (opt == "kurang") { total = Number(total) - Number(item) } else if (opt == "kali") { total = Number(total) * Number(item) console.log(); } else if (opt == "bagi") { total = R.equals((Number(total) / Number(item)), NaN) ? '0.0' : (R.equals((Number(total) / Number(item)), Infinity) ? '0.0' : (Number(total) / Number(item) == "-Infinity") ? "0.0" : Number(total) / Number(item)) } else { total += Number(item) } } }) total = R.equals(total, NaN) ? "0.0" : (R.equals(total, Infinity) ? "0.0" : (total == "-Infinity" ? "0.0" : total)) // if (String(tableMeta.rowData[5]) == "Net Income for the year (NPAT)") { // console.log(total); // } // if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) { // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) // // } // return Number(total) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) // } // return Number(total) return Number(total) } const columns = [{ name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "Account", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style }), customBodyRender: (val, tableMeta) => { return (
{tableMeta.rowData[24] ? tableMeta.rowData[24].length > 0 ?
{tableMeta.rowData[0] === 4 ? "" : val}
: tableMeta.rowData[4] == 0 ? {String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()} :
{tableMeta.rowData[0] === 4 ? "" : val}
: tableMeta.rowData[4] == 0 ? {String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()} :
{tableMeta.rowData[0] === 4 ? "" : val}
}
) } } }, { name: "Notes", options: { customHeadRender: (columnMeta) => ( dataTable2.length > 0 ? {columnMeta.name} : {columnMeta.name} ), setCellProps: () => ({ style: { position: "sticky", background: "white", zIndex: 101, left: 350 } }), customBodyRender: (value, tableMeta, updateValue) => { return (
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null : { // updateValue(event.target.value) handleNotes(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />}
) } } }, { name: `31 Dec ${Number(this.props.periode) - 1} Actual`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 1 ? null :
} />
}
) } } }, { name: `Jan ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{/*
{value}
*/} { console.log(event); handleChange(event.target.value, tableMeta) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? null : null }
) } } }, { name: `Feb ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Mar ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Apr ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `May ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Jun ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Jul ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Aug ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Sep ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Oct ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Nov ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `Dec ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: "Current Total", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 2 ? : // tableMeta.rowData[0] === 6 ? // : }
) } } }, { name: `31 Dec ${Number(this.props.periode) + 1} Total`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: `31 Dec ${Number(this.props.periode) + 2} Total`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{ this.props.status === 'CLOSED' ? tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null : tableMeta.rowData[0] === 3 ?
} />
:
} />
: tableMeta.rowData[0] === 3 ?
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) // console.log(dataTable2) }} /> } />
: tableMeta.rowData[0] === 2 ? : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? // null : tableMeta.rowData[0] === 5 ? // null : tableMeta.rowData[0] === 1 ? // value === "" ? // null : // null : null }
) } } }, { name: "", options: { display: false } }, { name: "", options: { display: false } } ] const loadingComponent = (
); return (
Master Budget Submission
this.closeAlert()}> this.closeAlert()} severity={this.state.tipeAlert}> {this.state.messageAlert} {/* {this.state.loading && loadingComponent} */}
{this.state.visibleProfitLoss === true ?
Master Budget - Profit & Loss
{this.props.company.company_name} Period : {this.props.periode} (rev.{this.props.revision}) {this.props.defaultCurrency.id === 1 ? in IDR mn : in USD thousand }
{this.state.dataTable.length == 0 ? null : this.props.isApprover == true ? null // :
{((!this.props.truelyApprover) && (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && } {((!this.props.truelyApprover) && (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && } {/* */}
}
{this.state.loading && loadingComponent} {!this.state.loading && ( )}
(*) There may be discrepancies in amount due to rounding
Last Updated by :
{ this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => { return ( {item.latest_update} ) }) : - }
{this.state.dataTable.length == 0 ? null : this.props.isApprover === true ? null : (!this.props.truelyApprover) && (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
: null }
:
{this.props.company.company_name} Period : {this.props.periode} {this.props.defaultCurrency.id === 1 ? in IDR mn : in USD thousand }
{this.state.dataLoaded && (
{this.state.loading && loadingComponent} {!this.state.loading && ( )}
)}
}
{/* {this.state.visibleUpload && (
Upload File
{ this.fileHandler(dt) this.setState({ uploadStatus: 'idle', percentage: '0' }) }} onUpload={() => { String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("PROFIT") && String(this.state.judul).includes("LOSS") ? this.checkUpload() : this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) }} />
Notes: Valid currency for uploading data is {this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}
)} */} {this.state.visibleUpload && (
Upload File
{ this.fileHandler(dt) this.setState({ uploadStatus: 'idle', percentage: '0' }) }} onUpload={() => { String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("PROFIT") && String(this.state.judul).includes("LOSS") ? this.checkUpload() : this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) }} />
Warning: Valid currency for uploading data in {this.props.defaultCurrency.id == 1 ? "IDR mn" : "thousand USD"}
)} {this.state.visibleAlertSave && (
Rate Currency USD pada periode yang dipilih belum diatur.
Silahkan menghubungi Superadmin
)}
); } }