Commit 2e25fc47 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

upload taxplan

parent 44860c47
......@@ -576,6 +576,104 @@ export default class TaxPlanning extends Component {
})
}
handleValidate() {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[4],
january: {
tbc: String(i[9].tbc),
fcp: String(i[9].fcp),
tbf: String(i[9].tbf)
},
february: {
tbc: String(i[10].tbc),
fcp: String(i[10].fcp),
tbf: String(i[10].tbf)
},
march: {
tbc: String(i[11].tbc),
fcp: String(i[11].fcp),
tbf: String(i[11].tbf)
},
april: {
tbc: String(i[12].tbc),
fcp: String(i[12].fcp),
tbf: String(i[12].tbf)
},
may: {
tbc: String(i[13].tbc),
fcp: String(i[13].fcp),
tbf: String(i[13].tbf)
},
june: {
tbc: String(i[14].tbc),
fcp: String(i[14].fcp),
tbf: String(i[14].tbf)
},
july: {
tbc: String(i[15].tbc),
fcp: String(i[15].fcp),
tbf: String(i[15].tbf)
},
august: {
tbc: String(i[16].tbc),
fcp: String(i[16].fcp),
tbf: String(i[16].tbf)
},
september: {
tbc: String(i[17].tbc),
fcp: String(i[17].fcp),
tbf: String(i[17].tbf)
},
october: {
tbc: String(i[18].tbc),
fcp: String(i[18].fcp),
tbf: String(i[18].tbf)
},
november: {
tbc: String(i[19].tbc),
fcp: String(i[19].fcp),
tbf: String(i[19].tbf)
},
december: {
tbc: String(i[20].tbc),
fcp: String(i[20].fcp),
tbf: String(i[20].tbf)
},
total_current_year: String(i[21]),
total_next_year: {
tbc: String(i[22].tbc),
fcp: String(i[22].fcp),
tbf: String(i[22].tbf)
},
total_more_year: {
tbc: String(i[23].tbc),
fcp: String(i[23].fcp),
tbf: String(i[23].tbf)
}
})
})
console.log(JSON.stringify(data))
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"balance_sheet": data,
"status": "submitted"
}
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true })
} else {
this.setState({ loading: false, buttonError: true, editable: true })
}
})
}
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
......@@ -624,16 +722,17 @@ export default class TaxPlanning extends Component {
}
}
const handleTotal = (tableMeta) => {
console.log(dataTable2[tableMeta.rowIndex]);
let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) {
let valItem = item == undefined || item == "" ? 0 : item
let valItem = item.fcp == undefined || item.fcp == "" ? 0 : item.fcp
total += Number(valItem)
console.log(item);
}
})
dataTable2[tableMeta.rowIndex][19] = total
dataTable2[tableMeta.rowIndex][21] = total
return total
// console.log(total);
}
const handleValue = (data) => {
let total = 0
......@@ -3981,19 +4080,27 @@ export default class TaxPlanning extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbc}
value={value}
control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// value={value.tbc}
// onBlur={(event) => {
// // updateValue(event.target.value)
// // handleChange(event.target.value, tableMeta)
// console.log(event.target.value)
// }}
// />
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value.tbc}
onBlur={(event) => {
// updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
console.log(event.target.value)
}}
disabled={true}
value={handleTotal(tableMeta)}
/>
}
/>
......@@ -4746,6 +4853,7 @@ export default class TaxPlanning extends Component {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
// this.handleValidate()
}, 100);
})
}}
......
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