Commit 5ef1d138 authored by rifkaki's avatar rifkaki

tp ceklis

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