Commit 02c0f3bd authored by Riri Novita's avatar Riri Novita

mtd explanation

parent 4c9b2ddc
......@@ -55,12 +55,46 @@ export default class ProfitLossMR extends Component {
super(props)
this.state = {
dataTable: [],
loading: true
loading: true,
value: 0
}
}
componentDidMount() {
this.getItemHierarki()
this.getSettingControl()
}
getSettingControl() {
let body = {
group: 'THRESHOLD_VARIANCE',
company_id: this.props.company.company_id,
type: 'PNL'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
value: response.data.data[0] ? response.data.data[0].value : null
}, () => {
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() {
......@@ -148,7 +182,9 @@ export default class ProfitLossMR extends Component {
})
}
}
})
console.log(dataTable, this.state.value);
this.setState({ dataTable, loading: false })
}
})
......@@ -268,7 +304,7 @@ export default class ProfitLossMR extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
months: this.props.month.month_id,
months: "2021",
profit_loss: payload
}
console.log(body)
......@@ -286,12 +322,12 @@ export default class ProfitLossMR extends Component {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.item_report_id,
item.item_report,
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.parent,
item.item_report,
item.notes,
item.rolling_outlook,
item.master_budget,
......@@ -299,6 +335,13 @@ export default class ProfitLossMR extends Component {
item.actual,
item.ytd_actual,
item.actual_previous_month,
item.amount_act_vs_previous_month,
item.percent_act_vs_previous_month,
item.amount_act_vs_mb,
item.percent_act_vs_mb,
item.amount_act_vs_rb,
item.percent_act_vs_rb,
item.mtd_vs_previous_month,
item.mtd_vs_mb,
item.mtd_vs_rb,
item.orders,
......@@ -307,7 +350,7 @@ export default class ProfitLossMR extends Component {
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[16].length > 0) {
if (item[22].length > 0) {
// console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
......@@ -723,6 +766,7 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
......@@ -764,7 +808,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[8]}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
}
/>
......@@ -1407,6 +1451,26 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
Number(tableMeta.rowData[21]).toFixed(1) < Number(this.state.value).toFixed(1) ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[21]}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
value={Number(tableMeta.rowData[21]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
......
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