Commit 735f1791 authored by r.kurnia's avatar r.kurnia

formula tp mr

parent 58116afd
...@@ -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,54 +1037,71 @@ export default class TaxPlanningMR extends Component { ...@@ -1035,54 +1037,71 @@ 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 ?
<NumberFormat <div style={{ flex: 1 }}>
thousandSeparator={true} <FormControlLabel
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ margin: 0 }}
type="text" value={value.tbc}
placeholder="" control={
disabled={true} <NumberFormat
value={Number(handleTotal(tableMeta, 6)).toFixed(1)} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
}
/> />
: </div>
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)) ? tableMeta.rowData[3] === 7 ? null
// <NumberFormat // (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// thousandSeparator={true} // <NumberFormat
// style={{ // thousandSeparator={true}
// fontSize: 12, // style={{
// textAlign: 'right', // fontSize: 12,
// borderColor: 'transparent', // textAlign: 'right',
// margin: 0, // borderColor: 'transparent',
// width: 96, // margin: 0,
// backgroundColor: 'transparent', // width: 96,
// color: 'black' // backgroundColor: 'transparent',
// }} // color: 'black'
// type="text" // }}
// placeholder="" // type="text"
// disabled={true} // placeholder=""
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // disabled={true}
// /> : // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow> // /> :
// <NumberFormat // <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// thousandSeparator={true} // <NumberFormat
// style={{ // thousandSeparator={true}
// fontSize: 12, // style={{
// textAlign: 'right', // fontSize: 12,
// borderColor: 'transparent', // textAlign: 'right',
// margin: 0, // borderColor: 'transparent',
// width: 96, // margin: 0,
// backgroundColor: 'transparent', // width: 96,
// color: 'red' // backgroundColor: 'transparent',
// }} // color: 'red'
// type="text" // }}
// placeholder="" // type="text"
// disabled={true} // placeholder=""
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // disabled={true}
// /> // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// </LightTooltip> // />
: // </LightTooltip>
null :
null
} }
</div> </div>
</div> </div>
......
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