Commit a1497d92 authored by Riri Novita's avatar Riri Novita

update dulu sebelum ganti laptop

parent e1263d6c
......@@ -393,7 +393,7 @@ export default class BalanceSheet extends Component {
balance_sheet: payload,
status: 'submitted'
}
// console.log(body)
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
}
});
......@@ -440,6 +440,7 @@ export default class BalanceSheet extends Component {
item.error
]
})
console.log(dataTable);
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false, saveDraft: true }, () => {
this.state.dataTable.map(item => {
if (item[26].length > 0) {
......@@ -1125,7 +1126,7 @@ export default class BalanceSheet extends Component {
type="text"
placeholder=""
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={this.props.defaultCurrency.id == 1 ? (String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? fixNumber(Number(value.value), 1) : fixNumber(Number(handleValueFormula(value, tableMeta)), 1)) : (String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value) : Number(handleValueFormula(value, tableMeta)))}
value={this.props.defaultCurrency.id == 1 ? String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? fixNumber(Number(value.value), 1) : fixNumber(Number(handleValueFormula(value, tableMeta)), 1) : String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value) : Number(handleValueFormula(value, tableMeta))}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 'r/e')
// console.log(dataTable2)
......
......@@ -66,7 +66,7 @@ export default class BalanceSheetMR extends Component {
componentDidMount() {
this.getSettingControl()
this.getLatestUpdate()
// this.handleViewOnly()
this.handleViewOnly()
}
handleViewOnly() {
......
......@@ -97,7 +97,7 @@ export default class CashFlowMR extends Component {
componentDidMount() {
// this.getItemHierarki()
console.log(this.props.PLBSFAMSubmitted)
// this.handleViewOnly()
this.handleViewOnly()
this.getSettingControl()
}
......
......@@ -4,7 +4,7 @@ import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
import api from '../../api';
import { titleCase } from '../../library/Utils';
import { fixNumber, titleCase } from '../../library/Utils';
import Tooltip from '@material-ui/core/Tooltip';
import NumberFormat from 'react-number-format';
import Constant from '../../library/Constant';
......@@ -237,7 +237,7 @@ export default class CorporateAnnualTargetMR extends Component {
// parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.corporate_annual_target.formula_ytd == "" ? null : item.corporate_annual_target.formula_ytd,
// parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
......@@ -289,7 +289,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula,
item.level,
item.description,
item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.weight == '' ? Number(0) : Number(Number(item.weight) * 100),
item.uom,
item.kpi_type == "" ? null : item.kpi_type,
// item.kpi_type == "" ? null : { value: item.kpi_type },
......@@ -297,7 +297,7 @@ export default class CorporateAnnualTargetMR extends Component {
// item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.corporate_annual_target.formula == "" ? null : item.corporate_annual_target.formula_ytd,
// item.formula == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
......@@ -473,6 +473,7 @@ export default class CorporateAnnualTargetMR extends Component {
uploadCATMR(type) {
let data = []
if (this.props.defaultCurrency.id == 2) {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -482,14 +483,34 @@ export default class CorporateAnnualTargetMR extends Component {
jenis_kpi: i[8] == null ? "" : i[8],
max_ach: i[9] == null ? "" : i[9],
formula_ytd: i[10] == null ? "" : i[10],
actual_monthly: String(Number(i[11]).toFixed(1)),
target_monthly: String(Number(i[12]).toFixed(1)),
achivement_monthly: String(Number(i[13]).toFixed(1)),
score: String(Number(i[14]).toFixed(0)),
score_x_weight: String(Number(i[15]).toFixed(2)),
actual_monthly: String(Number(i[11])),
target_monthly: String(Number(i[12])),
achivement_monthly: String(Number(i[13])),
score: String(Number(i[14])),
score_x_weight: String(Number(i[15])),
notes: String(i[16])
})
})
} else {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
item_report: String(i[5]),
weight: String(i[6]),
uom: String(i[7]),
jenis_kpi: i[8] == null ? "" : i[8],
max_ach: i[9] == null ? "" : i[9],
formula_ytd: i[10] == null ? "" : i[10],
actual_monthly: String(fixNumber(Number(i[11]), 1)),
target_monthly: String(fixNumber(Number(i[12]), 1)),
achivement_monthly: String(fixNumber(Number(i[13]), 1)),
score: String(fixNumber(Number(i[14]), 0)),
score_x_weight: String(fixNumber(Number(i[15]), 2)),
notes: String(i[16])
})
})
}
let body = {
// "monthly_report_id": this.props.monthlyReportId,
"monthly_report_id": this.props.monthlyReportId,
......@@ -624,6 +645,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ loading: true })
console.log(this.state.dataTable);
let data = []
if (this.props.defaultCurrency.id == 2) {
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
......@@ -632,14 +654,33 @@ export default class CorporateAnnualTargetMR extends Component {
"jenis_kpi": i[8] == null ? "" : i[8],
"max_ach": i[9] == null ? "" : i[9],
"formula_ytd": i[10] == null ? "" : i[10],
"actual_monthly": i[11] == null || i[11] == "" ? 0.0 : String(Number(i[11]).toFixed(1)),
"target_monthly": i[12] == null || i[12] == "" ? 0.0 : String(Number(i[12]).toFixed(1)),
"achivement_monthly": String(Number(i[13]).toFixed(1)),
"score": String(Number(i[14]).toFixed(0)),
"score_x_weight": String(Number(i[15]).toFixed(2)),
"actual_monthly": i[11] == null || i[11] == "" ? 0.0 : String(Number(i[11])),
"target_monthly": i[12] == null || i[12] == "" ? 0.0 : String(Number(i[12])),
"achivement_monthly": String(Number(i[13])),
"score": String(Number(i[14])),
"score_x_weight": String(Number(i[15])),
"notes": i[16]
})
})
} else {
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"weight": i[6],
"uom": i[7],
"jenis_kpi": i[8] == null ? "" : i[8],
"max_ach": i[9] == null ? "" : i[9],
"formula_ytd": i[10] == null ? "" : i[10],
"actual_monthly": i[11] == null || i[11] == "" ? 0.0 : String(fixNumber(Number(i[11]), 1)),
"target_monthly": i[12] == null || i[12] == "" ? 0.0 : String(fixNumber(Number(i[12]), 1)),
"achivement_monthly": String(fixNumber(Number(i[13]), 1)),
"score": String(fixNumber(Number(i[14]), 0)),
"score_x_weight": String(fixNumber(Number(i[15]), 2)),
"notes": i[16]
})
})
}
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
......@@ -796,7 +837,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
})
}
let totalScorez = this.props.lastStatus == 'APPROVED' ? item[14] : Number(totalScore).toFixed(0)
let totalScorez = this.props.lastStatus == 'APPROVED' ? item[14] : this.props.defaultCurrency.id == 1 ? fixNumber(Number(totalScore), 0) : Number(totalScore)
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(totalScorez)
// }
......@@ -813,7 +854,7 @@ export default class CorporateAnnualTargetMR extends Component {
} else {
totalSW = (Number(totalScorez) * Number(handlePercent) / 100)
}
totalSW = this.props.lastStatus == 'APPROVED' ? item[15] : Number(totalSW).toFixed(2)
totalSW = this.props.lastStatus == 'APPROVED' ? item[15] : this.props.defaultCurrency.id == 1 ? fixNumber(Number(totalSW), 2) : Number(totalSW)
if (item[0] !== 1 && item[0] !== 4) {
total += Number(totalSW)
}
......@@ -855,7 +896,7 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(total)
// console.log(datatable3);
let totalWeightz = Number(totalWeight) / 100
let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)
let totalz = this.props.defaultCurrency.id == 1 ? (Number(fixNumber(fixNumber(Number(total), 2) / Number(totalWeightz)), 2)) : Number(Number(total) / Number(totalWeightz))
console.log(totalz)
let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz
......@@ -865,7 +906,7 @@ export default class CorporateAnnualTargetMR extends Component {
lastTotal = totalz
}
console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
console.log(fixNumber(Number(Number(total), 2) / fixNumber(Number(totalWeightz)), 2))
let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id)
let listPerfomanceDefault = []
if (indexPerform == -1) {
......@@ -1214,10 +1255,10 @@ export default class CorporateAnnualTargetMR extends Component {
// if (dataTable2[tableMeta.rowIndex][5] == "ROIC") {
// dataTable2[tableMeta.rowIndex][column] = 0
// } else {
dataTable2[tableMeta.rowIndex][column] = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][column] = this.props.defaultCurrency.i == 1 ? fixNumber(Number(total), 1) : Number(total)
// }
return Number(total).toFixed(1)
return this.props.defaultCurrency.i == 1 ? fixNumber(Number(total), 1) : Number(total)
}
const handleChangeText = (value, tableMeta) => {
......@@ -1410,11 +1451,11 @@ export default class CorporateAnnualTargetMR extends Component {
})
}
if (Number(tableMeta.rowData[12]) == Number(0)) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(0).toFixed(0)
return Number(0).toFixed(0)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(0), 0) : Number(0)
return this.props.defaultCurrency.id == 1 ? fixNumber(Number(0), 0) : Number(0)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(totalScore), 0) : Number(totalScore)
return this.props.defaultCurrency.id == 1 ? fixNumber(Number(totalScore), 0) : Number(totalScore)
}
}
......@@ -1432,9 +1473,9 @@ export default class CorporateAnnualTargetMR extends Component {
totalScore += Number(item[15])
}
})
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(2)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(totalScore), 2) : Number(totalScore)
if (tableMeta.rowIndex == dataTable2.length - 1) {
someXXX = Number(totalScore).toFixed(2)
someXXX = this.props.defaultCurrency.id == 1 ? fixNumber(Number(totalScore), 2) : Number(totalScore)
// console.log(someXXX)
}
return null
......@@ -1452,7 +1493,7 @@ export default class CorporateAnnualTargetMR extends Component {
total = Number(dataTable2[tableMeta.rowIndex][14]) * Number(handlePercent) / 100
// console.log(total)
}
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(total), 2) : Number(total)
return total
}
......@@ -1583,7 +1624,7 @@ export default class CorporateAnnualTargetMR extends Component {
type="text"
placeholder=""
suffix={"%"}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
disabled={true}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
......@@ -1690,7 +1731,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={1}
......@@ -1699,14 +1740,14 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ flex: 1, textAlign: 'right' }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value)}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view' ? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) ? "#5198ea" : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)).toFixed(1) : Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? fixNumber(Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)) : Number(value))}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.state.get_for == 'view' ? true : !handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)}
decimalScale={1}
......@@ -1739,14 +1780,14 @@ export default class CorporateAnnualTargetMR extends Component {
null :
<FormControlLabel
style={{ margin: 0 }}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
decimalScale={1}
disabled={true}
/>
......@@ -1776,7 +1817,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
suffix={"%"}
......@@ -1785,7 +1826,7 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1793,7 +1834,7 @@ export default class CorporateAnnualTargetMR extends Component {
type="text"
placeholder=""
suffix={"%"}
value={handleAchiement(tableMeta).toFixed(1)}
value={fixNumber(handleAchiement(tableMeta), 1)}
decimalScale={1}
disabled={true}
/>
......@@ -1823,7 +1864,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(0)}
value={fixNumber(Number(value), 0)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={0}
......@@ -1831,7 +1872,7 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={Number(value).toFixed(0)}
value={fixNumber(Number(value), 0)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1876,7 +1917,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
value={fixNumber(Number(value), 2)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={true}
decimalScale={2}
......@@ -1887,7 +1928,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta).toFixed(2)}
value={fixNumber(handleTotal(tableMeta), 2)}
decimalScale={2}
disabled={true}
/>
......
......@@ -571,7 +571,7 @@ export default class ListOfCreditFacilities extends Component {
item.type_of_credit == "Others" ? item.out_loan_other_type : "",
item.type_of_credit == "Others" ? item.out_loan_other_amount_ori : "0.0",
item.type_of_credit == "Others" ? (item.out_loan_other_amount_idr === null ? "0.0" : item.out_loan_other_amount_idr === "" ? "0.0" : item.out_loan_other_amount_idr) : "0.0",
item.total_out_loan_ori === null ? "0.0" : item.total_out_loan_ori === "" ? "0.0" : item.total_out_loan_ori,
item.total_out_loan_ori === null ? "0.0" : item.total_out_loan_ori === "" ? "0.0" : item.total_out_loan_ori === 0 ? "0.0" : item.total_out_loan_ori,
item.total_out_loan_idr === null ? "0.0" : item.total_out_loan_idr === "" ? "0.0" : item.total_out_loan_idr,
item.remaining_plafond_ori === null ? "0.0" : item.remaining_plafond_ori === "" ? "0.0" : item.remaining_plafond_ori,
item.remaining_plafond_idr === null ? "0.0" : item.remaining_plafond_idr === "" ? "0.0" : item.remaining_plafond_idr,
......@@ -658,7 +658,7 @@ export default class ListOfCreditFacilities extends Component {
// }
// }
})
// console.log(dataTable);
console.log(dataTable);
if (dataTable.length == 0) {
dataTable.push(
[3, "", "", "", "", this.props.company.company_name, null, null, "", null, "0.00", "", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", 0],
......@@ -1308,6 +1308,7 @@ export default class ListOfCreditFacilities extends Component {
let dataCoba = []
let bankNameEmpty = false
let totalLoan = 0
console.log(dataTable2);
dataTable2.map((item, index) => {
if (item[0] !== 8) {
if (item[6] == null) {
......@@ -1336,6 +1337,7 @@ export default class ListOfCreditFacilities extends Component {
}
}
})
console.log(dataCoba);
let dataGabung = []
if (!bankNameEmpty) {
dataCoba.map((item, index) => {
......@@ -1343,9 +1345,11 @@ export default class ListOfCreditFacilities extends Component {
dataGabung.push(items)
})
})
console.log(dataGabung);
dataGabung.map((items, index) => {
console.log(items);
if (items[0] == 3) {
console.log(Number(totalLoan));
this.props.defaultCurrency.id == 1 ? totalLoan += items[22] : totalLoan += items[21]
}
if (bankPrev != "") {
......@@ -1500,10 +1504,10 @@ export default class ListOfCreditFacilities extends Component {
// console.log(dataGabung)
console.log(newData)
// console.log(dataTampungBank)
console.log(fixNumber(Number(totalLoan), 1));
console.log(totalLoan);
console.log(this.state.perBS)
console.log(this.state.diff)
// console.log(bankNameEmpty)
console.log(bankNameEmpty)
// dataTable: newData, totalOutStand: newData[newData.length-1][22]
if (bankNameEmpty) {
if (this.state.get_for == 'view') {
......@@ -1521,7 +1525,7 @@ export default class ListOfCreditFacilities extends Component {
} else {
if (this.props.defaultCurrency.id == 1) {
this.setState({ loading: false, dataTable: newData, diff: fixNumber(Number(fixNumber(Number(totalLoan), 1) - this.state.perBS),), saveDraft: false, saveComp: Number(fixNumber(Number(totalLoan), 1) - this.state.perBS) == 0 || Number(fixNumber(Number(totalLoan), 1) - this.state.perBS) == "-0.0" ? false : true })
this.setState({ loading: false, dataTable: newData, diff: fixNumber(Number(fixNumber(Number(totalLoan), 1) - this.state.perBS), 1), saveDraft: false, saveComp: Number(fixNumber(Number(totalLoan), 1) - this.state.perBS) == 0 || Number(fixNumber(Number(totalLoan), 1) - this.state.perBS) == "-0.0" ? false : true })
} else {
this.setState({ loading: false, dataTable: newData, diff: Number(Number(totalLoan) - this.state.perBS), saveDraft: false, saveComp: Number(Number(totalLoan) - this.state.perBS) == 0 || Number(Number(totalLoan) - this.state.perBS) == "-0.0" ? false : true })
}
......@@ -1644,6 +1648,9 @@ export default class ListOfCreditFacilities extends Component {
}
const handleFormulaHardcode = (value, tableMeta, column) => {
// console.log("------------coba------------------");
// console.log(tableMeta);
// console.log(tableMeta.rowData[0]);
let valuez = 0
if (tableMeta.rowData[0] == 8) {
dataTable2.map((item, index) => {
......@@ -1670,6 +1677,7 @@ export default class ListOfCreditFacilities extends Component {
} else if (column == 24) {
valuez = Number(tableMeta.rowData[13]) - Number(tableMeta.rowData[22])
}
}
dataTable2[tableMeta.rowIndex][column] = valuez
return valuez
......@@ -2114,7 +2122,7 @@ export default class ListOfCreditFacilities extends Component {
value={Number(value) == 0 ? "0.0" : this.state.get_for == 'view' ? fixNumber(Number(value), 2) : this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 2) : Number(value)}
disabled={this.state.get_for == 'view'}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, tableMeta.columnIndex)
......@@ -2754,7 +2762,7 @@ export default class ListOfCreditFacilities extends Component {
placeholder=""
disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[21]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21))}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)) == 0 ? "0.0" : Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21))}
/>
}
/>
......@@ -2772,7 +2780,7 @@ export default class ListOfCreditFacilities extends Component {
placeholder=""
disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[21]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21))}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21)) == 0 ? "0.0" : Number(handleFormulaHardcode(tableMeta.rowData[21], tableMeta, 21))}
/>
}
/>
......@@ -2797,7 +2805,7 @@ export default class ListOfCreditFacilities extends Component {
placeholder=""
disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[22]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22))}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)) == 0 ? "0.0" : Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22))}
/>
}
/>
......@@ -2815,7 +2823,7 @@ export default class ListOfCreditFacilities extends Component {
placeholder=""
disabled={true}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[22]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22))}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)), 1) : Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22)) == 0 ? "0.0" : Number(handleFormulaHardcode(tableMeta.rowData[22], tableMeta, 22))}
/>
}
/>
......@@ -2992,9 +3000,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[25]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[25]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[25]), 2) : Number(tableMeta.rowData[25])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 25)
}}
......@@ -3020,7 +3029,8 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={true}
value={fixNumber(Number(handleTableRatio(tableMeta.rowData[26], tableMeta, 26, "Current Ratio")), 1)}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[26]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTableRatio(tableMeta.rowData[26], tableMeta, 26, "Current Ratio")), 1) : Number(handleTableRatio(tableMeta.rowData[26], tableMeta, 26, "Current Ratio"))}
/>
}
/>
......@@ -3075,9 +3085,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[27]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[27]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[27]), 2) : Number(tableMeta.rowData[27])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 27)
}}
......@@ -3103,7 +3114,8 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={true}
value={fixNumber(Number(handleTableRatio(tableMeta.rowData[28], tableMeta, 28, "Debt to Equity Ratio")), 2)}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[28]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTableRatio(tableMeta.rowData[28], tableMeta, 28, "Debt to Equity Ratio")), 2) : Number(handleTableRatio(tableMeta.rowData[28], tableMeta, 28, "Debt to Equity Ratio"))}
/>
}
/>
......@@ -3158,9 +3170,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[29]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[29]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[29]), 2) : Number(tableMeta.rowData[29])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 29)
}}
......@@ -3186,7 +3199,8 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={true}
value={fixNumber(Number(handleTableRatio(tableMeta.rowData[30], tableMeta, 30, "Debt to EBITDA - YTD")), 2)}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={Number(tableMeta.rowData[30]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTableRatio(tableMeta.rowData[30], tableMeta, 30, "Debt to EBITDA - YTD")), 2) : Number(handleTableRatio(tableMeta.rowData[30], tableMeta, 30, "Debt to EBITDA - YTD"))}
/>
}
/>
......@@ -3241,9 +3255,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[31]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[31]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[31]), 2) : Number(tableMeta.rowData[31])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 31)
}}
......@@ -3269,7 +3284,8 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={true}
value={fixNumber(Number(handleTableRatio(tableMeta.rowData[32], tableMeta, 32, "EBITDA to Interest - YTD")), 2)}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[32]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTableRatio(tableMeta.rowData[32], tableMeta, 32, "EBITDA to Interest - YTD")), 2) : Number(handleTableRatio(tableMeta.rowData[32], tableMeta, 32, "EBITDA to Interest - YTD"))}
/>
}
/>
......@@ -3357,9 +3373,9 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[34]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[34]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[34]), 2) : Number(tableMeta.rowData[34])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 34)
}}
......@@ -3385,9 +3401,9 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[35]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[35]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[35]), 2) : Number(tableMeta.rowData[35])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 35)
}}
......@@ -3478,9 +3494,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[37]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[37]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[37]), 2) : Number(tableMeta.rowData[37])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 37)
}}
......@@ -3506,9 +3523,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[38]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[38]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[38]), 2) : Number(tableMeta.rowData[38])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 38)
}}
......@@ -3599,9 +3617,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[40]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[40]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[40]), 2) : Number(tableMeta.rowData[40])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 40)
}}
......@@ -3627,9 +3646,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[41]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[41]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[41]), 2) : Number(tableMeta.rowData[41])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 41)
}}
......@@ -3720,9 +3740,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[43]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[43]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[43]), 2) : Number(tableMeta.rowData[43])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 43)
}}
......@@ -3748,9 +3769,10 @@ export default class ListOfCreditFacilities extends Component {
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
fixedDecimalScale={2}
decimalScale={2}
value={fixNumber(Number(tableMeta.rowData[44]), 2)}
fixedDecimalScale={this.props.defaultCurrency.id == 1 ? true : false}
// decimalScale={2}
decimalScale={this.props.defaultCurrency.id == 1 ? 2 : 16}
value={Number(tableMeta.rowData[44]) == 0 ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(tableMeta.rowData[44]), 2) : Number(tableMeta.rowData[44])}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 44)
}}
......
......@@ -2565,9 +2565,9 @@ export default class MonthlyReport extends Component {
:
// {
// (tableMeta.rowData[5] ?
(tableMeta.rowData[5] ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null)
: null)
// console.log(tableMeta.rowData)
// }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment