Commit ec7b4016 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'rifka' into 'master'

Rifka

See merge request !361
parents b8358a3b f18f6018
......@@ -46,8 +46,7 @@ export default class TaxPlanning extends Component {
disabledSave: true,
editable: false,
buttonError: false,
judulColumn: null,
reportName: ''
judulColumn: null
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -148,7 +147,7 @@ export default class TaxPlanning extends Component {
}
}
})
this.setState({ dataTable, loading: false, buttonError: true, reportName: res[0].report_name })
this.setState({ dataTable, loading: false, buttonError: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true })
}
......@@ -295,7 +294,6 @@ export default class TaxPlanning extends Component {
if (i.length > 0) {
payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
// item_report_name: this.state.reportName,
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
january: {
tbc: i[2] === undefined ? "" : String(i[2]).trim(),
......@@ -403,21 +401,63 @@ export default class TaxPlanning extends Component {
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level,
item.item_report,
{tbc : item.january.tbc, fcp: item.january.fcp, tbf: item.january.tbf},
{tbc : item.february.tbc, fcp: item.february.fcp, tbf: item.february.tbf},
{tbc : item.march.tbc, fcp: item.march.fcp, tbf: item.march.tbf},
{tbc : item.april.tbc, fcp: item.april.fcp, tbf: item.april.tbf},
{tbc : item.may.tbc, fcp: item.may.fcp, tbf: item.may.tbf},
{tbc : item.june.tbc, fcp: item.june.fcp, tbf: item.june.tbf},
{tbc : item.july.tbc, fcp: item.july.fcp, tbf: item.july.tbf},
{tbc : item.august.tbc, fcp: item.august.fcp, tbf: item.august.tbf},
{tbc : item.september.tbc, fcp: item.september.fcp, tbf: item.september.tbf},
{tbc : item.october.tbc, fcp: item.october.fcp, tbf: item.october.tbf},
{tbc : item.november.tbc, fcp: item.november.fcp, tbf: item.november.tbf},
{tbc : item.december.tbc, fcp: item.december.fcp, tbf: item.december.tbf},
{tbc : Number(item.type_report_id.tbc) === 3 && item.january.tbc === "" ? "0" : item.january.tbc ,
fcp: Number(item.type_report_id.fcp) === 3 && item.january.fcp === "" ? "0" : item.january.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.january.tbf === "" ? "0" : item.january.tbf
},
{ tbc : Number(item.type_report_id.tbc) === 3 && item.february.tbc === "" ? "0" : item.february.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.january.fcp === "" ? "0" : item.january.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.february.tbf === "" ? "0" : item.february.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.march.tbc === "" ? "0" : item.march.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.march.fcp === "" ? "0" : item.march.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.march.tbf === "" ? "0" : item.march.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.april.tbc === "" ? "0" : item.april.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.april.fcp === "" ? "0" : item.april.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.april.tbf === "" ? "0" : item.april.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.may.tbc === "" ? "0" : item.may.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.may.fcp === "" ? "0" : item.may.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.may.tbf === "" ? "0" : item.may.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.june.tbc === "" ? "0" : item.june.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.june.fcp === "" ? "0" : item.june.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.june.tbf === "" ? "0" : item.june.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.july.tbc === "" ? "0" : item.july.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.july.fcp === "" ? "0" : item.july.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.july.tbf === "" ? "0" : item.july.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.august.tbc === "" ? "0" : item.august.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.august.fcp === "" ? "0" : item.august.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.august.tbf === "" ? "0" : item.august.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.september.tbc === "" ? "0" : item.september.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.september.fcp === "" ? "0" : item.september.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.september.tbf === "" ? "0" : item.september.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.october.tbc === "" ? "0" : item.october.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.october.fcp === "" ? "0" : item.october.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.october.tbf === "" ? "0" : item.october.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.november.tbc === "" ? "0" : item.november.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.november.fcp === "" ? "0" : item.november.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.november.tbf === "" ? "0" : item.november.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.december.tbc === "" ? "0" : item.december.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.december.fcp === "" ? "0" : item.december.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.december.tbf === "" ? "0" : item.december.tbf
},
item.total_current_year,
{tbc : item.total_next_year.tbc, fcp: item.total_next_year.fcp, tbf: item.total_next_year.tbf},
{tbc : item.total_more_year.tbc, fcp: item.total_more_year.fcp, tbf: item.total_more_year.tbf},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.total_next_year.tbc === "" ? "0" : item.total_next_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_next_year.fcp === "" ? "0" : item.total_next_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_next_year.tbf === "" ? "0" : item.total_next_year.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.total_more_year.tbc === "" ? "0" : item.total_more_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_more_year.fcp === "" ? "0" : item.total_more_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_more_year.tbf === "" ? "0" : item.total_more_year.tbf
},
item.error
]
})
......@@ -536,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}`
......@@ -584,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
......@@ -3941,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)}
/>
}
/>
......@@ -4706,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);
})
}}
......@@ -4771,7 +4919,7 @@ export default class TaxPlanning extends Component {
<button
className="button"
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
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