Commit dd197b84 authored by Riri Novita's avatar Riri Novita

ilangin object

parent e34859c4
......@@ -65,7 +65,7 @@ export default class ProfitLossMR extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"month": this.props.month.month_id
"months": this.props.month.month_id
}
api.create().getHierarkiMontlyReportPL(payload).then(response => {
console.log(response);
......@@ -84,26 +84,20 @@ export default class ProfitLossMR extends Component {
item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.rolling_outlook === null ? "0.0" : item.profit_loss.rolling_outlook === "" ? "0.0" : item.profit_loss.rolling_outlook,
{
mb: item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget,
rb: item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
actual: item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual
},
item.profit_loss.master_budget === null ? "0.0" : item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget,
item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month,
{
aavpm: item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
pavpm: item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
aavmb: item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
pavmb: item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
aavrb: item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
pavrb: item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
},
{
mtdvpm: item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month,
mtdvmb: item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
mtdvrb: item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
}
item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "0.0" : item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "0.0" : item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
])
}
if (item.children !== null) {
......@@ -124,26 +118,20 @@ export default class ProfitLossMR extends Component {
item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.rolling_outlook === null ? "0.0" : item.profit_loss.rolling_outlook === "" ? "0.0" : item.profit_loss.rolling_outlook,
{
mb: item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget,
rb: item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
actual: item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual
},
item.profit_loss.master_budget === null ? "0.0" : item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget,
item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month,
{
aavpm: item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
pavpm: item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
aavmb: item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
pavmb: item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
aavrb: item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
pavrb: item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
},
{
mtdvpm: item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month,
mtdvmb: item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
mtdvrb: item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
}
item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "0.0" : item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "0.0" : item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -168,15 +156,16 @@ export default class ProfitLossMR extends Component {
const handleChange = (value, tableMeta, indexChilds) => {
console.log(dataTable2)
let val = String(value).split(",").join("")
if (indexChilds == 0) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].mb = Number(val)
}
else if (indexChilds == 1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].rb = Number(val)
}
else if (indexChilds == 2) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].actual = Number(val)
}
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// if (indexChilds == 0) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// }
// else if (indexChilds == 1) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// }
// else if (indexChilds == 2) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// }
}
let columns = [
{
......@@ -368,7 +357,7 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.mb}
value={value}
control={
<NumberFormat
thousandSeparator={true}
......@@ -376,7 +365,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value.mb).toFixed(1)}
value={Number(value).toFixed(1)}
/>
}
/>
......@@ -391,7 +380,7 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.rb}
value={value}
control={
<NumberFormat
thousandSeparator={true}
......@@ -399,7 +388,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value.rb).toFixed(1)}
value={Number(value).toFixed(1)}
/>
}
/>
......@@ -415,7 +404,7 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.actual}
value={value}
control={
<NumberFormat
thousandSeparator={true}
......@@ -423,7 +412,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value.actual).toFixed(1)}
value={Number(value).toFixed(1)}
/>
}
/>
......@@ -432,7 +421,7 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.actual}
value={value}
control={
<NumberFormat
thousandSeparator={true}
......@@ -440,7 +429,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value.actual).toFixed(1)}
value={Number(value).toFixed(1)}
/>
}
/>
......@@ -451,14 +440,14 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.actual}
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={Number(value.actual).toFixed(1)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 2)
// console.log(dataTable2)
......@@ -583,7 +572,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.aavpm
val
}
</div>
</div>
......@@ -591,7 +580,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.pavpm
val
}
</div>
</div>
......@@ -603,7 +592,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.aavmb
val
}
</div>
</div>
......@@ -611,7 +600,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.pavmb
val
}
</div>
</div>
......@@ -623,7 +612,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.aavrb
val
}
</div>
</div>
......@@ -631,7 +620,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.pavrb
val
}
</div>
</div>
......@@ -679,7 +668,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.mtdvpm
val
}
</div>
</div>
......@@ -687,7 +676,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.mtdvmb
val
}
</div>
</div>
......@@ -695,7 +684,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
val.mtdvrb
val
}
</div>
</div>
......
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