Commit dad2004e authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-' into 'master'

+_+

See merge request !723
parents e20c9bd1 74d60c48
...@@ -10,6 +10,7 @@ import { PropagateLoader } from 'react-spinners'; ...@@ -10,6 +10,7 @@ import { PropagateLoader } from 'react-spinners';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
import * as R from 'ramda';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -44,13 +45,49 @@ export default class BalanceSheetMR extends Component { ...@@ -44,13 +45,49 @@ export default class BalanceSheetMR extends Component {
this.state = { this.state = {
dataTable: [], dataTable: [],
loading: true, loading: true,
visibleBSMR: true visibleBSMR: true,
valueThreshold: 0,
minValue: 0,
maxValue: 0
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
this.getItemHierarki() this.getSettingControl()
}
getSettingControl() {
let body = {
group: 'THRESHOLD_VARIANCE',
company_id: this.props.company.company_id,
type: 'BALANCE_SHEET'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : -5,
maxValue: response.data.data[0] ? response.data.data[0].max_value : 5,
}, () => {
this.getItemHierarki()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
} }
getItemHierarki() { getItemHierarki() {
...@@ -77,20 +114,20 @@ export default class BalanceSheetMR extends Component { ...@@ -77,20 +114,20 @@ export default class BalanceSheetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.rolling_outlook === null ? "1.0" : item.balance_sheet.rolling_outlook === "" ? "1.0" : item.balance_sheet.rolling_outlook, item.balance_sheet.rolling_outlook === null ? "0" : item.balance_sheet.rolling_outlook === "" ? "0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.master_budget === "" ? "2.0" : item.balance_sheet.master_budget, item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "3.0" : item.balance_sheet.rolling_budget, item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "4.0" : item.balance_sheet.actual, item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "5.0" : item.balance_sheet.actual_previous_month === "" ? "5.0" : item.balance_sheet.actual_previous_month, item.balance_sheet.actual_previous_month === null ? "0" : item.balance_sheet.actual_previous_month === "" ? "0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "6.0" : item.balance_sheet.amount_act_vs_previous_month, item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "7.0" : item.balance_sheet.percent_act_vs_previous_month, item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "8.0" : item.balance_sheet.amount_act_vs_mb, item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "9.0" : item.balance_sheet.percent_act_vs_mb, item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "10.0" : item.balance_sheet.amount_act_vs_rb, item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "11.0" : item.balance_sheet.percent_act_vs_rb, item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "12.0" : item.balance_sheet.mtd_vs_previous_month, item.balance_sheet.mtd_vs_previous_month === "" ? "0" : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "13.0" : item.balance_sheet.mtd_vs_mb, item.balance_sheet.mtd_vs_mb === "" ? "0" : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "14.0" : item.balance_sheet.mtd_vs_rb, item.balance_sheet.mtd_vs_rb === "" ? "0" : item.balance_sheet.mtd_vs_rb,
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -109,20 +146,20 @@ export default class BalanceSheetMR extends Component { ...@@ -109,20 +146,20 @@ export default class BalanceSheetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.rolling_outlook === null ? "1.0" : item.balance_sheet.rolling_outlook === "" ? "1.0" : item.balance_sheet.rolling_outlook, item.balance_sheet.rolling_outlook === null ? "0" : item.balance_sheet.rolling_outlook === "" ? "0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.master_budget === "" ? "2.0" : item.balance_sheet.master_budget, item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "3.0" : item.balance_sheet.rolling_budget, item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "4.0" : item.balance_sheet.actual, item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "5.0" : item.balance_sheet.actual_previous_month === "" ? "5.0" : item.balance_sheet.actual_previous_month, item.balance_sheet.actual_previous_month === null ? "0" : item.balance_sheet.actual_previous_month === "" ? "0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "6.0" : item.balance_sheet.amount_act_vs_previous_month, item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "7.0" : item.balance_sheet.percent_act_vs_previous_month, item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "8.0" : item.balance_sheet.amount_act_vs_mb, item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "9.0" : item.balance_sheet.percent_act_vs_mb, item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "10.0" : item.balance_sheet.amount_act_vs_rb, item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "11.0" : item.balance_sheet.percent_act_vs_rb, item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "12.0" : item.balance_sheet.mtd_vs_previous_month, item.balance_sheet.mtd_vs_previous_month === "" ? "0" : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "13.0" : item.balance_sheet.mtd_vs_mb, item.balance_sheet.mtd_vs_mb === "" ? "0" : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "14.0" : item.balance_sheet.mtd_vs_rb, item.balance_sheet.mtd_vs_rb === "" ? "0" : item.balance_sheet.mtd_vs_rb,
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -291,7 +328,7 @@ export default class BalanceSheetMR extends Component { ...@@ -291,7 +328,7 @@ export default class BalanceSheetMR extends Component {
"months": this.props.month.month_id, "months": this.props.month.month_id,
"balance_sheet": data "balance_sheet": data
} }
// console.log(data); // console.log(data);
api.create('UPLOAD').uploadMonthlyReportBS(body).then(response => { api.create('UPLOAD').uploadMonthlyReportBS(body).then(response => {
console.log(response); console.log(response);
...@@ -394,13 +431,13 @@ export default class BalanceSheetMR extends Component { ...@@ -394,13 +431,13 @@ export default class BalanceSheetMR extends Component {
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
// if (item[2] !== null) { // if (item[2] !== null) {
if (data.rowData[1] === item[2]) { if (data.rowData[1] === item[2]) {
// console.log(item[data.columnIndex + type]) // console.log(item[data.columnIndex + type])
let itemVal = item[data.columnIndex + type].value !== undefined ? Number(item[data.columnIndex + type].value) : Number(item[data.columnIndex + type]) let itemVal = item[data.columnIndex + type].value !== undefined ? Number(item[data.columnIndex + type].value) : Number(item[data.columnIndex + type])
total = item[data.columnIndex + type] === undefined ? Number(total) + 0 : Number(total) + itemVal total = item[data.columnIndex + type] === undefined ? Number(total) + 0 : Number(total) + itemVal
} }
// } // }
}) })
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2]) let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1) dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
...@@ -430,11 +467,20 @@ export default class BalanceSheetMR extends Component { ...@@ -430,11 +467,20 @@ export default class BalanceSheetMR extends Component {
// console.log(tableMeta); // console.log(tableMeta);
// } // }
if (dex === 1) { if (dex === 1) {
total = Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10]) total = R.equals((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])), Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// if (tableMeta.rowData[5] === "Cash and cash equivalent") {
// console.log(total);
// console.log(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10]));
// console.log(dataTable2[tableMeta.rowIndex]);
// }
} else if (dex === 2) { } else if (dex === 2) {
total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7]) total = R.equals((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])), Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 3) { } else if (dex === 3) {
total = Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8]) total = R.equals((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])), Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// console.log(total);
} }
return total return total
} }
...@@ -831,23 +877,40 @@ export default class BalanceSheetMR extends Component { ...@@ -831,23 +877,40 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
<div style={{ flex: 1 }}> Number(tableMeta.rowData[12]) <= this.state.minValue || Number(tableMeta.rowData[12]) >= this.state.maxValue ?
<FormControlLabel <div style={{ flex: 1 }}>
style={{ margin: 0 }} <FormControlLabel
value={val} style={{ margin: 0 }}
control={ value={val}
<NumberFormat control={
thousandSeparator={true} <NumberFormat
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} thousandSeparator={true}
type="text" style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
placeholder="" type="text"
suffix={'%'} placeholder=""
disabled={true} disabled={true}
value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)} value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)}
/> />
} }
/> />
</div> </div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)}
/>
}
/>
</div>
} }
</div> </div>
</div> </div>
...@@ -882,23 +945,40 @@ export default class BalanceSheetMR extends Component { ...@@ -882,23 +945,40 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
<div style={{ flex: 1 }}> Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
<FormControlLabel <div style={{ flex: 1 }}>
style={{ margin: 0 }} <FormControlLabel
value={val} style={{ margin: 0 }}
control={ value={val}
<NumberFormat control={
thousandSeparator={true} <NumberFormat
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} thousandSeparator={true}
type="text" style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
placeholder="" type="text"
disabled={true} placeholder=""
suffix={'%'} disabled={true}
value={Number(handleVariancePercent(tableMeta, 2, 5)).toFixed(1)} value={Number(handleVariancePercent(tableMeta, 2, 5)).toFixed(1)}
/> />
} }
/> />
</div> </div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 2, 5)).toFixed(1)}
/>
}
/>
</div>
} }
</div> </div>
</div> </div>
...@@ -933,23 +1013,40 @@ export default class BalanceSheetMR extends Component { ...@@ -933,23 +1013,40 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 120 }}> <div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
<div style={{ flex: 1 }}> Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<FormControlLabel <div style={{ flex: 1 }}>
style={{ margin: 0 }} <FormControlLabel
value={val} style={{ margin: 0 }}
control={ value={val}
<NumberFormat control={
thousandSeparator={true} <NumberFormat
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} thousandSeparator={true}
type="text" style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
placeholder="" type="text"
disabled={true} placeholder=""
suffix={'%'} disabled={true}
value={Number(handleVariancePercent(tableMeta, 3, 7)).toFixed(1)} value={Number(handleVariancePercent(tableMeta, 3, 7)).toFixed(1)}
/> />
} }
/> />
</div> </div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 3, 7)).toFixed(1)}
/>
}
/>
</div>
} }
</div> </div>
</div> </div>
...@@ -998,33 +1095,53 @@ export default class BalanceSheetMR extends Component { ...@@ -998,33 +1095,53 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
tableMeta.rowData[0] === 2 ? Number(tableMeta.rowData[12]) <= this.state.minValue || Number(tableMeta.rowData[12]) >= this.state.maxValue ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={tableMeta.rowData[17]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={false}
value={Number(tableMeta.rowData[17]).toFixed(1)} value={Number(tableMeta.rowData[17]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
}}
/> />
} }
/> />
</div> </div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<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[17]).toFixed(1)}
/>
}
/>
</div>
} }
</div> </div>
</div> </div>
...@@ -1032,33 +1149,53 @@ export default class BalanceSheetMR extends Component { ...@@ -1032,33 +1149,53 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
tableMeta.rowData[0] === 2 ? Number(tableMeta.rowData[14]) <= this.state.minValue || Number(tableMeta.rowData[14]) >= this.state.maxValue ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 8)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={tableMeta.rowData[18]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={false}
value={Number(tableMeta.rowData[18]).toFixed(1)} value={Number(tableMeta.rowData[18]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
}}
/> />
} }
/> />
</div> </div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 8)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<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)}
/>
}
/>
</div>
} }
</div> </div>
</div> </div>
...@@ -1066,33 +1203,53 @@ export default class BalanceSheetMR extends Component { ...@@ -1066,33 +1203,53 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
tableMeta.rowData[0] === 2 ? Number(tableMeta.rowData[16]) <= this.state.minValue || Number(tableMeta.rowData[16]) >= this.state.maxValue ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 9)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={val} value={tableMeta.rowData[19]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={false}
value={Number(tableMeta.rowData[19]).toFixed(1)} value={Number(tableMeta.rowData[19]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
}}
/> />
} }
/> />
</div> </div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 9)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<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[19]).toFixed(1)}
/>
}
/>
</div>
} }
</div> </div>
</div> </div>
...@@ -1167,7 +1324,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1167,7 +1324,7 @@ export default class BalanceSheetMR extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div> </div>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBSMR? <Paper style={{ paddingTop: 10 }}> {this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div> </div>
...@@ -1339,122 +1496,122 @@ export default class BalanceSheetMR extends Component { ...@@ -1339,122 +1496,122 @@ export default class BalanceSheetMR extends Component {
{/* : null {/* : null
} */} } */}
</div> </div>
</Paper> : </Paper> :
<Paper style={{ paddingTop: 10 }}> <Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ padding: 20 }}>
{!this.state.loading && ( <div>
<MuiThemeProvider theme={getMuiTheme()}> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<MUIDataTable <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
data={dataTable2} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<button {!this.state.loading && (
className="button" <MuiThemeProvider theme={getMuiTheme()}>
type="button" <MUIDataTable
style={{ data={dataTable2}
backgroundColor: 'transparent', columns={columns}
cursor: 'pointer', options={options}
borderColor: 'transparent', />
outline: 'none', </MuiThemeProvider>
marginRight: 20 )}
}} </div>
onClick={() => { <div className="grid grid-2x" style={{ marginTop: 20 }}>
this.setState({ loading: true }, () => { <div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.props.onClickClose()
// this.handleValidate()
}, 100); }, 100);
}) })}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> cursor: 'pointer',
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> borderColor: 'transparent',
</div> outline: 'none'
</button> }}
<button >
className="button" <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
type="button" <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
style={{ </div>
backgroundColor: 'transparent', </button>
cursor: this.state.saveDraft !== true ? 'pointer' : 'default', </div>
borderColor: 'transparent', <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
outline: 'none', <button
marginRight: 20 className="button"
}} type="button"
onClick={() => style={{
this.state.saveDraft === true ? backgroundColor: 'transparent',
null : cursor: 'pointer',
this.state.handleTekTekTek == 1 ? null : borderColor: 'transparent',
this.setState({ handleTekTekTek: 1 }, () => { outline: 'none',
this.uploadBalanceSheet('draft') marginRight: 20
}) }}
} onClick={() => {
> this.setState({ loading: true }, () => {
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> setTimeout(() => {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> this.setState({ loading: false })
</div> // this.handleValidate()
</button> }, 100);
<button })
type="button" }}
// disabled={this.state.buttonError} >
onClick={() => <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
this.state.buttonError ? <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) </div>
: </button>
this.state.handleTekTekTek == 1 ? null : <button
this.setState({ handleTekTekTek: 1 }, () => { className="button"
this.uploadBalanceSheet('submitted') type="button"
})} style={{
style={{ backgroundColor: 'transparent',
backgroundColor: 'transparent', cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
cursor: this.state.buttonError === true ? 'default' : 'pointer', borderColor: 'transparent',
borderColor: 'transparent', outline: 'none',
outline: 'none', marginRight: 20
}} }}
> onClick={() =>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> this.state.saveDraft === true ?
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> null :
</div> this.state.handleTekTekTek == 1 ? null :
</button> this.setState({ handleTekTekTek: 1 }, () => {
this.uploadBalanceSheet('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadBalanceSheet('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div> </div>
</div> </div>
</div> </Paper>
</Paper>
} }
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
......
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