Commit 1404374e authored by EKSAD's avatar EKSAD

pormula

parent bfe70c4c
...@@ -498,11 +498,16 @@ export default class ProfitLoss extends Component { ...@@ -498,11 +498,16 @@ export default class ProfitLoss extends Component {
total += Number(valItem) total += Number(valItem)
} }
}) })
let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2] )
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20]) let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : value dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : value
return R.equals(value, NaN) ? "0.0" : value return R.equals(value, NaN) ? "0.0" : value
} else { } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
// console.log("oke")
return handleFormula(0, tableMeta, 0)
}
else {
dataTable2[tableMeta.rowIndex][20] = total dataTable2[tableMeta.rowIndex][20] = total
return total return total
...@@ -769,15 +774,15 @@ export default class ProfitLoss extends Component { ...@@ -769,15 +774,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -859,15 +864,15 @@ export default class ProfitLoss extends Component { ...@@ -859,15 +864,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -949,15 +954,15 @@ export default class ProfitLoss extends Component { ...@@ -949,15 +954,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 3)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1039,15 +1044,15 @@ export default class ProfitLoss extends Component { ...@@ -1039,15 +1044,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 4)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1129,15 +1134,15 @@ export default class ProfitLoss extends Component { ...@@ -1129,15 +1134,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 5)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1219,15 +1224,15 @@ export default class ProfitLoss extends Component { ...@@ -1219,15 +1224,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 6)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1309,15 +1314,15 @@ export default class ProfitLoss extends Component { ...@@ -1309,15 +1314,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 7)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1399,15 +1404,15 @@ export default class ProfitLoss extends Component { ...@@ -1399,15 +1404,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 8)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1489,15 +1494,15 @@ export default class ProfitLoss extends Component { ...@@ -1489,15 +1494,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 9)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1579,15 +1584,15 @@ export default class ProfitLoss extends Component { ...@@ -1579,15 +1584,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 10)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1669,15 +1674,15 @@ export default class ProfitLoss extends Component { ...@@ -1669,15 +1674,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1759,15 +1764,15 @@ export default class ProfitLoss extends Component { ...@@ -1759,15 +1764,15 @@ export default class ProfitLoss extends Component {
// null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
// value === "" ? // value === "" ?
...@@ -1812,6 +1817,15 @@ export default class ProfitLoss extends Component { ...@@ -1812,6 +1817,15 @@ export default class ProfitLoss extends Component {
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(handleValue(tableMeta)).toFixed(1)}
/> />
</span> : </span> :
// 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(handleFormula(value, tableMeta, 12)).toFixed(1)}
// /> :
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -2288,14 +2302,15 @@ export default class ProfitLoss extends Component { ...@@ -2288,14 +2302,15 @@ export default class ProfitLoss extends Component {
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ loading: true}, () => null :
this.state.handleTekTekTek == 1 ? null : this.setState({ loading: true}, () =>
this.setState({ handleTekTekTek: 1 }, () => { this.state.handleTekTekTek == 1 ? null :
setTimeout(() => { this.setState({ handleTekTekTek: 1 }, () => {
this.uploadProfitLoss('draft') setTimeout(() => {
}, 100); this.uploadProfitLoss('draft')
}) }, 100);
) })
)
} }
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
...@@ -2312,14 +2327,15 @@ export default class ProfitLoss extends Component { ...@@ -2312,14 +2327,15 @@ export default class ProfitLoss extends Component {
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ loading: true}, () => null :
this.state.handleTekTekTek == 1 ? null : this.setState({ loading: true}, () =>
this.setState({ handleTekTekTek: 1 }, () => { this.state.handleTekTekTek == 1 ? null :
setTimeout(() => { this.setState({ handleTekTekTek: 1 }, () => {
this.uploadProfitLoss('submitted') setTimeout(() => {
}, 100); this.uploadProfitLoss('submitted')
}) }, 100);
) })
)
} }
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......
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