Commit f855fbc7 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

frml

See merge request !494
parents 6719d428 71bccad3
......@@ -110,21 +110,18 @@ export default class TaxPlanning extends Component {
{ 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.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 },
{ tbc: item.tax_planning.may.tbc, fcp: item.tax_planning.may.fcp, tbf: item.tax_planning.may.tbf },
{ tbc: item.tax_planning.june.tbc, fcp: item.tax_planning.june.fcp, tbf: item.tax_planning.june.tbf },
{ tbc: item.tax_planning.july.tbc, fcp: item.tax_planning.july.fcp, tbf: item.tax_planning.july.tbf },
{
tbc: item.tax_planning.august.tbc === null ? "0" : item.tax_planning.august.tbc === "" ? "0" : item.tax_planning.august.tbc,
fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf
},
{ tbc: item.tax_planning.september.tbc, fcp: item.tax_planning.september.fcp, tbf: item.tax_planning.september.tbf },
{ tbc: item.tax_planning.october.tbc, fcp: item.tax_planning.october.fcp, tbf: item.tax_planning.october.tbf },
{ 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 },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.january.tbc, formula: item.tax_planning.january_formula } : item.tax_planning.january.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.january.fcp, formula: item.tax_planning.january_formula } : item.tax_planning.january.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.january.tbf, formula: item.tax_planning.january_formula } : item.tax_planning.january.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.february.tbc, formula: item.tax_planning.february_formula } : item.tax_planning.february.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.february.fcp, formula: item.tax_planning.february_formula } : item.tax_planning.february.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.february.tbf, formula: item.tax_planning.february_formula } : item.tax_planning.february.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.march.tbc, formula: item.tax_planning.march_formula } : item.tax_planning.march.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.march.fcp, formula: item.tax_planning.march_formula } : item.tax_planning.march.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.march.tbf, formula: item.tax_planning.march_formula } : item.tax_planning.march.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.april.tbc, formula: item.tax_planning.april_formula } : item.tax_planning.april.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.april.fcp, formula: item.tax_planning.april_formula } : item.tax_planning.april.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.april.tbf, formula: item.tax_planning.april_formula } : item.tax_planning.april.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.may.tbc, formula: item.tax_planning.may_formula } : item.tax_planning.may.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.may.fcp, formula: item.tax_planning.may_formula } : item.tax_planning.may.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.may.tbf, formula: item.tax_planning.may_formula } : item.tax_planning.may.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.june.tbc, formula: item.tax_planning.june_formula } : item.tax_planning.june.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.june.fcp, formula: item.tax_planning.june_formula } : item.tax_planning.june.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.june.tbf, formula: item.tax_planning.june_formula } : item.tax_planning.june.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.july.tbc, formula: item.tax_planning.july_formula } : item.tax_planning.july.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.july.fcp, formula: item.tax_planning.july_formula } : item.tax_planning.july.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.july.tbf, formula: item.tax_planning.july_formula } : item.tax_planning.july.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.august.tbc, formula: item.tax_planning.august_formula } : item.tax_planning.august.tbc === null ? "0" : item.tax_planning.august.tbc === "" ? "0" : item.tax_planning.august.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.august.fcp, formula: item.tax_planning.august_formula } : item.tax_planning.august.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.august.tbf, formula: item.tax_planning.august_formula } : item.tax_planning.august.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.september.tbc, formula: item.tax_planning.september_formula } : item.tax_planning.september.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.september.fcp, formula: item.tax_planning.september_formula } : item.tax_planning.september.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.september.tbf, formula: item.tax_planning.september_formula } : item.tax_planning.september.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.october.tbc, formula: item.tax_planning.october_formula } : item.tax_planning.october.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.october.fcp, formula: item.tax_planning.october_formula } : item.tax_planning.october.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.october.tbf, formula: item.tax_planning.october_formula } : item.tax_planning.october.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.november.tbc, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.november.fcp, formula: item.tax_planning.november_formula } : item.tax_planning.november.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.november.tbf, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbf },
{ tbc: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.december.tbc, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbc, fcp: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.december.fcp, formula: item.tax_planning.december_formula } : item.tax_planning.december.fcp, tbf: item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.tax_planning.december.tbf, formula: item.tax_planning.december_formula } : 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 },
......@@ -769,6 +766,123 @@ export default class TaxPlanning extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleValueFormula = (value, tableMeta, dex) => {
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf
console.log(form);
console.log(tableMeta.columnIndex, dex);
let splitFormula = String(form).split('@')
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 !== "") {
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))
}
}
})
// console.log(baru)
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*') {
anjay.push(item)
} else {
if (String(item).includes('#')) {
if (String(item).includes('TP1' || 'TP2' || 'TP3')) {
let splitform = String(item).split('#')
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
// let valu = dex === 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex === 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// console.log(index);
// console.log(indexID)
if (indexID !== -1) {
// console.log(dataTable2[indexID][tableMeta.columnIndex])
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
// console.log(valuezz);
anjay.push(valuezz)
}
// }
// if (String(item).includes('[M-1]')) {
// let tst = String(item).replace('[M-1]', '')
// let indexID = tableMeta.rowData[18].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == Number(this.props.periode)-1)
// // console.log(indexID)
// if (indexID !== -1) {
// let valuezz = tableMeta.rowData[18].formula[indexID].value
// // baru.push(valuezz)
// anjay.push(valuezz)
// // console.log(valuezz)
// }
} else {
// let splitform = String(item).split('#')
// let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
// // let valu = dex === 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex === 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// // console.log(index);
// // console.log(indexID)
// if (indexID !== -1) {
// // console.log(dataTable2[indexID][tableMeta.columnIndex])
// 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
// // console.log(valuezz);
// anjay.push(valuezz)
// }
}
} else {
// console.log(item)
// let indexID = dataTable2.findIndex((val) => val[22] == item)
// // console.log(dataTable2[indexID][tableMeta.columnIndex])
// if (indexID !== -1) {
// let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
// anjay.push(valuezz)
// }
}
}
})
let total = 0
let opt = ""
anjay.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
})
// console.log(tableMeta.rowData[5])
console.log(baru)
console.log(anjay)
console.log(total)
// console.log(splitFormula)
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
// }
// return total
}
const handleChange = (value, tableMeta, indexChilds) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
......@@ -1127,18 +1241,19 @@ export default class TaxPlanning extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
/>
:
tableMeta.rowData[1] === 5 ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
/>
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={false}
// value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
// />
null
:
tableMeta.rowData[1] === 1 ?
// value[0] === "" ?
......@@ -1392,7 +1507,7 @@ export default class TaxPlanning extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1, 2)).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
:
tableMeta.rowData[3] === 5 ?
......
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