Commit 3b83343a authored by Riri Novita's avatar Riri Novita

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

parents 97004551 10f28123
......@@ -452,7 +452,7 @@ export default class ApprovalMatrix extends Component {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -462,10 +462,10 @@ export default class ApprovalMatrix extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -479,7 +479,7 @@ export default class ApprovalMatrix extends Component {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -489,10 +489,10 @@ export default class ApprovalMatrix extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -506,7 +506,7 @@ export default class ApprovalMatrix extends Component {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -516,10 +516,10 @@ export default class ApprovalMatrix extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -563,7 +563,7 @@ export default class ApprovalMatrix extends Component {
this.getData()
this.setState({ visibleAM: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -573,10 +573,10 @@ export default class ApprovalMatrix extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -595,7 +595,7 @@ export default class ApprovalMatrix extends Component {
this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -605,10 +605,10 @@ export default class ApprovalMatrix extends Component {
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......
......@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import Constant from '../../library/Constant';
import * as R from 'ramda'
const LightTooltip = withStyles((theme) => ({
......@@ -90,6 +91,8 @@ export default class FixedAssetsMovement extends Component {
// console.log(response);
let dataTable = []
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -168,7 +171,20 @@ export default class FixedAssetsMovement extends Component {
})
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -304,6 +320,7 @@ export default class FixedAssetsMovement extends Component {
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleFixedAssetsMovement: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
......@@ -345,7 +362,21 @@ export default class FixedAssetsMovement extends Component {
})
// // console.log(this.state.dataTable);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......@@ -385,15 +416,27 @@ export default class FixedAssetsMovement extends Component {
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ loading: false })
alert(response.problem)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
// this.setState({ loading: false })
// alert(response.problem)
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......
......@@ -12,6 +12,7 @@ import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -116,6 +117,7 @@ export default class TaxPlanning extends Component {
// console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status == 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -206,6 +208,16 @@ export default class TaxPlanning extends Component {
})
// console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
......@@ -600,11 +612,18 @@ export default class TaxPlanning extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
// alert(response.data.status)
}
} else {
this.setState({ loading: false })
alert(response.problem)
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......
......@@ -82,11 +82,9 @@ export default class DocumentManagement extends Component {
loadTable: true,
refresh: id === undefined ? '' : 'create'
})
} else {
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......
......@@ -12,6 +12,7 @@ import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -70,7 +71,7 @@ export default class TaxPlanningMR extends Component {
"revision": 0,
"periode": 2021,
"company_id": 2193390,
"submission_id": 3275722
"submission_id": 3425765
}
api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) {
......@@ -90,12 +91,13 @@ export default class TaxPlanningMR extends Component {
"revision": 0,
"periode": 2021,
"company_id": 2193390,
"submission_id": 3275722
"submission_id": 3425765
}
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status == 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -159,6 +161,16 @@ export default class TaxPlanningMR extends Component {
}
})
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
......@@ -552,11 +564,18 @@ export default class TaxPlanningMR extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
// alert(response.data.status)
}
} else {
this.setState({ loading: false })
alert(response.problem)
this.setState({ loading: false, alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
......
......@@ -12,6 +12,7 @@ import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -93,9 +94,10 @@ export default class TaxPlanningOLPA extends Component {
"company_id": this.props.company.company_id
}
api.create().getDetailReportOLPA(payload).then(response => {
// console.log(response);
// console.log(payload);
let dataTable = []
if (response.data) {
if (response.data.status == 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -107,10 +109,11 @@ export default class TaxPlanningOLPA extends Component {
item.type_report_tax.value_tbf.type_report_id,
item.id,
item.parent,
{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.description,
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf},
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp,
tbf: item.tax_planning.january.tbf === null ? "0" : item.tax_planning.january.tbf === "" ? "0" : item.tax_planning.january.tbf},
{tbc : item.tax_planning.february.tbc, fcp: item.tax_planning.february.fcp, tbf: item.tax_planning.february.tbf},
{tbc : item.tax_planning.march.tbc, fcp: item.tax_planning.march.fcp, tbf: item.tax_planning.march.tbf},
{tbc : item.tax_planning.april.tbc, fcp: item.tax_planning.april.fcp, tbf: item.tax_planning.april.tbf},
......@@ -124,9 +127,16 @@ export default class TaxPlanningOLPA extends Component {
{tbc : item.tax_planning.november.tbc, fcp: item.tax_planning.november.fcp, tbf: item.tax_planning.november.tbf},
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf},
item.tax_planning.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf},
item.order
{ tbc: item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf },
{ tbc: item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf },
item.order,
// { tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf },
// { tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf },
{ tbc: item.condition_it_should_be_tax, fcp: item.condition_it_should_be_tax, tbf: item.condition_it_should_be_tax },
{ tbc: item.condition_if_wrong_tax, fcp: item.condition_if_wrong_tax, tbf: item.condition_if_wrong_tax },
// item.tax_planning.forecast_tbc_formula,
// item.tax_planning.forecast_fcp_formula,
// item.tax_planning.forecast_tbf_formula,
])
}
if (item.children !== null) {
......@@ -145,10 +155,11 @@ export default class TaxPlanningOLPA extends Component {
item.type_report_tax.value_tbf.type_report_id,
item.id,
item.parent,
{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.description,
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf},
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp,
tbf: item.tax_planning.january.tbf === null ? "0" : item.tax_planning.january.tbf === "" ? "0" : item.tax_planning.january.tbf},
{tbc : item.tax_planning.february.tbc, fcp: item.tax_planning.february.fcp, tbf: item.tax_planning.february.tbf},
{tbc : item.tax_planning.march.tbc, fcp: item.tax_planning.march.fcp, tbf: item.tax_planning.march.tbf},
{tbc : item.tax_planning.april.tbc, fcp: item.tax_planning.april.fcp, tbf: item.tax_planning.april.tbf},
......@@ -162,9 +173,18 @@ export default class TaxPlanningOLPA extends Component {
{tbc : item.tax_planning.november.tbc, fcp: item.tax_planning.november.fcp, tbf: item.tax_planning.november.tbf},
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf},
item.tax_planning.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf},
item.order
{ tbc: item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf },
{ tbc: item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf },
{ tbc: item.condition_it_should_be_tax, fcp: item.condition_it_should_be_tax, tbf: item.condition_it_should_be_tax },
{ tbc: item.condition_if_wrong_tax, fcp: item.condition_if_wrong_tax, tbf: item.condition_if_wrong_tax },
item.order,
// { tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf },
// { tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf },
{ tbc: item.condition_it_should_be_tax, fcp: item.condition_it_should_be_tax, tbf: item.condition_it_should_be_tax },
{ tbc: item.condition_if_wrong_tax, fcp: item.condition_if_wrong_tax, tbf: item.condition_if_wrong_tax },
// item.tax_planning.forecast_tbc_formula,
// item.tax_planning.forecast_fcp_formula,
// item.tax_planning.forecast_tbf_formula,
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -175,6 +195,16 @@ export default class TaxPlanningOLPA extends Component {
}
})
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
......@@ -598,7 +628,15 @@ export default class TaxPlanningOLPA extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
this.setState({ alert: true, messageAlert: response.data.status, tipeAlert: 'error', loading: false })
// this.setState({ alert: true, messageAlert: response.data.status, tipeAlert: 'error', loading: false })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
......@@ -744,6 +782,262 @@ export default class TaxPlanningOLPA extends Component {
render() {
let dataTable2 = this.state.dataTable
let dataFormula = []
let id = 0
let double = false
const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf
let splitFormula = String(form).split('@')
console.log(form)
console.log(splitFormula)
let baru = []
let anjay = []
splitFormula.map((item, index) => {
let items = String(item).substr(Number(String(item).length) - 1, 1)
let re = /^[a-zA-Z0-9_]+$/;
let asd = ''
if (item !== "") {
// re.test(items) ngecek angka
if (!re.test(items)) {
baru.push(String(item).substr(0, Number(String(item).length) - 1))
baru.push(String(item).substr(Number(String(item).length) - 1, 1))
} else {
baru.push(String(item))
}
}
})
if (tableMeta.rowData[8] == "Under payment /(Over Payment ) Income Tax Art. 29" || forecast !== undefined) {
let opgab = []
baru.map((item, index) => {
if (item.length > 1 && (item.includes("+") || item.includes("-") || item.includes("*") || item.includes("/"))) {
opgab.push(String(item).substr(0, Number(String(item).length) - 1))
opgab.push(String(item).substr(Number(String(item).length) - 1, 1))
} else {
opgab.push(item)
}
})
if (opgab.length > 0) {
baru = opgab
}
}
let totalShldBeNil = 0
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
anjay.push(item)
} else {
// console.log(item)
if (String(item).includes('#')) {
let splitform = String(item).split('#')
if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') {
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
if (indexID !== -1) {
let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
let valuezz = data.value == undefined ? data : data.value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
if (forecast !== undefined) {
forecast.map((item, index) => {
if (periode == item.periode) {
totalShldBeNil += Number(item.value)
}
})
anjay.push(totalShldBeNil)
} else if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
let data = tableMeta.columnIndex == 9 ? 20 : tableMeta.columnIndex - 1
let dataSub = dex == 1 ? tableMeta.rowData[data].tbc : dex == 2 ? tableMeta.rowData[data].fcp : tableMeta.rowData[data].tbf
let period = data == 20 ? Number(this.props.periode) - 1 : this.props.periode
let indexID = dataSub.formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
// let data = dex == 1 ? tableMeta.rowData[data].tbc : dex == 2 ? tableMeta.rowData[data].fcp : tableMeta.rowData[data].tbf
// console.log(data);
let indexID = data.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = data.formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
}
} else {
let indexID = dataTable2.findIndex((val) => val[24] == item)
if (indexID !== -1) {
if (dataTable2[indexID][24] == tableMeta.rowData[24]) {
anjay.push(0)
} else {
let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
let valuezz = data.value == undefined ? data : data.value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
}
}
})
let total = 0
let total2 = 0
let opt = ""
let opt2 = ""
let prio = false
let simpen2 = ""
anjay.map((item, index) => {
if (item == "+") {
if (prio) {
opt2 = "tambah"
} else {
opt = "tambah"
}
} else if (item == "-") {
if (prio) {
opt2 = "kurang"
} else {
opt = "kurang"
}
} else if (item == "*") {
if (prio) {
opt2 = "kali"
} else {
opt = "kali"
}
} else if (item == "/") {
if (prio) {
opt2 = "bagi"
} else {
opt = "bagi"
}
} else if (item == "(") {
prio = true
simpen2 = "active"
} else if (item == ")") {
prio = false
}
else {
if (prio) {
if (opt2 == "tambah") {
total2 = Number(total2) + Number(item)
} else if (opt2 == "kurang") {
total2 = Number(total2) - Number(item)
} else if (opt2 == "kali") {
total2 = Number(total2) * Number(item)
} else if (opt2 == "bagi") {
total2 = Number(total2) / Number(item) == NaN ? 0 : Number(total2) / Number(item)
} else {
total2 += Number(item)
}
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
}
})
if (simpen2 == "active") {
if (opt == "tambah") {
total = Number(total) + Number(total2)
} else if (opt == "kurang") {
total = Number(total) - Number(total2)
} else if (opt == "kali") {
total = Number(total) * Number(total2)
} else if (opt == "bagi") {
total = Number(total) / Number(total2) == NaN ? 0 : Number(total) / Number(total2)
}
}
total = R.equals(total, NaN) ? "0.0" : total
// console.log(tableMeta.rowData[8])
// if (xntd !== undefined && tableMeta.rowData[8] == "Under payment /(Over Payment ) Income Tax Art. 29") {
// console.log(tableMeta.rowData[8])
// // console.log(splitFormula)
// console.log(xntd)
// console.log(baru)
// console.log(anjay)
// console.log(total)
// console.log(total2)
// console.log(opt)
// }
// let dataSub = dex == 1? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc : dex == 2? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp : dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf
if (dex == 1) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total).toFixed(1)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = Number(total).toFixed(1)
}
} else if (dex == 2) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(total).toFixed(1)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
}
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1)
}
}
return Number(total).toFixed(1)
}
const handleForecast = (tableMeta, periode, dex) => {
let total = 0
let data = dex == 1 ? dataTable2[tableMeta.rowIndex][6].tbc : dex == 2 ? dataTable2[tableMeta.rowIndex][6].fcp : dataTable2[tableMeta.rowIndex][6].tbf
let forecast = dex == 1 ? dataTable2[tableMeta.rowIndex][27] : dex == 2 ? dataTable2[tableMeta.rowIndex][28] : dataTable2[tableMeta.rowIndex][29]
if (data.includes('#PL')) {
if (tableMeta.rowData[8] == "Control (should be nil)") {
total = handleValueFormula(5, tableMeta, dex, data, forecast, periode)
} else {
forecast.map((item, index) => {
if (periode == item.periode) {
total += Number(item.value)
}
})
}
} else {
total = handleValueFormula(5, tableMeta, dex, data)
}
if (dex == 1) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = total
}
} else if (dex == 2) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = total
}
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = total
}
}
return total
}
const handleChange = (value, tableMeta, indexChilds) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
......@@ -756,33 +1050,50 @@ export default class TaxPlanningOLPA extends Component {
a = dataTable2[indexParent][tableMeta.columnIndex].fcp = jagain === undefined ? (0 + Number(val)) : (Number(jagain) + Number(val))
}
} else {
// console.log(tableMeta)
if (indexChilds == 0){
if (indexChilds == 0) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(val)
}
else if (indexChilds == 1){
else if (indexChilds == 1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val)
}
else if (indexChilds == 2){
else if (indexChilds == 2) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(val)
}
}
}
const handleTotal = (tableMeta) => {
const handleTotal = (tableMeta, dex) => {
let total = 0
let totalfcp = 0
if (String(tableMeta.rowData[8]).toLowerCase() === "fiscal correction positive / (negative) year to date") {
dataTable2[tableMeta.rowIndex - 2].map((item, index) => {
if (index >= 9 && index <= 20) {
if (dataTable2[tableMeta.rowIndex - 2][2] === 5 || dataTable2[tableMeta.rowIndex - 2][2] === 6 || dataTable2[tableMeta.rowIndex - 2][2] === 7) {
let valItem = item.fcp.value == undefined || item.fcp.value == "" || item.fcp.value == "undefined" ? 0.0 : item.fcp.value
total += Number(valItem)
} else {
let valItem = item.fcp == undefined || item.fcp == "" || item.fcp == "undefined" ? 0.0 : item.fcp
total += Number(valItem)
}
}
})
} else {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) {
// console.log(item);
let valItem = item.fcp == undefined || item.fcp == "" ? 0 : item.fcp
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 {
let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
total += Number(valItem)
}
}
})
dataTable2[tableMeta.rowIndex][21] = total
}
dataTable2[tableMeta.rowIndex][21] = Number(total).toFixed(1)
return total
}
const handleValue = (data) => {
let total = 0
// // console.log(dataTable2)
dataTable2.map((item, index) => {
if (data.rowData[4] === item[5]) {
total = item[data.columnIndex] === undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex].fcp))
......@@ -790,7 +1101,6 @@ export default class TaxPlanningOLPA extends Component {
})
let indexParent = dataTable2.findIndex((val) => val[4] === dataTable2[data.rowIndex][5])
let a = dataTable2[data.rowIndex][data.columnIndex].fcp = Number(total)
// console.log(indexParent);
return a
}
......@@ -839,10 +1149,6 @@ export default class TaxPlanningOLPA extends Component {
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
// console.log(tableMeta)
// console.log(tableMeta.rowIndex)
// console.log(rowColumn)
if (response.data) {
if (response.data.status === "success") {
return response.data.data.result
......@@ -891,18 +1197,44 @@ export default class TaxPlanningOLPA extends Component {
}
}
})
if (R.equals(Number(total), NaN) ){
total = {tbc: "", fcp: "", tbf: ""}
if (R.equals(Number(total), NaN)) {
total = { tbc: "", fcp: "", tbf: "" }
} else {
total = Number(total)
}
// console.log(Number(total))
// console.log(dataTable2[tableMeta.rowIndex])
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// console.log(total)
return a
}
}
const handleParent = (tableMeta, type) => {
let total = 0
dataTable2.map((item, index) => {
if (item[5] == tableMeta.rowData[4]) {
total += Number(type == 1 ?
item[tableMeta.columnIndex].tbc.value == undefined ? Number(item[tableMeta.columnIndex].tbc == "" || item[tableMeta.columnIndex].tbc == "0.0" ? 0 : item[tableMeta.columnIndex].tbc) : Number(item[tableMeta.columnIndex].tbc.value == "" || item[tableMeta.columnIndex].tbc.value == "0.0" ? 0 : item[tableMeta.columnIndex].tbc.value)
:
(type == 2 ?
item[tableMeta.columnIndex].fcp.value == undefined ? Number(item[tableMeta.columnIndex].fcp == "" || item[tableMeta.columnIndex].fcp == "0.0" ? 0 : item[tableMeta.columnIndex].fcp) : Number(item[tableMeta.columnIndex].fcp.value == "" || item[tableMeta.columnIndex].fcp.value == "0.0" ? 0 : item[tableMeta.columnIndex].fcp.value)
:
item[tableMeta.columnIndex].tbf.value == undefined ? Number(item[tableMeta.columnIndex].tbf == "" || item[tableMeta.columnIndex].tbf == "0.0" ? 0 : item[tableMeta.columnIndex].tbf) : Number(item[tableMeta.columnIndex].tbf.value == "" || item[tableMeta.columnIndex].tbf.value == "0.0" ? 0 : item[tableMeta.columnIndex].tbf.value)
)
)
}
})
if (type == 1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = total
} else if (type == 2) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = total
}
return total
}
const columns = [{
name: "",
options: {
......@@ -955,8 +1287,8 @@ export default class TaxPlanningOLPA extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{tableMeta.rowData[24] ?
tableMeta.rowData[24].length > 0 ?
{tableMeta.rowData[30] ?
tableMeta.rowData[30].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
......@@ -1133,6 +1465,7 @@ export default class TaxPlanningOLPA extends Component {
placeholder=""
disabled={true}
// value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleParent(tableMeta, 3)).toFixed(1)}
/>
</span>
:
......@@ -2540,7 +2873,7 @@ export default class TaxPlanningOLPA extends Component {
name: `${this.props.periode} Trial Balance (Fiscal)`,
options: {
customHeadRender: (columnMeta) => (
<div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 200, borderRight: "1px solid rgb(255, 255, 255)" }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */}
......@@ -2774,7 +3107,7 @@ export default class TaxPlanningOLPA extends Component {
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
......@@ -2890,7 +3223,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
......
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