Commit c3f1a20c authored by Riri Novita's avatar Riri Novita

OLPA Casflow Current Total

parent 06cc94d0
......@@ -173,6 +173,7 @@ export default class CashFlow extends Component {
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.cash_flow.october, formula: item.cash_flow.october_formula } : item.cash_flow.october,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.cash_flow.november, formula: item.cash_flow.november_formula } : item.cash_flow.november,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.cash_flow.december, formula: item.cash_flow.december_formula } : item.cash_flow.december,
item.cash_flow.total_current_year,
item.order,
item.condition_it_should_be,
item.condition_if_wrong,
......@@ -206,6 +207,7 @@ export default class CashFlow extends Component {
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.cash_flow.october, formula: item.cash_flow.october_formula } : item.cash_flow.october,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.cash_flow.november, formula: item.cash_flow.november_formula } : item.cash_flow.november,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.cash_flow.december, formula: item.cash_flow.december_formula } : item.cash_flow.december,
item.cash_flow.total_current_year,
item.order,
item.condition_it_should_be,
item.condition_if_wrong,
......@@ -328,7 +330,7 @@ export default class CashFlow extends Component {
"october": String(item[15].value == undefined ? item[15] : Number(item[15].value).toFixed(1)),
"november": String(item[16].value == undefined ? item[16] : Number(item[16].value).toFixed(1)),
"december": String(item[17].value == undefined ? item[17] : Number(item[17].value).toFixed(1)),
"total_current_year": String(item[18]= '' ? Number(item[18]).toFixed(1) : item[19]),
"total_current_year": String(item[18] != '' ? Number(item[18]).toFixed(1) : item[18]),
}
)
})
......@@ -387,8 +389,9 @@ export default class CashFlow extends Component {
render() {
let dataTable2 = this.state.dataTable
let loading = false
// console.log(dataTable2[tableMeta.rowIndex]);
const handleValueFormula = (value, tableMeta, column, periode, forecast) => {
// console.log(tableMeta.rowData[5])
// console.log(tableMeta)
// console.log(column)
loading = true
let splitFormula = String(tableMeta.rowData[3]).split(/([()@])/)
......@@ -417,9 +420,9 @@ export default class CashFlow extends Component {
if (String(item).includes('[M-1]')) {
if (forecast !== undefined) {
let forecastt = 0
if (column == 19) {
if (column == 20) {
let tst = String(item).replace('[M-1]', '')
let data = 18
let data = 19
let period = this.props.periode - 1
let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
if (indexID !== -1) {
......@@ -435,9 +438,9 @@ export default class CashFlow extends Component {
}
}
if (column == 20) {
if (column == 21) {
let tst = String(item).replace('[M-1]', '')
let data = 18
let data = 19
let period = this.props.periode
let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
if (indexID !== -1) {
......@@ -451,7 +454,7 @@ export default class CashFlow extends Component {
}
}
if (column == 21) {
if (column == 22) {
let tst = String(item).replace('[M-1]', '')
let period = Number(this.props.periode) + 1
let indexID = forecast.findIndex((val) => String(val.item_formula).replace('forecast_', '') == String(`@${tst}`) && val.periode == period)
......@@ -509,10 +512,10 @@ export default class CashFlow extends Component {
}
}
} else {
let indexID = dataTable2.findIndex((val) => val[18] == item)
let indexID = dataTable2.findIndex((val) => val[19] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][column].value == undefined ? dataTable2[indexID][column] : dataTable2[indexID][column].value
if (item == dataTable2[tableMeta.rowIndex][18]) {
if (item == dataTable2[tableMeta.rowIndex][19]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? 0 : valuezz)
......@@ -685,12 +688,12 @@ export default class CashFlow extends Component {
if (tableMeta.rowData[5] == "Cash at the end of the period" && column == 6) {
console.log(tableMeta.rowData)
console.log(splitFormula)
console.log(baru)
console.log(anjay)
console.log(anjay2)
console.log(total)
// console.log(tableMeta.rowData)
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(anjay2)
// console.log(total)
// let testttt = dataTable2[tableMeta.rowIndex - 1][7].value
// console.log(testttt)
// total = testttt
......@@ -705,6 +708,21 @@ export default class CashFlow extends Component {
return total
}
const handleTotal = (tableMeta) => {
// console.log(dataTable2[tableMeta.rowIndex]);
let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 6 && index <= 17) {
let valItem = item.value == undefined || item.value == "" ? 0 : item.value
total += Number(valItem)
}
})
dataTable2[tableMeta.rowIndex][18] = total
return total
// console.log(total);
}
let columns = [
{
name: "",
......@@ -743,8 +761,8 @@ export default class CashFlow extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{tableMeta.rowData[26] ?
tableMeta.rowData[26].length > 0 ?
{tableMeta.rowData[27] ?
tableMeta.rowData[27].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
......@@ -822,7 +840,7 @@ export default class CashFlow extends Component {
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"12"}</span>
</div>
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#07a7d0' }}>
<div className="column-5" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#07a7d0' }}>
<span>{"Current Total"}</span>
</div>
</div>
......@@ -885,7 +903,7 @@ export default class CashFlow extends Component {
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[6].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[6], tableMeta, 6)).toFixed(1)}
/>
:
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -960,7 +978,7 @@ export default class CashFlow extends Component {
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[7].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[7], tableMeta, 7)).toFixed(1)}
// value={Number(tableMeta.rowData[7].value).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1033,7 +1051,7 @@ export default class CashFlow extends Component {
// value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
// value={Number(tableMeta.rowData[8].value).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1111,7 +1129,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[9].value).toFixed(1)}
// value={this.props.quarter != 'q1' ? Number(tableMeta.rowData[9].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[9], tableMeta, 9)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1191,7 +1209,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[10].value).toFixed(1)}
// value={this.props.quarter != 'q1' ? Number(tableMeta.rowData[10].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[10], tableMeta, 10)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1268,7 +1286,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[11].value).toFixed(1)}
// value={this.props.quarter != 'q1' ? Number(tableMeta.rowData[11].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[11], tableMeta, 11)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1345,7 +1363,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[12].value).toFixed(1)}
// value={this.props.quarter == 'q3' ? Number(tableMeta.rowData[12].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[12], tableMeta, 12)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1422,7 +1440,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[13].value).toFixed(1)}
// value={this.props.quarter == 'q3' ? Number(tableMeta.rowData[13].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[13], tableMeta, 13)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1482,7 +1500,7 @@ export default class CashFlow extends Component {
/>
:
tableMeta.rowData[0] === 7 ?
((this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)) >= Number(this.state.minValue) && (this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)) <= Number(this.state.maxValue)) ?
((Number(tableMeta.rowData[14].value).toFixed(1)) >= Number(this.state.minValue) && (Number(tableMeta.rowData[14].value).toFixed(1)) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1501,7 +1519,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[14].value).toFixed(1)}
// value={this.props.quarter == 'q3' ? Number(tableMeta.rowData[14].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[14], tableMeta, 14)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1579,7 +1597,7 @@ export default class CashFlow extends Component {
// value={Number(tableMeta.rowData[15].value).toFixed(1)}
// value={Number(handleValueFormula(tableMeta.rowData[15], tableMeta, 15)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1651,7 +1669,7 @@ export default class CashFlow extends Component {
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[16].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
// value={Number(handleValueFormula(tableMeta.rowData[16], tableMeta, 16)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1724,7 +1742,7 @@ export default class CashFlow extends Component {
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[17].value).toFixed(1) : Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
// value={Number(handleValueFormula(tableMeta.rowData[17], tableMeta, 17)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1752,8 +1770,6 @@ export default class CashFlow extends Component {
tableMeta.rowData[0] === 3 || tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] === 5 ?
// null
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1762,58 +1778,9 @@ export default class CashFlow extends Component {
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18]).toFixed(1) : Number(handleTotal(tableMeta)).toFixed(1)}
/>
</span>
:
tableMeta.rowData[0] === 6 ?
// null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
/>
:
tableMeta.rowData[0] === 7 ?
((Number(tableMeta.rowData[18]).toFixed(1))) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
/>
</LightTooltip>
:
null
}
</div>
</div>
......@@ -1888,6 +1855,12 @@ export default class CashFlow extends Component {
display: false
}
},
{
name: "",
options: {
display: false
}
},
// {
// name: "",
// options: {
......@@ -1930,7 +1903,7 @@ export default class CashFlow extends Component {
// disabled={true}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
......@@ -2011,7 +1984,7 @@ export default class CashFlow extends Component {
// disabled={true}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`, 20)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
......@@ -2092,7 +2065,7 @@ export default class CashFlow extends Component {
// disabled={true}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`, 21)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[24]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
......
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