Commit 162b210c authored by EKSAD's avatar EKSAD

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

parents 19b0ac4c 574b28ed
...@@ -266,7 +266,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -266,7 +266,7 @@ export default class CorporateAnnualTarget extends Component {
// console.log(nilaiTotal) // console.log(nilaiTotal)
// // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%') // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%', weight: i[2] === undefined ? "" : String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%',
uom: i[3] === undefined ? "" : String(i[3]).trim(), uom: i[3] === undefined ? "" : String(i[3]).trim(),
...@@ -322,7 +322,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -322,7 +322,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
// console.log(JSON.stringify(this.state.payload)) console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(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)
...@@ -488,6 +488,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -488,6 +488,13 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
// if (i[0] == null && i[2] == null) {
// if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) {
// handleKosongKPIMAXYTD = true
// // console.log(handleKosongKPIMAXYTD)
// }
// }
if (i[2] !== null) { if (i[2] !== null) {
let indexID = dataTampung.findIndex((val) => val.id == i[2]) let indexID = dataTampung.findIndex((val) => val.id == i[2])
if (indexID !== -1) { if (indexID !== -1) {
...@@ -511,7 +518,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -511,7 +518,7 @@ export default class CorporateAnnualTarget extends Component {
} }
data.push({ data.push({
"item_report_id": i[1] == "" ? null : i[1], "item_report_id": i[1] == "" || i[1] == null? 0 : i[1],
"item_name": String(i[6]), "item_name": String(i[6]),
"parent": i[2] == "" ? null : i[2], "parent": i[2] == "" ? null : i[2],
"weight": weightReal == null ? String(i[7]) : weightReal, "weight": weightReal == null ? String(i[7]) : weightReal,
...@@ -578,7 +585,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -578,7 +585,7 @@ export default class CorporateAnnualTarget extends Component {
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
// // console.log(i[9] == null? "" : i[9].value) // // console.log(i[9] == null? "" : i[9].value)
data.push({ data.push({
"item_report_id": i[1] == "" ? null : i[1], "item_report_id": i[1] == "" || i[1] == null? 0 : i[1],
"item_name": String(i[6]), "item_name": String(i[6]),
"parent": i[2] == "" ? null : i[2], "parent": i[2] == "" ? null : i[2],
"weight": String(i[7]), "weight": String(i[7]),
...@@ -865,7 +872,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -865,7 +872,7 @@ export default class CorporateAnnualTarget extends Component {
return false return false
} }
} else { } else {
if (typeReport == null) { if (typeReport == null || typeReport == 3) {
return true return true
} else if (tableMeta !== undefined && tableMeta.rowData[0] == 1) { } else if (tableMeta !== undefined && tableMeta.rowData[0] == 1) {
let indexID = dataTable2.findIndex((val) => val[2] == tableMeta.rowData[1]) let indexID = dataTable2.findIndex((val) => val[2] == tableMeta.rowData[1])
...@@ -887,9 +894,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -887,9 +894,9 @@ export default class CorporateAnnualTarget extends Component {
newData.push(item) newData.push(item)
if (index == rowIndex) { if (index == rowIndex) {
newData.push([ newData.push([
3, null,
"", "",
item[2] == null ? item[1] : item[2], item[2] == null || item[2] == ""? item[1] : item[2],
item[3], item[3],
item[4], item[4],
"", "",
...@@ -1065,7 +1072,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1065,7 +1072,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// console.log(event.target.value) // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2) console.log(dataTable2)
}} }}
/> />
} }
......
...@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import * as R from 'ramda'
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -102,21 +103,21 @@ export default class FixedAssetsMovement extends Component { ...@@ -102,21 +103,21 @@ export default class FixedAssetsMovement extends Component {
item.level, item.level,
item.description, 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.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.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.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.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.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.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.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.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.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.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.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.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.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.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year,
item.order item.order
]) ])
} }
...@@ -137,21 +138,21 @@ export default class FixedAssetsMovement extends Component { ...@@ -137,21 +138,21 @@ export default class FixedAssetsMovement extends Component {
item.level, item.level,
item.description, 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.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.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.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.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.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.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.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.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.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.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.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.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.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.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year,
item.order item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -202,18 +203,18 @@ export default class FixedAssetsMovement extends Component { ...@@ -202,18 +203,18 @@ export default class FixedAssetsMovement extends Component {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(Number(i[6]).toFixed(1)), total_actual_before: String(Number(i[6]).toFixed(1)),
january: String(Number(i[7]).toFixed(1)), january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value).toFixed(1)) : String(Number(i[7]).toFixed(1)),
february: String(Number(i[8]).toFixed(1)), february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value).toFixed(1)) : String(Number(i[8]).toFixed(1)),
march: String(Number(i[9]).toFixed(1)), march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value).toFixed(1)) : String(Number(i[9]).toFixed(1)),
april: String(Number(i[10]).toFixed(1)), april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value).toFixed(1)) : String(Number(i[10]).toFixed(1)),
may: String(Number(i[11]).toFixed(1)), may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value).toFixed(1)) : String(Number(i[11]).toFixed(1)),
june: String(Number(i[12]).toFixed(1)), june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value).toFixed(1)) : String(Number(i[12]).toFixed(1)),
july: String(Number(i[13]).toFixed(1)), july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)),
august: String(Number(i[14]).toFixed(1)), august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)),
september: String(Number(i[15]).toFixed(1)), september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)),
october: String(Number(i[16]).toFixed(1)), october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)),
november: String(Number(i[17]).toFixed(1)), november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)),
december: String(Number(i[18]).toFixed(1)), december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)),
total_current_year: String(Number(i[19]).toFixed(1)), total_current_year: String(Number(i[19]).toFixed(1)),
total_next_year: String(Number(i[20]).toFixed(1)), total_next_year: String(Number(i[20]).toFixed(1)),
total_more_year: String(Number(i[21]).toFixed(1)) total_more_year: String(Number(i[21]).toFixed(1))
...@@ -311,18 +312,18 @@ export default class FixedAssetsMovement extends Component { ...@@ -311,18 +312,18 @@ export default class FixedAssetsMovement extends Component {
item.level, item.level,
item.item_report, item.item_report,
item.total_actual_before, item.total_actual_before,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.january, formula: item.january_formula} : item.january, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.january, formula: item.january_formula } : item.january,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.february, formula: item.february_formula} : item.february, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.february, formula: item.february_formula } : item.february,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.march, formula: item.march_formula} : item.march, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.march, formula: item.march_formula } : item.march,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.april, formula: item.april_formula} : item.april, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.april, formula: item.april_formula } : item.april,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.may, formula: item.may_formula} : item.may, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.may, formula: item.may_formula } : item.may,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.june, formula: item.june_formula} : item.june, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.june, formula: item.june_formula } : item.june,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.july, formula: item.july_formula} : item.july, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.july, formula: item.july_formula } : item.july,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.august, formula: item.august_formula} : item.august, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.august, formula: item.august_formula } : item.august,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.september, formula: item.september_formula} : item.september, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.september, formula: item.september_formula } : item.september,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.october, formula: item.october_formula} : item.october, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : item.october,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.november, formula: item.november_formula} : item.november, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : item.november,
item.type_report_id == 5 || item.type_report_id == 6? {value: item.december, formula: item.december_formula} : item.december, item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : item.december,
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
...@@ -411,29 +412,29 @@ export default class FixedAssetsMovement extends Component { ...@@ -411,29 +412,29 @@ export default class FixedAssetsMovement extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
// console.log(this.state.dataTable) console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(i[6]), total_actual_before: String(i[6]),
january: i[0] === 3 && i[7] === "" ? "0" : String(i[7]), january: i[0] === 3 && i[7] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[7].value) : String(i[7]),
february: i[0] === 3 && i[8] === "" ? "0" : String(i[8]), february: i[0] === 3 && i[8] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[8].value) : String(i[8]),
march: i[0] === 3 && i[9] === "" ? "0" : String(i[9]), march: i[0] === 3 && i[9] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[9].value) : String(i[9]),
april: i[0] === 3 && i[10] === "" ? "0" : String(i[10]), april: i[0] === 3 && i[10] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[10].value) : String(i[10]),
may: i[0] === 3 && i[11] === "" ? "0" : String(i[11]), may: i[0] === 3 && i[11] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[11].value) : String(i[11]),
june: i[0] === 3 && i[12] === "" ? "0" : String(i[12]), june: i[0] === 3 && i[12] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[12].value) : String(i[12]),
july: i[0] === 3 && i[13] === "" ? "0" : String(i[13]), july: i[0] === 3 && i[13] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[13].value) : String(i[13]),
august: i[0] === 3 && i[14] === "" ? "0" : String(i[14]), august: i[0] === 3 && i[14] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[14].value) : String(i[14]),
september: i[0] === 3 && i[15] === "" ? "0" : String(i[15]), september: i[0] === 3 && i[15] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[15].value) : String(i[15]),
october: i[0] === 3 && i[16] === "" ? "0" : String(i[16]), october: i[0] === 3 && i[16] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[16].value) : String(i[16]),
november: i[0] === 3 && i[17] === "" ? "0" : String(i[17]), november: i[0] === 3 && i[17] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[17].value) : String(i[17]),
december: i[0] === 3 && i[18] === "" ? "0" : String(i[18]), december: i[0] === 3 && i[18] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[18].value) : String(i[18]),
total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(i[19]), total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]), total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21]) total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21])
}) })
}) })
// console.log(JSON.stringify(data)) console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -462,14 +463,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -462,14 +463,14 @@ export default class FixedAssetsMovement extends Component {
let splitFormula = String(tableMeta.rowData[3]).split('@') let splitFormula = String(tableMeta.rowData[3]).split('@')
let baru = [] let baru = []
let anjay = [] let anjay = []
splitFormula.map((item,index) => { splitFormula.map((item, index) => {
let items = String(item).substr(Number(String(item).length) -1, 1) let items = String(item).substr(Number(String(item).length) - 1, 1)
let re = /^[a-zA-Z0-9_]+$/; let re = /^[a-zA-Z0-9_]+$/;
let asd = '' let asd = ''
if (item !== "") { if (item !== "") {
if (!re.test(items)) { if (!re.test(items)) {
baru.push(String(item).substr(0, Number(String(item).length) -1)) baru.push(String(item).substr(0, Number(String(item).length) - 1))
baru.push(String(item).substr(Number(String(item).length) -1, 1)) baru.push(String(item).substr(Number(String(item).length) - 1, 1))
} else { } else {
baru.push(String(item)) baru.push(String(item))
} }
...@@ -481,22 +482,22 @@ export default class FixedAssetsMovement extends Component { ...@@ -481,22 +482,22 @@ export default class FixedAssetsMovement extends Component {
// console.log(baru) // console.log(baru)
// } // }
// console.log(baru) // console.log(baru)
baru.map((item,index) => { baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*') { if (item == '-' || item == '+' || item == '/' || item == '*') {
anjay.push(item) anjay.push(item)
} else { } else {
if (String(item).includes('#')) { if (String(item).includes('#')) {
if (String(item).includes('[M-1]')) { if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '') let tst = String(item).replace('[M-1]', '')
let data = tableMeta.columnIndex == 7? 18 : tableMeta.columnIndex - 1 let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
let period = data == 18? Number(this.props.periode)-1 : this.props.periode let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
// console.log(tableMeta.columnIndex) // console.log(tableMeta.columnIndex)
let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period) let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// console.log(indexID) // console.log(indexID)
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value let valuezz = tableMeta.rowData[data].formula[indexID].value
// baru.push(valuezz) // baru.push(valuezz)
anjay.push(valuezz == ""? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
// console.log(valuezz) // console.log(valuezz)
} }
} else { } else {
...@@ -505,7 +506,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -505,7 +506,7 @@ export default class FixedAssetsMovement extends Component {
if (indexID !== -1) { if (indexID !== -1) {
// console.log(value.formula[indexID].value) // console.log(value.formula[indexID].value)
let valuezz = value.formula[indexID].value let valuezz = value.formula[indexID].value
anjay.push(valuezz == ""? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} }
} }
} else { } else {
...@@ -513,8 +514,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -513,8 +514,8 @@ export default class FixedAssetsMovement extends Component {
let indexID = dataTable2.findIndex((val) => val[22] == item) let indexID = dataTable2.findIndex((val) => val[22] == item)
// console.log(dataTable2[indexID][tableMeta.columnIndex]) // console.log(dataTable2[indexID][tableMeta.columnIndex])
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz == ""? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} }
} }
} }
...@@ -532,7 +533,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -532,7 +533,7 @@ export default class FixedAssetsMovement extends Component {
} else if (item == "/") { } else if (item == "/") {
opt = "bagi" opt = "bagi"
} else { } else {
item = item == ""? 0 : item item = item == "" ? 0 : item
if (opt == "tambah") { if (opt == "tambah") {
total = Number(total) + Number(item) total = Number(total) + Number(item)
} else if (opt == "kurang") { } else if (opt == "kurang") {
...@@ -540,20 +541,21 @@ export default class FixedAssetsMovement extends Component { ...@@ -540,20 +541,21 @@ export default class FixedAssetsMovement extends Component {
} else if (opt == "kali") { } else if (opt == "kali") {
total = Number(total) * Number(item) total = Number(total) * Number(item)
} else if (opt == "bagi") { } else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN? 0 : Number(total) / Number(item) total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else { } else {
total += Number(item) total += Number(item)
} }
} }
}) })
total = R.equals(total, NaN) ? "0.0" : total
// console.log(dataTable2[tableMeta.rowIndex][22]) // console.log(dataTable2[tableMeta.rowIndex][22])
// console.log(tableMeta.rowData[5]) // console.log(tableMeta.rowData[5])
// if (tableMeta.rowData[5] == 'Beginning Balance') { // if (tableMeta.rowData[5] == 'Beginning Balance') {
// console.log(baru) // console.log(baru)
// console.log(anjay) // console.log(anjay)
// console.log(total) // console.log(total)
// } // }
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// console.log([tableMeta.rowIndex][tableMeta.columnIndex]) // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
...@@ -587,7 +589,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -587,7 +589,7 @@ export default class FixedAssetsMovement extends Component {
// } // }
dataTable2[tableMeta.rowIndex].map((item, index) => { dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 7 && index <= 18) { if (index >= 7 && index <= 18) {
let valItem = item.value == undefined? item == undefined || item == "" ? 0 : item : item.value == "" ? 0 : item.value let valItem = item.value == undefined ? item == undefined || item == "" ? 0 : item : item.value == "" ? 0 : item.value
total += Number(valItem) total += Number(valItem)
} }
}) })
...@@ -2366,7 +2368,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -2366,7 +2368,7 @@ export default class FixedAssetsMovement extends Component {
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError} // disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
...@@ -110,7 +110,7 @@ export default class TaxPlanning extends Component { ...@@ -110,7 +110,7 @@ export default class TaxPlanning extends Component {
{ tbc: item.formula_tax.value_tbc, fcp: item.formula_tax.value_fc, tbf: item.formula_tax.value_tbf }, { tbc: item.formula_tax.value_tbc, fcp: item.formula_tax.value_fc, tbf: item.formula_tax.value_tbf },
item.level, item.level,
item.description, item.description,
{ tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.january.tbc, formula: item.tax_planning.january_formula } : item.tax_planning.january.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.january.fcp, formula: item.tax_planning.january_formula } : item.tax_planning.january.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.january.tbf, formula: item.tax_planning.january_formula } : item.tax_planning.january.tbf }, { tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.january.tbc, formula: item.tax_planning.january_formula } : item.tax_planning.january.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.january.fcp, formula: item.tax_planning.january_formula } : item.tax_planning.january.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.january.tbf, formula: item.tax_planning.january_formula } : item.tax_planning.january.tbf },
{ tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.february.tbc, formula: item.tax_planning.february_formula } : item.tax_planning.february.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.february.fcp, formula: item.tax_planning.february_formula } : item.tax_planning.february.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.february.tbf, formula: item.tax_planning.february_formula } : item.tax_planning.february.tbf }, { tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.february.tbc, formula: item.tax_planning.february_formula } : item.tax_planning.february.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.february.fcp, formula: item.tax_planning.february_formula } : item.tax_planning.february.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.february.tbf, formula: item.tax_planning.february_formula } : item.tax_planning.february.tbf },
{ tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.march.tbc, formula: item.tax_planning.march_formula } : item.tax_planning.march.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.march.fcp, formula: item.tax_planning.march_formula } : item.tax_planning.march.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.march.tbf, formula: item.tax_planning.march_formula } : item.tax_planning.march.tbf }, { tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.march.tbc, formula: item.tax_planning.march_formula } : item.tax_planning.march.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.march.fcp, formula: item.tax_planning.march_formula } : item.tax_planning.march.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.march.tbf, formula: item.tax_planning.march_formula } : item.tax_planning.march.tbf },
{ tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.april.tbc, formula: item.tax_planning.april_formula } : item.tax_planning.april.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.april.fcp, formula: item.tax_planning.april_formula } : item.tax_planning.april.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.april.tbf, formula: item.tax_planning.april_formula } : item.tax_planning.april.tbf }, { tbc: item.type_report_tax.value_tbc.type_report_id == 5 || item.type_report_tax.value_tbc.type_report_id == 6 || item.type_report_tax.value_tbc.type_report_id == 7 ? { value: item.tax_planning.april.tbc, formula: item.tax_planning.april_formula } : item.tax_planning.april.tbc, fcp: item.type_report_tax.value_fc.type_report_id == 5 || item.type_report_tax.value_fc.type_report_id == 6 || item.type_report_tax.value_fc.type_report_id == 7 ? { value: item.tax_planning.april.fcp, formula: item.tax_planning.april_formula } : item.tax_planning.april.fcp, tbf: item.type_report_tax.value_tbf.type_report_id == 5 || item.type_report_tax.value_tbf.type_report_id == 6 || item.type_report_tax.value_tbf.type_report_id == 7 ? { value: item.tax_planning.april.tbf, formula: item.tax_planning.april_formula } : item.tax_planning.april.tbf },
...@@ -222,64 +222,64 @@ export default class TaxPlanning extends Component { ...@@ -222,64 +222,64 @@ export default class TaxPlanning extends Component {
data.push({ data.push({
item_report_id: i[4], item_report_id: i[4],
january: { january: {
tbc: String(Number(i[9].tbc).toFixed(1)), 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: String(Number(i[9].fcp).toFixed(1)), 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: String(Number(i[9].tbf).toFixed(1)) 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: { february: {
tbc: String(Number(i[10].tbc).toFixed(1)), 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: String(Number(i[10].fcp).toFixed(1)), 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: String(Number(i[10].tbf).toFixed(1)) 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: { march: {
tbc: String(Number(i[11].tbc).toFixed(1)), 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: String(Number(i[11].fcp).toFixed(1)), 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: String(Number(i[11].tbf).toFixed(1)) 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: { april: {
tbc: String(Number(i[12].tbc).toFixed(1)), 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: String(Number(i[12].fcp).toFixed(1)), 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: String(Number(i[12].tbf).toFixed(1)) 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: { may: {
tbc: String(Number(i[13].tbc).toFixed(1)), 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: String(Number(i[13].fcp).toFixed(1)), 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: String(Number(i[13].tbf).toFixed(1)) 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: { june: {
tbc: String(Number(i[14].tbc).toFixed(1)), 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: String(Number(i[14].fcp).toFixed(1)), 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: String(Number(i[14].tbf).toFixed(1)) 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: { july: {
tbc: String(Number(i[15].tbc).toFixed(1)), 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: String(Number(i[15].fcp).toFixed(1)), 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: String(Number(i[15].tbf).toFixed(1)) 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: { august: {
tbc: String(Number(i[16].tbc).toFixed(1)), 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: String(Number(i[16].fcp).toFixed(1)), 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: String(Number(i[16].tbf).toFixed(1)) 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: { september: {
tbc: String(Number(i[17].tbc).toFixed(1)), 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: String(Number(i[17].fcp).toFixed(1)), 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: String(Number(i[17].tbf).toFixed(1)) 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: { october: {
tbc: String(Number(i[18].tbc).toFixed(1)), 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: String(Number(i[18].fcp).toFixed(1)), 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: String(Number(i[18].tbf).toFixed(1)) 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: { november: {
tbc: String(Number(i[19].tbc).toFixed(1)), 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: String(Number(i[19].fcp).toFixed(1)), 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: String(Number(i[19].tbf).toFixed(1)) 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: { december: {
tbc: String(Number(i[20].tbc).toFixed(1)), 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: String(Number(i[20].fcp).toFixed(1)), 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: String(Number(i[20].tbf).toFixed(1)) 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_current_year: String(Number(i[21]).toFixed(1)),
total_next_year: { total_next_year: {
...@@ -302,7 +302,7 @@ export default class TaxPlanning extends Component { ...@@ -302,7 +302,7 @@ export default class TaxPlanning extends Component {
"status": type, "status": type,
"tax_planning": data "tax_planning": data
} }
// console.log(JSON.stringify(payload)); console.log(JSON.stringify(payload));
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -585,64 +585,64 @@ export default class TaxPlanning extends Component { ...@@ -585,64 +585,64 @@ export default class TaxPlanning extends Component {
data.push({ data.push({
item_report_id: i[4], item_report_id: i[4],
january: { january: {
tbc: i[1] === 3 && i[9].tbc === "" ? "0" : String(i[9].tbc), 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" : String(i[9].fcp), 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" : String(i[9].tbf) 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: { february: {
tbc: i[1] === 3 && i[10].tbc === "" ? "0" : String(i[10].tbc), 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" : String(i[10].fcp), 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" : String(i[10].tbf) 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: { march: {
tbc: i[1] === 3 && i[11].tbc === "" ? "0" : String(i[11].tbc), 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" : String(i[11].fcp), 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" : String(i[11].tbf) 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: { april: {
tbc: i[1] === 3 && i[12].tbc === "" ? "0" : String(i[12].tbc), 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" : String(i[12].fcp), 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" : String(i[12].tbf) 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: { may: {
tbc: i[1] === 3 && i[13].tbc === "" ? "0" : String(i[13].tbc), 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" : String(i[13].fcp), 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" : String(i[13].tbf) 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: { june: {
tbc: i[1] === 3 && i[14].tbc === "" ? "0" : String(i[14].tbc), 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" : String(i[14].fcp), 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" : String(i[14].tbf) 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: { july: {
tbc: i[1] === 3 && i[15].tbc === "" ? "0" : String(i[15].tbc), 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" : String(i[15].fcp), 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" : String(i[15].tbf) 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: { august: {
tbc: i[1] === 3 && i[16].tbc === "" ? "0" : String(i[16].tbc), 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" : String(i[16].fcp), 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" : String(i[16].tbf) 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: { september: {
tbc: i[1] === 3 && i[17].tbc === "" ? "0" : String(i[17].tbc), 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" : String(i[17].fcp), 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" : String(i[17].tbf) 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: { october: {
tbc: i[1] === 3 && i[18].tbc === "" ? "0" : String(i[18].tbc), 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" : String(i[18].fcp), 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" : String(i[18].tbf) 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: { november: {
tbc: i[1] === 3 && i[19].tbc === "" ? "0" : String(i[19].tbc), 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" : String(i[19].fcp), 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" : String(i[19].tbf) 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: { december: {
tbc: i[1] === 3 && i[20].tbc === "" ? "0" : String(i[20].tbc), 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" : String(i[20].fcp), 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" : String(i[20].tbf) 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: i[2] === 3 && i[21] === "" ? "0" : String(i[21]), total_current_year: i[2] === 3 && i[21] === "" ? "0" : String(i[21]),
total_next_year: { total_next_year: {
...@@ -810,6 +810,7 @@ export default class TaxPlanning extends Component { ...@@ -810,6 +810,7 @@ export default class TaxPlanning extends Component {
} }
} }
}) })
total = R.equals(total, NaN) ? "0.0" : total
// console.log(tableMeta.rowData[8]) // console.log(tableMeta.rowData[8])
// console.log(baru) // console.log(baru)
// console.log(anjay) // console.log(anjay)
...@@ -820,19 +821,19 @@ export default class TaxPlanning extends Component { ...@@ -820,19 +821,19 @@ export default class TaxPlanning extends Component {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = total
} else { } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = total
} }
} else if (dex == 2) { } else if (dex == 2) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = total
} else { } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = total
} }
} else { } else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = total
} else { } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = total
} }
} }
...@@ -868,7 +869,7 @@ export default class TaxPlanning extends Component { ...@@ -868,7 +869,7 @@ export default class TaxPlanning extends Component {
dataTable2[tableMeta.rowIndex].map((item, index) => { dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) { if (index >= 9 && index <= 20) {
// console.log(item); // console.log(item);
let valItem = item.fcp == undefined || item.fcp == "" ? 0 : item.fcp let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0 : item.fcp
total += Number(valItem) total += Number(valItem)
} }
}) })
......
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