Commit 08d7ec6d authored by Riri Novita's avatar Riri Novita

profit loss

parent 1bb99888
...@@ -289,7 +289,7 @@ export default class ProfitLoss extends Component { ...@@ -289,7 +289,7 @@ export default class ProfitLoss extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp) console.log(resp)
if (err) { if (err) {
// console.log(err); // console.log(err);
} }
...@@ -329,7 +329,7 @@ export default class ProfitLoss extends Component { ...@@ -329,7 +329,7 @@ export default class ProfitLoss extends Component {
report_id: this.props.report_id, report_id: this.props.report_id,
profit_loss: payload profit_loss: payload
} }
// console.log(body) console.log(isi)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
} }
}); });
...@@ -338,7 +338,7 @@ export default class ProfitLoss extends Component { ...@@ -338,7 +338,7 @@ export default class ProfitLoss extends Component {
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true }) this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
...@@ -549,7 +549,7 @@ export default class ProfitLoss extends Component { ...@@ -549,7 +549,7 @@ export default class ProfitLoss extends Component {
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) { if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(String(item[data.columnIndex]).includes('-')? Number(String(item[data.columnIndex]).substr(1, String(item[data.columnIndex]).length)) * -1 : Number(item[data.columnIndex])))
} }
}) })
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2]) let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
...@@ -616,7 +616,7 @@ export default class ProfitLoss extends Component { ...@@ -616,7 +616,7 @@ export default class ProfitLoss extends Component {
} else if (opt == "bagi") { } else if (opt == "bagi") {
total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item) total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
} else { } else {
total += item total += Number(item)
} }
} }
}) })
......
This diff is collapsed.
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