Commit d6ee7252 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'riri' into 'master'

persave-an monthly pl

See merge request !696
parents e457786b 093072c1
......@@ -1069,7 +1069,7 @@ export default class MonthlyReport extends Component {
periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
// saveToMasterBudget={this.saveToMasterBudget.bind(this)}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleMonthlyReport: true })}
// getReport={this.getCompanyActive.bind(this)}
/>
......
......@@ -183,25 +183,27 @@ export default class ProfitLossMR extends Component {
}
backToMonthlyReport(type) {
console.log(this.state.dataTable);
// console.log(this.state.dataTable);
let data = []
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[2],
"rolling_outlook": i[6],
"master_budget": i[7],
"rolling_budget": i[8],
"actual": i[9],
"actual_previous_month": i[10],
"amount_act_vs_previous_month": i[11],
"percent_act_vs_previous_month": i[12],
"amount_act_vs_mb": i[13],
"percent_act_vs_mb": i[14],
"amount_act_vs_rb": i[15],
"percent_act_vs_rb": i[16],
"mtd_vs_previous_month": i[17],
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
"item_report_id": i[1],
"notes": i[6],
"rolling_outlook": i[7],
"master_budget": i[8],
"rolling_budget": i[9],
"actual": i[10],
"ytd_actual": i[11],
"actual_previous_month": i[12],
"amount_act_vs_previous_month": i[13],
"percent_act_vs_previous_month": i[14],
"amount_act_vs_mb": i[15],
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_previous_month": i[19],
"mtd_vs_mb": i[20],
"mtd_vs_rb": i[21]
})
})
let payload = {
......@@ -211,7 +213,7 @@ export default class ProfitLossMR extends Component {
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
"balance_sheet": data
"profit_loss": data
}
api.create('UPLOAD').createMonthlyReportPL(payload).then(response => {
console.log(response);
......@@ -234,59 +236,45 @@ export default class ProfitLossMR extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleNotes = (value, tableMeta) => {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleChange = (value, tableMeta, indexChilds) => {
console.log(dataTable2)
// console.log(tableMeta)
const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
let val = String(value).split(",").join("")
dataTable2[tableMeta.rowIndex][10] = Number(val)
}
const handlePrevAmount = ( tableMeta) =>{
let prevAmount = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
prevAmount = Number(dataTable2[tableMeta.rowIndex][10]) - Number(dataTable2[tableMeta.rowIndex][12])
})
dataTable2[tableMeta.rowIndex][13] = Number(prevAmount).toFixed(1)
// console.log(Number(dataTable2[tableMeta.rowIndex][10]))
// console.log(b);
if (type === "actual") {
dataTable2[tableMeta.rowIndex][10] = Number(val).toFixed(1)
} else {
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
dataTable2[tableMeta.rowIndex][10] = Number(val).toFixed(1)
let jagain = Number(dataTable2[indexParent][10]).toFixed(1)
dataTable2[indexParent][10] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(Number(jagain) + Number(val)).toFixed(1)
return prevAmount
} else {
dataTable2[tableMeta.rowIndex][10] = Number(val).toFixed(1)
}
}
const handlePrevPercent = ( tableMeta) =>{
let b = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
b = Number(dataTable2[tableMeta.rowIndex][10]) - Number(dataTable2[tableMeta.rowIndex][12])
})
dataTable2[tableMeta.rowIndex][13] = Number(b).toFixed(1)
// console.log(Number(dataTable2[tableMeta.rowIndex][10]))
// console.log(b);
return b
}
const handleValue = (data, type) => {
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] === item[2]) {
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
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex + type] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex + type]))
}
})
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex + type] = Number(total)
// console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, month, type) => {
const handleFormula = (data, tableMeta, type) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let tambahan = false
let opet = ""
arrayFormula.map((item, indexs) => {
if (item == 'X') {
tambahan = true
......@@ -329,20 +317,65 @@ export default class ProfitLossMR extends Component {
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
// if (tableMeta.rowData[22] === 3) {
// console.log(arrayFormula);
// console.log(array);
// console.log(total);
// console.log(item);
// }
total = Number(total) * Number(item)
// if (tableMeta.rowData[22] === 3) {
// console.log(dataTable2[tableMeta.rowIndex]);
// console.log(total);
// console.log(item);
// console.log(arrayJumlah);
// }
} else if (opt == "bagi") {
total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
} else {
total += item
total += Number(item)
}
}
})
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total)
return a
}
const handleVariance = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
total = Number(tableMeta.rowData[10]) - Number(tableMeta.rowData[12])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 2) {
total = Number(tableMeta.rowData[10]) - Number(tableMeta.rowData[8])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 3) {
total = Number(tableMeta.rowData[10]) - Number(tableMeta.rowData[9])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
}
const handleVariancePercent = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][12])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(2)
} else if (dex === 2) {
total = Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(2)
} else if (dex === 3) {
total = Number(dataTable2[tableMeta.rowIndex][17]) / Number(dataTable2[tableMeta.rowIndex][9])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(2)
}
return total
}
let columns = [
{
name: "",
......@@ -470,7 +503,26 @@ export default class ProfitLossMR extends Component {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
null :
null
:
tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[9]}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(val, tableMeta, 0)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -554,7 +606,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 0)).toFixed(1)}
/>
}
/>
......@@ -606,7 +658,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1, 1)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
/>
}
/>
......@@ -678,7 +730,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1, 2)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
/>
}
/>
......@@ -708,6 +760,18 @@ export default class ProfitLossMR extends Component {
}
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "YTD Actual",
options: {
......@@ -730,9 +794,28 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/>
</span> :
</span>
:
tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[9]}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(val, tableMeta, 0)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -777,9 +860,28 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/>
</span> :
</span>
:
tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[9]}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(val, tableMeta, 0)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -854,35 +956,25 @@ export default class ProfitLossMR extends Component {
setCellProps: () => ({
style: {
paddingLeft: 0,
paddingRight: 0
paddingRight: 10
}
}),
customBodyRender: (val, tableMeta, updateValue) => {
// console.log(tableMeta);
return (
<div>
<div className="grid grid-3x content-center">
<div className="column-1">
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
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, 2)).toFixed(1)}
/>
</span>
null
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(tableMeta.rowData[13]).toFixed(1)}
value={val}
control={
<NumberFormat
thousandSeparator={true}
......@@ -890,7 +982,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handlePrevAmount(tableMeta) ).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 0)).toFixed(1)}
/>
}
/>
......@@ -899,32 +991,23 @@ export default class ProfitLossMR extends Component {
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
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, 3)).toFixed(1)}
/>
</span> :
null
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(tableMeta.rowData[14]).toFixed(1)}
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(tableMeta.rowData[14]).toFixed(1)}
value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(2)}
/>
}
/>
......@@ -937,20 +1020,10 @@ export default class ProfitLossMR extends Component {
<div className="column-2">
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
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, 4)).toFixed(1)}
/>
</span> :
null
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -962,7 +1035,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[15]).toFixed(1)}
value={Number(handleVariance(tableMeta, 2, 2)).toFixed(1)}
/>
}
/>
......@@ -971,20 +1044,10 @@ export default class ProfitLossMR extends Component {
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
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, 5)).toFixed(1)}
/>
</span> :
null
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -996,7 +1059,8 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[16]).toFixed(1)}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 2, 3)).toFixed(2)}
/>
}
/>
......@@ -1009,20 +1073,10 @@ export default class ProfitLossMR extends Component {
<div className="column-3">
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
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, 6)).toFixed(1)}
/>
</span> :
null
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1034,7 +1088,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[17]).toFixed(1)}
value={Number(handleVariance(tableMeta, 3, 4)).toFixed(1)}
/>
}
/>
......@@ -1043,20 +1097,10 @@ export default class ProfitLossMR extends Component {
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
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, 7)).toFixed(1)}
/>
</span> :
null
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1068,7 +1112,8 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(2)}
/>
}
/>
......@@ -1084,6 +1129,36 @@ export default class ProfitLossMR extends Component {
}
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: `MTD Explanation`,
options: {
......@@ -1119,7 +1194,8 @@ export default class ProfitLossMR extends Component {
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
null
:
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
......@@ -1128,7 +1204,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
......@@ -1153,7 +1229,8 @@ export default class ProfitLossMR extends Component {
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
null
:
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
......@@ -1162,7 +1239,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 8)).toFixed(1)}
value={Number(handleValue(tableMeta, 1)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
......@@ -1187,7 +1264,8 @@ export default class ProfitLossMR extends Component {
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
null
:
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
......@@ -1196,7 +1274,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 9)).toFixed(1)}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
......@@ -1236,48 +1314,6 @@ export default class ProfitLossMR extends Component {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
......@@ -1286,13 +1322,25 @@ export default class ProfitLossMR extends Component {
}
]
const loadingComponent = (
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
{this.state.loading && loadingComponent}
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography>
</div>
......@@ -1313,7 +1361,7 @@ export default class ProfitLossMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
......@@ -1341,7 +1389,12 @@ export default class ProfitLossMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
......@@ -1362,7 +1415,8 @@ export default class ProfitLossMR extends Component {
</MuiThemeProvider>
)}
</div>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(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') ? */}
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
......@@ -1388,18 +1442,17 @@ export default class ProfitLossMR extends Component {
<button
className="button"
type="button"
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false})
this.setState({ loading: false })
// this.handleValidate()
}, 100);
})
......@@ -1410,26 +1463,23 @@ export default class ProfitLossMR extends Component {
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
// onClick={() =>
// this.state.editable === true ?
// null :
// this.setState({ loading: true }, () =>
// this.state.handleTekTekTek == 1 ? null :
// this.setState({ handleTekTekTek: 1 }, () => {
// setTimeout(() => {
// this.uploadProfitLoss('draft')
// }, 100);
// })
// )
// }
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('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>
......@@ -1437,24 +1487,21 @@ export default class ProfitLossMR extends Component {
</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.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
// onClick={() =>
// this.state.editable === true ?
// null :
// this.setState({ loading: true }, () =>
// this.state.handleTekTekTek == 1 ? null :
// this.setState({ handleTekTekTek: 1 }, () => {
// setTimeout(() => {
// this.uploadProfitLoss('submitted')
// }, 100);
// })
// )
// }
>
<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>
......@@ -1462,6 +1509,9 @@ export default class ProfitLossMR extends Component {
</button>
</div>
</div>
{/* : null
} */}
</div>
</Paper>
</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