Commit b0d765e0 authored by d.arizona's avatar d.arizona

update

parent 49159fba
......@@ -87,7 +87,7 @@ export default class FixedAssetsMovement extends Component {
"submission_id": this.props.submissionID
}
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
// // console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -180,7 +180,7 @@ export default class FixedAssetsMovement extends Component {
})
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
// // console.log(indexParent);
return a
}
......@@ -189,7 +189,7 @@ export default class FixedAssetsMovement extends Component {
let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
// // console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
......@@ -229,7 +229,7 @@ export default class FixedAssetsMovement extends Component {
"status": type,
"fixed_asset_movement": data
}
// console.log(data);
// // console.log(data);
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
......@@ -239,7 +239,7 @@ export default class FixedAssetsMovement extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
// // console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -252,13 +252,13 @@ export default class FixedAssetsMovement extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
// // console.log(resp)
if (err) {
console.log(err);
// console.log(err);
}
else {
let isi = resp.rows.slice(3)
// console.log(resp.rows[2]);
// // console.log(resp.rows[2]);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -291,7 +291,7 @@ export default class FixedAssetsMovement extends Component {
report_id: this.props.report_id,
fixed_asset_movement: payload
}
// console.log(body)
// // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
}
});
......@@ -299,8 +299,8 @@ export default class FixedAssetsMovement extends Component {
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleFixedAssetsMovement: false, loading: true })
......@@ -336,11 +336,11 @@ export default class FixedAssetsMovement extends Component {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[24].length > 0) {
// console.log('masuk')
// // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.dataTable);
// // console.log(this.state.dataTable);
})
}
}
......@@ -378,9 +378,9 @@ export default class FixedAssetsMovement extends Component {
fixed_asset_movement: data,
status: type
}
// console.log(JSON.stringify(body));
// // console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response);
// // console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
......@@ -397,7 +397,7 @@ export default class FixedAssetsMovement extends Component {
async downloadAllData() {
// let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
// console.log(url);
// // console.log(url);
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let res = await fetch(
......@@ -416,7 +416,7 @@ export default class FixedAssetsMovement extends Component {
handleValidate() {
let data = []
// console.log(this.state.dataTable)
// // console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -438,7 +438,7 @@ export default class FixedAssetsMovement extends Component {
total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21])
})
})
// console.log(JSON.stringify(data))
// // console.log(JSON.stringify(data))
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
......@@ -448,7 +448,7 @@ export default class FixedAssetsMovement extends Component {
"status": "submitted"
}
api.create().validateSubmitReport(payload).then((response) => {
// console.log(response)
// // console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false })
} else {
......@@ -482,12 +482,16 @@ export default class FixedAssetsMovement extends Component {
})
// if (tableMeta.columnIndex == 18) {
// console.log(splitFormula)
// console.log(baru)
// // console.log(splitFormula)
// // console.log(baru)
// }
// console.log(baru)
// // console.log(baru)
let tambahan = false
let opet = ""
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*') {
if (item == 'X') {
tambahan = true
} else if (item == '-' || item == '+' || item == '/' || item == '*') {
anjay.push(item)
} else {
if (String(item).includes('#')) {
......@@ -495,28 +499,34 @@ export default class FixedAssetsMovement extends Component {
let tst = String(item).replace('[M-1]', '')
let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
// console.log(tableMeta.columnIndex)
let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// console.log(indexID)
if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value
// baru.push(valuezz)
anjay.push(valuezz == "" ? 0 : valuezz)
// console.log(valuezz)
}
} else {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
// console.log(indexID)
// // console.log(indexID)
if (indexID !== -1) {
// console.log(value.formula[indexID].value)
// // console.log(value.formula[indexID].value)
let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
} else {
// console.log(item)
// // console.log(item)
let indexID = dataTable2.findIndex((val) => val[22] == item)
// console.log(dataTable2[indexID])
if (item == 'X-1') {
anjay.push(-1)
} else if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
anjay.push(opet == ''? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
} else {
if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz == "" ? 0 : valuezz)
......@@ -524,13 +534,14 @@ export default class FixedAssetsMovement extends Component {
if (item === '(-1)') {
anjay.push(-1)
}
// console.log(item);
// // console.log(item);
}
}
}
}
})
// console.log(baru)
// console.log(anjay)
// // console.log(baru)
// // console.log(anjay)
let total = 0
let opt = ""
......@@ -559,8 +570,8 @@ export default class FixedAssetsMovement extends Component {
}
})
total = R.equals(total, NaN) ? "0.0" : total
// console.log(dataTable2[tableMeta.rowIndex][22])
// console.log(tableMeta.rowData[5])
// // console.log(dataTable2[tableMeta.rowIndex][22])
// // console.log(tableMeta.rowData[5])
// if (tableMeta.rowData[5] == 'Beginning Balance') {
// console.log(baru)
// console.log(anjay)
......@@ -568,7 +579,7 @@ export default class FixedAssetsMovement extends Component {
// }
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// console.log([tableMeta.rowIndex][tableMeta.columnIndex])
// // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
......@@ -584,7 +595,7 @@ export default class FixedAssetsMovement extends Component {
} else {
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
// // console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = dataTable2[indexParent][tableMeta.columnIndex]
a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
......@@ -596,15 +607,15 @@ export default class FixedAssetsMovement extends Component {
const handleForecast = (tableMeta, periode) => {
let total = 0
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
// console.log(dataTable2[tableMeta.rowIndex][23])
// console.log()
// // console.log(dataTable2[tableMeta.rowIndex][23])
// // console.log()
let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
if (indexID !== -1) {
total = dataTable2[tableMeta.rowIndex][23][indexID].value
}
} else {
total = handleValueFormula(tableMeta.columnIndex, tableMeta)
// console.log(dataTable2[tableMeta.rowIndex])
// // console.log(dataTable2[tableMeta.rowIndex])
}
// if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
// total = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex - 1]
......@@ -616,7 +627,7 @@ export default class FixedAssetsMovement extends Component {
const handleTotal = (tableMeta) => {
let total = 0
// if (tableMeta.rowData[5] == 'Beginning balance') {
// console.log(tableMeta.rowData)
// // console.log(tableMeta.rowData)
// }
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance') {
total = dataTable2[tableMeta.rowIndex][18].value
......@@ -634,7 +645,7 @@ export default class FixedAssetsMovement extends Component {
dataTable2[tableMeta.rowIndex][19] = total
}
return total
// console.log(total);
// // console.log(total);
}
const handleValue = (data) => {
let total = 0
......@@ -645,7 +656,7 @@ export default class FixedAssetsMovement extends Component {
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent);
// // console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, month) => {
......@@ -681,7 +692,7 @@ export default class FixedAssetsMovement extends Component {
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response);
// // console.log(response);
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
......@@ -700,7 +711,7 @@ export default class FixedAssetsMovement extends Component {
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
// // console.log(response)
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
......@@ -880,7 +891,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -969,7 +980,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1058,7 +1069,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1147,7 +1158,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1236,7 +1247,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1325,7 +1336,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1414,7 +1425,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1503,7 +1514,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1592,7 +1603,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1681,7 +1692,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1770,7 +1781,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1859,7 +1870,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1986,7 +1997,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -2064,7 +2075,7 @@ export default class FixedAssetsMovement extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......
......@@ -57,7 +57,7 @@ export default class ProfitLoss extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
// console.log(this.props);
// // console.log(this.props);
}
getLatestUpdate() {
......@@ -89,7 +89,7 @@ export default class ProfitLoss extends Component {
"submission_id": this.props.submissionID
}
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
// // console.log(response);
let dataTable = []
this.setState({ visibleProfitLoss: true })
if (response.data) {
......@@ -167,8 +167,10 @@ export default class ProfitLoss extends Component {
}
}
})
// // console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => {
// console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
})
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
......@@ -185,7 +187,7 @@ export default class ProfitLoss extends Component {
})
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
// // console.log(indexParent);
return a
}
......@@ -194,7 +196,7 @@ export default class ProfitLoss extends Component {
let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
// // console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
......@@ -235,7 +237,7 @@ export default class ProfitLoss extends Component {
"status": type,
"profit_loss": data
}
// console.log(data);
// // console.log(data);
this.setState({ loading: false })
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
......@@ -246,7 +248,7 @@ export default class ProfitLoss extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
// // console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -259,13 +261,13 @@ export default class ProfitLoss extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
// // console.log(resp)
if (err) {
// console.log(err);
// // console.log(err);
}
else {
let isi = resp.rows.slice(3)
// console.log(resp.rows[2]);
// // console.log(resp.rows[2]);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -299,7 +301,7 @@ export default class ProfitLoss extends Component {
report_id: this.props.report_id,
profit_loss: payload
}
// console.log(body)
// // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
}
});
......@@ -307,8 +309,8 @@ export default class ProfitLoss extends Component {
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
......@@ -344,11 +346,11 @@ export default class ProfitLoss extends Component {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[24].length > 0) {
// console.log('masuk')
// // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.buttonError)
// // console.log(this.state.buttonError)
})
}
}
......@@ -387,9 +389,9 @@ export default class ProfitLoss extends Component {
profit_loss: data,
status: type
}
// console.log(data);
// // console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response);
// // console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
......@@ -409,7 +411,7 @@ export default class ProfitLoss extends Component {
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let sub_null = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
// console.log(url);
// // console.log(url);
let res = await fetch(
this.props.submissionID == null ? sub_null : url
)
......@@ -426,7 +428,7 @@ export default class ProfitLoss extends Component {
handleValidate() {
let data = []
// console.log(this.state.dataTable)
// // console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -457,9 +459,9 @@ export default class ProfitLoss extends Component {
"profit_loss": data,
"status": "submitted"
}
// console.log(payload)
// // console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
// console.log(response)
// // console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false })
} else {
......@@ -481,7 +483,7 @@ export default class ProfitLoss extends Component {
} else {
// let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
// if (indexParent > 0) {
// // // console.log(indexParent)
// // // // console.log(indexParent)
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// let jagain = dataTable2[indexParent][tableMeta.columnIndex]
// a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (Number(jagain) + Number(val))
......@@ -512,12 +514,12 @@ export default class ProfitLoss extends Component {
dataTable2[tableMeta.rowIndex][20] = total
return total
}
// console.log(total);
// // console.log(total);
}
const handleNotes = (value, tableMeta) => {
// console.log(value)
// // console.log(value)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// console.log(dataTable2[tableMeta.rowIndex]);
// // console.log(dataTable2[tableMeta.rowIndex]);
}
const handleValue = (data) => {
let total = 0
......@@ -528,23 +530,43 @@ export default class ProfitLoss extends Component {
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent);
// // console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, month) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let tambahan = false
let opet = ""
arrayFormula.map((item, indexs) => {
if (item == 'X') {
tambahan = true
} else if (item == '-' || item == '+' || item == '/' || item == '*') {
arrayJumlah.push(item)
} else {
let index = dataTable2.findIndex((val) => val[23] == item)
if (index > 0) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
arrayJumlah.push(item)
arrayJumlah.push(opet == ''? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
} else {
if (index != -1) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
}
}
}
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
})
// console.log(arrayFormula)
// console.log(arrayJumlah)
let array = arrayJumlah
let total = 0
let opt = ""
......@@ -667,7 +689,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleNotes(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -741,7 +763,7 @@ export default class ProfitLoss extends Component {
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -831,7 +853,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -921,7 +943,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1011,7 +1033,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1101,7 +1123,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1191,7 +1213,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1281,7 +1303,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1371,7 +1393,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1461,7 +1483,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1551,7 +1573,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1641,7 +1663,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1731,7 +1753,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1868,7 +1890,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1958,7 +1980,7 @@ export default class ProfitLoss extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......
......@@ -188,15 +188,15 @@ class HomePage extends Component {
["5", "PUNINAR INFINITE RAYA", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"],
]
const options = {
filter: false,
filter: true,
sort: false,
responsive: "scroll",
print: false,
download: false,
selectableRows: false,
viewColumns: false,
viewColumns: true,
rowsPerPage: 5,
search: false
search: true
}
const columnsMB = ["Company", "Master Budget & CAT", "Operating Indicator"]
......
......@@ -71,7 +71,7 @@ export default class BalanceSheet extends Component {
"periode": this.props.data.periode,
}
api.create().getLastestUpdateOI(payload).then(response => {
// console.log(response.data)
// // console.log(response.data)
if (response.data) {
if (response.data.status === "success") {
this.setState({
......@@ -86,7 +86,7 @@ export default class BalanceSheet extends Component {
// this.getItemHierarki()
this.getDataDetail()
this.getLatestUpdate()
// console.log(this.props);
// // console.log(this.props);
}
getDataDetail() {
......@@ -97,12 +97,12 @@ export default class BalanceSheet extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode
}
// console.log(payload)
// // console.log(payload)
api.create().getOperatingIndDetail(payload).then(response => {
console.log(response)
// console.log(response)
let dataTable = []
let res = response.data.data
// // console.log(res)
// // // console.log(res)
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
......@@ -210,8 +210,8 @@ export default class BalanceSheet extends Component {
"status": type,
"master_budget": payloadMB
}
// console.log('=========================')
// console.log(JSON.stringify(payload))
// // console.log('=========================')
// // console.log(JSON.stringify(payload))
this.props.saveOperatingInd(payload)
this.props.onClickClose()
}
......@@ -225,7 +225,7 @@ export default class BalanceSheet extends Component {
})
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// // console.log(indexParent);
// // // console.log(indexParent);
return a
}
......@@ -274,7 +274,7 @@ export default class BalanceSheet extends Component {
// "status": type,
// "balance_sheet": data
// }
// // // console.log(data);
// // // // console.log(data);
// this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
......@@ -284,7 +284,7 @@ export default class BalanceSheet extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
)
res = await res.blob()
// console.log(res)
// // console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -295,15 +295,15 @@ export default class BalanceSheet extends Component {
}
async downloadAllData() {
// // console.log('masuk')
// // // console.log('masuk')
let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode]
// console.log(bram)
// // console.log(bram)
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/export_operating_indicator?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
)
res = await res.blob()
// console.log(res)
// // console.log(res)
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
......@@ -317,13 +317,13 @@ export default class BalanceSheet extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// // console.log(resp)
// // // console.log(resp)
if (err) {
// console.log(err);
// // console.log(err);
}
else {
let isi = resp.rows.slice(3)
// console.log(isi);
// // console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -356,18 +356,18 @@ export default class BalanceSheet extends Component {
report_id: this.props.data.report_id,
master_budget: payload
}
// console.log(resp.rows[1][0])
// // console.log(resp.rows[1][0])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
}
});
}
checkUpload() {
// console.log(JSON.stringify(this.state.payload))
// // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadOperatingInd(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
// console.log('===============')
console.log(response)
// // // console.log(JSON.stringify(this.state.payload));
// // console.log('===============')
// console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleOI: false, loading: true })
......@@ -410,7 +410,7 @@ export default class BalanceSheet extends Component {
uploadOI(type) {
let data = []
// console.log(this.state.dataTable)
// // console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
......@@ -439,10 +439,10 @@ export default class BalanceSheet extends Component {
status: type,
master_budget: data
}
// console.log(data);
// console.log(JSON.stringify(body))
// // console.log(data);
// // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadOperatingInd(body).then(response => {
// console.log(response);
// // console.log(response);
this.setState({ loading: false })
if (response.data) {
if (response.data.status === "success") {
......@@ -474,7 +474,7 @@ export default class BalanceSheet extends Component {
// }
// })
// dataTable2[tableMeta.rowIndex][20] = total
// console.log(dataTable2[tableMeta.rowIndex])
// // console.log(dataTable2[tableMeta.rowIndex])
}
const handleValue = (value, tableMeta) => {
......@@ -492,13 +492,13 @@ export default class BalanceSheet extends Component {
}
const handleParent = (tableMeta) => {
// console.log(tableMeta)
// // console.log(tableMeta)
let total = 0
dataTable2.map((item, index) => {
if (item[2] == tableMeta.rowData[1]) {
// console.log(total)
// console.log(item[tableMeta.columnIndex])
// // console.log(total)
// // console.log(item[tableMeta.columnIndex])
total += Number(item[tableMeta.columnIndex])
}
})
......@@ -510,25 +510,35 @@ export default class BalanceSheet extends Component {
const handleFormula = (tableMeta) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayFormulaConvert = []
// // console.log(arrayFormula)
// // // console.log(arrayFormula)
let opet = ""
let tambahan = false
arrayFormula.map((item, indexs) => {
if (item == '-' || item == '+' || item == '/' || item == '*') {
if (item == 'X') {
tambahan = true
} else if (item == '-' || item == '+' || item == '/' || item == '*') {
arrayFormulaConvert.push(item)
} else {
let indexID = dataTable2.findIndex((val) => val[21] == item)
// console.log(item)
// console.log(indexID)
if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
arrayFormulaConvert.push(opet == ''? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
} else {
if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex]
// // console.log(dataTable2[indexID])
// // // console.log(dataTable2[indexID])
arrayFormulaConvert.push(valuezz == "" ? 0 : valuezz)
} else {
arrayFormulaConvert.push(Number(item))
}
}
}
})
// console.log(arrayFormula)
// console.log(arrayFormulaConvert)
// // console.log(arrayFormula)
// // console.log(arrayFormulaConvert)
let array = arrayFormulaConvert
let total = 0
let opt = ""
......@@ -693,10 +703,10 @@ export default class BalanceSheet extends Component {
value={value}
disabled={true}
// onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
// }}
/>
}
......@@ -784,7 +794,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -807,7 +817,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -870,7 +880,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -893,7 +903,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -955,7 +965,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -978,7 +988,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1040,7 +1050,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1063,7 +1073,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1125,7 +1135,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1148,7 +1158,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1210,7 +1220,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1233,7 +1243,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1295,7 +1305,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1318,7 +1328,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1380,7 +1390,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1403,7 +1413,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1465,7 +1475,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1488,7 +1498,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1550,7 +1560,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1573,7 +1583,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1635,7 +1645,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1658,7 +1668,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1720,7 +1730,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1743,7 +1753,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1805,7 +1815,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1828,7 +1838,7 @@ export default class BalanceSheet extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......
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