TaxPlanningOLPA.js 244 KB
Newer Older
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1
import React, { Component } from 'react';
syadziy's avatar
syadziy committed
2
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, Tooltip, withStyles, Snackbar } from '@material-ui/core';
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3 4 5 6 7 8 9 10 11 12
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 } from '@material-ui/lab';
import * as R from 'ramda';
r.kurnia's avatar
r.kurnia committed
13
import Constant from '../../library/Constant';
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

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,
    top: 0
};

export default class TaxPlanningOLPA extends Component {
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            visibleTP: true,
            disabledSave: true,
            editable: false,
            buttonError: false,
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
51
            updateBy: [],
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
52
            buttonDraft: true,
53
            handleDoubleClick: 0,
rifkaki's avatar
rifkaki committed
54 55
            get_for: "view",
            viewOnly : true
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
56 57 58 59 60 61 62

        }
        this.handleValue = this.handleValue.bind(this)
        this.fileHandler = this.fileHandler.bind(this);
    }

    componentDidMount() {
63 64
        // this.getItemHierarki()
        this.getSettingControl()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
65
        this.lastUpdate()
rifkaki's avatar
rifkaki committed
66
        this.handleViewOnly()
r.kurnia's avatar
r.kurnia committed
67
        console.log(this.props)
rifkaki's avatar
rifkaki committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    }

    handleViewOnly() {
        let checkApprover = false
        let checkLastStatus = false
        let checkStatus = false
        let checkPrevRev = false

        if (this.props.isApprover) {
            checkApprover = true
        } else {
            checkApprover = false
        }
        
        if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
            checkLastStatus = true
        } else {
            checkLastStatus = false
        } 
        
        if (this.props.prevRevision) {
            checkPrevRev = true
        } else {
            checkPrevRev = false
        }

        if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
            checkStatus = true
        } else {
            checkStatus = false
        }

r.kurnia's avatar
r.kurnia committed
100
        this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev})
rifkaki's avatar
rifkaki committed
101 102 103 104 105
    }

    handleGetFor(type) {
        console.log(type)
        this.setState({get_for: type}, () => {
106
            this.getSettingControl()
rifkaki's avatar
rifkaki committed
107 108
            this.lastUpdate()
        })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
109 110
    }

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
    getSettingControl() {
        let body = {
            group: 'THRESHOLD_CONTROL',
            company_id: this.props.company.company_id,
            type: 'TAX_PLANNING'
        }

        api.create().getAllSettingByType(body).then(response => {
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
                    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()
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
130
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
131 132 133 134 135 136 137 138 139 140 141 142 143
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
    }

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
144 145 146 147
    lastUpdate(){
        let payload = {
            "outlook_pa_id": this.props.outlook_pa_id,
            "report_id": this.props.report_id,
d.arizona's avatar
d.arizona committed
148
            "get_for": this.state.get_for,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
149 150 151 152 153 154 155 156
            "revision": this.props.revision,
            "periode": this.props.periode,
            "company_id": this.props.company.company_id
        }
        api.create().getLastestUpdateOLPA(payload).then(response => {
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
157
                        updateBy: response.data.data.detail === null ? '-' : response.data.data.detail
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
158 159 160 161 162 163 164 165 166 167 168 169
                    })
                }
            }
        })
    }

    getItemHierarki() {
        this.setState({ loading: true, judulColumn: null })
        let payload = {
            "outlook_pa_id": this.props.outlook_pa_id,
            "report_id": this.props.report_id,
            "revision": this.props.revision,
rifkaki's avatar
rifkaki committed
170 171 172
            "periode": this.props.periode,
            "company_id": this.props.company.company_id,
            "get_for": this.state.get_for
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
173 174
        }
        api.create().getDetailReportOLPA(payload).then(response => {
rifkaki's avatar
rifkaki committed
175 176
            console.log(payload);
            console.log(response);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
177 178
            let dataTable = []
            if (response.data) {
r.kurnia's avatar
r.kurnia committed
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
                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.type_report_tax.value_tbc.type_report_id,
                                item.type_report_tax.value_fc.type_report_id,
                                item.type_report_tax.value_tbf.type_report_id,
                                item.id,
                                item.parent,
                                { tbc: item.formula_tax.value_tbc, fcp: item.formula_tax.value_fc, tbf: item.formula_tax.value_tbf },
                                item.level,
                                item.description,
                                {tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, 
                                    tbf: item.tax_planning.january.tbf === null ? "0" : item.tax_planning.january.tbf === "" ? "0" : item.tax_planning.january.tbf},
                                {tbc : item.tax_planning.february.tbc, fcp: item.tax_planning.february.fcp, tbf: item.tax_planning.february.tbf},
                                {tbc : item.tax_planning.march.tbc, fcp: item.tax_planning.march.fcp, tbf: item.tax_planning.march.tbf},
                                {tbc : item.tax_planning.april.tbc, fcp: item.tax_planning.april.fcp, tbf: item.tax_planning.april.tbf},
                                {tbc : item.tax_planning.may.tbc, fcp: item.tax_planning.may.fcp, tbf: item.tax_planning.may.tbf},
                                {tbc : item.tax_planning.june.tbc, fcp: item.tax_planning.june.fcp, tbf: item.tax_planning.june.tbf},
                                {tbc : item.tax_planning.july.tbc, fcp: item.tax_planning.july.fcp, tbf: item.tax_planning.july.tbf},
                                {tbc : item.tax_planning.august.tbc === null ? "0" : item.tax_planning.august.tbc === "" ? "0" : item.tax_planning.august.tbc, 
                                    fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf},
                                {tbc : item.tax_planning.september.tbc, fcp: item.tax_planning.september.fcp, tbf: item.tax_planning.september.tbf},
                                {tbc : item.tax_planning.october.tbc, fcp: item.tax_planning.october.fcp, tbf: item.tax_planning.october.tbf},
r.kurnia's avatar
r.kurnia committed
206 207
                                { tbc: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbc).toFixed(1) : item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.november.tbc, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.fcp).toFixed(1) : item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.november.fcp, formula: item.tax_planning.november_formula } : item.tax_planning.november.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbf).toFixed(1) : item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.november.tbf, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbf },
                                { tbc: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbc).toFixed(1) : item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.december.tbc, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.fcp).toFixed(1) : item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.december.fcp, formula: item.tax_planning.december_formula } : item.tax_planning.december.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbf).toFixed(1) : item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.december.tbf, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbf },
r.kurnia's avatar
r.kurnia committed
208
                                item.tax_planning.total_current_year,
rifkaki's avatar
rifkaki committed
209 210
                                0,
                                0,
r.kurnia's avatar
r.kurnia committed
211
                                item.order,
r.kurnia's avatar
r.kurnia committed
212 213
                                { tbc: item.condition_it_should_be, fcp: item.condition_it_should_be, tbf: item.condition_it_should_be },
                                { tbc: item.condition_if_wrong, fcp: item.condition_if_wrong, tbf: item.condition_if_wrong },
r.kurnia's avatar
r.kurnia committed
214 215 216 217 218 219 220 221 222 223 224 225
                            ])
                        }
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
                        }  
                    }
                    res.map((item, index) => {
                        dataTable.push([  
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
226 227 228 229 230 231
                            item.type_report_id,
                            item.type_report_tax.value_tbc.type_report_id,
                            item.type_report_tax.value_fc.type_report_id,
                            item.type_report_tax.value_tbf.type_report_id,
                            item.id,
                            item.parent,
r.kurnia's avatar
r.kurnia committed
232
                            { tbc: item.formula_tax.value_tbc, fcp: item.formula_tax.value_fc, tbf: item.formula_tax.value_tbf },
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
233 234
                            item.level,
                            item.description,
r.kurnia's avatar
r.kurnia committed
235 236
                            {tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, 
                                tbf: item.tax_planning.january.tbf === null ? "0" : item.tax_planning.january.tbf === "" ? "0" : item.tax_planning.january.tbf},
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
237 238 239 240 241 242 243 244 245 246
                            {tbc : item.tax_planning.february.tbc, fcp: item.tax_planning.february.fcp, tbf: item.tax_planning.february.tbf},
                            {tbc : item.tax_planning.march.tbc, fcp: item.tax_planning.march.fcp, tbf: item.tax_planning.march.tbf},
                            {tbc : item.tax_planning.april.tbc, fcp: item.tax_planning.april.fcp, tbf: item.tax_planning.april.tbf},
                            {tbc : item.tax_planning.may.tbc, fcp: item.tax_planning.may.fcp, tbf: item.tax_planning.may.tbf},
                            {tbc : item.tax_planning.june.tbc, fcp: item.tax_planning.june.fcp, tbf: item.tax_planning.june.tbf},
                            {tbc : item.tax_planning.july.tbc, fcp: item.tax_planning.july.fcp, tbf: item.tax_planning.july.tbf},
                            {tbc : item.tax_planning.august.tbc === null ? "0" : item.tax_planning.august.tbc === "" ? "0" : item.tax_planning.august.tbc, 
                                fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf},
                            {tbc : item.tax_planning.september.tbc, fcp: item.tax_planning.september.fcp, tbf: item.tax_planning.september.tbf},
                            {tbc : item.tax_planning.october.tbc, fcp: item.tax_planning.october.fcp, tbf: item.tax_planning.october.tbf},
r.kurnia's avatar
r.kurnia committed
247 248
                            { tbc: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbc).toFixed(1) : item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.november.tbc, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.fcp).toFixed(1) : item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.november.fcp, formula: item.tax_planning.november_formula } : item.tax_planning.november.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbf).toFixed(1) : item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.november.tbf, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbf },
                            { tbc: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbc).toFixed(1) : item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.december.tbc, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.fcp).toFixed(1) : item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.december.fcp, formula: item.tax_planning.december_formula } : item.tax_planning.december.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbf).toFixed(1) : item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.december.tbf, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbf },
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
249
                            item.tax_planning.total_current_year,
rifkaki's avatar
rifkaki committed
250 251
                            0,
                            0,
r.kurnia's avatar
r.kurnia committed
252
                            item.order,
r.kurnia's avatar
r.kurnia committed
253 254
                            { tbc: item.condition_it_should_be, fcp: item.condition_it_should_be, tbf: item.condition_it_should_be },
                            { tbc: item.condition_if_wrong, fcp: item.condition_if_wrong, tbf: item.condition_if_wrong },
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
255
                        ])
r.kurnia's avatar
r.kurnia committed
256 257 258 259 260 261
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
262
                        }
r.kurnia's avatar
r.kurnia committed
263
                    })
r.kurnia's avatar
r.kurnia committed
264
                    this.setState({ dataTable, loading: false, buttonError: false, editable: true })
r.kurnia's avatar
r.kurnia committed
265 266
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
267
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
r.kurnia's avatar
r.kurnia committed
268 269 270 271
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
272
                        }
r.kurnia's avatar
r.kurnia committed
273 274
                    })
                }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
275 276 277
            } else {
                this.setState({ dataTable, loading: false, buttonError: true, editable: true })   
            }
rifkaki's avatar
rifkaki committed
278
            console.log(dataTable)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
        })
    }

    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[4] == item[5]) {
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
            }
        })
        let indexParent = this.state.dataTable.findIndex((val) => val[4] === this.state.dataTable[data.rowIndex][5])
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
        // console.log(indexParent);
        return a
    }

    handleChange(value, tableMeta) {
        let val = String(value).split(",").join("")
        let data = this.state.dataTable
        let indexParent = data.findIndex((val) => val[4] === data[tableMeta.rowIndex][5])
        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)
        }
        // this.forceUpdate()
        // console.log(this.state.dataTable)
        // this.setState({
        //     data: a,
        // }, () => console.log(this.state.dataTable))
    }

    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[4],
                january: {
rifkaki's avatar
rifkaki committed
320 321
                    // tbc: String(Number(i[9].tbc).toFixed(1)),
                    // fcp: String(Number(i[9].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
322
                    tbf: String(Number(i[9].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
323 324
                },
                february: {
rifkaki's avatar
rifkaki committed
325 326
                    // tbc: String(Number(i[10].tbc).toFixed(1)),
                    // fcp: String(Number(i[10].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
327
                    tbf: String(Number(i[10].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
328 329
                },
                march: {
rifkaki's avatar
rifkaki committed
330 331
                    // tbc: String(Number(i[11].tbc).toFixed(1)),
                    // fcp: String(Number(i[11].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
332
                    tbf: String(Number(i[11].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
333 334
                },
                april: {
rifkaki's avatar
rifkaki committed
335 336
                    // tbc: String(Number(i[12].tbc).toFixed(1)),
                    // fcp: String(Number(i[12].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
337
                    tbf: String(Number(i[12].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
338 339
                },
                may: {
rifkaki's avatar
rifkaki committed
340 341
                    // tbc: String(Number(i[13].tbc).toFixed(1)),
                    // fcp: String(Number(i[13].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
342
                    tbf: String(Number(i[13].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
343 344
                },
                june: {
rifkaki's avatar
rifkaki committed
345 346
                    // tbc: String(Number(i[14].tbc).toFixed(1)),
                    // fcp: String(Number(i[14].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
347
                    tbf: String(Number(i[14].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
348 349
                },
                july: {
rifkaki's avatar
rifkaki committed
350 351
                    // tbc: String(Number(i[15].tbc).toFixed(1)),
                    // fcp: String(Number(i[15].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
352
                    tbf: String(Number(i[15].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
353 354
                },
                august: {
rifkaki's avatar
rifkaki committed
355 356
                    // tbc: String(Number(i[16].tbc).toFixed(1)),
                    // fcp: String(Number(i[16].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
357
                    tbf: String(Number(i[16].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
358 359
                },
                september: {
rifkaki's avatar
rifkaki committed
360 361
                    // tbc: String(Number(i[17].tbc).toFixed(1)),
                    // fcp: String(Number(i[17].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
362
                    tbf: String(Number(i[17].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
363 364
                },
                october: {
rifkaki's avatar
rifkaki committed
365 366
                    // tbc: String(Number(i[18].tbc).toFixed(1)),
                    // fcp: String(Number(i[18].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
367
                    tbf: String(Number(i[18].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
368 369
                },
                november: {
r.kurnia's avatar
r.kurnia committed
370 371 372
                    tbc: i[1] === 3 && i[19].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[19].tbc.value) : String(i[19].tbc),
                    fcp: i[2] === 3 && i[19].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[19].fcp.value) : String(i[19].fcp),
                    tbf: i[3] === 3 && i[19].tbf === "" ? "0" : String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[19].tbf) : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
373 374
                },
                december: {
r.kurnia's avatar
r.kurnia committed
375 376 377
                    tbc: i[1] === 3 && i[20].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[20].tbc.value) : String(i[20].tbc),
                    fcp: i[2] === 3 && i[20].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[20].fcp.value) : String(i[20].fcp),
                    tbf: i[3] === 3 && i[20].tbf === "" ? "0" : String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[20].tbf) : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
378
                },
Deni Rinaldi's avatar
Deni Rinaldi committed
379
                total_current_year: String(Number(i[21]).toFixed(1)),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
380 381 382 383 384 385 386 387 388 389
            })
        })
        let payload = {
            "outlook_pa_id": this.props.outlook_pa_id,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "tax_planning": data
        }
rifkaki's avatar
rifkaki committed
390
        console.log(payload);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
391 392 393 394 395 396 397 398 399
        // console.log(JSON.stringify(payload));
        // this.setState({ loading: false })
        this.props.saveToOLPA(payload)
        this.props.onClickClose()
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
rifkaki's avatar
rifkaki committed
400
            console.log(resp)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
401
            if (err) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
402
                // console.log(err);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
403 404 405
            }
            else {
                let isi = resp.rows.slice(4)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
406 407
                // console.log(resp.rows[2]);
                // console.log(resp.rows);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
408 409 410 411 412 413 414 415
                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(),
                            january: {
rifkaki's avatar
rifkaki committed
416 417 418
                                // tbc: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
                                // fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
                                tbf: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
419 420
                            },
                            february: {
rifkaki's avatar
rifkaki committed
421 422 423
                                // tbc: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                                // fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                                tbf: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
424 425
                            },
                            march: {
rifkaki's avatar
rifkaki committed
426 427 428
                                // tbc: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                                // fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                                tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
429 430
                            },
                            april: {
rifkaki's avatar
rifkaki committed
431 432 433
                                // tbc: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                                // fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                                tbf: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
434 435
                            },
                            may: {
rifkaki's avatar
rifkaki committed
436 437 438
                                // tbc: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                                // fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                                tbf: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
439 440
                            },
                            june: {
rifkaki's avatar
rifkaki committed
441 442 443
                                // tbc: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
                                // fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
                                tbf: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
444 445
                            },
                            july: {
rifkaki's avatar
rifkaki committed
446 447 448
                                // tbc: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
                                // fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
                                tbf: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
449 450
                            },
                            august: {
rifkaki's avatar
rifkaki committed
451 452 453
                                // tbc: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
                                // fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
                                tbf: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
454 455
                            },
                            september: {
rifkaki's avatar
rifkaki committed
456 457 458
                                // tbc: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(),
                                // fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
                                tbf: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
459 460
                            },
                            october: {
rifkaki's avatar
rifkaki committed
461 462 463
                                // tbc: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(),
                                // fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
                                tbf: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
464 465
                            },
                            november: {
rifkaki's avatar
rifkaki committed
466 467 468
                                tbc: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                                fcp: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                                tbf: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
469 470
                            },
                            december: {
rifkaki's avatar
rifkaki committed
471 472 473
                                tbc: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                                fcp: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
                                tbf: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
474
                            },
rifkaki's avatar
rifkaki committed
475
                            total_current_year: i[18] === undefined ? "" : String(i[18]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
476
                            total_next_year: {
rifkaki's avatar
rifkaki committed
477 478 479
                                tbc: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(),
                                fcp: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
                                tbf: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
480 481
                            },
                            total_more_year: {
rifkaki's avatar
rifkaki committed
482 483 484
                                tbc: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[22]).trim(),
                                fcp: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
                                tbf: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
485 486 487 488 489 490 491 492 493 494 495
                            }
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    tax_planning: payload
                }
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
496
                // console.log(this.state.judulColumn)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
497 498 499 500 501 502
            }
        });
    }

    checkUpload() {
        api.create().checkUploadOLPA(this.state.payload).then(response => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
503
            // console.log(JSON.stringify(this.state.payload));
r.kurnia's avatar
r.kurnia committed
504
            console.log(response)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleTP: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            // item.type_report_id,
                            0,
                            Number(item.type_report_id.tbc), 
                            Number(item.type_report_id.fcp), 
                            Number(item.type_report_id.tbf),
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            // {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
                            item.level,
                            item.item_report,
rifkaki's avatar
rifkaki committed
521 522
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
523 524
                                tbf: Number(item.type_report_id.tbf) === 3 && item.january.tbf === "" ? "0" : item.january.tbf
                            },
rifkaki's avatar
rifkaki committed
525 526
                            {   tbc: 0, 
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
527 528
                                tbf: Number(item.type_report_id.tbf) === 3 && item.february.tbf === "" ? "0" : item.february.tbf
                            },
rifkaki's avatar
rifkaki committed
529 530
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
531 532
                                tbf: Number(item.type_report_id.tbf) === 3 && item.march.tbf === "" ? "0" : item.march.tbf
                            },
rifkaki's avatar
rifkaki committed
533 534
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
535 536
                                tbf: Number(item.type_report_id.tbf) === 3 && item.april.tbf === "" ? "0" : item.april.tbf
                            },
rifkaki's avatar
rifkaki committed
537 538
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
539 540
                                tbf: Number(item.type_report_id.tbf) === 3 && item.may.tbf === "" ? "0" : item.may.tbf
                            },
rifkaki's avatar
rifkaki committed
541 542
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
543 544
                                tbf: Number(item.type_report_id.tbf) === 3 && item.june.tbf === "" ? "0" : item.june.tbf
                            },
rifkaki's avatar
rifkaki committed
545 546
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
547 548
                                tbf: Number(item.type_report_id.tbf) === 3 && item.july.tbf === "" ? "0" : item.july.tbf
                            },
rifkaki's avatar
rifkaki committed
549 550
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
551 552
                                tbf: Number(item.type_report_id.tbf) === 3 && item.august.tbf === "" ? "0" : item.august.tbf
                            },
rifkaki's avatar
rifkaki committed
553 554
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
555 556
                                tbf: Number(item.type_report_id.tbf) === 3 && item.september.tbf === "" ? "0" : item.september.tbf
                            },
rifkaki's avatar
rifkaki committed
557 558
                            {   tbc: 0, 
                                fcp: 0, 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
559 560
                                tbf: Number(item.type_report_id.tbf) === 3 && item.october.tbf === "" ? "0" : item.october.tbf
                            },
syadziy's avatar
syadziy committed
561 562 563
                            {   tbc: Number(item.type_report_id.tbc) === 3 && item.november.tbc === "" ? "0" : (Number(item.type_report_id.tbc) === 5 || Number(item.type_report_id.tbc) === 6 || Number(item.type_report_id.tbc) === 7 ? { value: item.november.tbc, formula: item.november_formula } : item.november.tbc), 
                                fcp: Number(item.type_report_id.fcp) === 3 && item.november.fcp === "" ? "0" : (Number(item.type_report_id.fcp) === 5 || Number(item.type_report_id.fcp) === 6 || Number(item.type_report_id.fcp) === 7 ? { value: item.november.fcp, formula: item.november_formula } : item.november.fcp), 
                                tbf: Number(item.type_report_id.tbf) === 3 && item.november.tbf === "" ? "0" : (Number(item.type_report_id.tbf) === 5 || Number(item.type_report_id.tbf) === 6 || Number(item.type_report_id.tbf) === 7 ? { value: item.november.tbf, formula: item.november_formula } : item.november.tbf)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
564
                            },
syadziy's avatar
syadziy committed
565 566 567
                            {   tbc: Number(item.type_report_id.tbc) === 3 && item.december.tbc === "" ? "0" : (Number(item.type_report_id.tbc) === 5 || Number(item.type_report_id.tbc) === 6 || Number(item.type_report_id.tbc) === 7 ? { value: item.december.tbc, formula: item.december_formula } : item.december.tbc), 
                                fcp: Number(item.type_report_id.fcp) === 3 && item.december.fcp === "" ? "0" : (Number(item.type_report_id.fcp) === 5 || Number(item.type_report_id.fcp) === 6 || Number(item.type_report_id.fcp) === 7 ? { value: item.december.fcp, formula: item.december_formula } : item.december.fcp), 
                                tbf: Number(item.type_report_id.tbf) === 3 && item.december.tbf === "" ? "0" : (Number(item.type_report_id.tbf) === 5 || Number(item.type_report_id.tbf) === 6 || Number(item.type_report_id.tbf) === 7 ? { value: item.december.tbf, formula: item.december_formula } : item.december.tbf)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
568 569
                            },
                            item.total_current_year,
rifkaki's avatar
rifkaki committed
570 571
                            0,
                            0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
572 573 574 575 576
                            item.orders,
                            item.error
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
rifkaki's avatar
rifkaki committed
577 578 579 580 581 582
                        this.state.dataTable.map(item => {
                            if (item[25].length > 0) {
                                console.log('masuk')
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
                            }
                        })
rifkaki's avatar
rifkaki committed
583
                        console.log(this.state.dataTable);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
584
                    })
Riri Novita's avatar
Riri Novita committed
585 586
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
587
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
588 589 590 591 592 593
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
594 595 596 597 598 599 600 601 602 603 604
                }
            }
        })
    }

    uploadTP(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[4],
                january: {
rifkaki's avatar
rifkaki committed
605 606
                    // tbc: String(Number(i[9].tbc).toFixed(1)),
                    // fcp: String(Number(i[9].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
607
                    tbf: String(Number(i[9].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
608 609
                },
                february: {
rifkaki's avatar
rifkaki committed
610 611
                    // tbc: String(Number(i[10].tbc).toFixed(1)),
                    // fcp: String(Number(i[10].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
612
                    tbf: String(Number(i[10].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
613 614
                },
                march: {
rifkaki's avatar
rifkaki committed
615 616
                    // tbc: String(Number(i[11].tbc).toFixed(1)),
                    // fcp: String(Number(i[11].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
617
                    tbf: String(Number(i[11].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
618 619
                },
                april: {
rifkaki's avatar
rifkaki committed
620 621
                    // tbc: String(Number(i[12].tbc).toFixed(1)),
                    // fcp: String(Number(i[12].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
622
                    tbf: String(Number(i[12].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
623 624
                },
                may: {
rifkaki's avatar
rifkaki committed
625 626
                    // tbc: String(Number(i[13].tbc).toFixed(1)),
                    // fcp: String(Number(i[13].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
627
                    tbf: String(Number(i[13].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
628 629
                },
                june: {
rifkaki's avatar
rifkaki committed
630 631
                    // tbc: String(Number(i[14].tbc).toFixed(1)),
                    // fcp: String(Number(i[14].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
632
                    tbf: String(Number(i[14].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
633 634
                },
                july: {
rifkaki's avatar
rifkaki committed
635 636
                    // tbc: String(Number(i[15].tbc).toFixed(1)),
                    // fcp: String(Number(i[15].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
637
                    tbf: String(Number(i[15].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
638 639
                },
                august: {
rifkaki's avatar
rifkaki committed
640 641
                    // tbc: String(Number(i[16].tbc).toFixed(1)),
                    // fcp: String(Number(i[16].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
642
                    tbf: String(Number(i[16].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
643 644
                },
                september: {
rifkaki's avatar
rifkaki committed
645 646
                    // tbc: String(Number(i[17].tbc).toFixed(1)),
                    // fcp: String(Number(i[17].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
647
                    tbf: String(Number(i[17].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
648 649
                },
                october: {
rifkaki's avatar
rifkaki committed
650 651
                    // tbc: String(Number(i[18].tbc).toFixed(1)),
                    // fcp: String(Number(i[18].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
652
                    tbf: String(Number(i[18].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
653 654
                },
                november: {
Deni Rinaldi's avatar
Deni Rinaldi committed
655
                    tbc: String(Number(i[19].tbc).toFixed(1)),
r.kurnia's avatar
r.kurnia committed
656
                    fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[19].fcp).toFixed(2)) : String(Number(i[19].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
657
                    tbf: String(Number(i[19].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
658 659
                },
                december: {
Deni Rinaldi's avatar
Deni Rinaldi committed
660
                    tbc: String(Number(i[20].tbc).toFixed(1)),
r.kurnia's avatar
r.kurnia committed
661
                    fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[20].fcp).toFixed(2)) : String(Number(i[20].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
662
                    tbf: String(Number(i[20].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
663
                },
rifkaki's avatar
rifkaki committed
664
                total_current_year: String(Number(i[21]).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
665 666 667 668 669 670 671 672 673 674 675 676
            })
        })
        let body = {
            outlook_pa_id: this.props.outlook_pa_id,
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
            tax_planning: data,
            status: type
        }
        // console.log(data);
        api.create('UPLOAD').uploadOLPA(body).then(response => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
677
            // console.log(response);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
678 679 680 681 682
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
r.kurnia's avatar
r.kurnia committed
683 684
                    // this.setState({ alert: true, messageAlert: response.data.status, tipeAlert: 'error', loading: false })
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
685
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
r.kurnia's avatar
r.kurnia committed
686 687 688 689 690 691
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
692 693
                }
            } else {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
694
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
695 696 697 698 699 700
            }
        })
    }

    handleValidate() {
        let data = []
701 702
        let errorContrl = this.state.buttonError
        let editAble = this.state.editAble
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
703
        // console.log(this.state.dataTable)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
704
        this.state.dataTable.map(i => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
705
        // console.log(i[0])
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
            data.push({
                item_report_id: i[4],
                january: {
                    tbc: i[1] === 3 && i[9].tbc === "" ? "0" : String(i[9].tbc),
                    fcp: i[2] === 3 && i[9].fcp === "" ? "0" : String(i[9].fcp),
                    tbf: i[3] === 3 && i[9].tbf === "" ? "0" : String(i[9].tbf)
                },
                february: {
                    tbc: i[1] === 3 && i[10].tbc === "" ? "0" : String(i[10].tbc),
                    fcp: i[2] === 3 && i[10].fcp === "" ? "0" : String(i[10].fcp),
                    tbf: i[3] === 3 && i[10].tbf === "" ? "0" : String(i[10].tbf)
                },
                march: {
                    tbc: i[1] === 3 && i[11].tbc === "" ? "0" : String(i[11].tbc),
                    fcp: i[2] === 3 && i[11].fcp === "" ? "0" : String(i[11].fcp),
                    tbf: i[3] === 3 && i[11].tbf === "" ? "0" : String(i[11].tbf)
                },
                april: {
                    tbc: i[1] === 3 && i[12].tbc === "" ? "0" : String(i[12].tbc),
                    fcp: i[2] === 3 && i[12].fcp === "" ? "0" : String(i[12].fcp),
                    tbf: i[3] === 3 && i[12].tbf === "" ? "0" : String(i[12].tbf)
                },
                may: {
                    tbc: i[1] === 3 && i[13].tbc === "" ? "0" : String(i[13].tbc),
                    fcp: i[2] === 3 && i[13].fcp === "" ? "0" : String(i[13].fcp),
                    tbf: i[3] === 3 && i[13].tbf === "" ? "0" : String(i[13].tbf)
                },
                june: {
                    tbc: i[1] === 3 && i[14].tbc === "" ? "0" : String(i[14].tbc),
                    fcp: i[2] === 3 && i[14].fcp === "" ? "0" : String(i[14].fcp),
                    tbf: i[3] === 3 && i[14].tbc === "" ? "0" : String(i[14].tbf)
                },
                july: {
                    tbc: i[1] === 3 && i[15].tbc === "" ? "0" : String(i[15].tbc),
                    fcp: i[2] === 3 && i[15].fcp === "" ? "0" : String(i[15].fcp),
                    tbf: i[3] === 3 && i[15].tbf === "" ? "0" : String(i[15].tbf)
                },
                august: {
                    tbc: i[1] === 3 && i[16].tbc === "" ? "0" : String(i[16].tbc),
                    fcp: i[2] === 3 && i[16].fcp === "" ? "0" : String(i[16].fcp),
                    tbf: i[3] === 3 && i[16].tbf === "" ? "0" : String(i[16].tbf)
                },
                september: {
                    tbc: i[1] === 3 && i[17].tbc === "" ? "0" : String(i[17].tbc),
                    fcp: i[2] === 3 && i[17].fcp === "" ? "0" : String(i[17].fcp),
                    tbf: i[3] === 3 && i[17].tbf === "" ? "0" : String(i[17].tbf)
                },
                october: {
                    tbc: i[1] === 3 && i[18].tbc === "" ? "0" : String(i[18].tbc),
                    fcp: i[2] === 3 && i[18].fcp === "" ? "0" : String(i[18].fcp),
                    tbf: i[3] === 3 && i[18].tbf === "" ? "0" : String(i[18].tbf)
                },
                november: {
r.kurnia's avatar
r.kurnia committed
759 760 761
                    tbc: i[1] === 3 && i[19].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[19].tbc.value) : String(i[19].tbc),
                    fcp: i[2] === 3 && i[19].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[19].fcp.value) : String(i[19].fcp),
                    tbf: i[3] === 3 && i[19].tbf === "" ? "0" : String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[19].tbf) : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
762 763
                },
                december: {
r.kurnia's avatar
r.kurnia committed
764 765 766
                    tbc: i[1] === 3 && i[20].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[20].tbc.value) : String(i[20].tbc),
                    fcp: i[2] === 3 && i[20].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[20].fcp.value) : String(i[20].fcp),
                    tbf: i[3] === 3 && i[20].tbf === "" ? "0" : String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[20].tbf) : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
767 768
                },
                total_current_year: i[2] === 3 && i[21] === "" ? "0" : String(i[21]),
r.kurnia's avatar
r.kurnia committed
769 770 771 772 773 774 775 776 777 778
                // total_next_year: {
                //     tbc: i[1] === 3 && i[22].tbc === "" ? "0" : String(i[22].tbc),
                //     fcp: i[2] === 3 && i[22].fcp === "" ? "0" : String(i[22].fcp),
                //     tbf: i[3] === 3 && i[22].tbf === "" ? "0" : String(i[22].tbf)
                // },
                // total_more_year: {
                //     tbc: i[1] === 3 && i[23].tbc === "" ? "0" : String(i[23].tbc),
                //     fcp: i[2] === 3 && i[23].fcp === "" ? "0" : String(i[23].fcp),
                //     tbf: i[3] === 3 && i[23].tbf === "" ? "0" : String(i[23].tbf)
                // }
rifkaki's avatar
rifkaki committed
779

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
780
            })
781 782 783

            if (String(i[8]) == "Control (should be nil)") {
                this.setState({ loading: true })
r.kurnia's avatar
r.kurnia committed
784
                if ((Number(i[19].tbf.value) < Number(this.state.minValue) || Number(i[19].tbf.value) > Number(this.state.maxValue)) || (Number(i[20].tbf.value) < Number(this.state.minValue) || Number(i[20].tbf.value) > Number(this.state.maxValue)) || (Number(i[21]) < Number(this.state.minValue) || Number(i[21]) > Number(this.state.maxValue))) {
785 786 787 788 789 790 791 792
                    errorContrl = true
                    editAble = true
                } 
                else {
                    errorContrl = false
                    editAble = false
                }
            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
793
        })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
794
        // console.log(JSON.stringify(data))
r.kurnia's avatar
r.kurnia committed
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809
        // let payload = {
        //     "outlook_pa_id": this.props.outlook_pa_id,
        //     "company_id": this.props.company.company_id,
        //     "periode": this.props.periode,
        //     "report_id": this.props.report_id,
        //     "tax_planning": data,
        //     "status": "submitted"
        // }
        // api.create().validateSubmitReportOLPA(payload).then((response) => {
        //     console.log(payload)
        //     console.log(response)
        //     if (response.data) {
        //         if (response.data.status === "success") {
                    // if (response.data.data.result && errorContrl === false && editAble === false ) {
                    if (errorContrl === false && editAble === false ) {
810 811 812
                        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
                    } else {
                        this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
r.kurnia's avatar
r.kurnia committed
813
                        console.log("masuk button error")
814
                    }
r.kurnia's avatar
r.kurnia committed
815 816 817 818 819 820 821 822 823 824 825 826 827 828
            //     } 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.problem, tipeAlert: 'error', loading: false })
            // }
        // })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
829 830 831 832
    }

    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
833
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
834 835
        )
        res = await res.blob()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
836
        // console.log(res)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
837 838 839 840 841 842 843 844 845 846
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Outlook Performance Appraisal Tax Planning.xlsx';
            a.click();
        }
    }

    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
847 848
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&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/outlook_pa/export_outlook_pa?outlook_pa_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
849
        console.log(url);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869
        let res = await fetch(
            this.props.outlook_pa_id == 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 = 'Outlook Performance Appraisal Tax Planning.xlsx';
            a.click();
        }
    }

    closeAlert() {
        this.setState({ alert: false })
    }

    render() {
        let dataTable2 = this.state.dataTable
r.kurnia's avatar
r.kurnia committed
870 871 872
        let dataFormula = []
        let id = 0
        let double = false
r.kurnia's avatar
r.kurnia committed
873
        
r.kurnia's avatar
r.kurnia committed
874
        const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
r.kurnia's avatar
r.kurnia committed
875
            // console.log(xntd)
r.kurnia's avatar
r.kurnia committed
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893
            let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf
            let splitFormula = String(form).split('@')
            let baru = []
            let anjay = []
            splitFormula.map((item, index) => {
                let items = String(item).substr(Number(String(item).length) - 1, 1)
                let re = /^[a-zA-Z0-9_]+$/;
                let asd = ''
                if (item !== "") {
                    if (!re.test(items)) {
                        baru.push(String(item).substr(0, Number(String(item).length) - 1))
                        baru.push(String(item).substr(Number(String(item).length) - 1, 1))
                    } else {
                        baru.push(String(item))
                    }
                }
            })

r.kurnia's avatar
r.kurnia committed
894 895 896 897 898 899
            // console.log(baru);

            // if (forecast !== undefined) {
            //     console.log(splitFormula)
            // }

r.kurnia's avatar
r.kurnia committed
900
            if (tableMeta.rowData[8] == "Under payment  /(Over Payment ) Income Tax Art.  29" || forecast !== undefined) {
r.kurnia's avatar
r.kurnia committed
901 902
                // form.replace("(", "")
                // form.replace(")", "")
r.kurnia's avatar
r.kurnia committed
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926
                let opgab = []
                baru.map((item, index) => {
                    if (item.length > 1 && (item.includes("+") || item.includes("-") || item.includes("*") || item.includes("/"))) {
                        opgab.push(String(item).substr(0, Number(String(item).length) - 1))
                        opgab.push(String(item).substr(Number(String(item).length) - 1, 1))
                    } else {
                        opgab.push(item)
                    }
                })
                if (opgab.length > 0) {
                    baru = opgab
                }
            }

            let totalShldBeNil = 0
            baru.map((item, index) => {
                if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
                    anjay.push(item)
                } else {
                    if (String(item).includes('#')) {
                        let splitform = String(item).split('#')
                        if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') {
                            let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
                            if (indexID !== -1) {
r.kurnia's avatar
r.kurnia committed
927
                                // console.log(splitform)
r.kurnia's avatar
r.kurnia committed
928
                                let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
r.kurnia's avatar
r.kurnia committed
929 930 931 932
                                // console.log(data)
                                // if(value == null){
                                //     console.log(tableMeta);
                                // }
r.kurnia's avatar
r.kurnia committed
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953
                                let valuezz = data.value == undefined ? data : data.value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        } else {
                            if (forecast !== undefined) {
                                forecast.map((item, index) => {
                                    if (periode == item.periode) {
                                        totalShldBeNil += Number(item.value)
                                    }
                                })
                                anjay.push(totalShldBeNil)
                            } else if (String(item).includes('[M-1]')) {
                                let tst = String(item).replace('[M-1]', '')
                                let data = tableMeta.columnIndex == 9 ? 20 : tableMeta.columnIndex - 1
                                let dataSub = dex == 1 ? tableMeta.rowData[data].tbc : dex == 2 ? tableMeta.rowData[data].fcp : tableMeta.rowData[data].tbf
                                let period = data == 20 ? Number(this.props.periode) - 1 : this.props.periode
                                let indexID = dataSub.formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
                                if (indexID !== -1) {
                                    let valuezz = tableMeta.rowData[data].formula[indexID].value
                                    anjay.push(valuezz == "" ? 0 : valuezz)
                                }
r.kurnia's avatar
r.kurnia committed
954 955 956 957 958 959 960 961 962 963 964 965 966
                            } else {
                                // console.log(value);
                                // if(value == null){
                                //     console.log(tableMeta);
                                // }
                                let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
                                // console.log(data);
                                let indexID = data.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
                                if (indexID !== -1) {
                                    let valuezz = data.formula[indexID].value
                                    anjay.push(valuezz == "" ? 0 : valuezz)
                                }
                            }
r.kurnia's avatar
r.kurnia committed
967 968 969 970 971 972 973
                        }
                    } else {
                        let indexID = dataTable2.findIndex((val) => val[24] == item)
                        if (indexID !== -1) {
                            if (dataTable2[indexID][24] == tableMeta.rowData[24]) {
                                anjay.push(0)
                            } else {
r.kurnia's avatar
r.kurnia committed
974
                                let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
r.kurnia's avatar
r.kurnia committed
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
                                let valuezz = data.value == undefined ? data : data.value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }

                        }
                    }
                }
            })

            let total = 0
            let total2 = 0
            let opt = ""
            let opt2 = ""
            let prio = false
            let simpen2 = ""
            anjay.map((item, index) => {
                if (item == "+") {
                    if (prio) {
                        opt2 = "tambah"
                    } else {
                        opt = "tambah"
                    }
                } else if (item == "-") {
                    if (prio) {
                        opt2 = "kurang"
                    } else {
                        opt = "kurang"
                    }
                } else if (item == "*") {
                    if (prio) {
                        opt2 = "kali"
                    } else {
                        opt = "kali"
                    }
                } else if (item == "/") {
                    if (prio) {
                        opt2 = "bagi"
                    } else {
                        opt = "bagi"
                    }
                } else if (item == "(") {
                    prio = true
                    simpen2 = "active"
                } else if (item == ")") {
                    prio = false
                }
                else {
                    if (prio) {
                        if (opt2 == "tambah") {
                            total2 = Number(total2) + Number(item)
                        } else if (opt2 == "kurang") {
                            total2 = Number(total2) - Number(item)
                        } else if (opt2 == "kali") {
                            total2 = Number(total2) * Number(item)
                        } else if (opt2 == "bagi") {
                            total2 = Number(total2) / Number(item) == NaN ? 0 : Number(total2) / Number(item)
                        } else {
                            total2 += Number(item)
                        }
                    } 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)
                        } else if (opt == "bagi") {
                            total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
                        } else {
                            total += Number(item)
                        }
                    }
                }
            })

            if (simpen2 == "active") {
                if (opt == "tambah") {
                    total = Number(total) + Number(total2)
                } else if (opt == "kurang") {
                    total = Number(total) - Number(total2)
                } else if (opt == "kali") {
                    total = Number(total) * Number(total2)
                } else if (opt == "bagi") {
                    total = Number(total) / Number(total2) == NaN ? 0 : Number(total) / Number(total2)
                }
            }

            total = R.equals(total, NaN) ? "0.0" : total
            // console.log(tableMeta.rowData[8])
            // if (xntd !== undefined && tableMeta.rowData[8] == "Under payment  /(Over Payment ) Income Tax Art.  29") {
            //     console.log(tableMeta.rowData[8])
            //     // console.log(splitFormula)
            //     console.log(xntd)
            //     console.log(baru)
            //     console.log(anjay)
            //     console.log(total)
            //     console.log(total2)
            //     console.log(opt)
            // }

            // let dataSub = dex == 1? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc : dex == 2? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp : dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf
            if (dex == 1) {
                if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) {
Deni Rinaldi's avatar
Deni Rinaldi committed
1078
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1079
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
1080
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1081 1082 1083
                }
            } else if (dex == 2) {
                if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) {
Deni Rinaldi's avatar
Deni Rinaldi committed
1084
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1085
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
1086
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1087
                }
r.kurnia's avatar
r.kurnia committed
1088 1089 1090 1091 1092 1093 1094 1095 1096
            } else if (dex == 3) {
                if (tableMeta.rowData[8] == "Corporate Income Tax") {
                    if (total < 0) {
                        total = 0
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
                    } else {
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
                    }
                } else if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
Deni Rinaldi's avatar
Deni Rinaldi committed
1097
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1098
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
1099
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1100
                }
r.kurnia's avatar
r.kurnia committed
1101 1102 1103 1104 1105 1106
            } else {
                if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
                } else {
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(total).toFixed(1)
                }
r.kurnia's avatar
r.kurnia committed
1107 1108
            }

r.kurnia's avatar
r.kurnia committed
1109
            return tableMeta.rowData[8] == "Corporate Income Tax" ? Number(total).toFixed(2) : Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1110 1111
        }

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123
        const handleChange = (value, tableMeta, indexChilds) => {
            let val = String(value).split(",").join("")
            // let data = this.state.dataTable2
            let indexParent = dataTable2.findIndex((val) => val[4] === dataTable2[tableMeta.rowIndex][5])
            // ini buat input untuk perhitungan parent nya
            if (indexParent > 0) {
                if (indexChilds == 1) {
                    let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val)
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex].fcp
                    a = dataTable2[indexParent][tableMeta.columnIndex].fcp = jagain === undefined ? (0 + Number(val)) : (Number(jagain) + Number(val))
                }
            } else {
r.kurnia's avatar
r.kurnia committed
1124
                if (indexChilds == 0) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1125 1126
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val)
                }
r.kurnia's avatar
r.kurnia committed
1127
                else if (indexChilds == 1) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1128 1129
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val)
                }
r.kurnia's avatar
r.kurnia committed
1130
                else if (indexChilds == 2) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1131 1132 1133 1134
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val)
                }
            }
        }
r.kurnia's avatar
r.kurnia committed
1135

r.kurnia's avatar
r.kurnia committed
1136
        const handleTotal = (tableMeta, dex, periode) => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1137
            let total = 0
r.kurnia's avatar
r.kurnia committed
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
            let totalfcp = 0
            if (String(tableMeta.rowData[8]).toLowerCase() === "fiscal correction positive / (negative) year to date") {
                dataTable2[tableMeta.rowIndex - 2].map((item, index) => {
                    if (index >= 9 && index <= 20) {
                        if (dataTable2[tableMeta.rowIndex - 2][2] === 5 || dataTable2[tableMeta.rowIndex - 2][2] === 6 || dataTable2[tableMeta.rowIndex - 2][2] === 7) {
                            let valItem = item.fcp.value == undefined || item.fcp.value == "" || item.fcp.value == "undefined" ? 0.0 : item.fcp.value
                            total += Number(valItem)
                        } else {
                            let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
                            total += Number(valItem)
                        }
                    }
                })
            } else {
                dataTable2[tableMeta.rowIndex].map((item, index) => {
                    if (index >= 9 && index <= 20) {
r.kurnia's avatar
r.kurnia committed
1154 1155 1156 1157 1158 1159 1160 1161
                        if (String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX") {
                            let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
                            total += Number(valItem)
                        }
                        else if (tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7) {
                            let valItem = item.tbf.value == undefined || item.tbf.value == "" || item.tbf.value == "undefined" ? 0.0 : item.tbf.value
                            total += Number(valItem)
                        } else {
r.kurnia's avatar
r.kurnia committed
1162 1163
                            let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
                            total += Number(valItem)
r.kurnia's avatar
r.kurnia committed
1164
                        }
r.kurnia's avatar
r.kurnia committed
1165 1166 1167
                    }
                })
            }
r.kurnia's avatar
r.kurnia committed
1168
            dataTable2[tableMeta.rowIndex][21] = String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(total).toFixed(2) : Number(total).toFixed(1)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1169 1170
            return total
        }
r.kurnia's avatar
r.kurnia committed
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197

        const handleParent = (tableMeta, type) => {
            let total = 0
            dataTable2.map((item, index) => {
                if (item[5] == tableMeta.rowData[4]) {
                    total += Number(type == 1 ?
                        item[tableMeta.columnIndex].tbc.value == undefined ? Number(item[tableMeta.columnIndex].tbc == "" || item[tableMeta.columnIndex].tbc == "0.0" ? 0 : item[tableMeta.columnIndex].tbc) : Number(item[tableMeta.columnIndex].tbc.value == "" || item[tableMeta.columnIndex].tbc.value == "0.0" ? 0 : item[tableMeta.columnIndex].tbc.value)
                        :
                        (type == 2 ?
                            item[tableMeta.columnIndex].fcp.value == undefined ? Number(item[tableMeta.columnIndex].fcp == "" || item[tableMeta.columnIndex].fcp == "0.0" ? 0 : item[tableMeta.columnIndex].fcp) : Number(item[tableMeta.columnIndex].fcp.value == "" || item[tableMeta.columnIndex].fcp.value == "0.0" ? 0 : item[tableMeta.columnIndex].fcp.value)
                            :
                            item[tableMeta.columnIndex].tbf.value == undefined ? Number(item[tableMeta.columnIndex].tbf == "" || item[tableMeta.columnIndex].tbf == "0.0" ? 0 : item[tableMeta.columnIndex].tbf) : Number(item[tableMeta.columnIndex].tbf.value == "" || item[tableMeta.columnIndex].tbf.value == "0.0" ? 0 : item[tableMeta.columnIndex].tbf.value)
                        )
                    )
                }
            })

            if (type == 1) {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = total
            } else if (type == 2) {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = total
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = total
            }
            return total
        }

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249
        const columns = [{
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            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) => (
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style }),
                customBodyRender: (val, tableMeta) => {
                    return (
                        <div style={{ width: 300 }}>
r.kurnia's avatar
r.kurnia committed
1250 1251
                            {tableMeta.rowData[30] ?
                                tableMeta.rowData[30].length > 0 ?
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294
                                    <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
                                            <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </LightTooltip>
                                    </div>
                                    :
                                    tableMeta.rowData[7] == 0 ?
                                        <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                        :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[7]) }}>
                                            <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </div>
                                :
                                tableMeta.rowData[7] == 0 ?
                                    <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                    :
                                    <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[7]) }}>
                                        <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                    </div>
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Jan ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
r.kurnia's avatar
r.kurnia committed
1295
                                <div className="col-1">
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1296
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1297 1298 1299 1300 1301 1302 1303 1304 1305
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1306 1307 1308 1309 1310
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1311 1312
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1313
                                                            />
rifkaki's avatar
rifkaki committed
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        }, {
            name: `Feb ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (                    
                <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1366 1367 1368 1369 1370 1371 1372 1373 1374
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1375 1376 1377 1378 1379
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1380 1381
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1382
                                                            />
rifkaki's avatar
rifkaki committed
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1406 1407 1408 1409 1410 1411 1412 1413
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
r.kurnia's avatar
r.kurnia committed
1414
        }, {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434
            name: `Mar ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1435 1436 1437 1438 1439 1440 1441 1442 1443
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1444 1445 1446 1447 1448
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1449 1450
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1451
                                                            />
rifkaki's avatar
rifkaki committed
1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Apr ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1504 1505 1506 1507 1508 1509 1510 1511 1512
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1513 1514 1515 1516 1517
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1518 1519
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1520
                                                            />
rifkaki's avatar
rifkaki committed
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `May ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1573 1574 1575 1576 1577 1578 1579 1580 1581
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1582 1583 1584 1585 1586
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1587 1588
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1589
                                                            />
rifkaki's avatar
rifkaki committed
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Jun ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1642 1643 1644 1645 1646 1647 1648 1649 1650
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1651 1652 1653 1654 1655
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1656 1657
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1658
                                                            />
rifkaki's avatar
rifkaki committed
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Jul ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1711 1712 1713 1714 1715 1716 1717 1718 1719
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1720 1721 1722 1723 1724
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1725 1726
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1727
                                                            />
rifkaki's avatar
rifkaki committed
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Aug ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
rifkaki's avatar
rifkaki committed
1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1789 1790 1791 1792 1793
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1794 1795
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1796
                                                            />
rifkaki's avatar
rifkaki committed
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Sep ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1849 1850 1851 1852 1853 1854 1855 1856 1857
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1858 1859 1860 1861 1862
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1863 1864
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1865
                                                            />
rifkaki's avatar
rifkaki committed
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Oct ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div className="" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1918 1919 1920 1921 1922 1923 1924 1925 1926
                                        { tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
r.kurnia's avatar
r.kurnia committed
1927 1928 1929 1930 1931
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
1932 1933
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
1934
                                                            />
rifkaki's avatar
rifkaki committed
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957
                                                        }
                                                    />
                                                </div>
                                                :
                                                tableMeta.rowData[3] === 3 || tableMeta.rowData[3] === 2 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Nov ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell> */}
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
                        <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Commercial) MTD"}</span>
                            </div>
                            <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Fiscal Correction Positive /(Negative)"}</span>
                            </div>
                            <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="grid grid-3x content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1996 1997 1998 1999
                                        {tableMeta.rowData[1] === 4 || tableMeta.rowData[1] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
r.kurnia's avatar
r.kurnia committed
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033
                                                tableMeta.rowData[1] === 5 || tableMeta.rowData[1] === 6 || tableMeta.rowData[1] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbc}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbc.value).toFixed(2) : Number(value.tbc.value).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbc}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbc).toFixed(2) : Number(value.tbc).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2034
                                                :
rifkaki's avatar
rifkaki committed
2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045
                                                tableMeta.rowData[1] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbc}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    decimalSeparator={"."}
                                                                    style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
2046
                                                                    // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2047
                                                                    disabled={this.props.isApprover == true ? true : false}
rifkaki's avatar
rifkaki committed
2048 2049 2050 2051 2052 2053 2054 2055
                                                                    value={Number(value.tbc).toFixed(1)}
                                                                    onBlur={(event) => {
                                                                        // updateValue(event.target.value)
                                                                        handleChange(event.target.value, tableMeta, 0)
                                                                        // console.log(dataTable2)
                                                                    }}
                                                                />
                                                            }
r.kurnia's avatar
r.kurnia committed
2056
                                                        />
rifkaki's avatar
rifkaki committed
2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068
                                                    </div> :
                                                    tableMeta.rowData[1] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleParent(tableMeta, 1)).toFixed(1)}
                                                            />
                                                        </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2069
                                                        :
rifkaki's avatar
rifkaki committed
2070
                                                        tableMeta.rowData[1] === 6 ?
r.kurnia's avatar
r.kurnia committed
2071 2072 2073 2074 2075 2076
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2077
                                                                value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2078
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2079
                                                            :
rifkaki's avatar
rifkaki committed
2080 2081 2082 2083 2084 2085 2086 2087 2088
                                                            tableMeta.rowData[1] === 5 ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
                                                                />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2089
                                                                :
r.kurnia's avatar
r.kurnia committed
2090
                                                                tableMeta.rowData[1] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2091
                                                                    (Number(handleValueFormula(value, tableMeta, 0)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 0)).toFixed(1) <= Number(this.state.maxValue)) ?
r.kurnia's avatar
r.kurnia committed
2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'black'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2106
                                                                            value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122
                                                                        /> :
                                                                        <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{
                                                                                    fontSize: 12,
                                                                                    textAlign: 'right',
                                                                                    borderColor: 'transparent',
                                                                                    margin: 0,
                                                                                    width: 96,
                                                                                    backgroundColor: 'transparent',
                                                                                    color: 'red'
                                                                                }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2123
                                                                                value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2124 2125 2126 2127
                                                                            />
                                                                        </LightTooltip>
                                                                    :
                                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2128 2129 2130 2131 2132
                                        }
                                    </div>
                                </div>
                                <div className="col-2">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
2133 2134 2135 2136
                                        {tableMeta.rowData[2] === 4 || tableMeta.rowData[2] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
r.kurnia's avatar
r.kurnia committed
2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170
                                                tableMeta.rowData[2] === 5 || tableMeta.rowData[2] === 6 || tableMeta.rowData[2] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.fcp}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp.value).toFixed(2) : Number(value.fcp.value).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.fcp}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2171
                                                :
rifkaki's avatar
rifkaki committed
2172 2173 2174 2175 2176 2177 2178 2179 2180 2181
                                                tableMeta.rowData[2] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.fcp}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
2182
                                                                    // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2183
                                                                    // disabled={this.props.isApprover == true ? true : false}
r.kurnia's avatar
r.kurnia committed
2184
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
rifkaki's avatar
rifkaki committed
2185 2186 2187 2188 2189 2190
                                                                    onBlur={(event) => {
                                                                        handleChange(event.target.value, tableMeta, 1)
                                                                        // console.log(dataTable2)
                                                                    }}
                                                                />
                                                            }
r.kurnia's avatar
r.kurnia committed
2191
                                                        />
rifkaki's avatar
rifkaki committed
2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203
                                                    </div> :
                                                    tableMeta.rowData[2] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleParent(tableMeta, 2)).toFixed(1)}
                                                            />
                                                        </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2204
                                                        :
rifkaki's avatar
rifkaki committed
2205
                                                        tableMeta.rowData[2] === 6 ?
r.kurnia's avatar
r.kurnia committed
2206 2207 2208 2209 2210 2211
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2212
                                                                value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2213
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2214
                                                            :
rifkaki's avatar
rifkaki committed
2215 2216 2217 2218 2219 2220 2221 2222 2223
                                                            tableMeta.rowData[2] === 5 ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
                                                                />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2224
                                                                :
r.kurnia's avatar
r.kurnia committed
2225
                                                                tableMeta.rowData[2] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2226
                                                                    (Number(handleValueFormula(value, tableMeta, 2)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 2)).toFixed(1) <= Number(this.state.maxValue)) ?
r.kurnia's avatar
r.kurnia committed
2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'black'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2241
                                                                            value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257
                                                                        /> :
                                                                        <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{
                                                                                    fontSize: 12,
                                                                                    textAlign: 'right',
                                                                                    borderColor: 'transparent',
                                                                                    margin: 0,
                                                                                    width: 96,
                                                                                    backgroundColor: 'transparent',
                                                                                    color: 'red'
                                                                                }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2258
                                                                                value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2259 2260 2261 2262
                                                                            />
                                                                        </LightTooltip>
                                                                    :
                                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2263 2264 2265 2266 2267
                                        }
                                    </div>
                                </div>
                                <div className="col-3">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
2268 2269 2270 2271
                                        {tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
r.kurnia's avatar
r.kurnia committed
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290
                                                tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf.value).toFixed(2) : Number(value.tbf.value).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    <div style={{ flex: 1 }}>
rifkaki's avatar
rifkaki committed
2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                            />
                                                        }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2304
                                                    />
rifkaki's avatar
rifkaki committed
2305
                                                </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2306
                                                :
rifkaki's avatar
rifkaki committed
2307 2308 2309 2310 2311 2312 2313 2314 2315 2316
                                                tableMeta.rowData[3] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
2317
                                                                    // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2318
                                                                    disabled={this.props.isApprover == true ? true : false}
rifkaki's avatar
rifkaki committed
2319 2320 2321 2322 2323 2324 2325 2326
                                                                    value={Number(value.tbf).toFixed(1)}
                                                                    onBlur={(event) => {
                                                                        // updateValue(event.target.value)
                                                                        handleChange(event.target.value, tableMeta, 2)
                                                                        // console.log(dataTable2)
                                                                    }}
                                                                />
                                                            }
r.kurnia's avatar
r.kurnia committed
2327
                                                        />
rifkaki's avatar
rifkaki committed
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339
                                                    </div> :
                                                    tableMeta.rowData[3] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleParent(tableMeta, 3)).toFixed(1)}
                                                            />
                                                        </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2340
                                                        :
rifkaki's avatar
rifkaki committed
2341
                                                        tableMeta.rowData[3] === 6 ?
r.kurnia's avatar
r.kurnia committed
2342 2343 2344 2345 2346
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
2347
                                                                disabled={true}
r.kurnia's avatar
r.kurnia committed
2348
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2349
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2350
                                                            :
rifkaki's avatar
rifkaki committed
2351 2352 2353 2354 2355 2356 2357
                                                            tableMeta.rowData[3] === 5 ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={false}
r.kurnia's avatar
r.kurnia committed
2358
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
rifkaki's avatar
rifkaki committed
2359
                                                                />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2360
                                                                :
r.kurnia's avatar
r.kurnia committed
2361
                                                                tableMeta.rowData[3] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2362
                                                                    (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
r.kurnia's avatar
r.kurnia committed
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'black'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2377
                                                                            value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393
                                                                        /> :
                                                                        <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{
                                                                                    fontSize: 12,
                                                                                    textAlign: 'right',
                                                                                    borderColor: 'transparent',
                                                                                    margin: 0,
                                                                                    width: 96,
                                                                                    backgroundColor: 'transparent',
                                                                                    color: 'red'
                                                                                }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2394
                                                                                value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2395 2396 2397 2398
                                                                            />
                                                                        </LightTooltip>
                                                                    :
                                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `Dec ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
                    <th  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                        {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell> */}
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
                        <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
                            <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Commercial) MTD"}</span>
                            </div>
                            <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Fiscal Correction Positive /(Negative)"}</span>
                            </div>
                            <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal) MTD"}</span>
                            </div>
                        </div>
                    </th>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    // console.log(value)
                    return (
                        <div>
                            <div className="grid grid-3x content-center">
                                <div className="col-1">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
2437 2438 2439 2440
                                        {tableMeta.rowData[1] === 4 || tableMeta.rowData[1] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
r.kurnia's avatar
r.kurnia committed
2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474
                                                tableMeta.rowData[1] === 5 || tableMeta.rowData[1] === 6 || tableMeta.rowData[1] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbc}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbc.value).toFixed(2) : Number(value.tbc.value).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbc}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbc).toFixed(2) : Number(value.tbc).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2475
                                                :
rifkaki's avatar
rifkaki committed
2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486
                                                tableMeta.rowData[1] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbc}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    decimalSeparator={"."}
                                                                    style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
2487
                                                                    // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2488
                                                                    disabled={this.props.isApprover == true ? true : false}
rifkaki's avatar
rifkaki committed
2489 2490 2491 2492 2493 2494 2495 2496
                                                                    value={Number(value.tbc).toFixed(1)}
                                                                    onBlur={(event) => {
                                                                        // updateValue(event.target.value)
                                                                        handleChange(event.target.value, tableMeta, 0)
                                                                        // console.log(dataTable2)
                                                                    }}
                                                                />
                                                            }
r.kurnia's avatar
r.kurnia committed
2497
                                                        />
rifkaki's avatar
rifkaki committed
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509
                                                    </div> :
                                                    tableMeta.rowData[1] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleParent(tableMeta, 1)).toFixed(1)}
                                                            />
                                                        </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2510
                                                        :
rifkaki's avatar
rifkaki committed
2511
                                                        tableMeta.rowData[1] === 6 ?
r.kurnia's avatar
r.kurnia committed
2512 2513 2514 2515 2516 2517
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2518
                                                                value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2519
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2520
                                                            :
rifkaki's avatar
rifkaki committed
2521 2522 2523 2524 2525 2526 2527 2528 2529
                                                            tableMeta.rowData[1] === 5 ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
                                                                />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2530
                                                                :
r.kurnia's avatar
r.kurnia committed
2531
                                                                tableMeta.rowData[1] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2532
                                                                    (Number(handleValueFormula(value, tableMeta, 0)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 0)).toFixed(1) <= Number(this.state.maxValue)) ?
r.kurnia's avatar
r.kurnia committed
2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'black'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2547
                                                                            value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563
                                                                        /> :
                                                                        <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{
                                                                                    fontSize: 12,
                                                                                    textAlign: 'right',
                                                                                    borderColor: 'transparent',
                                                                                    margin: 0,
                                                                                    width: 96,
                                                                                    backgroundColor: 'transparent',
                                                                                    color: 'red'
                                                                                }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2564
                                                                                value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2565 2566 2567 2568
                                                                            />
                                                                        </LightTooltip>
                                                                    :
                                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2569 2570 2571 2572 2573
                                        }
                                    </div>
                                </div>
                                <div className="col-2">
                                    <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
2574 2575 2576 2577
                                        {tableMeta.rowData[2] === 4 || tableMeta.rowData[2] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
r.kurnia's avatar
r.kurnia committed
2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611
                                                tableMeta.rowData[2] === 5 || tableMeta.rowData[2] === 6 || tableMeta.rowData[2] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.fcp}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp.value).toFixed(2) : Number(value.fcp.value).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.fcp}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2612
                                                :
rifkaki's avatar
rifkaki committed
2613 2614 2615 2616 2617 2618 2619 2620 2621 2622
                                                tableMeta.rowData[2] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.fcp}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
2623
                                                                    // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2624
                                                                    // disabled={this.props.isApprover == true ? true : false}
r.kurnia's avatar
r.kurnia committed
2625
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
rifkaki's avatar
rifkaki committed
2626 2627 2628 2629 2630 2631
                                                                    onBlur={(event) => {
                                                                        handleChange(event.target.value, tableMeta, 1)
                                                                        // console.log(dataTable2)
                                                                    }}
                                                                />
                                                            }
r.kurnia's avatar
r.kurnia committed
2632
                                                        />
rifkaki's avatar
rifkaki committed
2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644
                                                    </div> :
                                                    tableMeta.rowData[2] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleParent(tableMeta, 2)).toFixed(1)}
                                                            />
                                                        </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2645
                                                        :
rifkaki's avatar
rifkaki committed
2646
                                                        tableMeta.rowData[2] === 6 ?
r.kurnia's avatar
r.kurnia committed
2647 2648 2649 2650 2651 2652
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2653
                                                                value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2654
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2655
                                                            :
rifkaki's avatar
rifkaki committed
2656 2657 2658 2659 2660 2661 2662 2663 2664
                                                            tableMeta.rowData[2] === 5 ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
                                                                />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2665
                                                                :
r.kurnia's avatar
r.kurnia committed
2666
                                                                tableMeta.rowData[2] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2667
                                                                    (Number(handleValueFormula(value, tableMeta, 2)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 2)).toFixed(1) <= Number(this.state.maxValue)) ?
r.kurnia's avatar
r.kurnia committed
2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'black'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2682
                                                                            value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698
                                                                        /> :
                                                                        <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{
                                                                                    fontSize: 12,
                                                                                    textAlign: 'right',
                                                                                    borderColor: 'transparent',
                                                                                    margin: 0,
                                                                                    width: 96,
                                                                                    backgroundColor: 'transparent',
                                                                                    color: 'red'
                                                                                }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2699
                                                                                value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2700 2701 2702 2703
                                                                            />
                                                                        </LightTooltip>
                                                                    :
                                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2704 2705 2706 2707
                                        }
                                    </div>
                                </div>
                                <div className="col-3">
rifkaki's avatar
rifkaki committed
2708 2709 2710 2711 2712
                                    <div style={{ textAlign: 'right' }}>
                                        {tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                            null
                                            :
                                            this.state.get_for == 'view'?
r.kurnia's avatar
r.kurnia committed
2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731
                                                tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf.value).toFixed(2) : Number(value.tbf.value).toFixed(1)}
                                                                />
                                                            }
                                                        />
                                                    </div>
                                                    :
                                                    <div style={{ flex: 1 }}>
rifkaki's avatar
rifkaki committed
2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value.tbf}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
                                                            />
                                                        }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2745
                                                    />
rifkaki's avatar
rifkaki committed
2746
                                                </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2747
                                                :
rifkaki's avatar
rifkaki committed
2748 2749 2750 2751 2752 2753 2754 2755 2756 2757
                                                tableMeta.rowData[3] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={value.tbf}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
2758
                                                                    // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2759
                                                                    disabled={this.props.isApprover == true ? true : false}
rifkaki's avatar
rifkaki committed
2760 2761 2762 2763 2764 2765 2766 2767
                                                                    value={Number(value.tbf).toFixed(1)}
                                                                    onBlur={(event) => {
                                                                        // updateValue(event.target.value)
                                                                        handleChange(event.target.value, tableMeta, 2)
                                                                        // console.log(dataTable2)
                                                                    }}
                                                                />
                                                            }
r.kurnia's avatar
r.kurnia committed
2768
                                                        />
rifkaki's avatar
rifkaki committed
2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780
                                                    </div> :
                                                    tableMeta.rowData[3] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleParent(tableMeta, 3)).toFixed(1)}
                                                            />
                                                        </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2781
                                                        :
rifkaki's avatar
rifkaki committed
2782
                                                        tableMeta.rowData[3] === 6 ?
r.kurnia's avatar
r.kurnia committed
2783 2784 2785 2786 2787
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
rifkaki's avatar
rifkaki committed
2788
                                                                disabled={true}
r.kurnia's avatar
r.kurnia committed
2789
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2790
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2791
                                                            :
rifkaki's avatar
rifkaki committed
2792 2793 2794 2795 2796 2797 2798
                                                            tableMeta.rowData[3] === 5 ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={false}
r.kurnia's avatar
r.kurnia committed
2799
                                                                    value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
rifkaki's avatar
rifkaki committed
2800
                                                                />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2801
                                                                :
r.kurnia's avatar
r.kurnia committed
2802
                                                                tableMeta.rowData[3] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2803
                                                                    (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
r.kurnia's avatar
r.kurnia committed
2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'black'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2818
                                                                            value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834
                                                                        /> :
                                                                        <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{
                                                                                    fontSize: 12,
                                                                                    textAlign: 'right',
                                                                                    borderColor: 'transparent',
                                                                                    margin: 0,
                                                                                    width: 96,
                                                                                    backgroundColor: 'transparent',
                                                                                    color: 'red'
                                                                                }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2835
                                                                                value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2836 2837 2838 2839
                                                                            />
                                                                        </LightTooltip>
                                                                    :
                                                                    null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                    )
                }
            }
        },{
            name: `${this.props.periode} Trial Balance (Fiscal)`,
            options: {
                customHeadRender: (columnMeta) => (
r.kurnia's avatar
r.kurnia committed
2852
                    <div  style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 200, borderRight: "1px solid rgb(255, 255, 255)" }} >
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869
                        {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell> */}
                        <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, paddingTop: 8 }}>{columnMeta.name}</div>
                        <div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky", paddingBottom: 20 }}>
                            <div style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
                                <span>{"Trial Balance (Fiscal)"}</span>
                            </div>
                        </div>
                    </div>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div>
                            <div className="content-center">
                                <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
2870 2871 2872
                                    {tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                        null
                                        :
r.kurnia's avatar
r.kurnia committed
2873
                                        this.state.get_for == 'view' ?
rifkaki's avatar
rifkaki committed
2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={tableMeta.rowData[21]}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(tableMeta.rowData[21]).toFixed(2) : Number(tableMeta.rowData[21]).toFixed(1)}
                                                        />
                                                    }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2888
                                                />
rifkaki's avatar
rifkaki committed
2889
                                            </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2890
                                            :
rifkaki's avatar
rifkaki committed
2891 2892 2893 2894 2895 2896 2897 2898 2899 2900
                                            tableMeta.rowData[3] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={value}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
2901
                                                                // placeholder="input"
r.kurnia's avatar
r.kurnia committed
2902
                                                                disabled={this.props.isApprover == true ? true : false}
rifkaki's avatar
rifkaki committed
2903 2904 2905
                                                                value={Number(handleTotal(tableMeta, 3)).toFixed(1)}
                                                            />
                                                        }
r.kurnia's avatar
r.kurnia committed
2906
                                                    />
rifkaki's avatar
rifkaki committed
2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918
                                                </div> :
                                                tableMeta.rowData[3] === 2 ?
                                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(handleTotal(tableMeta, 2)).toFixed(1)}
                                                        />
                                                    </span>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2919
                                                    :
rifkaki's avatar
rifkaki committed
2920
                                                    tableMeta.rowData[3] === 6 ?
r.kurnia's avatar
r.kurnia committed
2921 2922 2923 2924 2925 2926
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
r.kurnia's avatar
r.kurnia committed
2927
                                                            value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleTotal(tableMeta, 6)).toFixed(2) : Number(handleTotal(tableMeta, 6)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2928
                                                        />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2929
                                                        :
rifkaki's avatar
rifkaki committed
2930
                                                        tableMeta.rowData[3] === 5 ?
r.kurnia's avatar
r.kurnia committed
2931 2932 2933 2934 2935 2936
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
r.kurnia's avatar
r.kurnia committed
2937
                                                                value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleTotal(tableMeta, 5)).toFixed(2) : Number(handleTotal(tableMeta, 5)).toFixed(1)}
r.kurnia's avatar
r.kurnia committed
2938
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
2939
                                                            :
r.kurnia's avatar
r.kurnia committed
2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950
                                                            tableMeta.rowData[3] === 7 ? null
                                                                // (Number(handleTotal(tableMeta, 1)) >= Number(this.state.minValue) && Number(handleTotal(tableMeta, 1)) <= Number(this.state.maxValue)) ?
                                                                //     <NumberFormat
                                                                //         thousandSeparator={true}
                                                                //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                //         type="text"
                                                                //         placeholder=""
                                                                //         disabled={true}
                                                                //         value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
                                                                //     /> :
                                                                //     <LightTooltip title={this.state.minValue === null ? `Value Should be 0` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
2951 2952
                                                                //         <NumberFormat
                                                                //             thousandSeparator={true}
r.kurnia's avatar
r.kurnia committed
2953
                                                                //             style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', color: 'red' }}
2954 2955 2956
                                                                //             type="text"
                                                                //             placeholder=""
                                                                //             disabled={true}
r.kurnia's avatar
r.kurnia committed
2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999
                                                                //             value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
                                                                //         />
                                                                //     </LightTooltip> 
                                                                :
                                                                null
                                        // tableMeta.rowData[3] === 7 ?
                                        //     (Number(handleValueFormula(value, tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
                                        //         <NumberFormat
                                        //             thousandSeparator={true}
                                        //             style={{
                                        //                 fontSize: 12,
                                        //                 textAlign: 'right',
                                        //                 borderColor: 'transparent',
                                        //                 margin: 0,
                                        //                 width: 96,
                                        //                 backgroundColor: 'transparent',
                                        //                 color: 'black'
                                        //             }}
                                        //             type="text"
                                        //             placeholder=""
                                        //             disabled={true}
                                        //             value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
                                        //         /> :
                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                        //             <NumberFormat
                                        //                 thousandSeparator={true}
                                        //                 style={{
                                        //                     fontSize: 12,
                                        //                     textAlign: 'right',
                                        //                     borderColor: 'transparent',
                                        //                     margin: 0,
                                        //                     width: 96,
                                        //                     backgroundColor: 'transparent',
                                        //                     color: 'red'
                                        //                 }}
                                        //                 type="text"
                                        //                 placeholder=""
                                        //                 disabled={true}
                                        //                 value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
                                        //             />
                                        //         </LightTooltip>
                                        //     :
                                        //     null
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3000 3001 3002 3003 3004 3005 3006
                                    }
                                </div>
                            </div>
                        </div>
                    )
                }
            }
r.kurnia's avatar
r.kurnia committed
3007 3008 3009 3010 3011 3012 3013 3014 3015 3016
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054
        }
        ]
        const loadingComponent = (
            <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );

        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Outlook Performance Appraisal Submission</Typography>
                </div>
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                {/* {this.state.loading && loadingComponent} */}
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
                    {this.state.visibleTP === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Outlook Performance Appraisal - Tax Planning</Typography>
                            </div>
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
rifkaki's avatar
rifkaki committed
3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124
                                        {this.props.isApprover === true || this.state.get_for == 'view'?
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            </div> :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <a data-tip={'Download Template'} data-for="template">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.downloadTemplate()}
                                                    >
                                                        <img src={Images.template} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Upload'} data-for="upload">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.setState({ visibleUpload: true })}
                                                    >
                                                        <img src={Images.upload} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3125
                                            </div>
rifkaki's avatar
rifkaki committed
3126
                                        }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3127 3128 3129 3130
                                    </div>
                                </div>

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
rifkaki's avatar
rifkaki committed
3131
                                    {this.state.loading && loadingComponent}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3132 3133 3134 3135 3136 3137 3138 3139
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                </div>
Riri Novita's avatar
Riri Novita committed
3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
                                        }
                                    </div>
                                </div>
3153
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171
                            </div>
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
r.kurnia's avatar
r.kurnia committed
3172
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3173 3174 3175
                                        </div>
                                    </button>
                                </div>
r.kurnia's avatar
r.kurnia committed
3176 3177 3178
                                {this.props.isApprover === true ?
                                    <div className="col-2">
                                    </div> :
rifkaki's avatar
rifkaki committed
3179
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
r.kurnia's avatar
r.kurnia committed
3180 3181
                                        {this.state.get_for == 'view' && this.state.viewOnly && 
                                        <button
rifkaki's avatar
rifkaki committed
3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({loading: true}, () => {
                                                    this.handleGetFor('edit')
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
                                            </div>
r.kurnia's avatar
r.kurnia committed
3200 3201
                                        </button>
                                        }
rifkaki's avatar
rifkaki committed
3202
                                        {this.state.get_for == 'edit' && 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                // this.forceUpdate()
                                                this.setState({ loading: true, buttonDraft: false }, () => {
                                                    setTimeout(() => {
                                                        // this.setState({ loading: false, buttonError: false, editable: true })
                                                        this.handleValidate()
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>
rifkaki's avatar
rifkaki committed
3227 3228
                                        }
                                        {this.state.get_for == 'edit' && <button
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3229 3230 3231
                                            className="button"
                                            type="button"
                                            onClick={() => 
rifkaki's avatar
rifkaki committed
3232 3233 3234
                                                this.state.saveDraft === true ?
                                                this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' }) 
                                            :
3235 3236
                                            this.state.handleDoubleClick == 1 ? null :
                                                this.setState({ handleDoubleClick: 1, loading: true }, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3237 3238 3239 3240 3241 3242 3243
                                                    setTimeout(() => {
                                                        this.backToMasterBudget('draft')
                                                    }, 100);
                                                })
                                            }
                                            style={{
                                                backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
3244
                                                cursor: 'pointer',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3245 3246 3247 3248 3249 3250 3251 3252
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
rifkaki's avatar
rifkaki committed
3253 3254
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3255
                                            type="button"
rifkaki's avatar
rifkaki committed
3256 3257 3258 3259 3260
                                            // disabled={this.state.buttonError}
                                            onClick={() => 
                                                this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
                                                    :
3261 3262
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
rifkaki's avatar
rifkaki committed
3263 3264 3265 3266 3267
                                                            setTimeout(() => {
                                                                this.backToMasterBudget('submitted')
                                                            }, 100);
                                                        })
                                            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3268 3269
                                            style={{
                                                backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
3270
                                                cursor: 'pointer',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3271 3272 3273 3274
                                                borderColor: 'transparent',
                                                outline: 'none'
                                            }}
                                        >
rifkaki's avatar
rifkaki committed
3275
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 10 }}>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3276 3277
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
rifkaki's avatar
rifkaki committed
3278
                                        </button>}
r.kurnia's avatar
r.kurnia committed
3279
                                    </div> 
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316
                                }
                            </div>
                        </Paper>
                    :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    {this.state.dataLoaded && (
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
                                            </MuiThemeProvider>
                                        </div>
                                    )}
                                </div>
                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleTP: true }, () => {
                                                setTimeout(() => {
                                                    this.getItemHierarki()
                                                }, 100);
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
r.kurnia's avatar
r.kurnia committed
3317
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3318 3319 3320 3321 3322 3323 3324
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            className="button"
                                            type="button"
syadziy's avatar
syadziy committed
3325
                                            // disabled={this.state.buttonError}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3326 3327
                                            style={{
                                                backgroundColor: 'transparent',
syadziy's avatar
syadziy committed
3328
                                                cursor: 'pointer',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3329 3330 3331 3332 3333
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
syadziy's avatar
syadziy committed
3334
                                                this.setState({ loading: true, buttonDraft: false }, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3335
                                                    setTimeout(() => {
r.kurnia's avatar
r.kurnia committed
3336 3337
                                                        // this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
                                                        this.handleValidate()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
                                            // disabled={this.state.buttonError}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => this.state.editable === true ? 
                                                null
                                                : 
3359 3360
                                                this.state.handleDoubleClick == 1 ? null :
                                                this.setState({handleDoubleClick: 1, loading: true}, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378
                                                    setTimeout(() => {
                                                        this.uploadTP('draft')
                                                    }, 100);
                                                })}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
                                            // disabled={this.state.buttonError}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
r.kurnia's avatar
r.kurnia committed
3379 3380 3381
                                            onClick={() => 
                                                this.state.editable === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3382
                                                : 
3383 3384
                                                this.state.handleDoubleClick == 1 ? null :
                                                this.setState({handleDoubleClick: 1, loading: true}, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428
                                                    setTimeout(() => {
                                                        this.uploadTP('submitted')
                                                    }, 100);
                                                })}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </Paper>
                    }
                </div>
                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
                                    </div>
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
                                acceptedFiles={["xlsx"]}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onUpload={() => {
r.kurnia's avatar
r.kurnia committed
3429
                                    String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
                )}
            </div>
        );
    }
}