Commit bc75a98c authored by Riri Novita's avatar Riri Novita

udah bisa nih

parent 24d8f66b
...@@ -278,7 +278,7 @@ const create = (type = "") => { ...@@ -278,7 +278,7 @@ const create = (type = "") => {
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body) const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body) const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body)
const checkUploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/check_import', body) const checkUploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/check_import', body)
const uploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/import_monthly_report', body)
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -486,6 +486,7 @@ const create = (type = "") => { ...@@ -486,6 +486,7 @@ const create = (type = "") => {
getHierarkiMontlyReportFAM, getHierarkiMontlyReportFAM,
checkUploadMonthlyReportTP, checkUploadMonthlyReportTP,
checkUploadMonthlyReportFAM, checkUploadMonthlyReportFAM,
uploadMonthlyReportPL,
getMonthlyReport getMonthlyReport
} }
} }
......
...@@ -56,12 +56,12 @@ export default class ProfitLossMR extends Component { ...@@ -56,12 +56,12 @@ export default class ProfitLossMR extends Component {
this.state = { this.state = {
dataTable: [], dataTable: [],
loading: true, loading: true,
value: 0 valueThreshold: 0
} }
} }
componentDidMount() { componentDidMount() {
this.getItemHierarki() // this.getItemHierarki()
this.getSettingControl() this.getSettingControl()
} }
...@@ -77,7 +77,7 @@ export default class ProfitLossMR extends Component { ...@@ -77,7 +77,7 @@ export default class ProfitLossMR extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ this.setState({
value: response.data.data[0] ? response.data.data[0].value : null valueThreshold: response.data.data[0] ? response.data.data[0].value : null
}, () => { }, () => {
this.getItemHierarki() this.getItemHierarki()
}) })
...@@ -106,9 +106,9 @@ export default class ProfitLossMR extends Component { ...@@ -106,9 +106,9 @@ export default class ProfitLossMR extends Component {
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id "months": this.props.month.month_id
} }
console.log(payload);
api.create().getHierarkiMontlyReportPL(payload).then(response => { api.create().getHierarkiMontlyReportPL(payload).then(response => {
// console.log(response); console.log(response);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
...@@ -138,7 +138,7 @@ export default class ProfitLossMR extends Component { ...@@ -138,7 +138,7 @@ export default class ProfitLossMR extends Component {
item.profit_loss.mtd_vs_previous_month === null ? "0.0" : item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month, item.profit_loss.mtd_vs_previous_month === null ? "0.0" : item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "0.0" : item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb, item.profit_loss.mtd_vs_mb === null ? "0.0" : item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb, item.profit_loss.mtd_vs_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
item.order item.order,
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -182,9 +182,7 @@ export default class ProfitLossMR extends Component { ...@@ -182,9 +182,7 @@ export default class ProfitLossMR extends Component {
}) })
} }
} }
}) })
console.log(dataTable, this.state.value);
this.setState({ dataTable, loading: false }) this.setState({ dataTable, loading: false })
} }
}) })
...@@ -344,13 +342,13 @@ export default class ProfitLossMR extends Component { ...@@ -344,13 +342,13 @@ export default class ProfitLossMR extends Component {
item.mtd_vs_previous_month, item.mtd_vs_previous_month,
item.mtd_vs_mb, item.mtd_vs_mb,
item.mtd_vs_rb, item.mtd_vs_rb,
item.orders, item.order,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[22].length > 0) { if (item[23].length > 0) {
// console.log('masuk') // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
...@@ -367,35 +365,35 @@ export default class ProfitLossMR extends Component { ...@@ -367,35 +365,35 @@ export default class ProfitLossMR 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: String(i[6]), notes: i[6],
total_actual_before: String(Number(i[7]).toFixed(1)), rolling_outlook: String(Number(i[7]).toFixed(1)),
january: String(Number(i[8]).toFixed(1)), master_budget: String(Number(i[8]).toFixed(1)),
february: String(Number(i[9]).toFixed(1)), rolling_budget: String(Number(i[9]).toFixed(1)),
march: String(Number(i[10]).toFixed(1)), actual: String(Number(i[10]).toFixed(1)),
april: String(Number(i[11]).toFixed(1)), ytd_actual: String(Number(i[11]).toFixed(1)),
may: String(Number(i[12]).toFixed(1)), actual_previous_month: String(Number(i[12]).toFixed(1)),
june: String(Number(i[13]).toFixed(1)), amount_act_vs_previous_month: String(Number(i[13]).toFixed(1)),
july: String(Number(i[14]).toFixed(1)), percent_act_vs_previous_month: String(Number(i[14]).toFixed(1)),
august: String(Number(i[15]).toFixed(1)), amount_act_vs_mb: String(Number(i[15]).toFixed(1)),
september: String(Number(i[16]).toFixed(1)), percent_act_vs_mb: String(Number(i[16]).toFixed(1)),
october: String(Number(i[17]).toFixed(1)), amount_act_vs_rb: String(Number(i[17]).toFixed(1)),
november: String(Number(i[18]).toFixed(1)), percent_act_vs_rb: String(Number(i[18]).toFixed(1)),
december: String(Number(i[19]).toFixed(1)), mtd_vs_previous_month: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1)), mtd_vs_mb: String(Number(i[20]).toFixed(1)),
total_next_year: String(Number(i[21]).toFixed(1)), mtd_vs_rb: String(Number(i[21]).toFixed(1)),
total_more_year: String(Number(i[22]).toFixed(1)),
}) })
}) })
let body = { let body = {
submission_id: this.props.submissionID, // submission_id: this.props.submissionID,
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
months: this.props.month.month_id,
profit_loss: data, profit_loss: data,
status: type status: type
} }
// console.log(data); // console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMonthlyReportPL(body).then(response => {
// console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
...@@ -766,7 +764,6 @@ export default class ProfitLossMR extends Component { ...@@ -766,7 +764,6 @@ export default class ProfitLossMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null : null :
tableMeta.rowData[0] === 2 ? tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
...@@ -1381,7 +1378,7 @@ export default class ProfitLossMR extends Component { ...@@ -1381,7 +1378,7 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[19]).toFixed(1) > Number(this.state.value).toFixed(1) ? Number(tableMeta.rowData[19]).toFixed(1) < Number(this.state.valueThreshold).toFixed(1) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1436,7 +1433,7 @@ export default class ProfitLossMR extends Component { ...@@ -1436,7 +1433,7 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[20]).toFixed(1) > Number(this.state.value).toFixed(1) ? Number(tableMeta.rowData[20]).toFixed(1) < Number(this.state.valueThreshold).toFixed(1) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1491,7 +1488,7 @@ export default class ProfitLossMR extends Component { ...@@ -1491,7 +1488,7 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null null
: :
Number(tableMeta.rowData[21]).toFixed(1) > Number(this.state.value).toFixed(1) ? Number(tableMeta.rowData[21]).toFixed(1) < Number(this.state.valueThreshold).toFixed(1) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
......
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