Commit 906ac13d authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

formula olpa tp

See merge request !1407
parents cfc5dff3 8d6852a5
......@@ -206,8 +206,8 @@ export default class TaxPlanningOLPA extends Component {
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: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbc).toFixed(1) : 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.november.tbc, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.fcp).toFixed(1) : 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.november.fcp, formula: item.tax_planning.november_formula } : item.tax_planning.november.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbf).toFixed(1) : 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.november.tbf, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbf },
{ tbc: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbc).toFixed(1) : 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.december.tbc, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.fcp).toFixed(1) : 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.december.fcp, formula: item.tax_planning.december_formula } : item.tax_planning.december.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbf).toFixed(1) : 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.december.tbf, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbf },
item.tax_planning.total_current_year,
0,
0,
......@@ -247,8 +247,8 @@ export default class TaxPlanningOLPA extends Component {
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: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbc).toFixed(1) : 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.november.tbc, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.fcp).toFixed(1) : 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.november.fcp, formula: item.tax_planning.november_formula } : item.tax_planning.november.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.november.tbf).toFixed(1) : 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.november.tbf, formula: item.tax_planning.november_formula } : item.tax_planning.november.tbf },
{ tbc: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbc).toFixed(1) : 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.december.tbc, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbc, fcp: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.fcp).toFixed(1) : 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.december.fcp, formula: item.tax_planning.december_formula } : item.tax_planning.december.fcp, tbf: this.props.status === 'CLOSED' ? Number(item.tax_planning.december.tbf).toFixed(1) : 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.december.tbf, formula: item.tax_planning.december_formula } : item.tax_planning.december.tbf },
item.tax_planning.total_current_year,
0,
0,
......@@ -504,7 +504,7 @@ export default class TaxPlanningOLPA extends Component {
checkUpload() {
api.create().checkUploadOLPA(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true })
......@@ -870,11 +870,11 @@ export default class TaxPlanningOLPA extends Component {
let dataFormula = []
let id = 0
let double = false
const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
// console.log(xntd)
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) => {
......@@ -882,20 +882,24 @@ export default class TaxPlanningOLPA extends Component {
let re = /^[a-zA-Z0-9_]+$/;
let asd = ''
if (item !== "") {
// console.log(item)
// console.log(items)
// 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))
}
// console.log(baru)
}
})
// console.log(baru);
// if (forecast !== undefined) {
// console.log(splitFormula)
// }
if (tableMeta.rowData[8] == "Under payment /(Over Payment ) Income Tax Art. 29" || forecast !== undefined) {
// form.replace("(", "")
// form.replace(")", "")
let opgab = []
baru.map((item, index) => {
if (item.length > 1 && (item.includes("+") || item.includes("-") || item.includes("*") || item.includes("/"))) {
......@@ -915,14 +919,17 @@ export default class TaxPlanningOLPA extends Component {
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') {
// console.log(dataTable2)
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
if (indexID !== -1) {
// console.log(splitform)
let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// console.log(data)
// if(value == null){
// console.log(tableMeta);
// }
let valuezz = data.value == undefined ? data : data.value
anjay.push(valuezz == "" ? 0 : valuezz)
}
......@@ -944,17 +951,19 @@ export default class TaxPlanningOLPA extends Component {
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 {
// console.log(value);
// if(value == null){
// console.log(tableMeta);
// }
let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.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)
......@@ -962,7 +971,7 @@ export default class TaxPlanningOLPA extends Component {
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 : dex == 3 ? dataTable2[indexID][tableMeta.columnIndex].tbf : dataTable2[indexID][tableMeta.columnIndex]
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)
}
......@@ -1076,12 +1085,25 @@ export default class TaxPlanningOLPA extends Component {
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
}
} else if (dex == 3) {
if (tableMeta.rowData[8] == "Corporate Income Tax") {
if (total < 0) {
total = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
}
} 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)
}
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(total).toFixed(1)
}
}
return Number(total).toFixed(1)
......@@ -1110,6 +1132,7 @@ export default class TaxPlanningOLPA extends Component {
}
}
}
const handleTotal = (tableMeta, dex) => {
// console.log(tableMeta)
let total = 0
......@@ -1971,6 +1994,24 @@ export default class TaxPlanningOLPA extends Component {
null
:
this.state.get_for == 'view'?
tableMeta.rowData[1] === 5 || tableMeta.rowData[1] === 6 || tableMeta.rowData[1] === 7 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbc}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbc.value).toFixed(2) : Number(value.tbc.value).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -2090,6 +2131,24 @@ export default class TaxPlanningOLPA extends Component {
null
:
this.state.get_for == 'view'?
tableMeta.rowData[2] === 5 || tableMeta.rowData[2] === 6 || tableMeta.rowData[2] === 7 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.fcp}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp.value).toFixed(2) : Number(value.fcp.value).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -2207,6 +2266,24 @@ export default class TaxPlanningOLPA extends Component {
null
:
this.state.get_for == 'view'?
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbf}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf.value).toFixed(2) : Number(value.tbf.value).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -2358,6 +2435,24 @@ export default class TaxPlanningOLPA extends Component {
null
:
this.state.get_for == 'view'?
tableMeta.rowData[1] === 5 || tableMeta.rowData[1] === 6 || tableMeta.rowData[1] === 7 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbc}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbc.value).toFixed(2) : Number(value.tbc.value).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -2477,6 +2572,24 @@ export default class TaxPlanningOLPA extends Component {
null
:
this.state.get_for == 'view'?
tableMeta.rowData[2] === 5 || tableMeta.rowData[2] === 6 || tableMeta.rowData[2] === 7 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.fcp}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp.value).toFixed(2) : Number(value.fcp.value).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -2594,6 +2707,24 @@ export default class TaxPlanningOLPA extends Component {
null
:
this.state.get_for == 'view'?
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbf}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf.value).toFixed(2) : Number(value.tbf.value).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......
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