Commit 56d8de25 authored by d.arizona's avatar d.arizona

update idPL

parent 3f56b6b7
...@@ -73,7 +73,8 @@ export default class BudgetTahunan extends Component { ...@@ -73,7 +73,8 @@ export default class BudgetTahunan extends Component {
loadview: false, loadview: false,
permissionhandle: false, permissionhandle: false,
userType: '', userType: '',
PLBSFAMSubmitted: false PLBSFAMSubmitted: false,
PLID: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -1090,12 +1091,26 @@ export default class BudgetTahunan extends Component { ...@@ -1090,12 +1091,26 @@ export default class BudgetTahunan extends Component {
} }
getPL(type) { getPL(type) {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id
}
console.log(payloadID);
api.create().getPLID(payloadID).then(response => {
console.log(response);
if (response) {
PLID = response.data.data == null ? null : response.data.data.profit_loss_id
} else {
PLID = null
}
this.setState({ PLID }, () => {
let payload = { let payload = {
"report_id": 6, "report_id": 28,
"revision": Number(this.state.lastRevision), "revision": Number(this.state.lastRevision),
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"submission_id": this.state.submissionID, "submission_id": this.state.PLID,
"months": 0, "months": 0,
"quarter": 0, "quarter": 0,
} }
...@@ -1191,6 +1206,10 @@ export default class BudgetTahunan extends Component { ...@@ -1191,6 +1206,10 @@ export default class BudgetTahunan extends Component {
}) })
})
})
} }
handleValueFormulaDBPL = (indexDBCF, value, tableMeta, column, periode, forecast) => { handleValueFormulaDBPL = (indexDBCF, value, tableMeta, column, periode, forecast) => {
...@@ -1538,11 +1557,12 @@ export default class BudgetTahunan extends Component { ...@@ -1538,11 +1557,12 @@ export default class BudgetTahunan extends Component {
createDBPL() { createDBPL() {
let payload = { let payload = {
"submission_id": this.state.submissionID, // "submission_id": this.state.submissionID,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"report_id": 1, "report_id": 28,
"status": "submitted", "status": "submitted",
"profit_loss_id": this.state.PLID,
"profit_loss_mb": this.state.dbPL, "profit_loss_mb": this.state.dbPL,
"months": 0, "months": 0,
} }
......
...@@ -72,7 +72,8 @@ export default class MonthlyReport extends Component { ...@@ -72,7 +72,8 @@ export default class MonthlyReport extends Component {
isApprovedMB: false, isApprovedMB: false,
textRevision: '', textRevision: '',
dbCF: [], dbCF: [],
PLBSFAMSubmitted: false PLBSFAMSubmitted: false,
PLID: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -1383,6 +1384,20 @@ export default class MonthlyReport extends Component { ...@@ -1383,6 +1384,20 @@ export default class MonthlyReport extends Component {
} }
getPL(type) { getPL(type) {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id
}
console.log(payloadID);
api.create().getPLID(payloadID).then(response => {
console.log(response);
if (response) {
PLID = response.data.data == null ? null : response.data.data.profit_loss_id
} else {
PLID = null
}
this.setState({ PLID }, () => {
let payload = { let payload = {
"revision": Number(this.state.lastRevision), "revision": Number(this.state.lastRevision),
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
...@@ -1390,7 +1405,7 @@ export default class MonthlyReport extends Component { ...@@ -1390,7 +1405,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id, "months": this.state.month.month_id,
"quarter": 0, "quarter": 0,
"report_id": 1, "report_id": 1,
"submission_id": 0 "submission_id": this.state.PLID
} }
api.create().getHierarkiCreateReportPLMR(payload).then((response) => { api.create().getHierarkiCreateReportPLMR(payload).then((response) => {
...@@ -1505,6 +1520,9 @@ export default class MonthlyReport extends Component { ...@@ -1505,6 +1520,9 @@ export default class MonthlyReport extends Component {
} }
console.log(dataTable); console.log(dataTable);
}) })
})
})
} }
handleValueFormulaDBPLMR = (value, tableMeta, column, periode, forecast) => { handleValueFormulaDBPLMR = (value, tableMeta, column, periode, forecast) => {
...@@ -1757,13 +1775,14 @@ export default class MonthlyReport extends Component { ...@@ -1757,13 +1775,14 @@ export default class MonthlyReport extends Component {
createPL() { createPL() {
let payload = { let payload = {
"monthly_report_id": this.state.monthlyReportId, // "monthly_report_id": this.state.monthlyReportId,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"report_id": 1, "report_id": 1,
"status": "submitted", "status": "submitted",
"months": this.state.month.month_id, "months": this.state.month.month_id,
"quarter": 0, "quarter": 0,
"profit_loss_id": this.state.PLID,
"profit_loss_mr": this.state.dbPL "profit_loss_mr": this.state.dbPL
} }
api.create().createReportPLMR(payload).then((res) => { api.create().createReportPLMR(payload).then((res) => {
......
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