bug fixing issue double click calculate

parent d6c19730
...@@ -189,7 +189,8 @@ export default class BalanceSheetRO extends Component { ...@@ -189,7 +189,8 @@ export default class BalanceSheetRO extends Component {
"rolling_outlook_id": this.props.rollingOutlookID "rolling_outlook_id": this.props.rollingOutlookID
} }
api.create().getRollingOutlookBS(payload).then(response => { api.create().getRollingOutlookBS(payload).then(response => {
console.log(response); // console.log(response);
this.props.refresh()
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -217,7 +218,7 @@ export default class BalanceSheetRO extends Component { ...@@ -217,7 +218,7 @@ export default class BalanceSheetRO extends Component {
this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year, item.balance_sheet.total_current_year === "" ? "0" : Number(item.balance_sheet.total_current_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
...@@ -253,7 +254,7 @@ export default class BalanceSheetRO extends Component { ...@@ -253,7 +254,7 @@ export default class BalanceSheetRO extends Component {
this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year, item.balance_sheet.total_current_year === "" ? "0" : Number(item.balance_sheet.total_current_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
...@@ -267,7 +268,7 @@ export default class BalanceSheetRO extends Component { ...@@ -267,7 +268,7 @@ export default class BalanceSheetRO extends Component {
} }
} }
}) })
console.log(dataTable) // console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else { } else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -465,7 +466,7 @@ export default class BalanceSheetRO extends Component { ...@@ -465,7 +466,7 @@ export default class BalanceSheetRO extends Component {
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
// console.log(resp.rows[2]); console.log(isi);
let payload = [] let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -490,6 +491,7 @@ export default class BalanceSheetRO extends Component { ...@@ -490,6 +491,7 @@ export default class BalanceSheetRO extends Component {
}) })
} }
}) })
console.log(payload);
let body = { let body = {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
...@@ -507,8 +509,7 @@ export default class BalanceSheetRO extends Component { ...@@ -507,8 +509,7 @@ export default class BalanceSheetRO extends Component {
checkUpload() { checkUpload() {
api.create().checkImportRollingOutlookBS(this.state.payload).then(response => { api.create().checkImportRollingOutlookBS(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); this.props.refresh()
console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBSRO: false, loading: true }) this.setState({ visibleUpload: false, visibleBSRO: false, loading: true })
...@@ -539,7 +540,7 @@ export default class BalanceSheetRO extends Component { ...@@ -539,7 +540,7 @@ export default class BalanceSheetRO extends Component {
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1), item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1), item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1), item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1),
item.total_december_year === "" ? "0" : item.total_december_year, item.total_december_year === "" ? "0" : Number(item.total_december_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
...@@ -548,12 +549,12 @@ export default class BalanceSheetRO extends Component { ...@@ -548,12 +549,12 @@ export default class BalanceSheetRO extends Component {
}) })
console.log(dataTable) console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => {
this.state.dataTable.map(item => { // this.state.dataTable.map(item => {
// if (item[24].length > 0) { // if (item[24].length > 0) {
// // console.log('masuk') // // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true }) // this.setState({ buttonError: true, errorPreview: true })
// } // }
}) // })
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
}) })
} }
...@@ -667,9 +668,6 @@ export default class BalanceSheetRO extends Component { ...@@ -667,9 +668,6 @@ export default class BalanceSheetRO extends Component {
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
// if (data.rowData[5] == 'Retained Earnings') {
// console.log(item[data.columnIndex].value)
// }
if (data.rowData[1] === item[2]) { if (data.rowData[1] === item[2]) {
let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex]) let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex])
total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal
......
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