Commit 21144e70 authored by faisalhamdi's avatar faisalhamdi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into faisal

parents c87d4e0a 4dbd9fe1
...@@ -654,7 +654,6 @@ export default class BudgetTahunan extends Component { ...@@ -654,7 +654,6 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)} saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
getReport={this.getReport.bind(this)} getReport={this.getReport.bind(this)}
status={this.state.status}
/> />
)} )}
......
...@@ -553,7 +553,7 @@ export default class ProfitLoss extends Component { ...@@ -553,7 +553,7 @@ export default class ProfitLoss extends Component {
"formula": rilFormula "formula": rilFormula
} }
api.create().countingFormula(body).then(response => { api.create().countingFormula(body).then(response => {
console.log(response); // console.log(response);
}) })
} else { } else {
let body = { let body = {
...@@ -934,15 +934,15 @@ export default class ProfitLoss extends Component { ...@@ -934,15 +934,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1023,15 +1023,15 @@ export default class ProfitLoss extends Component { ...@@ -1023,15 +1023,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 3)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1112,15 +1112,15 @@ export default class ProfitLoss extends Component { ...@@ -1112,15 +1112,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 4)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1201,15 +1201,15 @@ export default class ProfitLoss extends Component { ...@@ -1201,15 +1201,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 5)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1290,15 +1290,15 @@ export default class ProfitLoss extends Component { ...@@ -1290,15 +1290,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 6)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1379,15 +1379,15 @@ export default class ProfitLoss extends Component { ...@@ -1379,15 +1379,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 7)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1468,15 +1468,15 @@ export default class ProfitLoss extends Component { ...@@ -1468,15 +1468,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 8)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1557,15 +1557,15 @@ export default class ProfitLoss extends Component { ...@@ -1557,15 +1557,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 9)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1646,15 +1646,15 @@ export default class ProfitLoss extends Component { ...@@ -1646,15 +1646,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 10)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1735,15 +1735,15 @@ export default class ProfitLoss extends Component { ...@@ -1735,15 +1735,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1824,15 +1824,15 @@ export default class ProfitLoss extends Component { ...@@ -1824,15 +1824,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1951,15 +1951,15 @@ export default class ProfitLoss extends Component { ...@@ -1951,15 +1951,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 13)).toFixed(1)}ue={handleFormula(value, tableMeta)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -2040,15 +2040,15 @@ export default class ProfitLoss extends Component { ...@@ -2040,15 +2040,15 @@ export default class ProfitLoss extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <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={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 14)).toFixed(1)}ue={handleFormula(value, tableMeta)}
// /> />
null // null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
......
...@@ -103,7 +103,7 @@ export default class TaxPlanning extends Component { ...@@ -103,7 +103,7 @@ export default class TaxPlanning extends Component {
item.type_report_tax.value_tbf.type_report_id, item.type_report_tax.value_tbf.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula, {tbc : item.formula_tax.value_tbc, fcp: item.formula_tax.value_fc, tbf: item.formula_tax.value_tbf },
item.level, item.level,
item.description, item.description,
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf}, {tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf},
...@@ -140,7 +140,7 @@ export default class TaxPlanning extends Component { ...@@ -140,7 +140,7 @@ export default class TaxPlanning extends Component {
item.type_report_tax.value_tbf.type_report_id, item.type_report_tax.value_tbf.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula, {tbc : item.formula_tax.value_tbc, fcp: item.formula_tax.value_fc, tbf: item.formula_tax.value_tbf },
item.level, item.level,
item.description, item.description,
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf}, {tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf},
...@@ -785,48 +785,106 @@ export default class TaxPlanning extends Component { ...@@ -785,48 +785,106 @@ export default class TaxPlanning extends Component {
return a return a
} }
const handleFormula = (data, tableMeta) => { const handleFormula = (data, tableMeta, month, rowColumn) => {
let arrayFormula = tableMeta.rowData[6].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let rilFormula = String(rowColumn == 0 ? tableMeta.rowData[6].tbc : tableMeta.rowData[6].tbf)
let arrayJumlah = [] if (rilFormula.includes('#')) {
arrayFormula.map((item, indexs) => { if (this.props.status === "not-yet") {
let index = dataTable2.findIndex((val) => val[4] == item) let splitOrder = String(rowColumn == 0 ? tableMeta.rowData[6].tbc : tableMeta.rowData[6].tbf).split('@')
if (index > 0) { for (let index = 0; index < splitOrder.length; index++) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex]) if (splitOrder[index] === "") {
} else {
if (splitOrder[index].includes('#')) {
} else {
let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let reg = /^\d+$/
splitOperator.map((item) => {
if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item)
if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
}
}
})
}
}
}
let body = {
"submission_id": null,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
console.log(response);
})
} else { } else {
arrayJumlah.push(item) let body = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
console.log(response)
console.log(tableMeta)
console.log(tableMeta.rowIndex)
console.log(rowColumn)
if (response.data) {
if (response.data.status === "success") {
return response.data.data.result
}
}
})
} }
// if (indexs % 2 !== 0) { } else {
// operator.push(item) let kondisi = rowColumn == 0 ? tableMeta.rowData[6].tbc : tableMeta.rowData[6].tbf
// } let arrayFormula = kondisi.match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
}) let arrayJumlah = []
let array = arrayJumlah arrayFormula.map((item, indexs) => {
let total = 0 let index = dataTable2.findIndex((val) => val[23] == item)
let opt = "" if (index > 0) {
array.map((item, index) => { arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item)
} else { } else {
total += item arrayJumlah.push(item)
} }
} // if (indexs % 2 !== 0) {
}) // operator.push(item)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) // }
return a })
let array = arrayJumlah
let total = 0
let opt = ""
array.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item)
} else {
total += item
}
}
})
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a
}
} }
const columns = [{ const columns = [{
...@@ -975,26 +1033,24 @@ export default class TaxPlanning extends Component { ...@@ -975,26 +1033,24 @@ export default class TaxPlanning extends Component {
null null
: :
tableMeta.rowData[1] === 6 ? tableMeta.rowData[1] === 6 ?
// <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(handleFormula(value, tableMeta)).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[1] === 5 ? tableMeta.rowData[1] === 5 ?
// <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={false}
// value={Number(handleFormula(value, tableMeta)).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 0)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[1] === 1 ? tableMeta.rowData[1] === 1 ?
// value[0] === "" ? // value[0] === "" ?
...@@ -1131,26 +1187,24 @@ export default class TaxPlanning extends Component { ...@@ -1131,26 +1187,24 @@ export default class TaxPlanning extends Component {
null null
: :
tableMeta.rowData[3] === 6 ? tableMeta.rowData[3] === 6 ?
// <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(handleFormula(value, tableMeta)).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 2)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[3] === 5 ? tableMeta.rowData[3] === 5 ?
// <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={false}
// value={Number(handleFormula(value, tableMeta)).toFixed(1)} value={Number(handleFormula(value, tableMeta, 1, 2)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[3] === 1 ? tableMeta.rowData[3] === 1 ?
// value[2] === "" ? // value[2] === "" ?
......
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