Commit ee35d2a5 authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

formula tp mr

See merge request !745
parents 16378b9f 33d1a35f
...@@ -113,7 +113,7 @@ export default class TaxPlanningMR extends Component { ...@@ -113,7 +113,7 @@ export default class TaxPlanningMR extends Component {
} }
api.create().getHierarkiMontlyReportTP(payload).then(response => { api.create().getHierarkiMontlyReportTP(payload).then(response => {
console.log(response); console.log(response);
console.log(payload); // console.log(payload);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -138,6 +138,7 @@ export default class TaxPlanningMR extends Component { ...@@ -138,6 +138,7 @@ export default class TaxPlanningMR extends Component {
}, },
item.tax_planning.trial_balance_fiscal_actual === null ? "0.0" : item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual, item.tax_planning.trial_balance_fiscal_actual === null ? "0.0" : item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual,
item.tax_planning.trial_balance_fiscal_mb === null ? "0.0" : item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb, item.tax_planning.trial_balance_fiscal_mb === null ? "0.0" : item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb,
item.tax_planning.actual_formula,
item.order, item.order,
{ tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf }, { tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf },
{ tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf }, { tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf },
...@@ -169,6 +170,7 @@ export default class TaxPlanningMR extends Component { ...@@ -169,6 +170,7 @@ export default class TaxPlanningMR extends Component {
}, },
item.tax_planning.trial_balance_fiscal_actual === null ? "0.0" : item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual, item.tax_planning.trial_balance_fiscal_actual === null ? "0.0" : item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual,
item.tax_planning.trial_balance_fiscal_mb === null ? "0.0" : item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb, item.tax_planning.trial_balance_fiscal_mb === null ? "0.0" : item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb,
item.tax_planning.actual_formula,
item.order, item.order,
{ tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf }, { tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf },
{ tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf }, { tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf },
...@@ -195,7 +197,7 @@ export default class TaxPlanningMR extends Component { ...@@ -195,7 +197,7 @@ export default class TaxPlanningMR extends Component {
} else { } else {
this.setState({ dataTable, loading: false, editable: true }) this.setState({ dataTable, loading: false, editable: true })
} }
console.log(this.state.dataTable) // console.log(this.state.dataTable)
}) })
} }
...@@ -241,7 +243,7 @@ export default class TaxPlanningMR extends Component { ...@@ -241,7 +243,7 @@ export default class TaxPlanningMR extends Component {
} }
api.create('UPLOAD').createMonthlyReportTP(payload).then(response => { api.create('UPLOAD').createMonthlyReportTP(payload).then(response => {
console.log(payload); // console.log(payload);
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -307,7 +309,7 @@ export default class TaxPlanningMR extends Component { ...@@ -307,7 +309,7 @@ export default class TaxPlanningMR extends Component {
checkUpload() { checkUpload() {
api.create().checkUploadMonthlyReportTP(this.state.payload).then(response => { api.create().checkUploadMonthlyReportTP(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload) // console.log(this.state.payload)
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -343,7 +345,7 @@ export default class TaxPlanningMR extends Component { ...@@ -343,7 +345,7 @@ export default class TaxPlanningMR extends Component {
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true }) this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
} }
}) })
console.log(this.state.dataTable); // console.log(this.state.dataTable);
}) })
} }
} }
...@@ -373,8 +375,8 @@ export default class TaxPlanningMR extends Component { ...@@ -373,8 +375,8 @@ export default class TaxPlanningMR extends Component {
} }
// console.log(data); // console.log(data);
api.create('UPLOAD').uploadMonthlyReportTP(body).then(response => { api.create('UPLOAD').uploadMonthlyReportTP(body).then(response => {
console.log(body); // console.log(body);
console.log(JSON.stringify(body)); // console.log(JSON.stringify(body));
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -521,7 +523,7 @@ export default class TaxPlanningMR extends Component { ...@@ -521,7 +523,7 @@ export default class TaxPlanningMR extends Component {
if (String(item).includes('#')) { if (String(item).includes('#')) {
let splitform = String(item).split('#') let splitform = String(item).split('#')
if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') { if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') {
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0]) let indexID = dataTable2.findIndex((val) => val[13] == splitform[0])
if (indexID !== -1) { if (indexID !== -1) {
let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
let valuezz = data.value == undefined ? data : data.value let valuezz = data.value == undefined ? data : data.value
...@@ -546,19 +548,19 @@ export default class TaxPlanningMR extends Component { ...@@ -546,19 +548,19 @@ export default class TaxPlanningMR extends Component {
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} }
} else { } else {
let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf let data = tableMeta.rowData[12]
// console.log(data); // console.log(data);
let indexID = data.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode)) let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = data.formula[indexID].value let valuezz = data[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} }
} }
} }
} else { } else {
let indexID = dataTable2.findIndex((val) => val[24] == item) let indexID = dataTable2.findIndex((val) => val[13] == item)
if (indexID !== -1) { if (indexID !== -1) {
if (dataTable2[indexID][24] == tableMeta.rowData[24]) { if (dataTable2[indexID][13] == tableMeta.rowData[13]) {
anjay.push(0) anjay.push(0)
} else { } else {
// console.log(dataTable2[indexID][tableMeta.columnIndex]); // console.log(dataTable2[indexID][tableMeta.columnIndex]);
...@@ -927,7 +929,7 @@ export default class TaxPlanningMR extends Component { ...@@ -927,7 +929,7 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value.tbc).toFixed(1)} value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
/> />
} }
/> />
...@@ -979,7 +981,7 @@ export default class TaxPlanningMR extends Component { ...@@ -979,7 +981,7 @@ export default class TaxPlanningMR extends Component {
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.fcp} value={value.tbc}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -987,7 +989,7 @@ export default class TaxPlanningMR extends Component { ...@@ -987,7 +989,7 @@ export default class TaxPlanningMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value.fcp).toFixed(1)} value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
/> />
} }
/> />
...@@ -1035,15 +1037,32 @@ export default class TaxPlanningMR extends Component { ...@@ -1035,15 +1037,32 @@ 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 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbc}
control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ 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" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleTotal(tableMeta, 6)).toFixed(1)} value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
}
/> />
</div>
: :
tableMeta.rowData[3] === 7 ? null tableMeta.rowData[3] === 7 ? null
// (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, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
......
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