Commit 710caf29 authored by Deni Rinaldi's avatar Deni Rinaldi

isu aplot reaveneu

parent 266d8075
......@@ -62,7 +62,8 @@ export default class ProfitLoss extends Component {
judulColumn: null,
updateBy: '-',
buttonDraft: true,
handleTekTekTek: 0
handleTekTekTek: 0,
fromUpload: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -338,7 +339,7 @@ export default class ProfitLoss extends Component {
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
......@@ -371,7 +372,7 @@ export default class ProfitLoss extends Component {
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, fromUpload: true}, () => {
this.state.dataTable.map(item => {
if (item[24].length > 0) {
// console.log('masuk')
......@@ -545,8 +546,11 @@ export default class ProfitLoss extends Component {
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleValue = (data) => {
const handleValue = (value, data) => {
let total = 0
if (this.state.fromUpload) {
return value
} else {
dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
......@@ -557,6 +561,7 @@ export default class ProfitLoss extends Component {
// console.log(indexParent);
return a
}
}
const handleFormula = (data, tableMeta, month) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
......@@ -853,7 +858,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -972,7 +977,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1101,7 +1106,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1230,7 +1235,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1359,7 +1364,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1488,7 +1493,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1617,7 +1622,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1746,7 +1751,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1875,7 +1880,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -2004,7 +2009,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -2133,7 +2138,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -2262,7 +2267,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -2370,7 +2375,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span> :
// tableMeta.rowData[0] === 6 ?
......@@ -2477,7 +2482,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -2606,7 +2611,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleValue(value,tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -2916,7 +2921,7 @@ export default class ProfitLoss extends Component {
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true, dataTable: [] }, () => {
onClick={() => this.setState({ loading: true, dataTable: [], fromUpload: false }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
......@@ -2964,7 +2969,7 @@ export default class ProfitLoss extends Component {
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true }, () =>
this.setState({ loading: true, fromUpload: false }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
......@@ -2989,7 +2994,7 @@ export default class ProfitLoss extends Component {
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true }, () =>
this.setState({ loading: true, fromUpload: false }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
......
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