FixedAssetsMovement.js 182 KB
Newer Older
faisalhamdi's avatar
faisalhamdi committed
1 2 3 4
import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
faisalhamdi's avatar
faisalhamdi committed
5
import api from '../../api';
faisalhamdi's avatar
faisalhamdi committed
6 7 8 9 10
import AddIcon from '@material-ui/icons/Add';
import { values } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
faisalhamdi's avatar
faisalhamdi committed
11 12
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
faisalhamdi's avatar
faisalhamdi committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26

var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());

const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    background: "white",
    zIndex: 101,
};
const style2 = {
    position: "sticky",
    background: "white",
faisalhamdi's avatar
faisalhamdi committed
27
    zIndex: 100
faisalhamdi's avatar
faisalhamdi committed
28 29 30
};

export default class FixedAssetsMovement extends Component {
faisalhamdi's avatar
faisalhamdi committed
31 32 33 34
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [
faisalhamdi's avatar
faisalhamdi committed
35 36 37 38 39 40
                // ["COST", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181"],
                // ["Control", "-", "-"],
                // ["Accumulated Depreciation (negative value)", "2,647,647", "2,058,898"],
                // ["Control", "-", "-"],
                // ["Gain / (Loss) on Fixed Assets", "-", "-"],
                // ["Control", "-", "-"]
faisalhamdi's avatar
faisalhamdi committed
41 42 43
            ],
            visibleFixedAssetsMovement: true,
            disabledSave: true
faisalhamdi's avatar
faisalhamdi committed
44
        }
faisalhamdi's avatar
faisalhamdi committed
45
        this.handleValue = this.handleValue.bind(this)
faisalhamdi's avatar
faisalhamdi committed
46
        this.fileHandler = this.fileHandler.bind(this);
faisalhamdi's avatar
faisalhamdi committed
47 48 49
    }

    componentDidMount() {
faisalhamdi's avatar
faisalhamdi committed
50
        this.getItemHierarki()
faisalhamdi's avatar
faisalhamdi committed
51 52 53
        console.log(this.props);
    }

faisalhamdi's avatar
faisalhamdi committed
54
    getItemHierarki() {
faisalhamdi's avatar
faisalhamdi committed
55
        this.setState({ loading: true })
faisalhamdi's avatar
faisalhamdi committed
56 57
        let payload = {
            "report_id": this.props.report_id,
faisalhamdi's avatar
faisalhamdi committed
58 59
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
faisalhamdi's avatar
faisalhamdi committed
60 61
            "company_id": this.props.company.company_id
        }
faisalhamdi's avatar
faisalhamdi committed
62 63
        console.log(payload);
        api.create().getDetailReportMB(payload).then(response => {
faisalhamdi's avatar
faisalhamdi committed
64 65 66 67 68 69 70 71 72 73 74 75
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
                    let dataTable = []
                    response.data.data.map((item, index) => {
                        if (item.children && item.children.length > 0) {
                            dataTable.push([
                                item.type_report_id,
                                item.id,
                                item.parent,
                                item.formula,
                                item.level,
faisalhamdi's avatar
faisalhamdi committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
                                item.description,
                                item.fixed_asset_movement.total_actual_before,
                                item.fixed_asset_movement.january,
                                item.fixed_asset_movement.february,
                                item.fixed_asset_movement.march,
                                item.fixed_asset_movement.april,
                                item.fixed_asset_movement.may,
                                item.fixed_asset_movement.june,
                                item.fixed_asset_movement.july,
                                item.fixed_asset_movement.august,
                                item.fixed_asset_movement.september,
                                item.fixed_asset_movement.october,
                                item.fixed_asset_movement.november,
                                item.fixed_asset_movement.december,
                                item.fixed_asset_movement.total_current_year,
                                item.fixed_asset_movement.total_next_year,
                                item.fixed_asset_movement.total_more_year
faisalhamdi's avatar
faisalhamdi committed
93 94 95 96 97 98 99 100 101 102
                            ])
                            item.children.map(i => {
                                if (i.children) {
                                    if (i.children.length > 0) {
                                        dataTable.push([
                                            i.type_report_id,
                                            i.id,
                                            i.parent,
                                            i.formula,
                                            i.level,
faisalhamdi's avatar
faisalhamdi committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
                                            i.description,
                                            i.fixed_asset_movement.total_actual_before,
                                            i.fixed_asset_movement.january,
                                            i.fixed_asset_movement.february,
                                            i.fixed_asset_movement.march,
                                            i.fixed_asset_movement.april,
                                            i.fixed_asset_movement.may,
                                            i.fixed_asset_movement.june,
                                            i.fixed_asset_movement.july,
                                            i.fixed_asset_movement.august,
                                            i.fixed_asset_movement.september,
                                            i.fixed_asset_movement.october,
                                            i.fixed_asset_movement.november,
                                            i.fixed_asset_movement.december,
                                            i.fixed_asset_movement.total_current_year,
                                            i.fixed_asset_movement.total_next_year,
                                            i.fixed_asset_movement.total_more_year
faisalhamdi's avatar
faisalhamdi committed
120 121 122 123 124 125 126 127 128
                                        ])
                                        i.children.map(val => {
                                            if (val.children && val.children.length > 0) {
                                                dataTable.push([
                                                    val.type_report_id,
                                                    val.id,
                                                    val.parent,
                                                    val.formula,
                                                    val.level,
faisalhamdi's avatar
faisalhamdi committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
                                                    val.description,
                                                    val.fixed_asset_movement.total_actual_before,
                                                    val.fixed_asset_movement.january,
                                                    val.fixed_asset_movement.february,
                                                    val.fixed_asset_movement.march,
                                                    val.fixed_asset_movement.april,
                                                    val.fixed_asset_movement.may,
                                                    val.fixed_asset_movement.june,
                                                    val.fixed_asset_movement.july,
                                                    val.fixed_asset_movement.august,
                                                    val.fixed_asset_movement.september,
                                                    val.fixed_asset_movement.october,
                                                    val.fixed_asset_movement.november,
                                                    val.fixed_asset_movement.december,
                                                    val.fixed_asset_movement.total_current_year,
                                                    val.fixed_asset_movement.total_next_year,
                                                    val.fixed_asset_movement.total_more_year
faisalhamdi's avatar
faisalhamdi committed
146 147
                                                ])
                                                val.children.map(items => {
faisalhamdi's avatar
faisalhamdi committed
148
                                                    if (items.children && items.children.length > 0) {
faisalhamdi's avatar
faisalhamdi committed
149 150 151 152 153 154
                                                    dataTable.push([
                                                        items.type_report_id,
                                                        items.id,
                                                        items.parent,
                                                        items.formula,
                                                        items.level,
faisalhamdi's avatar
faisalhamdi committed
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
                                                        items.description,
                                                        items.fixed_asset_movement.total_actual_before,
                                                        items.fixed_asset_movement.january,
                                                        items.fixed_asset_movement.february,
                                                        items.fixed_asset_movement.march,
                                                        items.fixed_asset_movement.april,
                                                        items.fixed_asset_movement.may,
                                                        items.fixed_asset_movement.june,
                                                        items.fixed_asset_movement.july,
                                                        items.fixed_asset_movement.august,
                                                        items.fixed_asset_movement.september,
                                                        items.fixed_asset_movement.october,
                                                        items.fixed_asset_movement.november,
                                                        items.fixed_asset_movement.december,
                                                        items.fixed_asset_movement.total_current_year,
                                                        items.fixed_asset_movement.total_next_year,
                                                        items.fixed_asset_movement.total_more_year
faisalhamdi's avatar
faisalhamdi committed
172
                                                    ])
faisalhamdi's avatar
faisalhamdi committed
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 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 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 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 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 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 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
                                                    items.children.map(itemss => {
                                                        if (itemss.children && itemss.children.length > 0) {
                                                            dataTable.push([
                                                                itemss.type_report_id,
                                                                itemss.id,
                                                                itemss.parent,
                                                                itemss.formula,
                                                                itemss.level,
                                                                itemss.description,
                                                                itemss.fixed_asset_movement.total_actual_before,
                                                                itemss.fixed_asset_movement.january,
                                                                itemss.fixed_asset_movement.february,
                                                                itemss.fixed_asset_movement.march,
                                                                itemss.fixed_asset_movement.april,
                                                                itemss.fixed_asset_movement.may,
                                                                itemss.fixed_asset_movement.june,
                                                                itemss.fixed_asset_movement.july,
                                                                itemss.fixed_asset_movement.august,
                                                                itemss.fixed_asset_movement.september,
                                                                itemss.fixed_asset_movement.october,
                                                                itemss.fixed_asset_movement.november,
                                                                itemss.fixed_asset_movement.december,
                                                                itemss.fixed_asset_movement.total_current_year,
                                                                itemss.fixed_asset_movement.total_next_year,
                                                                itemss.fixed_asset_movement.total_more_year
                                                            ])
                                                            itemss.children.map(item1 => {
                                                                if (item1.children && item1.children.length > 0) {
                                                                    dataTable.push([
                                                                        item1.type_report_id,
                                                                        item1.id,
                                                                        item1.parent,
                                                                        item1.formula,
                                                                        item1.level,
                                                                        item1.description,
                                                                        item1.fixed_asset_movement.total_actual_before,
                                                                        item1.fixed_asset_movement.january,
                                                                        item1.fixed_asset_movement.february,
                                                                        item1.fixed_asset_movement.march,
                                                                        item1.fixed_asset_movement.april,
                                                                        item1.fixed_asset_movement.may,
                                                                        item1.fixed_asset_movement.june,
                                                                        item1.fixed_asset_movement.july,
                                                                        item1.fixed_asset_movement.august,
                                                                        item1.fixed_asset_movement.september,
                                                                        item1.fixed_asset_movement.october,
                                                                        item1.fixed_asset_movement.november,
                                                                        item1.fixed_asset_movement.december,
                                                                        item1.fixed_asset_movement.total_current_year,
                                                                        item1.fixed_asset_movement.total_next_year,
                                                                        item1.fixed_asset_movement.total_more_year
                                                                    ])
                                                                    item1.children.map(item2 => {
                                                                        if (item2.children && item2.children.length > 0) {
                                                                            dataTable.push([
                                                                                item2.type_report_id,
                                                                                item2.id,
                                                                                item2.parent,
                                                                                item2.formula,
                                                                                item2.level,
                                                                                item2.description,
                                                                                item2.fixed_asset_movement.total_actual_before,
                                                                                item2.fixed_asset_movement.january,
                                                                                item2.fixed_asset_movement.february,
                                                                                item2.fixed_asset_movement.march,
                                                                                item2.fixed_asset_movement.april,
                                                                                item2.fixed_asset_movement.may,
                                                                                item2.fixed_asset_movement.june,
                                                                                item2.fixed_asset_movement.july,
                                                                                item2.fixed_asset_movement.august,
                                                                                item2.fixed_asset_movement.september,
                                                                                item2.fixed_asset_movement.october,
                                                                                item2.fixed_asset_movement.november,
                                                                                item2.fixed_asset_movement.december,
                                                                                item2.fixed_asset_movement.total_current_year,
                                                                                item2.fixed_asset_movement.total_next_year,
                                                                                item2.fixed_asset_movement.total_more_year
                                                                            ])
                                                                            item2.children.map(item3 => {
                                                                                if (item3.children && item3.children.length > 0) {
                                                                                    dataTable.push([
                                                                                        item3.type_report_id,
                                                                                        item3.id,
                                                                                        item3.parent,
                                                                                        item3.formula,
                                                                                        item3.level,
                                                                                        item3.description,
                                                                                        item3.fixed_asset_movement.total_actual_before,
                                                                                        item3.fixed_asset_movement.january,
                                                                                        item3.fixed_asset_movement.february,
                                                                                        item3.fixed_asset_movement.march,
                                                                                        item3.fixed_asset_movement.april,
                                                                                        item3.fixed_asset_movement.may,
                                                                                        item3.fixed_asset_movement.june,
                                                                                        item3.fixed_asset_movement.july,
                                                                                        item3.fixed_asset_movement.august,
                                                                                        item3.fixed_asset_movement.september,
                                                                                        item3.fixed_asset_movement.october,
                                                                                        item3.fixed_asset_movement.november,
                                                                                        item3.fixed_asset_movement.december,
                                                                                        item3.fixed_asset_movement.total_current_year,
                                                                                        item3.fixed_asset_movement.total_next_year,
                                                                                        item3.fixed_asset_movement.total_more_year
                                                                                    ])
                                                                                    item3.children.map(item4 => {
                                                                                        if (item4.children && item4.children.length > 0) {
                                                                                            dataTable.push([
                                                                                                item4.type_report_id,
                                                                                                item4.id,
                                                                                                item4.parent,
                                                                                                item4.formula,
                                                                                                item4.level,
                                                                                                item4.description,
                                                                                                item4.fixed_asset_movement.total_actual_before,
                                                                                                item4.fixed_asset_movement.january,
                                                                                                item4.fixed_asset_movement.february,
                                                                                                item4.fixed_asset_movement.march,
                                                                                                item4.fixed_asset_movement.april,
                                                                                                item4.fixed_asset_movement.may,
                                                                                                item4.fixed_asset_movement.june,
                                                                                                item4.fixed_asset_movement.july,
                                                                                                item4.fixed_asset_movement.august,
                                                                                                item4.fixed_asset_movement.september,
                                                                                                item4.fixed_asset_movement.october,
                                                                                                item4.fixed_asset_movement.november,
                                                                                                item4.fixed_asset_movement.december,
                                                                                                item4.fixed_asset_movement.total_current_year,
                                                                                                item4.fixed_asset_movement.total_next_year,
                                                                                                item4.fixed_asset_movement.total_more_year
                                                                                            ])
                                                                                            item4.children.map(item5 => {
                                                                                                if (item5.children && item5.children.length > 0) {
                                                                                                    dataTable.push([
                                                                                                        item5.type_report_id,
                                                                                                        item5.id,
                                                                                                        item5.parent,
                                                                                                        item5.formula,
                                                                                                        item5.level,
                                                                                                        item5.description,
                                                                                                        item5.fixed_asset_movement.total_actual_before,
                                                                                                        item5.fixed_asset_movement.january,
                                                                                                        item5.fixed_asset_movement.february,
                                                                                                        item5.fixed_asset_movement.march,
                                                                                                        item5.fixed_asset_movement.april,
                                                                                                        item5.fixed_asset_movement.may,
                                                                                                        item5.fixed_asset_movement.june,
                                                                                                        item5.fixed_asset_movement.july,
                                                                                                        item5.fixed_asset_movement.august,
                                                                                                        item5.fixed_asset_movement.september,
                                                                                                        item5.fixed_asset_movement.october,
                                                                                                        item5.fixed_asset_movement.november,
                                                                                                        item5.fixed_asset_movement.december,
                                                                                                        item5.fixed_asset_movement.total_current_year,
                                                                                                        item5.fixed_asset_movement.total_next_year,
                                                                                                        item5.fixed_asset_movement.total_more_year
                                                                                                    ])
                                                                                                    item5.children.map(item6 => {
                                                                                                        if (item6.children && item.children.length > 0) {
                                                                                                            dataTable.push([
                                                                                                                item6.type_report_id,
                                                                                                                item6.id,
                                                                                                                item6.parent,
                                                                                                                item6.formula,
                                                                                                                item6.level,
                                                                                                                item6.description,
                                                                                                                item6.fixed_asset_movement.total_actual_before,
                                                                                                                item6.fixed_asset_movement.january,
                                                                                                                item6.fixed_asset_movement.february,
                                                                                                                item6.fixed_asset_movement.march,
                                                                                                                item6.fixed_asset_movement.april,
                                                                                                                item6.fixed_asset_movement.may,
                                                                                                                item6.fixed_asset_movement.june,
                                                                                                                item6.fixed_asset_movement.july,
                                                                                                                item6.fixed_asset_movement.august,
                                                                                                                item6.fixed_asset_movement.september,
                                                                                                                item6.fixed_asset_movement.october,
                                                                                                                item6.fixed_asset_movement.november,
                                                                                                                item6.fixed_asset_movement.december,
                                                                                                                item6.fixed_asset_movement.total_current_year,
                                                                                                                item6.fixed_asset_movement.total_next_year,
                                                                                                                item6.fixed_asset_movement.total_more_year
                                                                                                            ])
                                                                                                        } else {
                                                                                                            dataTable.push([
                                                                                                                item6.type_report_id,
                                                                                                                item6.id,
                                                                                                                item6.parent,
                                                                                                                item6.formula,
                                                                                                                item6.level,
                                                                                                                item6.description,
                                                                                                                item6.fixed_asset_movement.total_actual_before,
                                                                                                                item6.fixed_asset_movement.january,
                                                                                                                item6.fixed_asset_movement.february,
                                                                                                                item6.fixed_asset_movement.march,
                                                                                                                item6.fixed_asset_movement.april,
                                                                                                                item6.fixed_asset_movement.may,
                                                                                                                item6.fixed_asset_movement.june,
                                                                                                                item6.fixed_asset_movement.july,
                                                                                                                item6.fixed_asset_movement.august,
                                                                                                                item6.fixed_asset_movement.september,
                                                                                                                item6.fixed_asset_movement.october,
                                                                                                                item6.fixed_asset_movement.november,
                                                                                                                item6.fixed_asset_movement.december,
                                                                                                                item6.fixed_asset_movement.total_current_year,
                                                                                                                item6.fixed_asset_movement.total_next_year,
                                                                                                                item6.fixed_asset_movement.total_more_year
                                                                                                            ])
                                                                                                        }
                                                                                                    })
                                                                                                } else {
                                                                                                    dataTable.push([
                                                                                                        item5.type_report_id,
                                                                                                        item5.id,
                                                                                                        item5.parent,
                                                                                                        item5.formula,
                                                                                                        item5.level,
                                                                                                        item5.description,
                                                                                                        item5.fixed_asset_movement.total_actual_before,
                                                                                                        item5.fixed_asset_movement.january,
                                                                                                        item5.fixed_asset_movement.february,
                                                                                                        item5.fixed_asset_movement.march,
                                                                                                        item5.fixed_asset_movement.april,
                                                                                                        item5.fixed_asset_movement.may,
                                                                                                        item5.fixed_asset_movement.june,
                                                                                                        item5.fixed_asset_movement.july,
                                                                                                        item5.fixed_asset_movement.august,
                                                                                                        item5.fixed_asset_movement.september,
                                                                                                        item5.fixed_asset_movement.october,
                                                                                                        item5.fixed_asset_movement.november,
                                                                                                        item5.fixed_asset_movement.december,
                                                                                                        item5.fixed_asset_movement.total_current_year,
                                                                                                        item5.fixed_asset_movement.total_next_year,
                                                                                                        item5.fixed_asset_movement.total_more_year
                                                                                                    ])
                                                                                                }
                                                                                            })
                                                                                        } else {
                                                                                            dataTable.push([
                                                                                                item4.type_report_id,
                                                                                                item4.id,
                                                                                                item4.parent,
                                                                                                item4.formula,
                                                                                                item4.level,
                                                                                                item4.description,
                                                                                                item4.fixed_asset_movement.total_actual_before,
                                                                                                item4.fixed_asset_movement.january,
                                                                                                item4.fixed_asset_movement.february,
                                                                                                item4.fixed_asset_movement.march,
                                                                                                item4.fixed_asset_movement.april,
                                                                                                item4.fixed_asset_movement.may,
                                                                                                item4.fixed_asset_movement.june,
                                                                                                item4.fixed_asset_movement.july,
                                                                                                item4.fixed_asset_movement.august,
                                                                                                item4.fixed_asset_movement.september,
                                                                                                item4.fixed_asset_movement.october,
                                                                                                item4.fixed_asset_movement.november,
                                                                                                item4.fixed_asset_movement.december,
                                                                                                item4.fixed_asset_movement.total_current_year,
                                                                                                item4.fixed_asset_movement.total_next_year,
                                                                                                item4.fixed_asset_movement.total_more_year
                                                                                            ])
                                                                                        }
                                                                                    })
                                                                                } else {
                                                                                    dataTable.push([
                                                                                        item3.type_report_id,
                                                                                        item3.id,
                                                                                        item3.parent,
                                                                                        item3.formula,
                                                                                        item3.level,
                                                                                        item3.description,
                                                                                        item3.fixed_asset_movement.total_actual_before,
                                                                                        item3.fixed_asset_movement.january,
                                                                                        item3.fixed_asset_movement.february,
                                                                                        item3.fixed_asset_movement.march,
                                                                                        item3.fixed_asset_movement.april,
                                                                                        item3.fixed_asset_movement.may,
                                                                                        item3.fixed_asset_movement.june,
                                                                                        item3.fixed_asset_movement.july,
                                                                                        item3.fixed_asset_movement.august,
                                                                                        item3.fixed_asset_movement.september,
                                                                                        item3.fixed_asset_movement.october,
                                                                                        item3.fixed_asset_movement.november,
                                                                                        item3.fixed_asset_movement.december,
                                                                                        item3.fixed_asset_movement.total_current_year,
                                                                                        item3.fixed_asset_movement.total_next_year,
                                                                                        item3.fixed_asset_movement.total_more_year
                                                                                    ])
                                                                                }
                                                                            })
                                                                        } else {
                                                                            dataTable.push([
                                                                                item2.type_report_id,
                                                                                item2.id,
                                                                                item2.parent,
                                                                                item2.formula,
                                                                                item2.level,
                                                                                item2.description,
                                                                                item2.fixed_asset_movement.total_actual_before,
                                                                                item2.fixed_asset_movement.january,
                                                                                item2.fixed_asset_movement.february,
                                                                                item2.fixed_asset_movement.march,
                                                                                item2.fixed_asset_movement.april,
                                                                                item2.fixed_asset_movement.may,
                                                                                item2.fixed_asset_movement.june,
                                                                                item2.fixed_asset_movement.july,
                                                                                item2.fixed_asset_movement.august,
                                                                                item2.fixed_asset_movement.september,
                                                                                item2.fixed_asset_movement.october,
                                                                                item2.fixed_asset_movement.november,
                                                                                item2.fixed_asset_movement.december,
                                                                                item2.fixed_asset_movement.total_current_year,
                                                                                item2.fixed_asset_movement.total_next_year,
                                                                                item2.fixed_asset_movement.total_more_year
                                                                            ])
                                                                        }
                                                                    })
                                                                } else {
                                                                    dataTable.push([
                                                                        item1.type_report_id,
                                                                        item1.id,
                                                                        item1.parent,
                                                                        item1.formula,
                                                                        item1.level,
                                                                        item1.description,
                                                                        item1.fixed_asset_movement.total_actual_before,
                                                                        item1.fixed_asset_movement.january,
                                                                        item1.fixed_asset_movement.february,
                                                                        item1.fixed_asset_movement.march,
                                                                        item1.fixed_asset_movement.april,
                                                                        item1.fixed_asset_movement.may,
                                                                        item1.fixed_asset_movement.june,
                                                                        item1.fixed_asset_movement.july,
                                                                        item1.fixed_asset_movement.august,
                                                                        item1.fixed_asset_movement.september,
                                                                        item1.fixed_asset_movement.october,
                                                                        item1.fixed_asset_movement.november,
                                                                        item1.fixed_asset_movement.december,
                                                                        item1.fixed_asset_movement.total_current_year,
                                                                        item1.fixed_asset_movement.total_next_year,
                                                                        item1.fixed_asset_movement.total_more_year
                                                                    ])
                                                                }
                                                            })
                                                        } else {
                                                            dataTable.push([
                                                                itemss.type_report_id,
                                                                itemss.id,
                                                                itemss.parent,
                                                                itemss.formula,
                                                                itemss.level,
                                                                itemss.description,
                                                                itemss.fixed_asset_movement.total_actual_before,
                                                                itemss.fixed_asset_movement.january,
                                                                itemss.fixed_asset_movement.february,
                                                                itemss.fixed_asset_movement.march,
                                                                itemss.fixed_asset_movement.april,
                                                                itemss.fixed_asset_movement.may,
                                                                itemss.fixed_asset_movement.june,
                                                                itemss.fixed_asset_movement.july,
                                                                itemss.fixed_asset_movement.august,
                                                                itemss.fixed_asset_movement.september,
                                                                itemss.fixed_asset_movement.october,
                                                                itemss.fixed_asset_movement.november,
                                                                itemss.fixed_asset_movement.december,
                                                                itemss.fixed_asset_movement.total_current_year,
                                                                itemss.fixed_asset_movement.total_next_year,
                                                                itemss.fixed_asset_movement.total_more_year
                                                            ])
                                                        }
                                                    })
                                                } else {
                                                    dataTable.push([
                                                        items.type_report_id,
                                                        items.id,
                                                        items.parent,
                                                        items.formula,
                                                        items.level,
                                                        items.description,
                                                        items.fixed_asset_movement.total_actual_before,
                                                        items.fixed_asset_movement.january,
                                                        items.fixed_asset_movement.february,
                                                        items.fixed_asset_movement.march,
                                                        items.fixed_asset_movement.april,
                                                        items.fixed_asset_movement.may,
                                                        items.fixed_asset_movement.june,
                                                        items.fixed_asset_movement.july,
                                                        items.fixed_asset_movement.august,
                                                        items.fixed_asset_movement.september,
                                                        items.fixed_asset_movement.october,
                                                        items.fixed_asset_movement.november,
                                                        items.fixed_asset_movement.december,
                                                        items.fixed_asset_movement.total_current_year,
                                                        items.fixed_asset_movement.total_next_year,
                                                        items.fixed_asset_movement.total_more_year
                                                    ])
                                                }
                                            })
                                        } else {
                                            dataTable.push([
                                                val.type_report_id,
                                                val.id,
                                                val.parent,
                                                val.formula,
                                                val.level,
                                                val.description,
                                                val.fixed_asset_movement.total_actual_before,
                                                val.fixed_asset_movement.january,
                                                val.fixed_asset_movement.february,
                                                val.fixed_asset_movement.march,
                                                val.fixed_asset_movement.april,
                                                val.fixed_asset_movement.may,
                                                val.fixed_asset_movement.june,
                                                val.fixed_asset_movement.july,
                                                val.fixed_asset_movement.august,
                                                val.fixed_asset_movement.september,
                                                val.fixed_asset_movement.october,
                                                val.fixed_asset_movement.november,
                                                val.fixed_asset_movement.december,
                                                val.fixed_asset_movement.total_current_year,
                                                val.fixed_asset_movement.total_next_year,
                                                val.fixed_asset_movement.total_more_year
                                            ])
                                        }
                                    })
faisalhamdi's avatar
faisalhamdi committed
598 599 600 601 602 603 604
                                } else {
                                    dataTable.push([
                                        i.type_report_id,
                                        i.id,
                                        i.parent,
                                        i.formula,
                                        i.level,
faisalhamdi's avatar
faisalhamdi committed
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
                                        i.description,
                                        i.fixed_asset_movement.total_actual_before,
                                        i.fixed_asset_movement.january,
                                        i.fixed_asset_movement.february,
                                        i.fixed_asset_movement.march,
                                        i.fixed_asset_movement.april,
                                        i.fixed_asset_movement.may,
                                        i.fixed_asset_movement.june,
                                        i.fixed_asset_movement.july,
                                        i.fixed_asset_movement.august,
                                        i.fixed_asset_movement.september,
                                        i.fixed_asset_movement.october,
                                        i.fixed_asset_movement.november,
                                        i.fixed_asset_movement.december,
                                        i.fixed_asset_movement.total_current_year,
                                        i.fixed_asset_movement.total_next_year,
                                        i.fixed_asset_movement.total_more_year
faisalhamdi's avatar
faisalhamdi committed
622 623
                                    ])
                                }
faisalhamdi's avatar
faisalhamdi committed
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
                            } else {
                                dataTable.push([
                                    i.type_report_id,
                                    i.id,
                                    i.parent,
                                    i.formula,
                                    i.level,
                                    i.description,
                                    i.fixed_asset_movement.total_actual_before,
                                    i.fixed_asset_movement.january,
                                    i.fixed_asset_movement.february,
                                    i.fixed_asset_movement.march,
                                    i.fixed_asset_movement.april,
                                    i.fixed_asset_movement.may,
                                    i.fixed_asset_movement.june,
                                    i.fixed_asset_movement.july,
                                    i.fixed_asset_movement.august,
                                    i.fixed_asset_movement.september,
                                    i.fixed_asset_movement.october,
                                    i.fixed_asset_movement.november,
                                    i.fixed_asset_movement.december,
                                    i.fixed_asset_movement.total_current_year,
                                    i.fixed_asset_movement.total_next_year,
                                    i.fixed_asset_movement.total_more_year
                                ])
                            }
                        })
                    } else {
                        dataTable.push([
                            item.type_report_id,
                            item.id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.description,
                            item.fixed_asset_movement.total_actual_before,
                            item.fixed_asset_movement.january,
                            item.fixed_asset_movement.february,
                            item.fixed_asset_movement.march,
                            item.fixed_asset_movement.april,
                            item.fixed_asset_movement.may,
                            item.fixed_asset_movement.june,
                            item.fixed_asset_movement.july,
                            item.fixed_asset_movement.august,
                            item.fixed_asset_movement.september,
                            item.fixed_asset_movement.october,
                            item.fixed_asset_movement.november,
                            item.fixed_asset_movement.december,
                            item.fixed_asset_movement.total_current_year,
                            item.fixed_asset_movement.total_next_year,
                            item.fixed_asset_movement.total_more_year
                        ])
                    }
faisalhamdi's avatar
faisalhamdi committed
677
                    })
faisalhamdi's avatar
faisalhamdi committed
678
                    console.log(dataTable);
faisalhamdi's avatar
faisalhamdi committed
679
                    this.setState({ dataTable, loading: false })
faisalhamdi's avatar
faisalhamdi committed
680
                }
faisalhamdi's avatar
faisalhamdi committed
681 682
            } else {
                this.setState({ loading: false })
faisalhamdi's avatar
faisalhamdi committed
683 684 685 686 687 688 689 690
            }
        })
    }

    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[1] == item[2]) {
faisalhamdi's avatar
faisalhamdi committed
691
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
faisalhamdi's avatar
faisalhamdi committed
692 693 694 695 696 697 698 699
            }
        })
        let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
        // console.log(indexParent);
        return a
    }

faisalhamdi's avatar
faisalhamdi committed
700
    handleChange(value, tableMeta) {
faisalhamdi's avatar
faisalhamdi committed
701
        let val = String(value).split(",").join("")
faisalhamdi's avatar
faisalhamdi committed
702
        let data = this.state.dataTable
faisalhamdi's avatar
faisalhamdi committed
703 704
        let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
        if (indexParent > 0) {
faisalhamdi's avatar
faisalhamdi committed
705
            // console.log(indexParent)
faisalhamdi's avatar
faisalhamdi committed
706 707 708 709 710 711
            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)
        }
faisalhamdi's avatar
faisalhamdi committed
712
        // this.forceUpdate()
faisalhamdi's avatar
faisalhamdi committed
713
        // console.log(this.state.dataTable)
faisalhamdi's avatar
faisalhamdi committed
714 715
    }

faisalhamdi's avatar
faisalhamdi committed
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                total_actual_before: String(i[6]),
                january: String(i[7]),
                february: String(i[8]),
                march: String(i[9]),
                april: String(i[10]),
                may: String(i[11]),
                june: String(i[12]),
                july: String(i[13]),
                august: String(i[14]),
                september: String(i[15]),
                october: String(i[16]),
                november: String(i[17]),
                december: String(i[18]),
                total_current_year: String(i[19]),
                total_next_year: String(i[20]),
                total_more_year: String(i[21])
            })

        })
        let payload = {
            "submission_id": this.props.submissionID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "fixed_asset_movement": data
        }
        // console.log(data);
        this.props.saveToMasterBudget(payload)
        this.props.onClickClose()
    }

faisalhamdi's avatar
faisalhamdi committed
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 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
    downloadTemplate = async () => {
        let res = await fetch(
            `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
        )
        res = await res.blob()
        console.log(res)
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Fixed Assets Movement.xlsx';
            a.click();
        }
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
                console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
                console.log(isi);
                let payload = []
                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(),
                            total_actual_before: i[2] === undefined ? "" : String(i[2]).trim(),
                            january: i[3] === undefined ? "" : String(i[3]).trim(),
                            february: i[4] === undefined ? "" : String(i[4]).trim(),
                            march: i[5] === undefined ? "" : String(i[5]).trim(),
                            april: i[6] === undefined ? "" : String(i[6]).trim(),
                            may: i[7] === undefined ? "" : String(i[7]).trim(),
                            june: i[8] === undefined ? "" : String(i[8]).trim(),
                            july: i[9] === undefined ? "" : String(i[9]).trim(),
                            august: i[10] === undefined ? "" : String(i[10]).trim(),
                            september: i[11] === undefined ? "" : String(i[11]).trim(),
                            october: i[12] === undefined ? "" : String(i[12]).trim(),
                            november: i[13] === undefined ? "" : String(i[13]).trim(),
                            december: i[14] === undefined ? "" : String(i[14]).trim(),
                            total_current_year: i[15] === undefined ? "" : String(i[15]).trim(),
                            total_next_year: i[16] === undefined ? "" : String(i[16]).trim(),
                            total_more_year: i[17] === undefined ? "" : String(i[17]).trim()
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    fixed_asset_movement: payload
                }
                // console.log(JSON.stringify(body))
                this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
            }
        });
    }

    checkUpload() {
        api.create().checkUploadMB(this.state.payload).then(response => {
            console.log(JSON.stringify(this.state.payload));
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleFixedAssetsMovement: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.total_actual_before,
                            item.january,
                            item.february,
                            item.march,
                            item.april,
                            item.may,
                            item.june,
                            item.july,
                            item.august,
                            item.september,
                            item.october,
                            item.november,
                            item.december,
                            item.total_current_year,
                            item.total_next_year,
                            item.total_more_year,
                            item.error
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false })
                }
            }
        })
    }

    checkError(tableMeta) {
        if (tableMeta.rowData[22]) {
            if (tableMeta.rowData[22][0] === 'item') {
                this.setState({ buttonError: true })
            }
        }
    }

    uploadFAM() {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                total_actual_before: String(i[6]),
                january: String(i[7]),
                february: String(i[8]),
                march: String(i[9]),
                april: String(i[10]),
                may: String(i[11]),
                june: String(i[12]),
                july: String(i[13]),
                august: String(i[14]),
                september: String(i[15]),
                october: String(i[16]),
                november: String(i[17]),
                december: String(i[18]),
                total_current_year: String(i[19]),
                total_next_year: String(i[20]),
                total_more_year: String(i[21])
            })
        })
        let body = {
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
            fixed_asset_movement: data
        }
        console.log(data);
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                    this.props.getReportAttachment()
                } else {
                    alert(response.data.status)
                }
            } else {
                alert(response.problem)
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
909
    render() {
faisalhamdi's avatar
faisalhamdi committed
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935
        let dataTable2 = this.state.dataTable
        const handleChange = (value, tableMeta) => {
            let val = String(value).split(",").join("")
            // let data = this.state.dataTable2
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
            if (indexParent > 0) {
                // console.log(indexParent)
                let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
            }
        }
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] == item[2]) {
                    total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
            // console.log(indexParent);
            return a
        }
faisalhamdi's avatar
faisalhamdi committed
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
        const handleFormula = (data, tableMeta) => {
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
            arrayFormula.map((item, indexs) => {
                let index = dataTable2.findIndex((val) => val[1] == item)
                if (index > 0) {
                    arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
                } else {
                    arrayJumlah.push(item)
                }
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
            let array = arrayJumlah
            let total = 0
            let opt = ""
            array.map((item, index) => {
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
                    if (opt == "tambah") {
                        total = Number(total) + Number(item)
                    } else if (opt == "kurang") {
                        total = Number(total) - Number(item)
                    } else if (opt == "kali") {
                        total = Number(total) * Number(item)
                    } else if (opt == "bagi") {
                        total = Number(total) / Number(item)
                    } else {
                        total += item
                    }
                }
            })
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            return a

        }
faisalhamdi's avatar
faisalhamdi committed
980
        const columns = [{
faisalhamdi's avatar
faisalhamdi committed
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1006 1007 1008
            name: "Account",
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1009
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
faisalhamdi's avatar
faisalhamdi committed
1010 1011 1012 1013 1014 1015
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style }),
                customBodyRender: (val, tableMeta) => {
                    return (
faisalhamdi's avatar
faisalhamdi committed
1016
                       <div style={{ width: 300 }}>
faisalhamdi's avatar
faisalhamdi committed
1017 1018
                       {console.log(val)}
                       {console.log(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1019
                            {tableMeta.rowData[4] == 0 ?
faisalhamdi's avatar
faisalhamdi committed
1020
                                <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
faisalhamdi's avatar
faisalhamdi committed
1021
                                :
faisalhamdi's avatar
faisalhamdi committed
1022 1023 1024
                                <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                    <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
1025 1026 1027 1028 1029 1030
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1031
            name: "31 Dec 2020 Actual",
faisalhamdi's avatar
faisalhamdi committed
1032 1033
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1034 1035
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
1036 1037
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1038
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1039 1040 1041
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1042
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1054 1055 1056 1057
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1058 1059 1060 1061 1062
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1063
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1064 1065 1066 1067 1068 1069 1070
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1071
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1072 1073 1074
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1075 1076
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1077
                                        :
faisalhamdi's avatar
faisalhamdi committed
1078
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1079 1080 1081 1082 1083 1084 1085 1086
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={handleFormula(value, tableMeta)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1087 1088
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1089 1090 1091 1092 1093 1094 1095 1096
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
                                                    value={handleFormula(value, tableMeta)}
                                                />
faisalhamdi's avatar
faisalhamdi committed
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1110
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1111 1112 1113 1114
                            }
                        </div>
                    )
                }
faisalhamdi's avatar
faisalhamdi committed
1115 1116
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1117
            name: "Jan 2021",
faisalhamdi's avatar
faisalhamdi committed
1118 1119
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1120
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1121 1122 1123
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1124
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1125 1126 1127
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1128
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1140 1141 1142 1143
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1144
                                                }}
faisalhamdi's avatar
faisalhamdi committed
1145 1146 1147 1148
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1149
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1150 1151 1152 1153 1154 1155 1156
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1157
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1158 1159 1160
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1161 1162
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1163
                                        :
faisalhamdi's avatar
faisalhamdi committed
1164
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1165 1166 1167 1168 1169 1170
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1171
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1172
                                            />
faisalhamdi's avatar
faisalhamdi committed
1173 1174
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1175 1176 1177 1178 1179 1180
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1181
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1182
                                                />
faisalhamdi's avatar
faisalhamdi committed
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1196
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1197 1198 1199 1200 1201 1202
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1203
            name: "Feb 2021",
faisalhamdi's avatar
faisalhamdi committed
1204 1205
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1206
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1207 1208 1209
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1210
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1211
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1212
                    return (
faisalhamdi's avatar
faisalhamdi committed
1213
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1214
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1226 1227 1228 1229
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1230 1231 1232 1233 1234
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1235
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1236 1237 1238 1239 1240 1241 1242
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1243
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1244 1245 1246
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1247 1248
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1249
                                        :
faisalhamdi's avatar
faisalhamdi committed
1250
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1251 1252 1253 1254 1255 1256
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1257
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1258
                                            />
faisalhamdi's avatar
faisalhamdi committed
1259 1260
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1261 1262 1263 1264 1265 1266
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1267
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1268
                                                />
faisalhamdi's avatar
faisalhamdi committed
1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1282
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1283
                            }
faisalhamdi's avatar
faisalhamdi committed
1284 1285 1286 1287 1288
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1289
            name: "Mar 2021",
faisalhamdi's avatar
faisalhamdi committed
1290 1291
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1292
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1293 1294 1295
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1296
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1297
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1298
                    return (
faisalhamdi's avatar
faisalhamdi committed
1299
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1300
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1312 1313 1314 1315
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1316 1317 1318 1319 1320
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1321
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1322 1323 1324 1325 1326 1327 1328
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1329
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1330 1331 1332
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1333 1334
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1335
                                        :
faisalhamdi's avatar
faisalhamdi committed
1336
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1337 1338 1339 1340 1341 1342
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1343
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1344
                                            />
faisalhamdi's avatar
faisalhamdi committed
1345 1346
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1347 1348 1349 1350 1351 1352
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1353
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1354
                                                />
faisalhamdi's avatar
faisalhamdi committed
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1368
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1369
                            }
faisalhamdi's avatar
faisalhamdi committed
1370 1371 1372 1373 1374
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1375
            name: "Apr 2021",
faisalhamdi's avatar
faisalhamdi committed
1376 1377
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1378
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1379 1380 1381
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1382
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1383
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1384
                    return (
faisalhamdi's avatar
faisalhamdi committed
1385
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1386
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1398 1399 1400 1401
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1402 1403 1404 1405 1406
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1407
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1408 1409 1410 1411 1412 1413 1414
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1415
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1416 1417 1418
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1419 1420
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1421
                                        :
faisalhamdi's avatar
faisalhamdi committed
1422
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1423 1424 1425 1426 1427 1428
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1429
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1430
                                            />
faisalhamdi's avatar
faisalhamdi committed
1431 1432
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1433 1434 1435 1436 1437 1438
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1439
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1440
                                                />
faisalhamdi's avatar
faisalhamdi committed
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1454
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1455
                            }
faisalhamdi's avatar
faisalhamdi committed
1456 1457 1458 1459 1460 1461 1462 1463
                        </div>
                    )
                }
            }
        }, {
            name: "May 2021",
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1464
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1465 1466 1467
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1468
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1469
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1470
                    return (
faisalhamdi's avatar
faisalhamdi committed
1471
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1472
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1484 1485 1486 1487
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1488 1489 1490 1491 1492
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1493
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1494 1495 1496 1497 1498 1499 1500
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1501
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1502 1503 1504
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1505 1506
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1507
                                        :
faisalhamdi's avatar
faisalhamdi committed
1508
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1509 1510 1511 1512 1513 1514
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1515
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1516
                                            />
faisalhamdi's avatar
faisalhamdi committed
1517 1518
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1519 1520 1521 1522 1523 1524
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1525
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1526
                                                />
faisalhamdi's avatar
faisalhamdi committed
1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1540
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1541
                            }
faisalhamdi's avatar
faisalhamdi committed
1542 1543 1544 1545 1546
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1547
            name: "Jun 2021",
faisalhamdi's avatar
faisalhamdi committed
1548 1549
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1550
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1551 1552 1553
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1554
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1555
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1556
                    return (
faisalhamdi's avatar
faisalhamdi committed
1557
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1558
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
faisalhamdi's avatar
faisalhamdi committed
1570 1571 1572 1573
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1574 1575 1576 1577 1578
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1579
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1580 1581 1582 1583 1584 1585 1586
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1587
                                            value={handleValue(tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1588 1589 1590
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1591 1592
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1593
                                        :
faisalhamdi's avatar
faisalhamdi committed
1594
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1595 1596 1597 1598 1599 1600
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1601
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1602
                                            />
faisalhamdi's avatar
faisalhamdi committed
1603 1604
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1605 1606 1607 1608 1609 1610
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1611
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1612
                                                />
faisalhamdi's avatar
faisalhamdi committed
1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1626
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1627
                            }
faisalhamdi's avatar
faisalhamdi committed
1628 1629 1630 1631 1632
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1633
            name: "Jul 2021",
faisalhamdi's avatar
faisalhamdi committed
1634 1635
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1636
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1637 1638 1639
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1640 1641
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1642
                    return (
faisalhamdi's avatar
faisalhamdi committed
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1665
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1681 1682 1683 1684 1685 1686
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1687
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1688
                                            />
faisalhamdi's avatar
faisalhamdi committed
1689 1690
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1691 1692 1693 1694 1695 1696
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1697
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1698
                                                />
faisalhamdi's avatar
faisalhamdi committed
1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1712
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1713
                            }
faisalhamdi's avatar
faisalhamdi committed
1714 1715 1716 1717 1718
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1719
            name: "Aug 2021",
faisalhamdi's avatar
faisalhamdi committed
1720 1721
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1722
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1723 1724 1725
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1726 1727
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1728
                    return (
faisalhamdi's avatar
faisalhamdi committed
1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1751
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1767 1768 1769 1770 1771 1772
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1773
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1774
                                            />
faisalhamdi's avatar
faisalhamdi committed
1775 1776
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1777 1778 1779 1780 1781 1782
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1783
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1784
                                                />
faisalhamdi's avatar
faisalhamdi committed
1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1798
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1799
                            }
faisalhamdi's avatar
faisalhamdi committed
1800 1801 1802 1803 1804
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1805
            name: "Sep 2021",
faisalhamdi's avatar
faisalhamdi committed
1806 1807
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1808
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1809 1810 1811
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1812 1813
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1814
                    return (
faisalhamdi's avatar
faisalhamdi committed
1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1837
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1853 1854 1855 1856 1857 1858
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1859
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1860
                                            />
faisalhamdi's avatar
faisalhamdi committed
1861 1862
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1863 1864 1865 1866 1867 1868
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1869
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1870
                                                />
faisalhamdi's avatar
faisalhamdi committed
1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1884
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1885 1886 1887 1888 1889 1890
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1891
            name: "Oct 2021",
faisalhamdi's avatar
faisalhamdi committed
1892 1893
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1894
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1923
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1939 1940 1941 1942 1943 1944
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1945
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1946
                                            />
faisalhamdi's avatar
faisalhamdi committed
1947 1948
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1949 1950 1951 1952 1953 1954
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1955
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
1956
                                                />
faisalhamdi's avatar
faisalhamdi committed
1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1970
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
1971 1972 1973 1974 1975 1976
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1977
            name: "Nov 2021",
faisalhamdi's avatar
faisalhamdi committed
1978 1979
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1980
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
2009
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2025 2026 2027 2028 2029 2030
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2031
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2032
                                            />
faisalhamdi's avatar
faisalhamdi committed
2033 2034
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2035 2036 2037 2038 2039 2040
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2041
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2042
                                                />
faisalhamdi's avatar
faisalhamdi committed
2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
2056
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
2057 2058 2059 2060 2061 2062
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2063
            name: "Dec 2021",
faisalhamdi's avatar
faisalhamdi committed
2064 2065
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2066
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
2095
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2111 2112 2113 2114 2115 2116
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2117
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2118
                                            />
faisalhamdi's avatar
faisalhamdi committed
2119 2120
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2121 2122 2123 2124 2125 2126
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2127
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2128
                                                />
faisalhamdi's avatar
faisalhamdi committed
2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
2142
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
2143 2144 2145 2146 2147 2148 2149 2150 2151
                            }
                        </div>
                    )
                }
            }
        }, {
            name: "Current Total",
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2152 2153
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2154 2155 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
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
2181
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2197 2198 2199 2200 2201 2202
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2203
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2204
                                            />
faisalhamdi's avatar
faisalhamdi committed
2205 2206
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2207 2208 2209 2210 2211 2212
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2213
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2214
                                                />
faisalhamdi's avatar
faisalhamdi committed
2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
2228
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
2229 2230 2231 2232 2233 2234 2235 2236 2237
                            }
                        </div>
                    )
                }
            }
        }, {
            name: "31 Dec 2022 Total",
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2238 2239
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
2267
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2283 2284 2285 2286 2287 2288
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2289
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2290
                                            />
faisalhamdi's avatar
faisalhamdi committed
2291 2292
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2293 2294 2295 2296 2297 2298
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2299
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2300
                                                />
faisalhamdi's avatar
faisalhamdi committed
2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
2314
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
2315 2316 2317 2318 2319 2320 2321 2322 2323
                            }
                        </div>
                    )
                }
            }
        }, {
            name: "31 Dec 2023 Total",
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2324 2325
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                value={value}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
2353
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368
                                    <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={handleValue(tableMeta)}
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2369 2370 2371 2372 2373 2374
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2375
                                                value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2376
                                            />
faisalhamdi's avatar
faisalhamdi committed
2377 2378
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
2379 2380 2381 2382 2383 2384
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2385
                                                    value={handleFormula(value, tableMeta)}
faisalhamdi's avatar
faisalhamdi committed
2386
                                                />
faisalhamdi's avatar
faisalhamdi committed
2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    value === "" ?
                                                        null :
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value)}
                                                        />
                                                    :
faisalhamdi's avatar
faisalhamdi committed
2400
                                                    <span>-</span>
faisalhamdi's avatar
faisalhamdi committed
2401
                            }
faisalhamdi's avatar
faisalhamdi committed
2402 2403 2404 2405 2406 2407
                        </div>
                    )
                }
            }
        }
        ]
faisalhamdi's avatar
faisalhamdi committed
2408 2409 2410 2411 2412 2413 2414 2415 2416 2417
        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>
        );
faisalhamdi's avatar
faisalhamdi committed
2418

faisalhamdi's avatar
faisalhamdi committed
2419 2420 2421 2422 2423
        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' }}>Pengajuan Budget Tahunan</Typography>
                </div>
faisalhamdi's avatar
faisalhamdi committed
2424
                {this.state.loading && loadingComponent}
faisalhamdi's avatar
faisalhamdi committed
2425
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
faisalhamdi's avatar
faisalhamdi committed
2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483
                    {this.state.visibleFixedAssetsMovement === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Fixed Assets Movement</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' }}>Periode : {this.props.periode}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                            <a data-tip={'Download Template'} data-for="template">
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.downloadTemplate()}
                                                >
                                                    <img src={Images.template} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                            <a data-tip={'Upload'} data-for="upload">
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.setState({ visibleUpload: true })}
                                                >
                                                    <img src={Images.upload} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                            <a data-tip={'Download'} data-for="download">
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => null}
                                                >
                                                    <img src={Images.download} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                        </div>
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2484
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 200 }}>
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                </div> 
                            </div>
                            <div className="grid grid-2x">
                                <div className="col-1">
                                    <button
                                        type="button"
                                        onClick={() => this.backToMasterBudget('draft')}
                                        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' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
                                        </div>
                                    </button>
                                </div>
                                <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%'}}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
                                        onClick={() => {
                                            this.props.onClickClose()
                                        }}
                                    >
                                        <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' }}>Cancel</Typography>
                                        </div>
                                    </button>
                                    <button
                                        type="button"
                                        disabled={this.state.disabledSave}
                                        onClick={() => this.backToMasterBudget('submitted')}
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: this.state.disabledSave === true ? 'default' : 'pointer',
                                            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</Typography>
                                        </div>
                                    </button>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                        onClick={() => {
                                            this.setState({ loading: true }, () => {
                                                setTimeout(() => {
                                                    this.setState({ loading: false, disabledSave: false })
                                                }, 100);
                                            })
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
                                        </div>
                                    </button>
                                </div>
                            </div>
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
faisalhamdi's avatar
faisalhamdi committed
2580
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637
                                    {this.state.dataLoaded && (
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
                                            {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
                                            </MuiThemeProvider>}
                                        </div>
                                    )}
                                </div>
                                <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ visibleFixedAssetsMovement: true }, () => this.getItemHierarki())}
                                        style={{ marginRight: 20 }}
                                    >
                                        <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' }}>Cancel</Typography>
                                        </div>
                                    </button>
                                    <button
                                        type="button"
                                        disabled={this.state.buttonError == true ? true : false}
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.uploadFAM()
                                            }, 100);
                                        })}
                                        style={{ 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</Typography>
                                        </div>
                                    </button>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                        onClick={() => {
                                            this.setState({ loading: true }, () => {
                                                setTimeout(() => {
                                                    this.setState({ loading: false })
                                                }, 100);
                                            })
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
                                        </div>
                                    </button>
faisalhamdi's avatar
faisalhamdi committed
2638
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2639
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2640 2641
                        </Paper>}
                </div>
faisalhamdi's avatar
faisalhamdi committed
2642

faisalhamdi's avatar
faisalhamdi committed
2643 2644 2645 2646 2647 2648 2649
                {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>
faisalhamdi's avatar
faisalhamdi committed
2650
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2651
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2652 2653 2654 2655 2656 2657 2658 2659
                                <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>
faisalhamdi's avatar
faisalhamdi committed
2660 2661
                                </div>
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676
                            <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={() => {
                                    this.state.judul === "MASTER BUDGET - FIXED ASSETS MOVEMENT" ?
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
faisalhamdi's avatar
faisalhamdi committed
2677
                        </div>
faisalhamdi's avatar
faisalhamdi committed
2678 2679
                    </div>
                )}
faisalhamdi's avatar
faisalhamdi committed
2680 2681 2682 2683
            </div>
        );
    }
}