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