Commit 9352f086 authored by Deni Rinaldi's avatar Deni Rinaldi

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

parents 18019e45 2a04849b
......@@ -265,7 +265,9 @@ const create = (type = "") => {
const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body)
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 createTaxPlanningMR = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......@@ -432,6 +434,7 @@ const create = (type = "") => {
uploadAttachmentMonthly,
getMontlyReportAtt,
deleteAttachmentMonthly,
createTaxPlanningMR,
getSubmitMasterBudget,
createPeriodeRevision,
getLastestUpdateOI,
......@@ -467,7 +470,8 @@ const create = (type = "") => {
getReportHierarkiFR,
getDetailHierarkiCF,
getHierarkiMontlyReportPL,
getHierarkiMontlyReportLOCF
getHierarkiMontlyReportLOCF,
getHierarkiMontlyReportFAM
}
}
......
......@@ -52,10 +52,11 @@ export default class FixedAssetsMovementMR extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"month": this.props.month
"months": this.props.month.month_id
}
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
api.create().getHierarkiMontlyReportFAM(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -69,24 +70,17 @@ export default class FixedAssetsMovementMR extends Component {
item.formula,
item.level,
item.description,
item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula } : item.fixed_asset_movement.january,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula } : item.fixed_asset_movement.february,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula } : item.fixed_asset_movement.march,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula } : item.fixed_asset_movement.april,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula } : item.fixed_asset_movement.may,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula } : item.fixed_asset_movement.june,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula } : item.fixed_asset_movement.july,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula } : item.fixed_asset_movement.august,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula } : item.fixed_asset_movement.september,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula } : item.fixed_asset_movement.october,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula } : item.fixed_asset_movement.november,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula } : item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year,
item.order,
item.fixed_asset_movement.forecast_formula
item.fixed_asset_movement.mtd_mb === "" ? "0.0" : item.fixed_asset_movement.mtd_mb,
item.fixed_asset_movement.mtd_rb === "" ? "0.0" : item.fixed_asset_movement.mtd_rb,
item.fixed_asset_movement.mtd_actual === "" ? "0.0" : item.fixed_asset_movement.mtd_actual,
item.fixed_asset_movement.act_previous_month === "" ? "0.0" : item.fixed_asset_movement.act_previous_month,
item.fixed_asset_movement.act_vs_prev_month_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_prev_month_amount,
item.fixed_asset_movement.act_vs_prev_month_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_prev_month_percent,
item.fixed_asset_movement.act_vs_mb_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_mb_amount,
item.fixed_asset_movement.act_vs_mb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_mb_percent,
item.fixed_asset_movement.act_vs_rb_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_amount,
item.fixed_asset_movement.act_vs_rb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_percent,
item.order
])
}
if (item.children !== null) {
......@@ -105,24 +99,18 @@ export default class FixedAssetsMovementMR extends Component {
item.formula,
item.level,
item.description,
item.fixed_asset_movement.total_actual_before === null ? "0" : item.fixed_asset_movement.total_actual_before === "" ? "0" : item.fixed_asset_movement.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.january, formula: item.fixed_asset_movement.january_formula } : item.fixed_asset_movement.january,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.february, formula: item.fixed_asset_movement.february_formula } : item.fixed_asset_movement.february,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.march, formula: item.fixed_asset_movement.march_formula } : item.fixed_asset_movement.march,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.april, formula: item.fixed_asset_movement.april_formula } : item.fixed_asset_movement.april,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.may, formula: item.fixed_asset_movement.may_formula } : item.fixed_asset_movement.may,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.june, formula: item.fixed_asset_movement.june_formula } : item.fixed_asset_movement.june,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.july, formula: item.fixed_asset_movement.july_formula } : item.fixed_asset_movement.july,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.august, formula: item.fixed_asset_movement.august_formula } : item.fixed_asset_movement.august,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.september, formula: item.fixed_asset_movement.september_formula } : item.fixed_asset_movement.september,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.october, formula: item.fixed_asset_movement.october_formula } : item.fixed_asset_movement.october,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.november, formula: item.fixed_asset_movement.november_formula } : item.fixed_asset_movement.november,
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.fixed_asset_movement.december, formula: item.fixed_asset_movement.december_formula } : item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year,
item.order,
item.fixed_asset_movement.forecast_formula
item.fixed_asset_movement.mtd_mb === "" ? "0.0" : item.fixed_asset_movement.mtd_mb,
item.fixed_asset_movement.mtd_rb === "" ? "0.0" : item.fixed_asset_movement.mtd_rb,
item.fixed_asset_movement.mtd_actual === "" ? "0.0" : item.fixed_asset_movement.mtd_actual,
item.fixed_asset_movement.act_previous_month === "" ? "0.0" : item.fixed_asset_movement.act_previous_month,
item.fixed_asset_movement.act_vs_prev_month_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_prev_month_amount,
item.fixed_asset_movement.act_vs_prev_month_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_prev_month_percent,
item.fixed_asset_movement.act_vs_mb_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_mb_amount,
item.fixed_asset_movement.act_vs_mb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_mb_percent,
item.fixed_asset_movement.act_vs_rb_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_amount,
item.fixed_asset_movement.act_vs_rb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_percent,
item.ordert_vs_rb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_percent,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -132,6 +120,7 @@ export default class FixedAssetsMovementMR extends Component {
}
}
})
console.log(dataTable);
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
......@@ -140,8 +129,38 @@ export default class FixedAssetsMovementMR extends Component {
}
render() {
// let dataTable2 = this.state.dataTable
const columns = [{
let columns = [
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "Account",
options: {
customHeadRender: (columnMeta) => (
......@@ -209,17 +228,26 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.a}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[6]
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.b}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[7]
}
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{val.c}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[8]
}
</div>
</div>
</div>
......@@ -239,7 +267,12 @@ export default class FixedAssetsMovementMR extends Component {
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{val}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[0] === 6 ?
tableMeta.rowData[9] :
null
}
</div>
)
}
......@@ -302,12 +335,18 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.a}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[10]
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.b}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[11]
}
</div>
</div>
</div>
......@@ -316,12 +355,18 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.c}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[12]
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.d}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[13]
}
</div>
</div>
</div>
......@@ -330,12 +375,18 @@ export default class FixedAssetsMovementMR extends Component {
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.e}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[14]
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.f}
{tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[15]
}
</div>
</div>
</div>
......@@ -345,12 +396,47 @@ export default class FixedAssetsMovementMR extends Component {
)
}
}
}
]
let data = [
["Total Assets", { a: "2", b: "3", c: "4" }, "5", { a: "6", b: "7", c: "8", d: "9", e: "10", f: "11" }],
["Total Assets", { a: "12", b: "13", c: "14" }, "15", { a: "16", b: "17", c: "18", d: "19", e: "110", f: "111" }]
]
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}]
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
......@@ -420,7 +506,7 @@ export default class FixedAssetsMovementMR extends Component {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={data}
data={this.state.dataTable}
columns={columns}
options={options}
/>
......
......@@ -91,7 +91,7 @@ export default class TaxPlanningMR extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"month": this.props.month.month_id
"months": this.props.month.month_id
}
api.create().getHierarkiMontlyReportTP(payload).then(response => {
console.log(response);
......@@ -209,91 +209,37 @@ export default class TaxPlanningMR extends Component {
let data = []
this.state.dataTable.map(i => {
data.push({
item_report_id: i[4],
january: {
tbc: i[1] === 3 && i[9].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[9].tbc.value) : String(i[9].tbc),
fcp: i[2] === 3 && i[9].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[9].fcp.value) : String(i[9].fcp),
tbf: i[3] === 3 && i[9].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[9].tbf.value) : String(i[9].tbf)
},
february: {
tbc: i[1] === 3 && i[10].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[10].tbc.value) : String(i[10].tbc),
fcp: i[2] === 3 && i[10].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[10].fcp.value) : String(i[10].fcp),
tbf: i[3] === 3 && i[10].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[10].tbf.value) : String(i[10].tbf)
},
march: {
tbc: i[1] === 3 && i[11].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[11].tbc.value) : String(i[11].tbc),
fcp: i[2] === 3 && i[11].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[11].fcp.value) : String(i[11].fcp),
tbf: i[3] === 3 && i[11].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[11].tbf.value) : String(i[11].tbf)
},
april: {
tbc: i[1] === 3 && i[12].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[12].tbc.value) : String(i[12].tbc),
fcp: i[2] === 3 && i[12].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[12].fcp.value) : String(i[12].fcp),
tbf: i[3] === 3 && i[12].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[12].tbf.value) : String(i[12].tbf)
},
may: {
tbc: i[1] === 3 && i[13].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[13].tbc.value) : String(i[13].tbc),
fcp: i[2] === 3 && i[13].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[13].fcp.value) : String(i[13].fcp),
tbf: i[3] === 3 && i[13].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[13].tbf.value) : String(i[13].tbf)
},
june: {
tbc: i[1] === 3 && i[14].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[14].tbc.value) : String(i[14].tbc),
fcp: i[2] === 3 && i[14].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[14].fcp.value) : String(i[14].fcp),
tbf: i[3] === 3 && i[14].tbc === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[14].tbf.value) : String(i[14].tbf)
},
july: {
tbc: i[1] === 3 && i[15].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[15].tbc.value) : String(i[15].tbc),
fcp: i[2] === 3 && i[15].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[15].fcp.value) : String(i[15].fcp),
tbf: i[3] === 3 && i[15].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[15].tbf.value) : String(i[15].tbf)
},
august: {
tbc: i[1] === 3 && i[16].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[16].tbc.value) : String(i[16].tbc),
fcp: i[2] === 3 && i[16].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[16].fcp.value) : String(i[16].fcp),
tbf: i[3] === 3 && i[16].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[16].tbf.value) : String(i[16].tbf)
},
september: {
tbc: i[1] === 3 && i[17].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[17].tbc.value) : String(i[17].tbc),
fcp: i[2] === 3 && i[17].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[17].fcp.value) : String(i[17].fcp),
tbf: i[3] === 3 && i[17].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[17].tbf.value) : String(i[17].tbf)
},
october: {
tbc: i[1] === 3 && i[18].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[18].tbc.value) : String(i[18].tbc),
fcp: i[2] === 3 && i[18].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[18].fcp.value) : String(i[18].fcp),
tbf: i[3] === 3 && i[18].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[18].tbf.value) : String(i[18].tbf)
},
november: {
tbc: i[1] === 3 && i[19].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[19].tbc.value) : String(i[19].tbc),
fcp: i[2] === 3 && i[19].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[19].fcp.value) : String(i[19].fcp),
tbf: i[3] === 3 && i[19].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
},
december: {
tbc: i[1] === 3 && i[20].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[20].tbc.value) : String(i[20].tbc),
fcp: i[2] === 3 && i[20].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[20].fcp.value) : String(i[20].fcp),
tbf: i[3] === 3 && i[20].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf)
},
total_current_year: String(Number(i[21]).toFixed(1)),
total_next_year: {
tbc: String(Number(i[22].tbc).toFixed(1)),
fcp: String(Number(i[22].fcp).toFixed(1)),
tbf: String(Number(i[22].tbf).toFixed(1))
},
total_more_year: {
tbc: String(Number(i[23].tbc).toFixed(1)),
fcp: String(Number(i[23].fcp).toFixed(1)),
tbf: String(Number(i[23].tbf).toFixed(1))
}
item_report_id: i[1],
trial_balance_commercial: String(Number(i[6].tbc).toFixed(1)),
fiscal_correction: String(Number(i[6].fcp).toFixed(1)),
trial_balance_fiscal: String(Number(i[6].tbf).toFixed(1)),
trial_balance_fiscal_actual: String(Number(i[7]).toFixed(1)),
trial_balance_fiscal_mb: String(Number(i[8]).toFixed(1))
})
})
let payload = {
"submission_id": this.props.submissionID,
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
"tax_planning": data
}
// console.log(JSON.stringify(payload));
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
console.log(JSON.stringify(payload));
console.log(payload);
// this.props.saveToMasterBudget(payload)
// this.props.onClickClose()
api.create('UPLOAD').createTaxPlanningMR(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
alert("draft saved")
this.props.onClickClose()
}
}
})
}
fileHandler = (event) => {
......@@ -588,72 +534,7 @@ export default class TaxPlanningMR extends Component {
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)),
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))
},
february: {
tbc: i[1] === 3 && i[10].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[10].tbc.value).toFixed(1)) : String(Number(i[10].tbc).toFixed(1)),
fcp: i[2] === 3 && i[10].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[10].fcp.value).toFixed(1)) : String(Number(i[10].fcp).toFixed(1)),
tbf: i[3] === 3 && i[10].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[10].tbf.value).toFixed(1)) : String(Number(i[10].tbf).toFixed(1))
},
march: {
tbc: i[1] === 3 && i[11].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[11].tbc.value).toFixed(1)) : String(Number(i[11].tbc).toFixed(1)),
fcp: i[2] === 3 && i[11].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[11].fcp.value).toFixed(1)) : String(Number(i[11].fcp).toFixed(1)),
tbf: i[3] === 3 && i[11].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[11].tbf.value).toFixed(1)) : String(Number(i[11].tbf).toFixed(1))
},
april: {
tbc: i[1] === 3 && i[12].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[12].tbc.value).toFixed(1)) : String(Number(i[12].tbc).toFixed(1)),
fcp: i[2] === 3 && i[12].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[12].fcp.value).toFixed(1)) : String(Number(i[12].fcp).toFixed(1)),
tbf: i[3] === 3 && i[12].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[12].tbf.value).toFixed(1)) : String(Number(i[12].tbf).toFixed(1))
},
may: {
tbc: i[1] === 3 && i[13].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[13].tbc.value).toFixed(1)) : String(Number(i[13].tbc).toFixed(1)),
fcp: i[2] === 3 && i[13].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[13].fcp.value).toFixed(1)) : String(Number(i[13].fcp).toFixed(1)),
tbf: i[3] === 3 && i[13].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[13].tbf.value).toFixed(1)) : String(Number(i[13].tbf).toFixed(1))
},
june: {
tbc: i[1] === 3 && i[14].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[14].tbc.value).toFixed(1)) : String(Number(i[14].tbc).toFixed(1)),
fcp: i[2] === 3 && i[14].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[14].fcp.value).toFixed(1)) : String(Number(i[14].fcp).toFixed(1)),
tbf: i[3] === 3 && i[14].tbc === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[14].tbf.value).toFixed(1)) : String(Number(i[14].tbf).toFixed(1))
},
july: {
tbc: i[1] === 3 && i[15].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[15].tbc.value).toFixed(1)) : String(Number(i[15].tbc).toFixed(1)),
fcp: i[2] === 3 && i[15].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[15].fcp.value).toFixed(1)) : String(Number(i[15].fcp).toFixed(1)),
tbf: i[3] === 3 && i[15].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[15].tbf.value).toFixed(1)) : String(Number(i[15].tbf).toFixed(1))
},
august: {
tbc: i[1] === 3 && i[16].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[16].tbc.value).toFixed(1)) : String(Number(i[16].tbc).toFixed(1)),
fcp: i[2] === 3 && i[16].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[16].fcp.value).toFixed(1)) : String(Number(i[16].fcp).toFixed(1)),
tbf: i[3] === 3 && i[16].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[16].tbf.value).toFixed(1)) : String(Number(i[16].tbf).toFixed(1))
},
september: {
tbc: i[1] === 3 && i[17].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[17].tbc.value).toFixed(1)) : String(Number(i[17].tbc).toFixed(1)),
fcp: i[2] === 3 && i[17].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[17].fcp.value).toFixed(1)) : String(Number(i[17].fcp).toFixed(1)),
tbf: i[3] === 3 && i[17].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[17].tbf.value).toFixed(1)) : String(Number(i[17].tbf).toFixed(1))
},
october: {
tbc: i[1] === 3 && i[18].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[18].tbc.value).toFixed(1)) : String(Number(i[18].tbc).toFixed(1)),
fcp: i[2] === 3 && i[18].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[18].fcp.value).toFixed(1)) : String(Number(i[18].fcp).toFixed(1)),
tbf: i[3] === 3 && i[18].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[18].tbf.value).toFixed(1)) : String(Number(i[18].tbf).toFixed(1))
},
november: {
tbc: i[1] === 3 && i[19].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[19].tbc.value).toFixed(1)) : String(Number(i[19].tbc).toFixed(1)),
fcp: i[2] === 3 && i[19].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[19].fcp.value).toFixed(1)) : String(Number(i[19].fcp).toFixed(1)),
tbf: i[3] === 3 && i[19].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[19].tbf.value).toFixed(1)) : String(Number(i[19].tbf).toFixed(1))
},
december: {
tbc: i[1] === 3 && i[20].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[20].tbc.value).toFixed(1)) : String(Number(i[20].tbc).toFixed(1)),
fcp: i[2] === 3 && i[20].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[20].fcp.value).toFixed(1)) : String(Number(i[20].fcp).toFixed(1)),
tbf: i[3] === 3 && i[20].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[20].tbf.value).toFixed(1)) : String(Number(i[20].tbf).toFixed(1))
},
total_current_year: i[2] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
total_next_year: {
tbc: i[1] === 3 && i[22].tbc === "" ? "0.0" : String(Number(i[22].tbc).toFixed(1)),
fcp: i[2] === 3 && i[22].fcp === "" ? "0.0" : String(Number(i[22].fcp).toFixed(1)),
tbf: i[3] === 3 && i[22].tbf === "" ? "0.0" : String(Number(i[22].tbf).toFixed(1))
},
total_more_year: {
tbc: i[1] === 3 && i[23].tbc === "" ? "0.0" : String(Number(i[23].tbc).toFixed(1)),
fcp: i[2] === 3 && i[23].fcp === "" ? "0.0" : String(Number(i[23].fcp).toFixed(1)),
tbf: i[3] === 3 && i[23].tbf === "" ? "0.0" : String(Number(i[23].tbf).toFixed(1))
}
})
})
let payload = {
......@@ -665,20 +546,20 @@ export default class TaxPlanningMR extends Component {
"status": "submitted"
}
// console.log(JSON.stringify(payload));
api.create().validateSubmitReport(payload).then((response) => {
// console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// alert("Type Input Can't be Empty")
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
})
// api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response)
// if (response.data.data.result) {
// this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// // alert("Type Input Can't be Empty")
// } else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
// }
// })
}
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_tp/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
......@@ -686,17 +567,17 @@ export default class TaxPlanningMR extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Master Budget Tax Planning.xlsx';
a.download = 'Template Monthly Report Tax Planning.xlsx';
a.click();
}
}
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let sub_null = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let urls = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_tp/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_tp/export_monthly_report?monthly_report_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
// console.log(url);
let res = await fetch(
this.props.submissionID == null ? sub_null : url
this.props.monthlyReportId == null ? url : urls
)
res = await res.blob()
this.setState({ loading: false })
......@@ -704,7 +585,7 @@ export default class TaxPlanningMR extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Master Budget Tax Planning.xlsx';
a.download = 'Monthly Report Tax Planning.xlsx';
a.click();
}
}
......@@ -990,36 +871,44 @@ export default class TaxPlanningMR extends Component {
}
} else {
if (indexChilds == 0) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val).toFixed(1)
}
else if (indexChilds == 1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val).toFixed(1)
}
else if (indexChilds == 2) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val).toFixed(1)
}
}
}
const handleTotal = (tableMeta, dex) => {
let total = 0
// dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index == 9) {
// if ( tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ) {
// let valItem = item.tbf.value == undefined || item.tbf.value == "" || item.tbf.value == "undefined" ? 0.0 : item.tbf.value
// total += Number(valItem)
// } else {
// if (tableMeta.rowData[8] === "Fiscal Correction positive / (negative) Year To Date"){
// let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
// total += Number(valItem)
// } else {
// let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
// total += Number(valItem)
// }
// }
// }
// })
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index == 9) {
if ( tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ) {
let valItem = item.tbf.value == undefined || item.tbf.value == "" || item.tbf.value == "undefined" ? 0.0 : item.tbf.value
total += Number(valItem)
} else {
if (tableMeta.rowData[8] === "Fiscal Correction positive / (negative) Year To Date"){
let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
total += Number(valItem)
} else {
let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
total += Number(valItem)
}
}
if (index == 6) {
let valItemTBC = item.tbc == undefined || item.tbc == "" || item.tbc == "undefined" ? 0.0 : item.tbc
let valItemFCP = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
total = Number(valItemTBC) + Number(valItemFCP)
}
})
dataTable2[tableMeta.rowIndex][21] = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][6].tbf = Number(total).toFixed(1)
return total
}
const handleValue = (data) => {
......@@ -1375,13 +1264,21 @@ export default class TaxPlanningMR extends Component {
/>
</LightTooltip>
:
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={Number(handleTotal(tableMeta, 6)).toFixed(1)}
/>
}
</div>
......@@ -1564,8 +1461,9 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null
// this.downloadTemplate()
onClick={() =>
// null
this.downloadTemplate()
}
>
<img src={Images.template} />
......@@ -1602,12 +1500,13 @@ export default class TaxPlanningMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.downloadAllData()
// }, 100);
// })
onClick={() =>
// null
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})
}
>
<img src={Images.download} />
......@@ -1666,16 +1565,17 @@ export default class TaxPlanningMR extends Component {
outline: 'none',
marginRight: 20
}}
onClick={() => null
// {
// // this.forceUpdate()
// this.setState({ loading: true, buttonDraft: false }, () => {
// setTimeout(() => {
// // this.setState({ loading: false, buttonError: false, editable: true })
// this.handleValidate()
// }, 100);
// })
// }
onClick={() =>
// null
{
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => {
// this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate()
}, 100);
})
}
}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
......@@ -1685,15 +1585,16 @@ export default class TaxPlanningMR extends Component {
<button
className="button"
type="button"
onClick={() => null
onClick={() =>
// null
// this.state.saveDraft === true ?
// null :
// this.state.handleTekTekTek == 1 ? null :
// this.setState({ handleTekTekTek: 1, loading: true }, () => {
// setTimeout(() => {
// this.backToMasterBudget('draft')
// }, 100);
// })
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
})
}
style={{
backgroundColor: 'transparent',
......@@ -1710,16 +1611,17 @@ export default class TaxPlanningMR extends Component {
<button
type="button"
disabled={this.state.buttonError}
onClick={() => null
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
// this.state.handleTekTekTek == 1 ? null :
// this.setState({ handleTekTekTek: 1, loading: true }, () => {
// setTimeout(() => {
// this.backToMasterBudget('submitted')
// }, 100);
// })
onClick={() =>
// null
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('submitted')
}, 100);
})
}
style={{
backgroundColor: 'transparent',
......
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