Commit a3d4ffa9 authored by r.kurnia's avatar r.kurnia

AKHIRNYA tp olpa

parent 906ac13d
......@@ -370,14 +370,14 @@ export default class TaxPlanningOLPA extends Component {
tbf: String(Number(i[18].tbf).toFixed(1))
},
november: {
tbc: String(Number(i[19].tbc).toFixed(1)),
fcp: String(Number(i[19].fcp).toFixed(1)),
tbf: String(Number(i[19].tbf).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: 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[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[19].tbf) : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
},
december: {
tbc: String(Number(i[20].tbc).toFixed(1)),
fcp: String(Number(i[20].fcp).toFixed(1)),
tbf: String(Number(i[20].tbf).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: 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[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[20].tbf) : 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)),
})
......@@ -759,26 +759,26 @@ export default class TaxPlanningOLPA extends Component {
tbf: i[3] === 3 && i[18].tbf === "" ? "0" : String(i[18].tbf)
},
november: {
tbc: i[1] === 3 && i[19].tbc === "" ? "0" : String(i[19].tbc),
fcp: i[2] === 3 && i[19].fcp === "" ? "0" : String(i[19].fcp),
tbf: i[3] === 3 && i[19].tbf === "" ? "0" : String(i[19].tbf)
tbc: i[1] === 3 && i[19].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[19].tbc.value) : String(i[19].tbc),
fcp: i[2] === 3 && i[19].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[19].fcp.value) : String(i[19].fcp),
tbf: i[3] === 3 && i[19].tbf === "" ? "0" : String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[19].tbf) : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[19].tbf.value) : String(i[19].tbf)
},
december: {
tbc: i[1] === 3 && i[20].tbc === "" ? "0" : String(i[20].tbc),
fcp: i[2] === 3 && i[20].fcp === "" ? "0" : String(i[20].fcp),
tbf: i[3] === 3 && i[20].tbf === "" ? "0" : String(i[20].tbf)
tbc: i[1] === 3 && i[20].tbc === "" ? "0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(i[20].tbc.value) : String(i[20].tbc),
fcp: i[2] === 3 && i[20].fcp === "" ? "0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(i[20].fcp.value) : String(i[20].fcp),
tbf: i[3] === 3 && i[20].tbf === "" ? "0" : String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(i[20].tbf) : 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_next_year: {
tbc: i[1] === 3 && i[22].tbc === "" ? "0" : String(i[22].tbc),
fcp: i[2] === 3 && i[22].fcp === "" ? "0" : String(i[22].fcp),
tbf: i[3] === 3 && i[22].tbf === "" ? "0" : String(i[22].tbf)
},
total_more_year: {
tbc: i[1] === 3 && i[23].tbc === "" ? "0" : String(i[23].tbc),
fcp: i[2] === 3 && i[23].fcp === "" ? "0" : String(i[23].fcp),
tbf: i[3] === 3 && i[23].tbf === "" ? "0" : String(i[23].tbf)
}
// total_next_year: {
// tbc: i[1] === 3 && i[22].tbc === "" ? "0" : String(i[22].tbc),
// fcp: i[2] === 3 && i[22].fcp === "" ? "0" : String(i[22].fcp),
// tbf: i[3] === 3 && i[22].tbf === "" ? "0" : String(i[22].tbf)
// },
// total_more_year: {
// tbc: i[1] === 3 && i[23].tbc === "" ? "0" : String(i[23].tbc),
// fcp: i[2] === 3 && i[23].fcp === "" ? "0" : String(i[23].fcp),
// tbf: i[3] === 3 && i[23].tbf === "" ? "0" : String(i[23].tbf)
// }
})
......@@ -795,37 +795,39 @@ export default class TaxPlanningOLPA extends Component {
}
})
// console.log(JSON.stringify(data))
let payload = {
"outlook_pa_id": this.props.outlook_pa_id,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"tax_planning": data,
"status": "submitted"
}
api.create().validateSubmitReportOLPA(payload).then((response) => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && errorContrl === false && editAble === false ) {
// let payload = {
// "outlook_pa_id": this.props.outlook_pa_id,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "tax_planning": data,
// "status": "submitted"
// }
// api.create().validateSubmitReportOLPA(payload).then((response) => {
// console.log(payload)
// console.log(response)
// if (response.data) {
// if (response.data.status === "success") {
// if (response.data.data.result && errorContrl === false && editAble === false ) {
if (errorContrl === false && editAble === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// })
}
downloadTemplate = async () => {
......@@ -1106,7 +1108,7 @@ export default class TaxPlanningOLPA extends Component {
}
}
return Number(total).toFixed(1)
return tableMeta.rowData[8] == "Corporate Income Tax" ? Number(total).toFixed(2) : Number(total).toFixed(1)
}
const handleChange = (value, tableMeta, indexChilds) => {
......@@ -1133,8 +1135,7 @@ export default class TaxPlanningOLPA extends Component {
}
}
const handleTotal = (tableMeta, dex) => {
// console.log(tableMeta)
const handleTotal = (tableMeta, dex, periode) => {
let total = 0
let totalfcp = 0
if (String(tableMeta.rowData[8]).toLowerCase() === "fiscal correction positive / (negative) year to date") {
......@@ -1152,17 +1153,21 @@ export default class TaxPlanningOLPA extends Component {
} else {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) {
// if (tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7) {
// let valItem = item.tbf.value == undefined || item.tbf.value == "" || item.tbf.value == "undefined" ? 0.0 : item.tbf.value
// total += Number(valItem)
// } else {
if (String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX") {
let valItem = item.tbf == undefined || item.tbf == "" || item.tbf == "undefined" ? 0.0 : item.tbf
total += Number(valItem)
}
else 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] = Number(total)
dataTable2[tableMeta.rowIndex][21] = String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(total).toFixed(2) : Number(total).toFixed(1)
return total
}
......@@ -2178,7 +2183,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder="input"
// disabled={this.props.isApprover == true ? true : false}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(1) : Number(value.fcp).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 1)
// console.log(dataTable2)
......@@ -2342,7 +2347,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
:
tableMeta.rowData[3] === 5 ?
......@@ -2352,7 +2357,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={false}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
:
tableMeta.rowData[3] === 7 ?
......@@ -2619,7 +2624,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder="input"
// disabled={this.props.isApprover == true ? true : false}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(1) : Number(value.fcp).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 1)
// console.log(dataTable2)
......@@ -2783,7 +2788,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
:
tableMeta.rowData[3] === 5 ?
......@@ -2793,7 +2798,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={false}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleValueFormula(value, tableMeta, 3)).toFixed(2) : Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
:
tableMeta.rowData[3] === 7 ?
......@@ -2867,7 +2872,7 @@ export default class TaxPlanningOLPA extends Component {
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null
:
this.state.get_for == 'view'?
this.state.get_for == 'view' ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -2921,7 +2926,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleTotal(tableMeta, 6)).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleTotal(tableMeta, 6)).toFixed(2) : Number(handleTotal(tableMeta, 6)).toFixed(1)}
/>
:
tableMeta.rowData[3] === 5 ?
......@@ -2931,79 +2936,69 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleTotal(tableMeta, 5)).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(handleTotal(tableMeta, 5)).toFixed(2) : Number(handleTotal(tableMeta, 5)).toFixed(1)}
/>
:
// tableMeta.rowData[3] === 1 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleTotal(tableMeta, 1)).toFixed(1)}
// />
// :
tableMeta.rowData[3] === 7 ?
(Number(handleTotal(tableMeta, 1)) >= Number(this.state.minValue) && Number(handleTotal(tableMeta, 1)) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be 0` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', color: 'red' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
/>
</LightTooltip>
:
null
// tableMeta.rowData[3] === 7 ?
// (Number(handleValueFormula(value, tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
tableMeta.rowData[3] === 7 ? null
// (Number(handleTotal(tableMeta, 1)) >= Number(this.state.minValue) && Number(handleTotal(tableMeta, 1)) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be 0` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', color: 'red' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
// />
// </LightTooltip>
// :
// null
// value={Number(handleTotal(tableMeta, 7)).toFixed(1)}
// />
// </LightTooltip>
:
null
// tableMeta.rowData[3] === 7 ?
// (Number(handleValueFormula(value, tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
// />
// </LightTooltip>
// :
// null
}
</div>
</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