Commit 4ac8e578 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

update master bajet fam

See merge request !724
parents 9fdfcdef 5628b4d8
...@@ -105,21 +105,21 @@ export default class FixedAssetsMovement extends Component { ...@@ -105,21 +105,21 @@ export default class FixedAssetsMovement extends Component {
item.level, item.level,
item.description, item.description,
item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before, item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula } : item.fixed_asset_movement.january, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.january).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula } : Number(item.fixed_asset_movement.january).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula } : item.fixed_asset_movement.february, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.february).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula } : Number(item.fixed_asset_movement.february).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula } : item.fixed_asset_movement.march, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.march).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula } : Number(item.fixed_asset_movement.march).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula } : item.fixed_asset_movement.april, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.april).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula } : Number(item.fixed_asset_movement.april).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula } : item.fixed_asset_movement.may, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.may).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula } : Number(item.fixed_asset_movement.may).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula } : item.fixed_asset_movement.june, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.june).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula } : Number(item.fixed_asset_movement.june).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula } : item.fixed_asset_movement.july, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.july).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula } : Number(item.fixed_asset_movement.july).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula } : item.fixed_asset_movement.august, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.august).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula } : Number(item.fixed_asset_movement.august).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula } : item.fixed_asset_movement.september, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.september).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula } : Number(item.fixed_asset_movement.september).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula } : item.fixed_asset_movement.october, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula } : Number(item.fixed_asset_movement.october).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula } : item.fixed_asset_movement.november, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula } : Number(item.fixed_asset_movement.november).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula } : item.fixed_asset_movement.december, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula } : Number(item.fixed_asset_movement.december).toFixed(1),
item.fixed_asset_movement.total_current_year, Number(item.fixed_asset_movement.total_current_year).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year, Number(item.fixed_asset_movement.total_next_year).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year, Number(item.fixed_asset_movement.total_more_year).toFixed(1),
item.order, item.order,
item.fixed_asset_movement.forecast_formula, item.fixed_asset_movement.forecast_formula,
item.fixed_asset_movement.before_formula item.fixed_asset_movement.before_formula
...@@ -142,21 +142,21 @@ export default class FixedAssetsMovement extends Component { ...@@ -142,21 +142,21 @@ export default class FixedAssetsMovement extends Component {
item.level, item.level,
item.description, item.description,
item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before, item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula } : item.fixed_asset_movement.january, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.january).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula } : Number(item.fixed_asset_movement.january).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula } : item.fixed_asset_movement.february, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.february).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula } : Number(item.fixed_asset_movement.february).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula } : item.fixed_asset_movement.march, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.march).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula } : Number(item.fixed_asset_movement.march).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula } : item.fixed_asset_movement.april, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.april).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula } : Number(item.fixed_asset_movement.april).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula } : item.fixed_asset_movement.may, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.may).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula } : Number(item.fixed_asset_movement.may).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula } : item.fixed_asset_movement.june, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.june).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula } : Number(item.fixed_asset_movement.june).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula } : item.fixed_asset_movement.july, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.july).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula } : Number(item.fixed_asset_movement.july).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula } : item.fixed_asset_movement.august, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.august).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula } : Number(item.fixed_asset_movement.august).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula } : item.fixed_asset_movement.september, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.september).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula } : Number(item.fixed_asset_movement.september).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula } : item.fixed_asset_movement.october, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula } : Number(item.fixed_asset_movement.october).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula } : item.fixed_asset_movement.november, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula } : Number(item.fixed_asset_movement.november).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula } : item.fixed_asset_movement.december, this.props.status === 'CLOSED' ? Number(item.fixed_asset_movement.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula } : Number(item.fixed_asset_movement.december).toFixed(1),
item.fixed_asset_movement.total_current_year, Number(item.fixed_asset_movement.total_current_year).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year, Number(item.fixed_asset_movement.total_next_year).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year, Number(item.fixed_asset_movement.total_more_year).toFixed(1),
item.order, item.order,
item.fixed_asset_movement.forecast_formula, item.fixed_asset_movement.forecast_formula,
item.fixed_asset_movement.before_formula item.fixed_asset_movement.before_formula
...@@ -183,6 +183,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -183,6 +183,8 @@ export default class FixedAssetsMovement extends Component {
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false}) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false})
} }
console.log(dataTable);
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -683,9 +685,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -683,9 +685,10 @@ export default class FixedAssetsMovement extends Component {
} }
const handleTotal = (tableMeta) => { const handleTotal = (tableMeta) => {
let total = 0 let total = 0
// if (tableMeta.rowData[5] == 'Beginning balance') { // console.log(tableMeta)
// // console.log(tableMeta.rowData) if (tableMeta.rowData[5] == 'Beginning balance') {
// } console.log(tableMeta.rowData)
}
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance') { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance') {
total = dataTable2[tableMeta.rowIndex][18].value total = dataTable2[tableMeta.rowIndex][18].value
dataTable2[tableMeta.rowIndex][19] = total dataTable2[tableMeta.rowIndex][19] = total
...@@ -2242,18 +2245,68 @@ export default class FixedAssetsMovement extends Component { ...@@ -2242,18 +2245,68 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96, textAlign: 'right' }}> <div style={{ width: 96, textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ? {
null : tableMeta.rowData[0] === 2 ? this.props.status === 'CLOSED' ?
<span style={{ fontSize: 12, textAlign: 'right' }}> tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
/>
}
/>
</div> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(value).toFixed(1)}
/>
}
/>
</div>
:
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
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)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/> />
</span> : }
/>
</div> :
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -2263,7 +2316,48 @@ export default class FixedAssetsMovement extends Component { ...@@ -2263,7 +2316,48 @@ export default class FixedAssetsMovement extends Component {
disabled={true} disabled={true}
value={Number(handleTotal(tableMeta)).toFixed(1)} value={Number(handleTotal(tableMeta)).toFixed(1)}
/> />
</span>} </span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleTotal(tableMeta)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
null
:
null
// 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)).toFixed(1)}
// />
// </span>
// :
// <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(handleTotal(tableMeta)).toFixed(1)}
// />
// </span>
}
</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