Commit 28673877 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into deni-

parents 573ac7ea 992ed7ec
...@@ -265,8 +265,10 @@ const create = (type = "") => { ...@@ -265,8 +265,10 @@ const create = (type = "") => {
const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body) const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body)
const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`) const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`)
const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body) const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body)
const createTaxPlanningMR = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body) const createMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body) const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
// MonthlyPL // MonthlyPL
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)
...@@ -402,6 +404,7 @@ const create = (type = "") => { ...@@ -402,6 +404,7 @@ const create = (type = "") => {
deleteDocument, deleteDocument,
createSubmitReport, createSubmitReport,
createMonthlyReportBS, createMonthlyReportBS,
createMonthlyReportTP,
getSubmission, getSubmission,
checkUploadMB, checkUploadMB,
getAllOperatingInd, getAllOperatingInd,
...@@ -434,7 +437,6 @@ const create = (type = "") => { ...@@ -434,7 +437,6 @@ const create = (type = "") => {
uploadAttachmentMonthly, uploadAttachmentMonthly,
getMontlyReportAtt, getMontlyReportAtt,
deleteAttachmentMonthly, deleteAttachmentMonthly,
createTaxPlanningMR,
getSubmitMasterBudget, getSubmitMasterBudget,
createPeriodeRevision, createPeriodeRevision,
getLastestUpdateOI, getLastestUpdateOI,
...@@ -471,7 +473,8 @@ const create = (type = "") => { ...@@ -471,7 +473,8 @@ const create = (type = "") => {
getDetailHierarkiCF, getDetailHierarkiCF,
getHierarkiMontlyReportPL, getHierarkiMontlyReportPL,
getHierarkiMontlyReportLOCF, getHierarkiMontlyReportLOCF,
getHierarkiMontlyReportFAM getHierarkiMontlyReportFAM,
checkUploadMonthlyReportTP
} }
} }
......
...@@ -1085,9 +1085,9 @@ export default class MonthlyReport extends Component { ...@@ -1085,9 +1085,9 @@ export default class MonthlyReport extends Component {
periode={this.state.periode.periode} periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId} monthlyReportId={this.state.monthlyReportId}
month={this.state.month} month={this.state.month}
// saveToMasterBudget={this.saveToMasterBudget.bind(this)} saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleMonthlyReport: true })} onClickClose={() => this.setState({ visibleTP: false, visibleMonthlyReport: true })}
// getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
{this.state.visibleFAM && ( {this.state.visibleFAM && (
......
...@@ -5,6 +5,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -5,6 +5,7 @@ import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import api from '../../api'; import api from '../../api';
import NumberFormat from 'react-number-format'; import NumberFormat from 'react-number-format';
import * as R from 'ramda';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -65,7 +66,7 @@ export default class ProfitLossMR extends Component { ...@@ -65,7 +66,7 @@ export default class ProfitLossMR extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"month": this.props.month.month_id "months": this.props.month.month_id
} }
api.create().getHierarkiMontlyReportPL(payload).then(response => { api.create().getHierarkiMontlyReportPL(payload).then(response => {
console.log(response); console.log(response);
...@@ -84,26 +85,21 @@ export default class ProfitLossMR extends Component { ...@@ -84,26 +85,21 @@ export default class ProfitLossMR extends Component {
item.description, item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes, item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.rolling_outlook === null ? "0.0" : item.profit_loss.rolling_outlook === "" ? "0.0" : item.profit_loss.rolling_outlook, item.profit_loss.rolling_outlook === null ? "0.0" : item.profit_loss.rolling_outlook === "" ? "0.0" : item.profit_loss.rolling_outlook,
{ item.profit_loss.master_budget === null ? "0.0" : item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget,
mb: item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget, item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
rb: item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget, item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
actual: item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual
},
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual, item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month, item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month,
{ item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
aavpm: item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month, item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
pavpm: item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month, item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
aavmb: item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb, item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
pavmb: item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb, item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
aavrb: item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb, item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
pavrb: item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb, 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_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
mtdvpm: item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month, item.order
mtdvmb: item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
mtdvrb: item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
}
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -124,26 +120,21 @@ export default class ProfitLossMR extends Component { ...@@ -124,26 +120,21 @@ export default class ProfitLossMR extends Component {
item.description, item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes, item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.rolling_outlook === null ? "0.0" : item.profit_loss.rolling_outlook === "" ? "0.0" : item.profit_loss.rolling_outlook, item.profit_loss.rolling_outlook === null ? "0.0" : item.profit_loss.rolling_outlook === "" ? "0.0" : item.profit_loss.rolling_outlook,
{ item.profit_loss.master_budget === null ? "0.0" : item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget,
mb: item.profit_loss.master_budget === "" ? "0.0" : item.profit_loss.master_budget, item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
rb: item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget, item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
actual: item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual
},
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual, item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month, item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month,
{ item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
aavpm: item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month, item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
pavpm: item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month, item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
aavmb: item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb, item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
pavmb: item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb, item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
aavrb: item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb, item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
pavrb: item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb, 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_rb === null ? "0.0" : item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
mtdvpm: item.profit_loss.mtd_vs_previous_month === "" ? "0.0" : item.profit_loss.mtd_vs_previous_month, item.order,
mtdvmb: item.profit_loss.mtd_vs_mb === "" ? "0.0" : item.profit_loss.mtd_vs_mb,
mtdvrb: item.profit_loss.mtd_vs_rb === "" ? "0.0" : item.profit_loss.mtd_vs_rb,
}
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -158,25 +149,128 @@ export default class ProfitLossMR extends Component { ...@@ -158,25 +149,128 @@ export default class ProfitLossMR extends Component {
}) })
} }
handleValidate() {
// let data = []
// console.log(JSON.stringify(this.state.dataTable))
// this.state.dataTable.map(i => {
// data.push({
// item_report_id: i[1],
// notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
// total_actual_before: String(i[7]),
// january: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
// february: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
// march: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
// april: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
// may: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
// june: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
// july: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
// august: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
// september: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
// october: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
// november: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
// december: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
// total_current_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
// total_next_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21]),
// total_more_year: i[0] === 3 && i[22] === "" ? "0" : String(i[22])
// })
// })
// let payload = {
// "submission_id": this.props.submissionID,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "profit_loss": data,
// "status": "submitted"
// }
// console.log(payload)
// api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response)
// if (response.data.data.result) {
// this.setState({ loading: false, buttonError: false, editable: false })
// } else {
this.setState({ loading: false, buttonError: true, editable: true })
// }
// })
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleNotes = (value, tableMeta) => { const handleNotes = (value, tableMeta) => {
console.log(value)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
} }
const handleChange = (value, tableMeta, indexChilds) => { const handleChange = (value, tableMeta, indexChilds) => {
console.log(dataTable2) console.log(dataTable2)
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
if (indexChilds == 0) { dataTable2[tableMeta.rowIndex][10] = Number(val)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].mb = Number(val) }
const handleFormula = (data, tableMeta, month, type) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let tambahan = false
let opet = ""
arrayFormula.map((item, indexs) => {
if (item == 'X') {
tambahan = true
} else if (item == '-' || item == '+' || item == '/' || item == '*') {
arrayJumlah.push(item)
} else {
let index = dataTable2.findIndex((val) => val[22] == item)
if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
} else {
if (index != -1) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex + type])
if (tableMeta.rowData[5] === 'Unit Business/ Brand/ SubCo 1') {
console.log(dataTable2[index][tableMeta.columnIndex + type]);
console.log(arrayJumlah);
}
} }
else if (indexChilds == 1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].rb = Number(val)
} }
else if (indexChilds == 2) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].actual = Number(val)
} }
})
let array = arrayJumlah
let total = 0
let opt = ""
array.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
} else {
total += item
}
}
})
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total)
return a
} }
let columns = [ let columns = [
{ {
...@@ -365,10 +459,11 @@ export default class ProfitLossMR extends Component { ...@@ -365,10 +459,11 @@ 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] === 4 ?
null : null :
tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.mb} value={tableMeta.rowData[10]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -376,7 +471,24 @@ export default class ProfitLossMR extends Component { ...@@ -376,7 +471,24 @@ export default class ProfitLossMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value.mb).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[8]}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[8]}
/> />
} }
/> />
...@@ -388,10 +500,11 @@ export default class ProfitLossMR extends Component { ...@@ -388,10 +500,11 @@ 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] === 4 ?
null : null :
tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.rb} value={tableMeta.rowData[10]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -399,7 +512,24 @@ export default class ProfitLossMR extends Component { ...@@ -399,7 +512,24 @@ export default class ProfitLossMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value.rb).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 1)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[9]}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[9]}
/> />
} }
/> />
...@@ -415,7 +545,7 @@ export default class ProfitLossMR extends Component { ...@@ -415,7 +545,7 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.actual} value={tableMeta.rowData[10]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -423,7 +553,7 @@ export default class ProfitLossMR extends Component { ...@@ -423,7 +553,7 @@ export default class ProfitLossMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value.actual).toFixed(1)} value={tableMeta.rowData[10]}
/> />
} }
/> />
...@@ -432,7 +562,7 @@ export default class ProfitLossMR extends Component { ...@@ -432,7 +562,7 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.actual} value={tableMeta.rowData[10]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -440,7 +570,7 @@ export default class ProfitLossMR extends Component { ...@@ -440,7 +570,7 @@ export default class ProfitLossMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value.actual).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 2)).toFixed(1)}
/> />
} }
/> />
...@@ -451,17 +581,17 @@ export default class ProfitLossMR extends Component { ...@@ -451,17 +581,17 @@ export default class ProfitLossMR extends Component {
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.actual} value={tableMeta.rowData[10]}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value.actual).toFixed(1)} value={tableMeta.rowData[10]}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 2) handleChange(event.target.value, tableMeta)
// console.log(dataTable2) console.log(dataTable2)
}} }}
/> />
} }
...@@ -583,7 +713,7 @@ export default class ProfitLossMR extends Component { ...@@ -583,7 +713,7 @@ 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] === 4 ?
null : null :
val.aavpm tableMeta.rowData[13]
} }
</div> </div>
</div> </div>
...@@ -591,7 +721,7 @@ export default class ProfitLossMR extends Component { ...@@ -591,7 +721,7 @@ 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] === 4 ?
null : null :
val.pavpm tableMeta.rowData[14]
} }
</div> </div>
</div> </div>
...@@ -603,7 +733,7 @@ export default class ProfitLossMR extends Component { ...@@ -603,7 +733,7 @@ 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] === 4 ?
null : null :
val.aavmb tableMeta.rowData[15]
} }
</div> </div>
</div> </div>
...@@ -611,7 +741,7 @@ export default class ProfitLossMR extends Component { ...@@ -611,7 +741,7 @@ 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] === 4 ?
null : null :
val.pavmb tableMeta.rowData[16]
} }
</div> </div>
</div> </div>
...@@ -623,7 +753,7 @@ export default class ProfitLossMR extends Component { ...@@ -623,7 +753,7 @@ 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] === 4 ?
null : null :
val.aavrb tableMeta.rowData[17]
} }
</div> </div>
</div> </div>
...@@ -631,7 +761,7 @@ export default class ProfitLossMR extends Component { ...@@ -631,7 +761,7 @@ 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] === 4 ?
null : null :
val.pavrb tableMeta.rowData[18]
} }
</div> </div>
</div> </div>
...@@ -679,7 +809,7 @@ export default class ProfitLossMR extends Component { ...@@ -679,7 +809,7 @@ 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] === 4 ?
null : null :
val.mtdvpm tableMeta.rowData[19]
} }
</div> </div>
</div> </div>
...@@ -687,7 +817,7 @@ export default class ProfitLossMR extends Component { ...@@ -687,7 +817,7 @@ 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] === 4 ?
null : null :
val.mtdvmb tableMeta.rowData[20]
} }
</div> </div>
</div> </div>
...@@ -695,7 +825,7 @@ export default class ProfitLossMR extends Component { ...@@ -695,7 +825,7 @@ 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] === 4 ?
null : null :
val.mtdvrb tableMeta.rowData[21]
} }
</div> </div>
</div> </div>
...@@ -705,6 +835,12 @@ export default class ProfitLossMR extends Component { ...@@ -705,6 +835,12 @@ export default class ProfitLossMR extends Component {
} }
} }
}, },
{
name: "",
options: {
display: false
}
}
] ]
return ( return (
...@@ -805,6 +941,83 @@ export default class ProfitLossMR extends Component { ...@@ -805,6 +941,83 @@ export default class ProfitLossMR extends Component {
</div> </div>
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
setTimeout(() => {
this.setState({ loading: false})
// this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
// onClick={() =>
// this.state.editable === true ?
// null :
// this.setState({ loading: true }, () =>
// this.state.handleTekTekTek == 1 ? null :
// this.setState({ handleTekTekTek: 1 }, () => {
// setTimeout(() => {
// this.uploadProfitLoss('draft')
// }, 100);
// })
// )
// }
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
}}
// onClick={() =>
// this.state.editable === true ?
// null :
// this.setState({ loading: true }, () =>
// this.state.handleTekTekTek == 1 ? null :
// this.setState({ handleTekTekTek: 1 }, () => {
// setTimeout(() => {
// this.uploadProfitLoss('submitted')
// }, 100);
// })
// )
// }
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div> </div>
</Paper> </Paper>
</div> </div>
......
...@@ -226,18 +226,27 @@ export default class TaxPlanningMR extends Component { ...@@ -226,18 +226,27 @@ export default class TaxPlanningMR extends Component {
"months": this.props.month.month_id, "months": this.props.month.month_id,
"tax_planning": data "tax_planning": data
} }
console.log(JSON.stringify(payload));
console.log(payload);
// this.props.saveToMasterBudget(payload)
// this.props.onClickClose()
api.create('UPLOAD').createTaxPlanningMR(payload).then(response => { api.create('UPLOAD').createMonthlyReportTP(payload).then(response => {
console.log(payload);
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
alert("draft saved") this.props.saveToMonthlyReport()
this.props.onClickClose() } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', submissionID: null, loading: false }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
} }
this.props.saveToMonthlyReport()
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
}) })
} }
...@@ -260,77 +269,11 @@ export default class TaxPlanningMR extends Component { ...@@ -260,77 +269,11 @@ export default class TaxPlanningMR 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(),
january: { trial_balance_commercial: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
tbc: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(), fiscal_correction: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(), trial_balance_fiscal: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
tbf: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(), trial_balance_fiscal_actual: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
}, trial_balance_fiscal_mb: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
february: {
tbc: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
tbf: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
},
march: {
tbc: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
tbf: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
},
april: {
tbc: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
tbf: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
},
may: {
tbc: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
tbf: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
},
june: {
tbc: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
tbf: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(),
},
july: {
tbc: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(),
fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
tbf: i[22] === undefined ? "0" : reg.test(String(i[22])) === false ? "0" : String(i[22]).trim(),
},
august: {
tbc: i[23] === undefined ? "0" : reg.test(String(i[23])) === false ? "0" : String(i[23]).trim(),
fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
tbf: i[25] === undefined ? "0" : reg.test(String(i[25])) === false ? "0" : String(i[25]).trim(),
},
september: {
tbc: i[26] === undefined ? "0" : reg.test(String(i[26])) === false ? "0" : String(i[26]).trim(),
fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
tbf: i[28] === undefined ? "0" : reg.test(String(i[28])) === false ? "0" : String(i[28]).trim(),
},
october: {
tbc: i[29] === undefined ? "0" : reg.test(String(i[29])) === false ? "0" : String(i[29]).trim(),
fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
tbf: i[31] === undefined ? "0" : reg.test(String(i[31])) === false ? "0" : String(i[31]).trim(),
},
november: {
tbc: i[32] === undefined ? "0" : reg.test(String(i[32])) === false ? "0" : String(i[32]).trim(),
fcp: i[33] === undefined ? "0" : reg.test(String(i[33])) === false ? "0" : String(i[33]).trim(),
tbf: i[34] === undefined ? "0" : reg.test(String(i[34])) === false ? "0" : String(i[34]).trim(),
},
december: {
tbc: i[35] === undefined ? "0" : reg.test(String(i[35])) === false ? "0" : String(i[35]).trim(),
fcp: i[36] === undefined ? "0" : reg.test(String(i[36])) === false ? "0" : String(i[36]).trim(),
tbf: i[37] === undefined ? "0" : reg.test(String(i[37])) === false ? "0" : String(i[37]).trim(),
},
total_current_year: i[38] === undefined ? "" : String(i[38]).trim(),
total_next_year: {
tbc: i[39] === undefined ? "0" : reg.test(String(i[39])) === false ? "0" : String(i[39]).trim(),
fcp: i[40] === undefined ? "0" : reg.test(String(i[40])) === false ? "0" : String(i[40]).trim(),
tbf: i[41] === undefined ? "0" : reg.test(String(i[41])) === false ? "0" : String(i[41]).trim(),
},
total_more_year: {
tbc: i[42] === undefined ? "0" : reg.test(String(i[42])) === false ? "0" : String(i[42]).trim(),
fcp: i[43] === undefined ? "0" : reg.test(String(i[43])) === false ? "0" : String(i[43]).trim(),
tbf: i[44] === undefined ? "0" : reg.test(String(i[44])) === false ? "0" : String(i[44]).trim(),
}
}) })
} }
}) })
...@@ -338,6 +281,7 @@ export default class TaxPlanningMR extends Component { ...@@ -338,6 +281,7 @@ export default class TaxPlanningMR extends Component {
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,
tax_planning: payload tax_planning: payload
} }
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
...@@ -347,7 +291,7 @@ export default class TaxPlanningMR extends Component { ...@@ -347,7 +291,7 @@ export default class TaxPlanningMR extends Component {
} }
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMonthlyReportTP(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
...@@ -355,52 +299,28 @@ export default class TaxPlanningMR extends Component { ...@@ -355,52 +299,28 @@ export default class TaxPlanningMR extends Component {
this.setState({ visibleUpload: false, visibleTP: false, loading: true }) this.setState({ visibleUpload: false, visibleTP: false, loading: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
// item.type_report_id,
0, 0,
Number(item.type_report_id.tbc),
Number(item.type_report_id.fcp),
Number(item.type_report_id.tbf),
item.item_report_id, item.item_report_id,
item.parent, item.parent,
item.formula, item.formula,
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level, item.level,
item.item_report, item.item_report,
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.january.tbc, formula: item.january_formula } : item.january.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 || item.type_report_id.fcp == 7 ? { value: item.january.fcp, formula: item.january_formula } : item.january.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 || item.type_report_id.tbf == 7 ? { value: item.january.tbf, formula: item.january_formula } : item.january.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.february.tbc, formula: item.february_formula } : item.february.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.february.fcp, formula: item.february_formula } : item.february.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.february.tbf, formula: item.february_formula } : item.february.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.march.tbc, formula: item.march_formula } : item.march.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.march.fcp, formula: item.march_formula } : item.march.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.march.tbf, formula: item.march_formula } : item.march.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.april.tbc, formula: item.april_formula } : item.april.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.april.fcp, formula: item.april_formula } : item.april.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.april.tbf, formula: item.april_formula } : item.april.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.may.tbc, formula: item.may_formula } : item.may.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.may.fcp, formula: item.may_formula } : item.may.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.may.tbf, formula: item.may_formula } : item.may.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.june.tbc, formula: item.june_formula } : item.june.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.june.fcp, formula: item.june_formula } : item.june.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.june.tbf, formula: item.june_formula } : item.june.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.july.tbc, formula: item.july_formula } : item.july.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.july.fcp, formula: item.july_formula } : item.july.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.july.tbf, formula: item.july_formula } : item.july.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.august.tbc, formula: item.august_formula } : item.august.tbc === null ? "0" : item.august.tbc === "" ? "0" : item.august.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.august.fcp, formula: item.august_formula } : item.august.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.august.tbf, formula: item.august_formula } : item.august.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.september.tbc, formula: item.september_formula } : item.september.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.september.fcp, formula: item.september_formula } : item.september.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.september.tbf, formula: item.september_formula } : item.september.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.october.tbc, formula: item.october_formula } : item.october.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.october.fcp, formula: item.october_formula } : item.october.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.october.tbf, formula: item.october_formula } : item.october.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.november.tbc, formula: item.november_formula } : item.november.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.november.fcp, formula: item.november_formula } : item.november.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.november.tbf, formula: item.november_formula } : item.november.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.december.tbc, formula: item.december_formula } : item.december.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.december.fcp, formula: item.december_formula } : item.december.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.december.tbf, formula: item.december_formula } : item.december.tbf },
item.total_current_year,
{
tbc: Number(item.type_report_id.tbc) === 3 && item.total_next_year.tbc === "" ? "0" : item.total_next_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_next_year.fcp === "" ? "0" : item.total_next_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_next_year.tbf === "" ? "0" : item.total_next_year.tbf
},
{ {
tbc: Number(item.type_report_id.tbc) === 3 && item.total_more_year.tbc === "" ? "0" : item.total_more_year.tbc, tbc: item.trial_balance_commercial === "" ? "0" : item.trial_balance_commercial,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_more_year.fcp === "" ? "0" : item.total_more_year.fcp, fcp: item.fiscal_correction === "" ? "0" : item.fiscal_correction,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_more_year.tbf === "" ? "0" : item.total_more_year.tbf tbf: item.trial_balance_fiscal === "" ? "0" : item.trial_balance_fiscal
}, },
item.orders, item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual,
{ tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf }, item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb,
{ tbc: item.condition_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf }, item.order,
item.forecast_tbc_formula, item.condition_it_should_be,
item.forecast_fcp_formula, item.condition_if_wrong,
item.forecast_tbf_formula,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[27].length > 0) { if (item[12].length > 0) {
// console.log('masuk') // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true }) this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
} }
...@@ -526,15 +446,13 @@ export default class TaxPlanningMR extends Component { ...@@ -526,15 +446,13 @@ export default class TaxPlanningMR extends Component {
let data = [] let data = []
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
// console.log(i[0])
data.push({ data.push({
item_report_id: i[4], item_report_id: i[1],
january: { trial_balance_commercial: String(Number(i[6].tbc).toFixed(1)),
tbc: i[1] === 3 && i[9].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[9].tbc.value).toFixed(1)) : String(Number(i[9].tbc).toFixed(1)), fiscal_correction: String(Number(i[6].fcp).toFixed(1)),
fcp: i[2] === 3 && i[9].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[9].fcp.value).toFixed(1)) : String(Number(i[9].fcp).toFixed(1)), trial_balance_fiscal: String(Number(i[6].tbf).toFixed(1)),
tbf: i[3] === 3 && i[9].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[9].tbf.value).toFixed(1)) : String(Number(i[9].tbf).toFixed(1)) trial_balance_fiscal_actual: String(Number(i[7]).toFixed(1)),
}, trial_balance_fiscal_mb: String(Number(i[8]).toFixed(1))
total_current_year: i[2] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
}) })
}) })
let payload = { let payload = {
...@@ -1390,8 +1308,9 @@ export default class TaxPlanningMR extends Component { ...@@ -1390,8 +1308,9 @@ export default class TaxPlanningMR extends Component {
} }
}, },
] ]
const loadingComponent = ( const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}> <div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader <PropagateLoader
// css={override} // css={override}
size={20} size={20}
...@@ -1461,10 +1380,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1461,10 +1380,7 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => onClick={() => this.downloadTemplate()}
// null
this.downloadTemplate()
}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
...@@ -1482,8 +1398,8 @@ export default class TaxPlanningMR extends Component { ...@@ -1482,8 +1398,8 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null onClick={() =>
// this.setState({ visibleUpload: true }) this.setState({ visibleUpload: true })
} }
> >
<img src={Images.upload} /> <img src={Images.upload} />
...@@ -1501,7 +1417,6 @@ export default class TaxPlanningMR extends Component { ...@@ -1501,7 +1417,6 @@ export default class TaxPlanningMR extends Component {
margin: 5 margin: 5
}} }}
onClick={() => onClick={() =>
// null
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.downloadAllData() this.downloadAllData()
...@@ -1554,7 +1469,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1554,7 +1469,7 @@ export default class TaxPlanningMR extends Component {
</div> </div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null : {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */} (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', marginTop: 20 }}>
<button <button
className="button" className="button"
type="button" type="button"
...@@ -1566,9 +1481,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1566,9 +1481,7 @@ export default class TaxPlanningMR extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
// null
{ {
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => { this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
// this.setState({ loading: false, buttonError: false, editable: true }) // this.setState({ loading: false, buttonError: false, editable: true })
...@@ -1610,9 +1523,8 @@ export default class TaxPlanningMR extends Component { ...@@ -1610,9 +1523,8 @@ export default class TaxPlanningMR extends Component {
</button> </button>
<button <button
type="button" type="button"
disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
// null
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
...@@ -1782,7 +1694,7 @@ export default class TaxPlanningMR extends Component { ...@@ -1782,7 +1694,7 @@ export default class TaxPlanningMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => { onUpload={() => {
this.state.judul === "MASTER BUDGET - TAX PLANNING" ? this.state.judul === "TAX PLANNING - MONTHLY REPORT" ?
this.checkUpload() : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}} }}
......
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