Commit 7bbaef0c authored by EKSAD's avatar EKSAD

aplod pl

parent db1fd98d
...@@ -241,8 +241,8 @@ export default class ProfitLoss extends Component { ...@@ -241,8 +241,8 @@ export default class ProfitLoss extends Component {
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
notes: i[2] === undefined ? "" : reg.test(String(i[2])) === false ? "" : String(i[2]).trim(), notes: i[2] === undefined ? "" : String(i[2]).trim(),
total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(), total_actual_before: i[3] === undefined ? "0" : String(i[3]).trim(),
january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(), january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(), february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(), march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
...@@ -267,7 +267,7 @@ export default class ProfitLoss extends Component { ...@@ -267,7 +267,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(payload)
this.setState({ payload: body, judul: resp.rows[1][0] }) this.setState({ payload: body, judul: resp.rows[1][0] })
} }
}); });
...@@ -308,6 +308,7 @@ export default class ProfitLoss extends Component { ...@@ -308,6 +308,7 @@ export default class ProfitLoss extends Component {
item.error item.error
] ]
}) })
// console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
if (this.state.dataTable[23].length > 0) { if (this.state.dataTable[23].length > 0) {
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true })
...@@ -323,7 +324,7 @@ export default class ProfitLoss extends Component { ...@@ -323,7 +324,7 @@ export default class ProfitLoss extends Component {
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
notes: i[6], notes: String(i[6]),
total_actual_before: String(i[7]), total_actual_before: String(i[7]),
january: String(i[8]), january: String(i[8]),
february: String(i[9]), february: String(i[9]),
...@@ -349,6 +350,7 @@ export default class ProfitLoss extends Component { ...@@ -349,6 +350,7 @@ export default class ProfitLoss extends Component {
profit_loss: data profit_loss: data
} }
console.log(data); console.log(data);
// console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -2211,7 +2213,7 @@ export default class ProfitLoss extends Component { ...@@ -2211,7 +2213,7 @@ export default class ProfitLoss extends Component {
</button> </button>
<button <button
type="button" type="button"
disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadProfitLoss() this.uploadProfitLoss()
......
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