Commit fadd910f authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

issue OI

See merge request !860
parents af5a51a0 dc904c50
...@@ -254,6 +254,7 @@ const create = (type = "") => { ...@@ -254,6 +254,7 @@ const create = (type = "") => {
// Monthly // Monthly
const getMonthlyReport = (body) => api.post('transaction/monthly_report/get_all_report', body) const getMonthlyReport = (body) => api.post('transaction/monthly_report/get_all_report', body)
const getMonthlyOI = (body) => api.post('transaction/monthly_report_oi/get_operating_indicator_id', body)
const getMonthlyReportID = (body) => api.post('transaction/monthly_report/get_monthly_report_id', body) const getMonthlyReportID = (body) => api.post('transaction/monthly_report/get_monthly_report_id', body)
const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body) const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body)
const getHierarkiMontlyReportOI = (body) => api.post('transaction/monthly_report_oi/get_report_hierarki', body) const getHierarkiMontlyReportOI = (body) => api.post('transaction/monthly_report_oi/get_report_hierarki', body)
...@@ -530,7 +531,8 @@ const create = (type = "") => { ...@@ -530,7 +531,8 @@ const create = (type = "") => {
getPerBSiMontlyReportLOCF, getPerBSiMontlyReportLOCF,
checkUploadMonthlyReportLOCF, checkUploadMonthlyReportLOCF,
uploadMonthlyReportLOCF, uploadMonthlyReportLOCF,
validateSubmitReportOI validateSubmitReportOI,
getMonthlyOI
} }
} }
......
...@@ -84,7 +84,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -84,7 +84,7 @@ export default class OperatingIndicatorMR extends Component {
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDMonthly,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
...@@ -148,12 +148,14 @@ export default class OperatingIndicatorMR extends Component { ...@@ -148,12 +148,14 @@ export default class OperatingIndicatorMR extends Component {
} }
getOperatingIDMonthly() { getOperatingIDMonthly() {
// console.log(this.props.data.operatingIndID);
let payload = { let payload = {
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode.periode, "periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null "months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null
} }
api.create().getOpetratingIndID(payload).then(response => { api.create().getMonthlyOI(payload).then(response => {
console.log(response);
if (response) { if (response) {
if (response.data.data) { if (response.data.data) {
this.setState({ operatingIndIDMonthly: response.data.data.operating_indicator_id } , () => { this.setState({ operatingIndIDMonthly: response.data.data.operating_indicator_id } , () => {
...@@ -178,12 +180,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -178,12 +180,13 @@ export default class OperatingIndicatorMR extends Component {
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null, "months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"get_for": this.state.get_for "get_for": this.state.get_for
} }
console.log(payload);
api.create().getHierarkiMontlyReportOI(payload).then(response => { api.create().getHierarkiMontlyReportOI(payload).then(response => {
console.log(response); console.log(response);
// console.log(JSON.stringify(response));
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
console.log(res);
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
...@@ -196,13 +199,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -196,13 +199,13 @@ export default class OperatingIndicatorMR extends Component {
item.description, item.description,
item.uom === "" ? null : item.uom, item.uom === "" ? null : item.uom,
item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook, item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.master_budget, item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_budget, item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
item.monthly_report.actual === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.actual, item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_mb, item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_mb, item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.percent_act_vs_mb === "" ? "0.0" : item.monthly_report.percent_act_vs_mb,
item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_rb, item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.amount_act_vs_rb === "" ? "0.0" : item.monthly_report.amount_act_vs_rb,
item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_rb, item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.percent_act_vs_rb === "" ? "0.0" : item.monthly_report.percent_act_vs_rb,
item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb, item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb,
item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb, item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb,
item.order, item.order,
...@@ -226,13 +229,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -226,13 +229,13 @@ export default class OperatingIndicatorMR extends Component {
item.description, item.description,
item.uom === "" ? null : item.uom, item.uom === "" ? null : item.uom,
item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook, item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.master_budget, item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_budget, item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
item.monthly_report.actual === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.actual, item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_mb, item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_mb, item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.percent_act_vs_mb === "" ? "0.0" : item.monthly_report.percent_act_vs_mb,
item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.amount_act_vs_rb, item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.amount_act_vs_rb === "" ? "0.0" : item.monthly_report.amount_act_vs_rb,
item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.percent_act_vs_rb, item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.percent_act_vs_rb === "" ? "0.0" : item.monthly_report.percent_act_vs_rb,
item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb, item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb,
item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb, item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb,
item.order, item.order,
...@@ -306,7 +309,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -306,7 +309,7 @@ export default class OperatingIndicatorMR extends Component {
}) })
}) })
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDMonthly,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
...@@ -425,15 +428,15 @@ export default class OperatingIndicatorMR extends Component { ...@@ -425,15 +428,15 @@ export default class OperatingIndicatorMR extends Component {
}) })
let body = { let body = {
company_id: this.props.data.company.company_id, company_id: this.props.data.company.company_id,
operating_indicator_id: this.props.data.operatingIndID, operating_indicator_id: this.state.operatingIndIDMonthly,
periode: this.props.data.periode, periode: this.props.data.periode,
report_id: this.props.data.report_id, report_id: this.props.data.report_id,
status: type, status: type,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null, months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
monthly_report: data monthly_report: data
} }
console.log(body); // console.log(body);
// // console.log(JSON.stringify(body)) // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMonthlyReportOI(body).then(response => { api.create('UPLOAD').uploadMonthlyReportOI(body).then(response => {
// // console.log(response); // // console.log(response);
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -482,7 +485,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -482,7 +485,7 @@ export default class OperatingIndicatorMR extends Component {
// console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.state.operatingIndIDMonthly,
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
......
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