Commit 5ef1d138 authored by rifkaki's avatar rifkaki

tp ceklis

parent 902c91fd
......@@ -49,12 +49,12 @@ export default class TaxPlanningMR extends Component {
editable: false,
judulColumn: null,
updateBy: '-',
notesUpdate: '-',
notesUpdate: "",
buttonDraft: true,
handleTekTekTek: 0,
saveDraft: true,
buttonError: true,
get_for: 'view'
get_for: "view"
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -67,6 +67,7 @@ export default class TaxPlanningMR extends Component {
}
handleGetFor(type) {
console.log(type)
this.setState({get_for: type}, () => {
this.getSettingControl()
this.getLatestUpdate()
......@@ -81,13 +82,30 @@ export default class TaxPlanningMR extends Component {
}
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
console.log(body);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
this.getItemHierarki()
console.log("masuk ko")
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -106,7 +124,7 @@ export default class TaxPlanningMR extends Component {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notesUpdate: response.data.data.notes_update === null ? '-' : response.data.data.notes_update
notesUpdate: response.data.data.notes_update === null ? "" : response.data.data.notes_update
})
}
}
......@@ -114,6 +132,8 @@ export default class TaxPlanningMR extends Component {
}
getItemHierarki() {
console.log("masuk hierarki")
console.log(this.state.get_for)
this.setState({ loading: true, judulColumn: null })
let payload = {
"report_id": this.props.report_id,
......@@ -122,7 +142,7 @@ export default class TaxPlanningMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"get_for": "edit"
"get_for": this.state.get_for
}
api.create().getHierarkiMontlyReportTP(payload).then(response => {
console.log(response);
......@@ -443,7 +463,7 @@ export default class TaxPlanningMR extends Component {
}
}
})
this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
// this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
let i = this.state.dataTable
let payload = {
......@@ -455,29 +475,29 @@ export default class TaxPlanningMR extends Component {
"months": this.props.month.month_id,
"tax_planning": data
}
// api.create().validateSubmitReportMRTP(payload).then((response) => {
// console.log(response)
// if (response.data) {
// if (response.data.status === "success") {
// if (response.data.data.result) {
// 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")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// })
api.create().validateSubmitReportMRTP(payload).then((response) => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && 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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
downloadTemplate = async () => {
......@@ -521,7 +541,7 @@ export default class TaxPlanningMR extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleValueFormula = (value, tableMeta, dex, xntd, forecast, periode) => {
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : tableMeta.rowData[6].tbf
let form = dex === 1 ? tableMeta.rowData[6].tbc : dex === 2 ? tableMeta.rowData[6].fcp : dex === 3 ? tableMeta.rowData[6].tbf : tableMeta.rowData[6].tbf
let splitFormula = String(form).split('@')
let baru = []
let anjay = []
......@@ -602,7 +622,7 @@ export default class TaxPlanningMR extends Component {
if (dataTable2[indexID][13] == tableMeta.rowData[13]) {
anjay.push(0)
} else {
let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
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 valuezz = data.value == undefined ? data : data.value
anjay.push(valuezz == "" ? 0 : valuezz)
}
......@@ -704,7 +724,7 @@ export default class TaxPlanningMR extends Component {
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
}
} else {
} else if (dex == 3) {
if (tableMeta.rowData[8] == "Corporate Income Tax") {
if (total < 0) {
total = 0
......@@ -717,6 +737,12 @@ export default class TaxPlanningMR extends Component {
} 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)
......@@ -1106,15 +1132,6 @@ export default class TaxPlanningMR extends Component {
/>
</div>
:
// tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
// <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, 6)).toFixed(1)}
// />
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1230,8 +1247,8 @@ export default class TaxPlanningMR extends Component {
</span>
:
tableMeta.rowData[3] === 7 ?
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
(Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
(Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) <= Number(this.state.maxValue)) ?
// (Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1623,7 +1640,7 @@ export default class TaxPlanningMR extends Component {
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete', tipeAlert: 'warning' })
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
......@@ -1743,7 +1760,7 @@ export default class TaxPlanningMR extends Component {
outline: 'none',
}}
onClick={() => this.state.editable === true ?
null
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
......
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