TaxPlanningOLPA.js 277 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
            get_for: "view",
55 56 57
            viewOnly: true,
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
58 59 60 61 62 63 64

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

    componentDidMount() {
65 66
        // this.getItemHierarki()
        this.getSettingControl()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
67
        this.lastUpdate()
rifkaki's avatar
rifkaki committed
68
        this.handleViewOnly()
r.kurnia's avatar
r.kurnia committed
69
        console.log(this.props)
rifkaki's avatar
rifkaki committed
70 71 72 73 74 75 76 77 78 79 80 81 82
    }

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

        if (this.props.isApprover) {
            checkApprover = true
        } else {
            checkApprover = false
        }
qorri_di's avatar
qorri_di committed
83

rifkaki's avatar
rifkaki committed
84 85 86 87
        if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
            checkLastStatus = true
        } else {
            checkLastStatus = false
qorri_di's avatar
qorri_di committed
88 89
        }

rifkaki's avatar
rifkaki committed
90 91 92 93 94 95 96 97 98 99 100 101
        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
        }

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

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

113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
    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
132
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
133 134 135 136 137 138 139 140 141 142 143 144 145
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
    }

qorri_di's avatar
qorri_di committed
146
    lastUpdate() {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
147 148 149
        let payload = {
            "outlook_pa_id": this.props.outlook_pa_id,
            "report_id": this.props.report_id,
d.arizona's avatar
d.arizona committed
150
            "get_for": this.state.get_for,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
151 152 153 154 155 156 157 158
            "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
159
                        updateBy: response.data.data.detail === null ? '-' : response.data.data.detail
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
160 161 162 163 164 165 166 167 168 169 170 171
                    })
                }
            }
        })
    }

    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
172 173
            "periode": this.props.periode,
            "company_id": this.props.company.company_id,
174 175
            "get_for": this.state.get_for,
            "currency_id": this.props.defaultCurrency.id
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
176 177
        }
        api.create().getDetailReportOLPA(payload).then(response => {
rifkaki's avatar
rifkaki committed
178 179
            console.log(payload);
            console.log(response);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
180 181
            let dataTable = []
            if (response.data) {
r.kurnia's avatar
r.kurnia committed
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
                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,
197
                                {
Riri Novita's avatar
Riri Novita committed
198 199
                                    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
200
                                },
Riri Novita's avatar
Riri Novita committed
201 202 203 204 205 206
                                { 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 },
207
                                {
Riri Novita's avatar
Riri Novita committed
208 209
                                    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
210
                                },
Riri Novita's avatar
Riri Novita committed
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
                                { 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 },
                                { 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 },
                                // {
                                //     tbc: item.tax_planning.january !== null ? item.tax_planning.january !== "" ? item.tax_planning.january.tbc !== null ? item.tax_planning.january.tbc !== "" ? item.tax_planning.january.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.january !== null ? item.tax_planning.january !== "" ? item.tax_planning.january.fcp !== null ? item.tax_planning.january.fcp !== "" ? item.tax_planning.january.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.january !== null ? item.tax_planning.january !== "" ? item.tax_planning.january.tbf !== null ? item.tax_planning.january.tbf !== "" ? item.tax_planning.january.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.february !== null ? item.tax_planning.february !== "" ? item.tax_planning.february.tbc !== null ? item.tax_planning.february.tbc !== "" ? item.tax_planning.february.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.february !== null ? item.tax_planning.february !== "" ? item.tax_planning.february.fcp !== null ? item.tax_planning.february.fcp !== "" ? item.tax_planning.february.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.february !== null ? item.tax_planning.february !== "" ? item.tax_planning.february.tbf !== null ? item.tax_planning.february.tbf !== "" ? item.tax_planning.february.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.march !== null ? item.tax_planning.march !== "" ? item.tax_planning.march.tbc !== null ? item.tax_planning.march.tbc !== "" ? item.tax_planning.march.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.march !== null ? item.tax_planning.march !== "" ? item.tax_planning.march.fcp !== null ? item.tax_planning.march.fcp !== "" ? item.tax_planning.march.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.march !== null ? item.tax_planning.march !== "" ? item.tax_planning.march.tbf !== null ? item.tax_planning.march.tbf !== "" ? item.tax_planning.march.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.april !== null ? item.tax_planning.april !== "" ? item.tax_planning.april.tbc !== null ? item.tax_planning.april.tbc !== "" ? item.tax_planning.april.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.april !== null ? item.tax_planning.april !== "" ? item.tax_planning.april.fcp !== null ? item.tax_planning.april.fcp !== "" ? item.tax_planning.april.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.april !== null ? item.tax_planning.april !== "" ? item.tax_planning.april.tbf !== null ? item.tax_planning.april.tbf !== "" ? item.tax_planning.april.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.may !== null ? item.tax_planning.may !== "" ? item.tax_planning.may.tbc !== null ? item.tax_planning.may.tbc !== "" ? item.tax_planning.may.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.may !== null ? item.tax_planning.may !== "" ? item.tax_planning.may.fcp !== null ? item.tax_planning.may.fcp !== "" ? item.tax_planning.may.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.may !== null ? item.tax_planning.may !== "" ? item.tax_planning.may.tbf !== null ? item.tax_planning.may.tbf !== "" ? item.tax_planning.may.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.june !== null ? item.tax_planning.june !== "" ? item.tax_planning.june.tbc !== null ? item.tax_planning.june.tbc !== "" ? item.tax_planning.june.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.june !== null ? item.tax_planning.june !== "" ? item.tax_planning.june.fcp !== null ? item.tax_planning.june.fcp !== "" ? item.tax_planning.june.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.june !== null ? item.tax_planning.june !== "" ? item.tax_planning.june.tbf !== null ? item.tax_planning.june.tbf !== "" ? item.tax_planning.june.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.july !== null ? item.tax_planning.july !== "" ? item.tax_planning.july.tbc !== null ? item.tax_planning.july.tbc !== "" ? item.tax_planning.july.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.july !== null ? item.tax_planning.july !== "" ? item.tax_planning.july.fcp !== null ? item.tax_planning.july.fcp !== "" ? item.tax_planning.july.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.july !== null ? item.tax_planning.july !== "" ? item.tax_planning.july.tbf !== null ? item.tax_planning.july.tbf !== "" ? item.tax_planning.july.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.august !== null ? item.tax_planning.august !== "" ? item.tax_planning.august.tbc !== null ? item.tax_planning.august.tbc !== "" ? item.tax_planning.august.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.august !== null ? item.tax_planning.august !== "" ? item.tax_planning.august.fcp !== null ? item.tax_planning.august.fcp !== "" ? item.tax_planning.august.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.august !== null ? item.tax_planning.august !== "" ? item.tax_planning.august.tbf !== null ? item.tax_planning.august.tbf !== "" ? item.tax_planning.august.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.september !== null ? item.tax_planning.september !== "" ? item.tax_planning.september.tbc !== null ? item.tax_planning.september.tbc !== "" ? item.tax_planning.september.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.september !== null ? item.tax_planning.september !== "" ? item.tax_planning.september.fcp !== null ? item.tax_planning.september.fcp !== "" ? item.tax_planning.september.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.september !== null ? item.tax_planning.september !== "" ? item.tax_planning.september.tbf !== null ? item.tax_planning.september.tbf !== "" ? item.tax_planning.september.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: item.tax_planning.october !== null ? item.tax_planning.october !== "" ? item.tax_planning.october.tbc !== null ? item.tax_planning.october.tbc !== "" ? item.tax_planning.october.tbc : "0" : "0" : "0" : "0",
                                //     fcp: item.tax_planning.october !== null ? item.tax_planning.october !== "" ? item.tax_planning.october.fcp !== null ? item.tax_planning.october.fcp !== "" ? item.tax_planning.october.fcp : "0" : "0" : "0" : "0",
                                //     tbf: item.tax_planning.october !== null ? item.tax_planning.october !== "" ? item.tax_planning.october.tbf !== null ? item.tax_planning.october.tbf !== "" ? item.tax_planning.october.tbf : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: this.props.status === 'CLOSED' ? item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbc !== null ? item.tax_planning.november.tbc !== "" ? Number(item.tax_planning.november.tbc).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbc !== null ? item.tax_planning.november.tbc !== "" ? Number(item.tax_planning.november.tbc).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.november_formula } : item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbc !== null ? item.tax_planning.november.tbc !== "" ? Number(item.tax_planning.november.tbc).toFixed(1) : "0" : "0" : "0" : "0",
                                //     fcp: this.props.status === 'CLOSED' ? item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.fcp !== null ? item.tax_planning.november.fcp !== "" ? Number(item.tax_planning.november.fcp).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.fcp !== null ? item.tax_planning.november.fcp !== "" ? Number(item.tax_planning.november.fcp).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.november_formula } : item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.fcp !== null ? item.tax_planning.november.fcp !== "" ? Number(item.tax_planning.november.fcp).toFixed(1) : "0" : "0" : "0" : "0",
                                //     tbf: this.props.status === 'CLOSED' ? item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbf !== null ? item.tax_planning.november.tbf !== "" ? Number(item.tax_planning.november.tbf).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbf !== null ? item.tax_planning.november.tbf !== "" ? Number(item.tax_planning.november.tbf).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.november_formula } : item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbf !== null ? item.tax_planning.november.tbf !== "" ? Number(item.tax_planning.november.tbf).toFixed(1) : "0" : "0" : "0" : "0"
                                // },
                                // {
                                //     tbc: this.props.status === 'CLOSED' ? item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbc !== null ? item.tax_planning.december.tbc !== "" ? Number(item.tax_planning.december.tbc).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbc !== null ? item.tax_planning.december.tbc !== "" ? Number(item.tax_planning.december.tbc).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.december_formula } : item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbc !== null ? item.tax_planning.december.tbc !== "" ? Number(item.tax_planning.december.tbc).toFixed(1) : "0" : "0" : "0" : "0",
                                //     fcp: this.props.status === 'CLOSED' ? item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.fcp !== null ? item.tax_planning.december.fcp !== "" ? Number(item.tax_planning.december.fcp).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.fcp !== null ? item.tax_planning.december.fcp !== "" ? Number(item.tax_planning.december.fcp).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.december_formula } : item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.fcp !== null ? item.tax_planning.december.fcp !== "" ? Number(item.tax_planning.december.fcp).toFixed(1) : "0" : "0" : "0" : "0",
                                //     tbf: this.props.status === 'CLOSED' ? item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbf !== null ? item.tax_planning.december.tbf !== "" ? Number(item.tax_planning.december.tbf).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbf !== null ? item.tax_planning.december.tbf !== "" ? Number(item.tax_planning.december.tbf).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.december_formula } : item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbf !== null ? item.tax_planning.december.tbf !== "" ? Number(item.tax_planning.december.tbf).toFixed(1) : "0" : "0" : "0" : "0"
                                // },
r.kurnia's avatar
r.kurnia committed
275
                                item.tax_planning.total_current_year,
rifkaki's avatar
rifkaki committed
276 277
                                0,
                                0,
r.kurnia's avatar
r.kurnia committed
278
                                item.order,
r.kurnia's avatar
r.kurnia committed
279 280
                                { 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
281 282 283 284 285 286 287 288
                            ])
                        }
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
qorri_di's avatar
qorri_di committed
289
                        }
r.kurnia's avatar
r.kurnia committed
290 291
                    }
                    res.map((item, index) => {
qorri_di's avatar
qorri_di committed
292
                        dataTable.push([
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
293 294 295 296 297 298
                            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
299
                            { 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
300 301
                            item.level,
                            item.description,
302
                            {
Riri Novita's avatar
Riri Novita committed
303 304
                                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
305
                            },
Riri Novita's avatar
Riri Novita committed
306 307 308 309 310 311
                            { 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 },
312
                            {
Riri Novita's avatar
Riri Novita committed
313 314
                                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
315
                            },
Riri Novita's avatar
Riri Novita committed
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
                            { 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 },
                            { 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 },
                            // {
                            //     tbc: item.tax_planning.january !== null ? item.tax_planning.january !== "" ? item.tax_planning.january.tbc !== null ? item.tax_planning.january.tbc !== "" ? item.tax_planning.january.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.january !== null ? item.tax_planning.january !== "" ? item.tax_planning.january.fcp !== null ? item.tax_planning.january.fcp !== "" ? item.tax_planning.january.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.january !== null ? item.tax_planning.january !== "" ? item.tax_planning.january.tbf !== null ? item.tax_planning.january.tbf !== "" ? item.tax_planning.january.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.february !== null ? item.tax_planning.february !== "" ? item.tax_planning.february.tbc !== null ? item.tax_planning.february.tbc !== "" ? item.tax_planning.february.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.february !== null ? item.tax_planning.february !== "" ? item.tax_planning.february.fcp !== null ? item.tax_planning.february.fcp !== "" ? item.tax_planning.february.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.february !== null ? item.tax_planning.february !== "" ? item.tax_planning.february.tbf !== null ? item.tax_planning.february.tbf !== "" ? item.tax_planning.february.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.march !== null ? item.tax_planning.march !== "" ? item.tax_planning.march.tbc !== null ? item.tax_planning.march.tbc !== "" ? item.tax_planning.march.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.march !== null ? item.tax_planning.march !== "" ? item.tax_planning.march.fcp !== null ? item.tax_planning.march.fcp !== "" ? item.tax_planning.march.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.march !== null ? item.tax_planning.march !== "" ? item.tax_planning.march.tbf !== null ? item.tax_planning.march.tbf !== "" ? item.tax_planning.march.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.april !== null ? item.tax_planning.april !== "" ? item.tax_planning.april.tbc !== null ? item.tax_planning.april.tbc !== "" ? item.tax_planning.april.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.april !== null ? item.tax_planning.april !== "" ? item.tax_planning.april.fcp !== null ? item.tax_planning.april.fcp !== "" ? item.tax_planning.april.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.april !== null ? item.tax_planning.april !== "" ? item.tax_planning.april.tbf !== null ? item.tax_planning.april.tbf !== "" ? item.tax_planning.april.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.may !== null ? item.tax_planning.may !== "" ? item.tax_planning.may.tbc !== null ? item.tax_planning.may.tbc !== "" ? item.tax_planning.may.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.may !== null ? item.tax_planning.may !== "" ? item.tax_planning.may.fcp !== null ? item.tax_planning.may.fcp !== "" ? item.tax_planning.may.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.may !== null ? item.tax_planning.may !== "" ? item.tax_planning.may.tbf !== null ? item.tax_planning.may.tbf !== "" ? item.tax_planning.may.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.june !== null ? item.tax_planning.june !== "" ? item.tax_planning.june.tbc !== null ? item.tax_planning.june.tbc !== "" ? item.tax_planning.june.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.june !== null ? item.tax_planning.june !== "" ? item.tax_planning.june.fcp !== null ? item.tax_planning.june.fcp !== "" ? item.tax_planning.june.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.june !== null ? item.tax_planning.june !== "" ? item.tax_planning.june.tbf !== null ? item.tax_planning.june.tbf !== "" ? item.tax_planning.june.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.july !== null ? item.tax_planning.july !== "" ? item.tax_planning.july.tbc !== null ? item.tax_planning.july.tbc !== "" ? item.tax_planning.july.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.july !== null ? item.tax_planning.july !== "" ? item.tax_planning.july.fcp !== null ? item.tax_planning.july.fcp !== "" ? item.tax_planning.july.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.july !== null ? item.tax_planning.july !== "" ? item.tax_planning.july.tbf !== null ? item.tax_planning.july.tbf !== "" ? item.tax_planning.july.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.august !== null ? item.tax_planning.august !== "" ? item.tax_planning.august.tbc !== null ? item.tax_planning.august.tbc !== "" ? item.tax_planning.august.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.august !== null ? item.tax_planning.august !== "" ? item.tax_planning.august.fcp !== null ? item.tax_planning.august.fcp !== "" ? item.tax_planning.august.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.august !== null ? item.tax_planning.august !== "" ? item.tax_planning.august.tbf !== null ? item.tax_planning.august.tbf !== "" ? item.tax_planning.august.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.september !== null ? item.tax_planning.september !== "" ? item.tax_planning.september.tbc !== null ? item.tax_planning.september.tbc !== "" ? item.tax_planning.september.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.september !== null ? item.tax_planning.september !== "" ? item.tax_planning.september.fcp !== null ? item.tax_planning.september.fcp !== "" ? item.tax_planning.september.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.september !== null ? item.tax_planning.september !== "" ? item.tax_planning.september.tbf !== null ? item.tax_planning.september.tbf !== "" ? item.tax_planning.september.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: item.tax_planning.october !== null ? item.tax_planning.october !== "" ? item.tax_planning.october.tbc !== null ? item.tax_planning.october.tbc !== "" ? item.tax_planning.october.tbc : "0" : "0" : "0" : "0",
                            //     fcp: item.tax_planning.october !== null ? item.tax_planning.october !== "" ? item.tax_planning.october.fcp !== null ? item.tax_planning.october.fcp !== "" ? item.tax_planning.october.fcp : "0" : "0" : "0" : "0",
                            //     tbf: item.tax_planning.october !== null ? item.tax_planning.october !== "" ? item.tax_planning.october.tbf !== null ? item.tax_planning.october.tbf !== "" ? item.tax_planning.october.tbf : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: this.props.status === 'CLOSED' ? item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbc !== null ? item.tax_planning.november.tbc !== "" ? Number(item.tax_planning.november.tbc).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbc !== null ? item.tax_planning.november.tbc !== "" ? Number(item.tax_planning.november.tbc).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.november_formula } : item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbc !== null ? item.tax_planning.november.tbc !== "" ? Number(item.tax_planning.november.tbc).toFixed(1) : "0" : "0" : "0" : "0",
                            //     fcp: this.props.status === 'CLOSED' ? item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.fcp !== null ? item.tax_planning.november.fcp !== "" ? Number(item.tax_planning.november.fcp).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.fcp !== null ? item.tax_planning.november.fcp !== "" ? Number(item.tax_planning.november.fcp).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.november_formula } : item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.fcp !== null ? item.tax_planning.november.fcp !== "" ? Number(item.tax_planning.november.fcp).toFixed(1) : "0" : "0" : "0" : "0",
                            //     tbf: this.props.status === 'CLOSED' ? item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbf !== null ? item.tax_planning.november.tbf !== "" ? Number(item.tax_planning.november.tbf).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbf !== null ? item.tax_planning.november.tbf !== "" ? Number(item.tax_planning.november.tbf).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.november_formula } : item.tax_planning.november !== null ? item.tax_planning.november !== "" ? item.tax_planning.november.tbf !== null ? item.tax_planning.november.tbf !== "" ? Number(item.tax_planning.november.tbf).toFixed(1) : "0" : "0" : "0" : "0"
                            // },
                            // {
                            //     tbc: this.props.status === 'CLOSED' ? item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbc !== null ? item.tax_planning.december.tbc !== "" ? Number(item.tax_planning.december.tbc).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbc !== null ? item.tax_planning.december.tbc !== "" ? Number(item.tax_planning.december.tbc).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.december_formula } : item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbc !== null ? item.tax_planning.december.tbc !== "" ? Number(item.tax_planning.december.tbc).toFixed(1) : "0" : "0" : "0" : "0",
                            //     fcp: this.props.status === 'CLOSED' ? item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.fcp !== null ? item.tax_planning.december.fcp !== "" ? Number(item.tax_planning.december.fcp).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.fcp !== null ? item.tax_planning.december.fcp !== "" ? Number(item.tax_planning.december.fcp).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.december_formula } : item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.fcp !== null ? item.tax_planning.december.fcp !== "" ? Number(item.tax_planning.december.fcp).toFixed(1) : "0" : "0" : "0" : "0",
                            //     tbf: this.props.status === 'CLOSED' ? item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbf !== null ? item.tax_planning.december.tbf !== "" ? Number(item.tax_planning.december.tbf).toFixed(1) : "0" : "0" : "0" : "0" : 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 !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbf !== null ? item.tax_planning.december.tbf !== "" ? Number(item.tax_planning.december.tbf).toFixed(1) : "0" : "0" : "0" : "0", formula: item.tax_planning.december_formula } : item.tax_planning.december !== null ? item.tax_planning.december !== "" ? item.tax_planning.december.tbf !== null ? item.tax_planning.december.tbf !== "" ? Number(item.tax_planning.december.tbf).toFixed(1) : "0" : "0" : "0" : "0"
                            // },
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
380
                            item.tax_planning.total_current_year,
rifkaki's avatar
rifkaki committed
381 382
                            0,
                            0,
r.kurnia's avatar
r.kurnia committed
383
                            item.order,
r.kurnia's avatar
r.kurnia committed
384 385
                            { 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
386
                        ])
r.kurnia's avatar
r.kurnia committed
387 388 389 390 391 392
                        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
393
                        }
r.kurnia's avatar
r.kurnia committed
394
                    })
r.kurnia's avatar
r.kurnia committed
395
                    this.setState({ dataTable, loading: false, buttonError: false, editable: true })
r.kurnia's avatar
r.kurnia committed
396 397
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
398
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
r.kurnia's avatar
r.kurnia committed
399 400 401 402
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
403
                        }
r.kurnia's avatar
r.kurnia committed
404 405
                    })
                }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
406
            } else {
qorri_di's avatar
qorri_di committed
407
                this.setState({ dataTable, loading: false, buttonError: true, editable: true })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
408
            }
rifkaki's avatar
rifkaki committed
409
            console.log(dataTable)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
        })
    }

    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
451 452
                    // tbc: String(Number(i[9].tbc).toFixed(1)),
                    // fcp: String(Number(i[9].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
453
                    tbf: String(Number(i[9].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
454 455
                },
                february: {
rifkaki's avatar
rifkaki committed
456 457
                    // tbc: String(Number(i[10].tbc).toFixed(1)),
                    // fcp: String(Number(i[10].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
458
                    tbf: String(Number(i[10].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
459 460
                },
                march: {
rifkaki's avatar
rifkaki committed
461 462
                    // tbc: String(Number(i[11].tbc).toFixed(1)),
                    // fcp: String(Number(i[11].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
463
                    tbf: String(Number(i[11].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
464 465
                },
                april: {
rifkaki's avatar
rifkaki committed
466 467
                    // tbc: String(Number(i[12].tbc).toFixed(1)),
                    // fcp: String(Number(i[12].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
468
                    tbf: String(Number(i[12].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
469 470
                },
                may: {
rifkaki's avatar
rifkaki committed
471 472
                    // tbc: String(Number(i[13].tbc).toFixed(1)),
                    // fcp: String(Number(i[13].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
473
                    tbf: String(Number(i[13].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
474 475
                },
                june: {
rifkaki's avatar
rifkaki committed
476 477
                    // tbc: String(Number(i[14].tbc).toFixed(1)),
                    // fcp: String(Number(i[14].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
478
                    tbf: String(Number(i[14].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
479 480
                },
                july: {
rifkaki's avatar
rifkaki committed
481 482
                    // tbc: String(Number(i[15].tbc).toFixed(1)),
                    // fcp: String(Number(i[15].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
483
                    tbf: String(Number(i[15].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
484 485
                },
                august: {
rifkaki's avatar
rifkaki committed
486 487
                    // tbc: String(Number(i[16].tbc).toFixed(1)),
                    // fcp: String(Number(i[16].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
488
                    tbf: String(Number(i[16].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
489 490
                },
                september: {
rifkaki's avatar
rifkaki committed
491 492
                    // tbc: String(Number(i[17].tbc).toFixed(1)),
                    // fcp: String(Number(i[17].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
493
                    tbf: String(Number(i[17].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
494 495
                },
                october: {
rifkaki's avatar
rifkaki committed
496 497
                    // tbc: String(Number(i[18].tbc).toFixed(1)),
                    // fcp: String(Number(i[18].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
498
                    tbf: String(Number(i[18].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
499 500
                },
                november: {
r.kurnia's avatar
r.kurnia committed
501 502 503
                    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
504 505
                },
                december: {
r.kurnia's avatar
r.kurnia committed
506 507 508
                    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
509
                },
Deni Rinaldi's avatar
Deni Rinaldi committed
510
                total_current_year: String(Number(i[21]).toFixed(1)),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
511 512 513 514 515 516 517 518
            })
        })
        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,
519
            "currency_id": this.props.defaultCurrency.id,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
520 521
            "tax_planning": data
        }
rifkaki's avatar
rifkaki committed
522
        console.log(payload);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
523 524
        // console.log(JSON.stringify(payload));
        // this.setState({ loading: false })
Riri Novita's avatar
Riri Novita committed
525 526 527 528 529 530 531
        if (type == 'submitted') {
            this.props.saveToOLPA(payload, 'TP')
        } else {
            this.props.saveToOLPA(payload)
        }
        // this.props.saveToOLPA(payload)
        // this.props.onClickClose()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
532 533 534 535 536
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
rifkaki's avatar
rifkaki committed
537
            console.log(resp)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
538
            if (err) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
539
                // console.log(err);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
540 541 542
            }
            else {
                let isi = resp.rows.slice(4)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
543 544
                // console.log(resp.rows[2]);
                // console.log(resp.rows);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
545 546 547 548 549 550 551 552
                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
553 554 555
                                // 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
556 557
                            },
                            february: {
rifkaki's avatar
rifkaki committed
558 559 560
                                // 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
561 562
                            },
                            march: {
rifkaki's avatar
rifkaki committed
563 564 565
                                // 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
566 567
                            },
                            april: {
rifkaki's avatar
rifkaki committed
568 569 570
                                // 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
571 572
                            },
                            may: {
rifkaki's avatar
rifkaki committed
573 574 575
                                // 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
576 577
                            },
                            june: {
rifkaki's avatar
rifkaki committed
578 579 580
                                // 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
581 582
                            },
                            july: {
rifkaki's avatar
rifkaki committed
583 584 585
                                // 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
586 587
                            },
                            august: {
rifkaki's avatar
rifkaki committed
588 589 590
                                // 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
591 592
                            },
                            september: {
rifkaki's avatar
rifkaki committed
593 594 595
                                // 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
596 597
                            },
                            october: {
rifkaki's avatar
rifkaki committed
598 599 600
                                // 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
601 602
                            },
                            november: {
rifkaki's avatar
rifkaki committed
603 604 605
                                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
606 607
                            },
                            december: {
rifkaki's avatar
rifkaki committed
608 609 610
                                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
611
                            },
rifkaki's avatar
rifkaki committed
612
                            total_current_year: i[18] === undefined ? "" : String(i[18]).trim(),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
613
                            total_next_year: {
rifkaki's avatar
rifkaki committed
614 615 616
                                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
617 618
                            },
                            total_more_year: {
rifkaki's avatar
rifkaki committed
619 620 621
                                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
622 623 624 625 626 627 628 629 630 631 632
                            }
                        })
                    }
                })
                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
633
                // console.log(this.state.judulColumn)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
634 635 636 637 638
            }
        });
    }

    checkUpload() {
639 640 641 642 643
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
        api.create().checkUploadOLPA(payload).then(response => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
644
            // console.log(JSON.stringify(this.state.payload));
r.kurnia's avatar
r.kurnia committed
645
            console.log(response)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
646 647 648 649 650 651 652
            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,
qorri_di's avatar
qorri_di committed
653 654
                            Number(item.type_report_id.tbc),
                            Number(item.type_report_id.fcp),
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
655 656 657 658 659 660 661
                            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,
qorri_di's avatar
qorri_di committed
662 663 664
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
665 666
                                tbf: Number(item.type_report_id.tbf) === 3 && item.january.tbf === "" ? "0" : item.january.tbf
                            },
qorri_di's avatar
qorri_di committed
667 668
                            {
                                tbc: 0,
rifkaki's avatar
rifkaki committed
669
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
670 671
                                tbf: Number(item.type_report_id.tbf) === 3 && item.february.tbf === "" ? "0" : item.february.tbf
                            },
qorri_di's avatar
qorri_di committed
672 673 674
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
675 676
                                tbf: Number(item.type_report_id.tbf) === 3 && item.march.tbf === "" ? "0" : item.march.tbf
                            },
qorri_di's avatar
qorri_di committed
677 678 679
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
680 681
                                tbf: Number(item.type_report_id.tbf) === 3 && item.april.tbf === "" ? "0" : item.april.tbf
                            },
qorri_di's avatar
qorri_di committed
682 683 684
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
685 686
                                tbf: Number(item.type_report_id.tbf) === 3 && item.may.tbf === "" ? "0" : item.may.tbf
                            },
qorri_di's avatar
qorri_di committed
687 688 689
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
690 691
                                tbf: Number(item.type_report_id.tbf) === 3 && item.june.tbf === "" ? "0" : item.june.tbf
                            },
qorri_di's avatar
qorri_di committed
692 693 694
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
695 696
                                tbf: Number(item.type_report_id.tbf) === 3 && item.july.tbf === "" ? "0" : item.july.tbf
                            },
qorri_di's avatar
qorri_di committed
697 698 699
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
700 701
                                tbf: Number(item.type_report_id.tbf) === 3 && item.august.tbf === "" ? "0" : item.august.tbf
                            },
qorri_di's avatar
qorri_di committed
702 703 704
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
705 706
                                tbf: Number(item.type_report_id.tbf) === 3 && item.september.tbf === "" ? "0" : item.september.tbf
                            },
qorri_di's avatar
qorri_di committed
707 708 709
                            {
                                tbc: 0,
                                fcp: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
710 711
                                tbf: Number(item.type_report_id.tbf) === 3 && item.october.tbf === "" ? "0" : item.october.tbf
                            },
qorri_di's avatar
qorri_di committed
712 713 714
                            {
                                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),
syadziy's avatar
syadziy committed
715
                                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
716
                            },
qorri_di's avatar
qorri_di committed
717 718 719
                            {
                                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),
syadziy's avatar
syadziy committed
720
                                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
721 722
                            },
                            item.total_current_year,
rifkaki's avatar
rifkaki committed
723 724
                            0,
                            0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
725 726 727 728 729
                            item.orders,
                            item.error
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
rifkaki's avatar
rifkaki committed
730 731 732 733 734 735
                        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
736
                        console.log(this.state.dataTable);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
737
                    })
Riri Novita's avatar
Riri Novita committed
738 739
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
740
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
741 742 743 744 745 746
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
747 748 749 750 751 752 753 754 755 756 757
                }
            }
        })
    }

    uploadTP(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[4],
                january: {
rifkaki's avatar
rifkaki committed
758 759
                    // tbc: String(Number(i[9].tbc).toFixed(1)),
                    // fcp: String(Number(i[9].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
760
                    tbf: String(Number(i[9].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
761 762
                },
                february: {
rifkaki's avatar
rifkaki committed
763 764
                    // tbc: String(Number(i[10].tbc).toFixed(1)),
                    // fcp: String(Number(i[10].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
765
                    tbf: String(Number(i[10].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
766 767
                },
                march: {
rifkaki's avatar
rifkaki committed
768 769
                    // tbc: String(Number(i[11].tbc).toFixed(1)),
                    // fcp: String(Number(i[11].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
770
                    tbf: String(Number(i[11].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
771 772
                },
                april: {
rifkaki's avatar
rifkaki committed
773 774
                    // tbc: String(Number(i[12].tbc).toFixed(1)),
                    // fcp: String(Number(i[12].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
775
                    tbf: String(Number(i[12].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
776 777
                },
                may: {
rifkaki's avatar
rifkaki committed
778 779
                    // tbc: String(Number(i[13].tbc).toFixed(1)),
                    // fcp: String(Number(i[13].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
780
                    tbf: String(Number(i[13].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
781 782
                },
                june: {
rifkaki's avatar
rifkaki committed
783 784
                    // tbc: String(Number(i[14].tbc).toFixed(1)),
                    // fcp: String(Number(i[14].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
785
                    tbf: String(Number(i[14].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
786 787
                },
                july: {
rifkaki's avatar
rifkaki committed
788 789
                    // tbc: String(Number(i[15].tbc).toFixed(1)),
                    // fcp: String(Number(i[15].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
790
                    tbf: String(Number(i[15].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
791 792
                },
                august: {
rifkaki's avatar
rifkaki committed
793 794
                    // tbc: String(Number(i[16].tbc).toFixed(1)),
                    // fcp: String(Number(i[16].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
795
                    tbf: String(Number(i[16].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
796 797
                },
                september: {
rifkaki's avatar
rifkaki committed
798 799
                    // tbc: String(Number(i[17].tbc).toFixed(1)),
                    // fcp: String(Number(i[17].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
800
                    tbf: String(Number(i[17].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
801 802
                },
                october: {
rifkaki's avatar
rifkaki committed
803 804
                    // tbc: String(Number(i[18].tbc).toFixed(1)),
                    // fcp: String(Number(i[18].fcp).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
805
                    tbf: String(Number(i[18].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
806 807
                },
                november: {
Deni Rinaldi's avatar
Deni Rinaldi committed
808
                    tbc: String(Number(i[19].tbc).toFixed(1)),
r.kurnia's avatar
r.kurnia committed
809
                    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
810
                    tbf: String(Number(i[19].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
811 812
                },
                december: {
Deni Rinaldi's avatar
Deni Rinaldi committed
813
                    tbc: String(Number(i[20].tbc).toFixed(1)),
r.kurnia's avatar
r.kurnia committed
814
                    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
815
                    tbf: String(Number(i[20].tbf).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
816
                },
rifkaki's avatar
rifkaki committed
817
                total_current_year: String(Number(i[21]).toFixed(1))
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
818 819 820 821 822 823 824
            })
        })
        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,
825
            currency_id: this.state.defaultCurrencyUpload?.id,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
826 827 828 829 830
            tax_planning: data,
            status: type
        }
        // console.log(data);
        api.create('UPLOAD').uploadOLPA(body).then(response => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
831
            // console.log(response);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
832 833 834 835 836
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
r.kurnia's avatar
r.kurnia committed
837
                    // this.setState({ alert: true, messageAlert: response.data.status, tipeAlert: 'error', loading: false })
838
                    this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
839
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
r.kurnia's avatar
r.kurnia committed
840 841 842 843 844 845
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
846 847
                }
            } else {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
848
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
849 850 851 852 853 854
            }
        })
    }

    handleValidate() {
        let data = []
855 856
        let errorContrl = this.state.buttonError
        let editAble = this.state.editAble
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
857
        // console.log(this.state.dataTable)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
858
        this.state.dataTable.map(i => {
qorri_di's avatar
qorri_di committed
859
            // console.log(i[0])
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912
            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
913 914 915
                    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
916 917
                },
                december: {
r.kurnia's avatar
r.kurnia committed
918 919 920
                    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
921 922
                },
                total_current_year: i[2] === 3 && i[21] === "" ? "0" : String(i[21]),
r.kurnia's avatar
r.kurnia committed
923 924 925 926 927 928 929 930 931 932
                // 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
933

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
934
            })
935 936 937

            if (String(i[8]) == "Control (should be nil)") {
                this.setState({ loading: true })
r.kurnia's avatar
r.kurnia committed
938
                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))) {
939 940
                    errorContrl = true
                    editAble = true
qorri_di's avatar
qorri_di committed
941
                }
942 943 944 945 946
                else {
                    errorContrl = false
                    editAble = false
                }
            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
947
        })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
948
        // console.log(JSON.stringify(data))
r.kurnia's avatar
r.kurnia committed
949 950 951 952 953 954 955 956 957 958 959 960 961
        // 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") {
qorri_di's avatar
qorri_di committed
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
        // if (response.data.data.result && errorContrl === false && editAble === false ) {
        if (errorContrl === false && editAble === false) {
            this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
        } else {
            this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
            console.log("masuk button error")
        }
        //     } 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 })
        // }
r.kurnia's avatar
r.kurnia committed
982
        // })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
983 984 985 986
    }

    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
987
            `${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
988 989
        )
        res = await res.blob()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
990
        // console.log(res)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
991 992 993 994 995 996 997 998 999 1000
        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
1001 1002
        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}`
1003
        console.log(url);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
        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
1024 1025 1026
        let dataFormula = []
        let id = 0
        let double = false
qorri_di's avatar
qorri_di committed
1027

r.kurnia's avatar
r.kurnia committed
1028
        const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
r.kurnia's avatar
r.kurnia committed
1029
            // console.log(xntd)
r.kurnia's avatar
r.kurnia committed
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
            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
1048 1049 1050 1051 1052 1053
            // console.log(baru);

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

r.kurnia's avatar
r.kurnia committed
1054
            if (tableMeta.rowData[8] == "Under payment  /(Over Payment ) Income Tax Art.  29" || forecast !== undefined) {
r.kurnia's avatar
r.kurnia committed
1055 1056
                // form.replace("(", "")
                // form.replace(")", "")
r.kurnia's avatar
r.kurnia committed
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080
                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
1081
                                // console.log(splitform)
r.kurnia's avatar
r.kurnia committed
1082
                                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
1083 1084 1085 1086
                                // console.log(data)
                                // if(value == null){
                                //     console.log(tableMeta);
                                // }
r.kurnia's avatar
r.kurnia committed
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107
                                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
1108 1109 1110 1111 1112 1113
                            } else {
                                // console.log(value);
                                // if(value == null){
                                //     console.log(tableMeta);
                                // }
                                let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
qorri_di's avatar
qorri_di committed
1114
                                console.log(data);
1115 1116 1117 1118 1119 1120
                                if (data.formula) {
                                    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
1121 1122
                                }
                            }
r.kurnia's avatar
r.kurnia committed
1123 1124 1125 1126 1127 1128 1129
                        }
                    } 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
1130
                                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
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 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 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
                                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
1234
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1235
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
1236
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1237 1238 1239
                }
            } else if (dex == 2) {
                if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) {
Deni Rinaldi's avatar
Deni Rinaldi committed
1240
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1241
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
1242
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1243
                }
r.kurnia's avatar
r.kurnia committed
1244 1245 1246 1247 1248 1249 1250 1251 1252
            } 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
1253
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1254
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
1255
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1)
r.kurnia's avatar
r.kurnia committed
1256
                }
r.kurnia's avatar
r.kurnia committed
1257 1258 1259 1260 1261 1262
            } 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
1263 1264
            }

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

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
        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
1280
                if (indexChilds == 0) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1281 1282
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val)
                }
r.kurnia's avatar
r.kurnia committed
1283
                else if (indexChilds == 1) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1284 1285
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val)
                }
r.kurnia's avatar
r.kurnia committed
1286
                else if (indexChilds == 2) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1287 1288 1289 1290
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val)
                }
            }
        }
r.kurnia's avatar
r.kurnia committed
1291

r.kurnia's avatar
r.kurnia committed
1292
        const handleTotal = (tableMeta, dex, periode) => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
1293
            let total = 0
r.kurnia's avatar
r.kurnia committed
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309
            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
1310 1311 1312 1313 1314 1315 1316 1317
                        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
1318 1319
                            let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
                            total += Number(valItem)
r.kurnia's avatar
r.kurnia committed
1320
                        }
r.kurnia's avatar
r.kurnia committed
1321 1322 1323
                    }
                })
            }
r.kurnia's avatar
r.kurnia committed
1324
            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
1325 1326
            return total
        }
r.kurnia's avatar
r.kurnia committed
1327 1328 1329 1330 1331 1332 1333 1334 1335

        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 ?
qorri_di's avatar
qorri_di committed
1336 1337 1338
                            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)
r.kurnia's avatar
r.kurnia committed
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353
                        )
                    )
                }
            })

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

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3028 3029 3030 3031 3032 3033 3034
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div>
                            <div className="content-center">
                                <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
3035 3036 3037
                                    {tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
                                        null
                                        :
r.kurnia's avatar
r.kurnia committed
3038
                                        this.state.get_for == 'view' ?
rifkaki's avatar
rifkaki committed
3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052
                                            <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
3053
                                                />
rifkaki's avatar
rifkaki committed
3054
                                            </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3055
                                            :
rifkaki's avatar
rifkaki committed
3056 3057 3058 3059 3060 3061 3062 3063 3064 3065
                                            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"
3066
                                                                // placeholder="input"
r.kurnia's avatar
r.kurnia committed
3067
                                                                disabled={this.props.isApprover == true ? true : false}
rifkaki's avatar
rifkaki committed
3068 3069 3070
                                                                value={Number(handleTotal(tableMeta, 3)).toFixed(1)}
                                                            />
                                                        }
r.kurnia's avatar
r.kurnia committed
3071
                                                    />
rifkaki's avatar
rifkaki committed
3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083
                                                </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
3084
                                                    :
rifkaki's avatar
rifkaki committed
3085
                                                    tableMeta.rowData[3] === 6 ?
r.kurnia's avatar
r.kurnia committed
3086 3087 3088 3089 3090 3091
                                                        <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
3092
                                                            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
3093
                                                        />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3094
                                                        :
rifkaki's avatar
rifkaki committed
3095
                                                        tableMeta.rowData[3] === 5 ?
r.kurnia's avatar
r.kurnia committed
3096 3097 3098 3099 3100 3101
                                                            <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
3102
                                                                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
3103
                                                            />
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3104
                                                            :
r.kurnia's avatar
r.kurnia committed
3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115
                                                            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>
3116 3117
                                                                //         <NumberFormat
                                                                //             thousandSeparator={true}
r.kurnia's avatar
r.kurnia committed
3118
                                                                //             style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', color: 'red' }}
3119 3120 3121
                                                                //             type="text"
                                                                //             placeholder=""
                                                                //             disabled={true}
r.kurnia's avatar
r.kurnia committed
3122 3123
                                                                //             value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
                                                                //         />
qorri_di's avatar
qorri_di committed
3124
                                                                //     </LightTooltip> 
r.kurnia's avatar
r.kurnia committed
3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164
                                                                :
                                                                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
3165 3166 3167 3168 3169 3170 3171
                                    }
                                </div>
                            </div>
                        </div>
                    )
                }
            }
r.kurnia's avatar
r.kurnia committed
3172 3173 3174 3175 3176 3177 3178 3179 3180 3181
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219
        }
        ]
        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%' }}>
qorri_di's avatar
qorri_di committed
3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241
                                        {this.props.isApprover === true || this.state.get_for == 'view' ?
                                            null
                                            // <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" />
qorri_di's avatar
qorri_di committed
3242
                                            // </div> 
qorri_di's avatar
qorri_di committed
3243
                                            :
rifkaki's avatar
rifkaki committed
3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272
                                            <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" />
qorri_di's avatar
qorri_di committed
3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291
                                                {/* <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
3292
                                            </div>
rifkaki's avatar
rifkaki committed
3293
                                        }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3294 3295 3296 3297
                                    </div>
                                </div>

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
rifkaki's avatar
rifkaki committed
3298
                                    {this.state.loading && loadingComponent}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3299 3300 3301 3302 3303 3304 3305 3306
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                </div>
Riri Novita's avatar
Riri Novita committed
3307 3308 3309 3310 3311
                                <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) => {
qorri_di's avatar
qorri_di committed
3312 3313 3314 3315
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
qorri_di's avatar
qorri_di committed
3316
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
3317 3318 3319
                                        }
                                    </div>
                                </div>
3320
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338
                            </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
3339
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3340 3341 3342
                                        </div>
                                    </button>
                                </div>
r.kurnia's avatar
r.kurnia committed
3343 3344 3345
                                {this.props.isApprover === true ?
                                    <div className="col-2">
                                    </div> :
rifkaki's avatar
rifkaki committed
3346
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
qorri_di's avatar
qorri_di committed
3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367
                                        {this.state.get_for == 'view' && this.state.viewOnly &&
                                            <button
                                                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>
                                            </button>
r.kurnia's avatar
r.kurnia committed
3368
                                        }
qorri_di's avatar
qorri_di committed
3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393
                                        {this.state.get_for == 'edit' &&
                                            <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
3394 3395
                                        }
                                        {this.state.get_for == 'edit' && <button
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3396 3397
                                            className="button"
                                            type="button"
qorri_di's avatar
qorri_di committed
3398
                                            onClick={() =>
rifkaki's avatar
rifkaki committed
3399
                                                this.state.saveDraft === true ?
qorri_di's avatar
qorri_di committed
3400 3401 3402 3403 3404 3405 3406 3407
                                                    this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
                                                            setTimeout(() => {
                                                                this.backToMasterBudget('draft')
                                                            }, 100);
                                                        })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3408 3409 3410
                                            }
                                            style={{
                                                backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
3411
                                                cursor: 'pointer',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3412 3413 3414 3415 3416 3417 3418 3419
                                                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
3420 3421
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3422
                                            type="button"
rifkaki's avatar
rifkaki committed
3423
                                            // disabled={this.state.buttonError}
qorri_di's avatar
qorri_di committed
3424
                                            onClick={() =>
rifkaki's avatar
rifkaki committed
3425 3426 3427
                                                this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
                                                    :
3428
                                                    this.state.handleDoubleClick == 1 ? null :
Riri Novita's avatar
Riri Novita committed
3429
                                                        this.setState({ handleDoubleClick: 1 }, () => {
rifkaki's avatar
rifkaki committed
3430 3431 3432 3433 3434
                                                            setTimeout(() => {
                                                                this.backToMasterBudget('submitted')
                                                            }, 100);
                                                        })
                                            }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3435 3436
                                            style={{
                                                backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
3437
                                                cursor: 'pointer',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3438 3439 3440 3441
                                                borderColor: 'transparent',
                                                outline: 'none'
                                            }}
                                        >
rifkaki's avatar
rifkaki committed
3442
                                            <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
3443 3444
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
rifkaki's avatar
rifkaki committed
3445
                                        </button>}
qorri_di's avatar
qorri_di committed
3446
                                    </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3447 3448 3449
                                }
                            </div>
                        </Paper>
qorri_di's avatar
qorri_di committed
3450
                        :
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483
                        <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
3484
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3485 3486 3487 3488 3489 3490 3491
                                            </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
3492
                                            // disabled={this.state.buttonError}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3493 3494
                                            style={{
                                                backgroundColor: 'transparent',
syadziy's avatar
syadziy committed
3495
                                                cursor: 'pointer',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3496 3497 3498 3499 3500
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
syadziy's avatar
syadziy committed
3501
                                                this.setState({ loading: true, buttonDraft: false }, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3502
                                                    setTimeout(() => {
r.kurnia's avatar
r.kurnia committed
3503 3504
                                                        // this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
                                                        this.handleValidate()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522
                                                    }, 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
                                            }}
qorri_di's avatar
qorri_di committed
3523
                                            onClick={() => this.state.editable === true ?
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3524
                                                null
qorri_di's avatar
qorri_di committed
3525
                                                :
3526
                                                this.state.handleDoubleClick == 1 ? null :
qorri_di's avatar
qorri_di committed
3527 3528 3529 3530 3531
                                                    this.setState({ handleDoubleClick: 1, loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.uploadTP('draft')
                                                        }, 100);
                                                    })}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545
                                        >
                                            <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',
                                            }}
qorri_di's avatar
qorri_di committed
3546
                                            onClick={() =>
r.kurnia's avatar
r.kurnia committed
3547 3548
                                                this.state.editable === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
qorri_di's avatar
qorri_di committed
3549 3550 3551 3552 3553 3554 3555
                                                    :
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
                                                            setTimeout(() => {
                                                                this.uploadTP('submitted')
                                                            }, 100);
                                                        })}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585
                                        >
                                            <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>
3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639
                            <div style={{ padding: '25px 30px' }}>
                                <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={() => {
                                        String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("TAX") && String(this.state.judul).includes("PLANNING") ?
                                            this.checkUpload() :
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
                            <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
                        </div>
                    </div>
                )}

                {this.state.visibleAlertSave && (
                    <div className="test app-popup-show">
                        <div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
                            <div style={{ margin: 30 }}>
                                <div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
                                    <div style={{ alignSelf: 'center', marginRight: 25 }}>
                                        <img src={Images.warning} />
                                    </div>
                                    <div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
                                        <b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
                                    </div>
                                </div>
                                <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            background: '#F6F7F9',
                                            cursor: 'pointer',
                                            border: '1px solid #3549609e',
                                            outline: 'none',
                                            marginRight: 20,
                                            borderRadius: 9
                                        }}
                                        onClick={() => this.setState({ visibleAlertSave: false })}
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
                                            <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
                                        </div>
                                    </button>
                                </div>
                            </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
3640 3641 3642 3643 3644 3645 3646
                        </div>
                    </div>
                )}
            </div>
        );
    }
}