Commit f19e40c0 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

FAM MR

See merge request !746
parents ee35d2a5 6b571570
......@@ -1122,6 +1122,7 @@ export default class MonthlyReport extends Component {
periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleFAM: false, visibleMonthlyReport: true })}
/>
)}
......
......@@ -90,6 +90,7 @@ export default class FixedAssetsMovementMR extends Component {
item.fixed_asset_movement.act_vs_mb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_mb_percent,
item.fixed_asset_movement.act_vs_rb_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_amount,
item.fixed_asset_movement.act_vs_rb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_percent,
item.fixed_asset_movement.actual_formula,
item.order
])
}
......@@ -119,6 +120,7 @@ export default class FixedAssetsMovementMR extends Component {
item.fixed_asset_movement.act_vs_mb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_mb_percent,
item.fixed_asset_movement.act_vs_rb_amount === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_amount,
item.fixed_asset_movement.act_vs_rb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_percent,
item.fixed_asset_movement.actual_formula,
item.order
])
if (item.children !== null) {
......@@ -162,13 +164,14 @@ export default class FixedAssetsMovementMR extends Component {
}
}
// url donlot data minta ama arfin
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report/fam/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
console.log(url);
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report/fam/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -181,13 +184,11 @@ export default class FixedAssetsMovementMR extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) {
console.log(err);
}
else {
let isi = resp.rows.slice(3)
// console.log(resp.rows[2]);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -196,16 +197,7 @@ export default class FixedAssetsMovementMR extends Component {
orders: i[0] === undefined ? "" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
mtd_actual: i[3] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[3]).trim(),
mtd_mb: "",
mtd_rb: "",
act_previous_month: "",
act_vs_prev_month_amount: "",
act_vs_prev_month_percent: "",
act_vs_mb_amount: "",
act_vs_mb_percent: "",
act_vs_rb_amount: "",
act_vs_rb_percent: ""
mtd_actual: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
})
}
})
......@@ -216,18 +208,17 @@ export default class FixedAssetsMovementMR extends Component {
months: this.props.month.month_id,
fixed_asset_movement: payload
}
console.log(body)
// console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
}
});
}
// cek upload error network mulu..
checkUpload() {
api.create().checkUploadMonthlyReportFAM(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
console.log(response)
// console.log(this.state.payload)
// console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, loading: true, visibleFAMMR: false })
......@@ -242,26 +233,27 @@ export default class FixedAssetsMovementMR extends Component {
item.mtd_mb,
item.mtd_rb,
item.mtd_actual,
"",
"",
"",
"",
"",
"",
"",
item.act_previous_month,
item.act_vs_prev_month_amount,
item.act_vs_prev_month_percent,
item.act_vs_mb_amount,
item.act_vs_mb_percent,
item.act_vs_rb_amount,
item.act_vs_rb_percent,
item.actual_formula,
item.order,
item.error
]
})
console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
// console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[17].length > 0) {
if (item[18].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
console.log(this.state.dataTable);
// console.log(this.state.dataTable);
})
}
}
......@@ -274,16 +266,16 @@ export default class FixedAssetsMovementMR extends Component {
data.push({
item_report_id: i[1],
item_report: String(i[5]).trim(),
master_budget: String(Number(i[6]).toFixed(1)),
rolling_budget: String(Number(i[7]).toFixed(1)),
actual: String(Number(i[8]).toFixed(1)),
actual_previous_month: String(Number(i[9]).toFixed(1)),
amount_act_vs_previous_month: String(Number(i[10]).toFixed(1)),
percent_act_vs_previous_month: String(Number(i[11]).toFixed(1)),
amount_act_vs_mb: String(Number(i[12]).toFixed(1)),
percent_act_vs_mb: String(Number(i[13]).toFixed(1)),
amount_act_vs_rb: String(Number(i[14]).toFixed(1)),
percent_act_vs_rb: String(Number(i[15]).toFixed(1)),
mtd_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[6]).toFixed(1)) : i[0] === 3 && i[6] === "" ? "0.0" : String(Number(i[6]).toFixed(1)),
mtd_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[7]).toFixed(1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
mtd_actual: i[0] === 5 || i[0] === 6 ? String(Number(i[8]).toFixed(1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
act_previous_month: i[0] === 5 || i[0] === 6 ? String(Number(i[9]).toFixed(1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
act_vs_prev_month_amount: i[0] === 5 || i[0] === 6 ? String(Number(i[10]).toFixed(1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
act_vs_prev_month_percent: i[0] === 5 || i[0] === 6 ? String(Number(i[11]).toFixed(1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
act_vs_mb_amount: i[0] === 5 || i[0] === 6 ? String(Number(i[12]).toFixed(1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
act_vs_mb_percent: i[0] === 5 || i[0] === 6 ? String(Number(i[13]).toFixed(1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
act_vs_rb_amount: i[0] === 5 || i[0] === 6 ? String(Number(i[14]).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
act_vs_rb_percent: i[0] === 5 || i[0] === 6 ? String(Number(i[15]).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
})
})
let body = {
......@@ -299,10 +291,9 @@ export default class FixedAssetsMovementMR extends Component {
api.create('UPLOAD').uploadMonthlyReportFAM(body).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
// this.props.getReport()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -312,10 +303,6 @@ export default class FixedAssetsMovementMR extends Component {
}, 1000);
}
})
// alert(response.data.status)
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
......@@ -351,6 +338,8 @@ export default class FixedAssetsMovementMR extends Component {
"months": this.props.month.month_id,
"fixed_asset_movement": data
}
// console.log(JSON.stringify(payload));
api.create('UPLOAD').createMonthlyReportFAM(payload).then(response => {
console.log(response);
if (response.data) {
......@@ -376,90 +365,183 @@ export default class FixedAssetsMovementMR extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
console.log(tableMeta);
let val = String(value).split(",").join("")
if (type === "actual") {
dataTable2[tableMeta.rowIndex][8] = Number(val).toFixed(1)
} else {
console.log(val);
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
console.log(indexParent);
if (indexParent > 0) {
// console.log(indexParent)
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
let jagain = Number(dataTable2[indexParent][8]).toFixed(1)
dataTable2[indexParent][9] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(Number(jagain) + Number(val)).toFixed(1)
// if (tableMeta.rowData[5] === 'Cash & Bank Balance') {
// console.log(value);
// console.log(a);
// console.log(jagain);
// console.log(dataTable2[indexParent]);
// }
const handleValueFormula = (tableMeta, colIdx) => {
// loading = true
// console.log(tableMeta);
// "@44[M-1]#BS"
let splitFormula = String(tableMeta.rowData[3]).split(/([()@])/)
let baru = []
let anjay = []
// console.log(splitFormula);
splitFormula.map((item, index) => {
let items = String(item).substr(Number(String(item).length) - 1, 1)
let subForm = String(item).substr(0, Number(String(item).length) - 1)
// console.log(item);
// console.log(items);
// console.log(subForm);
let re = /^[a-zA-Z0-9_]+$/;
if (item !== "") {
if (items == ']') {
baru.push(String(item))
} else if (!re.test(items)) {
baru.push(subForm)
baru.push(items)
} else {
dataTable2[tableMeta.rowIndex][8] = Number(val).toFixed(1)
}
baru.push(String(item))
}
}
// handleValue(tableMeta, 2)
const handleValue = (data, type) => {
// console.log(data, type);
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] === item[2]) {
let itemVal = item[data.columnIndex + type].value !== undefined ? Number(item[data.columnIndex + type].value) : Number(item[data.columnIndex + type])
total = item[data.columnIndex + type] === undefined ? Number(total) + 0 : Number(total) + itemVal
}
})
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
// console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, type) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let tambahan = false
let opet = ""
// console.log(baru);
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
anjay.push(item)
} else {
if (String(item).includes('#')) {
if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
let indexID = dataTable2.findIndex((val) => val[17] == tst)
// console.log(indexID);
arrayFormula.map((item, indexs) => {
if (item == 'X') {
tambahan = true
} else if (item == '-' || item == '+' || item == '/' || item == '*') {
arrayJumlah.push(item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][8]
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let index = dataTable2.findIndex((val) => val[22] == item)
if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
let data = tableMeta.rowData[16]
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) {
let valuezz = data[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
} else {
arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
let indexID = dataTable2.findIndex((val) => val[17] == tst)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][8]
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
if (index != -1) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex + type])
let indexID = dataTable2.findIndex((val) => val[17] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][colIdx]
if (item == dataTable2[tableMeta.rowIndex][28]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
if (item === '(-1)') {
anjay.push(-1)
}
}
}
}
}
})
let array = arrayJumlah
let anjay2 = []
let kurung = false
let item1 = []
anjay.map((item, index) => {
if (item == "(") {
kurung = true
} else if (item == ")") {
kurung = false
anjay2.push(item1)
item1 = []
} else {
if (kurung) {
item1.push(item)
} else {
anjay2.push(item)
}
}
})
let total = 0
let opt = ""
let totalPrio = 0
let optPrio = ""
let prio = false
anjay2.map((item, index) => {
if (Array.isArray(item)) {
prio = true
item.map((items, indexs) => {
if (items == "+") {
optPrio = "tambah"
} else if (items == "-") {
optPrio = "kurang"
} else if (items == "*") {
optPrio = "kali"
} else if (items == "/") {
optPrio = "bagi"
} else {
if (optPrio == "tambah") {
totalPrio = Number(totalPrio) + Number(items)
} else if (optPrio == "kurang") {
totalPrio = Number(totalPrio) - Number(items)
} else if (optPrio == "kali") {
totalPrio = Number(totalPrio) * Number(items)
} else if (optPrio == "bagi") {
totalPrio = Number(totalPrio) / Number(items) == NaN ? 0 : Number(totalPrio) / Number(items)
} else {
totalPrio += Number(items)
}
}
})
array.map((item, index) => {
if (index == anjay2.length - 1) {
if (opt == "tambah") {
total = Number(total) + Number(totalPrio)
} else if (opt == "kurang") {
total = Number(total) - Number(totalPrio)
} else if (opt == "kali") {
total = Number(total) * Number(totalPrio)
} else if (opt == "bagi") {
total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
} else {
total += Number(totalPrio)
}
}
} else {
if (item == "+") {
opt = "tambah"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else if (item == "-") {
opt = "kurang"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else if (item == "*") {
opt = "kali"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else if (item == "/") {
opt = "bagi"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
......@@ -467,27 +549,62 @@ export default class FixedAssetsMovementMR extends Component {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
// if (tableMeta.rowData[22] === 3) {
// console.log(dataTable2[tableMeta.rowIndex]);
// console.log(total);
// console.log(item);
// console.log(arrayJumlah);
// }
} else if (opt == "bagi") {
total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
}
})
total = R.equals(total, NaN) ? "0.0" : total
// // // total = R.equals(total, NaN) ? "0.0" : total
// // // console.log(dataTable2[tableMeta.rowIndex][22])
// // // console.log(tableMeta.rowData[5])
// // if (tableMeta.rowData[5] == "1.5 Other non-current assets") {
// // if (forecast !== undefined) {
// // if (String(tableMeta.rowData[5]) == "Depreciation & amortisation") {
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(anjay2)
// console.log(total)
// // console.log(dataTable2[tableMeta.rowIndex])
// // }
// // }
// if (dataTable2[tableMeta.rowIndex][colIdx].value == undefined) {
dataTable2[tableMeta.rowIndex][colIdx] = total
// } else {
// dataTable2[tableMeta.rowIndex][column].value = total
// }
// loading = false
return total
}
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total)
const handleChange = (value, tableMeta, type) => {
dataTable2[tableMeta.rowIndex][type] = value
// console.log(dataTable2[tableMeta.rowIndex][type]);
// console.log(value);
return a
}
const handleValue = (data, type) => {
// console.log(data, type);
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] === item[2]) {
let itemVal = item[data.columnIndex + type].value !== undefined ? Number(item[data.columnIndex + type].value) : Number(item[data.columnIndex + type])
total = item[data.columnIndex + type] === undefined ? Number(total) + 0 : Number(total) + itemVal
}
})
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
// console.log(indexParent);
return a
}
const handleVariance = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
......@@ -505,18 +622,27 @@ export default class FixedAssetsMovementMR extends Component {
const handleVariancePercent = (tableMeta, dex, type) => {
let total = 0
// if (tableMeta.rowData[5] === "Disposal (negative value)") {
// console.log(dataTable2);
// console.log(tableMeta);
// }
// value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)}
// dataTable2[5][11]
if (dex === 1) {
// total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][12])
total = R.equals((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][12])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][12])), Infinity) ? '0' : Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][12])
total = R.equals((Number(dataTable2[tableMeta.rowIndex][10]) / Number(dataTable2[tableMeta.rowIndex][9])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][10]) / Number(dataTable2[tableMeta.rowIndex][9])), Infinity) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][10]) / Number(dataTable2[tableMeta.rowIndex][9])), -Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][10]) / Number(dataTable2[tableMeta.rowIndex][9])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// if (tableMeta.rowData[5] === "Cash and cash equivalent") {
// console.log(total);
// console.log(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10]));
// console.log(dataTable2[tableMeta.rowIndex]);
// }
} else if (dex === 2) {
// total = Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])
total = R.equals((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])), Infinity) ? '0' : Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])
total = R.equals((Number(dataTable2[tableMeta.rowIndex][12]) / Number(dataTable2[tableMeta.rowIndex][6])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][12]) / Number(dataTable2[tableMeta.rowIndex][6])), Infinity) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][12]) / Number(dataTable2[tableMeta.rowIndex][6])), -Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][12]) / Number(dataTable2[tableMeta.rowIndex][6])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 3) {
// total = Number(dataTable2[tableMeta.rowIndex][17]) / Number(dataTable2[tableMeta.rowIndex][9])
total = R.equals((Number(dataTable2[tableMeta.rowIndex][17]) / Number(dataTable2[tableMeta.rowIndex][9])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][17]) / Number(dataTable2[tableMeta.rowIndex][9])), Infinity) ? '0' : Number(dataTable2[tableMeta.rowIndex][17]) / Number(dataTable2[tableMeta.rowIndex][9])
total = R.equals((Number(dataTable2[tableMeta.rowIndex][14]) / Number(dataTable2[tableMeta.rowIndex][7])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][14]) / Number(dataTable2[tableMeta.rowIndex][7])), Infinity) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][14]) / Number(dataTable2[tableMeta.rowIndex][7])), -Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][14]) / Number(dataTable2[tableMeta.rowIndex][7])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
// console.log(total);
}
return total
}
......@@ -622,24 +748,7 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[6]).toFixed(1)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 5 ?
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -647,21 +756,25 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 0)).toFixed(1)}
value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 0)).toFixed(1)}
value={Number(value).toFixed(1)}
/>
</span> :
null
}
/>
</div>
}
</div>
</div>
......@@ -678,10 +791,9 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -693,12 +805,11 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
value={Number(value).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -721,13 +832,13 @@ export default class FixedAssetsMovementMR extends Component {
disabled={false}
value={Number(tableMeta.rowData[8]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
handleChange(event.target.value, tableMeta, 8)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 5 ?
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -735,22 +846,25 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
// value={Number(handleValue(tableMeta, 2)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
value={Number(value).toFixed(1)}
/>
</span> :
null
}
/>
</div>
}
</div>
</div>
......@@ -778,14 +892,13 @@ export default class FixedAssetsMovementMR extends Component {
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
value={Number(handleValueFormula(tableMeta, 9)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -793,7 +906,7 @@ export default class FixedAssetsMovementMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
......@@ -801,8 +914,7 @@ export default class FixedAssetsMovementMR extends Component {
/>
}
/>
</div> :
null
</div>
}
</div>
)
......@@ -857,18 +969,22 @@ export default class FixedAssetsMovementMR extends Component {
</div>
</th>
),
setCellProps: () => ({ style2 }),
setCellProps: () => ({
style: {
paddingLeft: 0,
paddingRight: 10
}
}),
customBodyRender: (val, tableMeta, updateValue) => {
// console.log(tableMeta);
return (
<div>
<div className="grid grid-3x content-center">
<div className="col-1">
<div className="column-1">
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div className="column-1">
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -889,10 +1005,9 @@ export default class FixedAssetsMovementMR extends Component {
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div className="column-2">
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -904,8 +1019,9 @@ export default class FixedAssetsMovementMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)}
/>
}
/>
......@@ -915,12 +1031,11 @@ export default class FixedAssetsMovementMR extends Component {
</div>
</div>
</div>
<div className="col-2">
<div className="column-2">
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div className="column-1">
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -933,7 +1048,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
value={Number(handleVariance(tableMeta, 2, 4)).toFixed(1)}
/>
}
/>
......@@ -941,10 +1056,9 @@ export default class FixedAssetsMovementMR extends Component {
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div className="column-2">
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -957,7 +1071,8 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 2, 5)).toFixed(1)}
/>
}
/>
......@@ -967,12 +1082,11 @@ export default class FixedAssetsMovementMR extends Component {
</div>
</div>
</div>
<div className="col-3">
<div className="column-3">
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div className="column-1">
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -985,7 +1099,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
value={Number(handleVariance(tableMeta, 3, 6)).toFixed(1)}
/>
}
/>
......@@ -993,10 +1107,9 @@ export default class FixedAssetsMovementMR extends Component {
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
<div className="column-2">
<div style={{ textAlign: 'right', width: 120 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1009,7 +1122,8 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
suffix={'%'}
value={Number(handleVariancePercent(tableMeta, 3, 7)).toFixed(1)}
/>
}
/>
......@@ -1064,6 +1178,11 @@ export default class FixedAssetsMovementMR extends Component {
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}]
const loadingComponent = (
......@@ -1337,13 +1456,13 @@ export default class FixedAssetsMovementMR extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
......
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