Commit c86e8477 authored by Faisal Hamdi's avatar Faisal Hamdi

Merge branch 'faisal' into 'master'

fam mr

See merge request !725
parents 4ac8e578 f6b28404
......@@ -274,6 +274,7 @@ const create = (type = "") => {
const checkUploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/check_import', body)
const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body)
const uploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/import_monthly_report', body)
const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......@@ -490,7 +491,8 @@ const create = (type = "") => {
uploadMonthlyReportPL,
getMonthlyReport,
checkUploadMonthlyReportBS,
uploadMonthlyReportBS
uploadMonthlyReportBS,
uploadMonthlyReportFAM
}
}
......
import React, { Component } from 'react';
import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core';
import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles, Snackbar } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import api from '../../api';
import Images from '../../assets/Images';
......@@ -8,6 +8,9 @@ import NumberFormat from 'react-number-format';
import { PropagateLoader } from 'react-spinners';
import UploadFile from '../../library/Upload';
import { ExcelRenderer } from 'react-excel-renderer';
import * as R from 'ramda'
import Constant from '../../library/Constant';
import { Alert } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -41,7 +44,8 @@ export default class FixedAssetsMovementMR extends Component {
super(props)
this.state = {
dataTable: [],
loading: true
loading: true,
visibleFAMMR: true
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -64,6 +68,7 @@ export default class FixedAssetsMovementMR extends Component {
console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status === 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -114,7 +119,6 @@ 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.ordert_vs_rb_percent === "" ? "0.0" : item.fixed_asset_movement.act_vs_rb_percent,
item.order
])
if (item.children !== null) {
......@@ -127,6 +131,18 @@ export default class FixedAssetsMovementMR extends Component {
})
console.log(dataTable);
this.setState({ dataTable, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -146,11 +162,12 @@ 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_bs/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}`
`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}`
)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
......@@ -164,21 +181,22 @@ export default class FixedAssetsMovementMR extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
console.log(resp)
// console.log(resp)
if (err) {
console.log(err);
}
else {
let isi = resp.rows.slice(3)
console.log(isi);
// console.log(resp.rows[2]);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
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_mb: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim()
actual: i[3] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[3]).trim(),
})
}
})
......@@ -186,8 +204,8 @@ export default class FixedAssetsMovementMR extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
fixed_asset_movement: payload,
months: this.props.month.month_id
months: this.props.month.month_id,
fixed_asset_movement: payload
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
......@@ -195,74 +213,124 @@ export default class FixedAssetsMovementMR extends Component {
});
}
// cek upload error network mulu..
checkUpload() {
api.create().checkUploadMonthlyReportFAM(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload));
// console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, loading: true })
// let dataTable = response.data.data.map((item, index) => {
// return [
// item.type_report_id,
// item.item_report_id,
// item.parent,
// item.formula,
// item.level,
// item.item_report,
// item.total_actual_before,
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.january, formula: item.january_formula } : Number(item.january).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.february, formula: item.february_formula } : Number(item.february).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.march, formula: item.march_formula } : Number(item.march).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.april, formula: item.april_formula } : Number(item.april).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.may, formula: item.may_formula } : Number(item.may).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.june, formula: item.june_formula } : Number(item.june).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.july, formula: item.july_formula } : Number(item.july).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.august, formula: item.august_formula } : Number(item.august).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.september, formula: item.september_formula } : Number(item.september).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1),
// Number(item.total_current_year).toFixed(1),
// Number(item.total_next_year).toFixed(1),
// Number(item.total_more_year).toFixed(1),
// item.orders,
// item.forecast_formula,
// item.before_formula,
// item.error
// ]
// })
// this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
// this.state.dataTable.map(item => {
// if (item[12].length > 0) {
// // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
// }
// })
// // console.log(this.state.dataTable);
// })
this.setState({ visibleUpload: false, loading: true, visibleFAMMR: false })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.item_report,
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.order,
item.error
]
})
console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
this.state.dataTable.map(item => {
if (item[17].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
}
})
console.log(this.state.dataTable);
})
}
}
})
}
uploadFAMMR(type) {
let data = []
this.state.dataTable.map(i => {
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)),
})
})
let body = {
"monthly_report_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"months": this.props.month.month_id,
"fixed_asset_movement": data
}
console.log(data);
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()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 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 })
}
})
}
backToMonthlyReport(type) {
this.setState({ loading: true })
console.log(this.state.dataTable);
let data = []
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
mtd_mb: String(Number(i[6]).toFixed(1)),
mtd_rb: String(Number(i[7]).toFixed(1)),
mtd_actual: String(Number(i[8]).toFixed(1)),
act_previous_month: String(Number(i[9]).toFixed(1)),
act_vs_prev_month_amount: String(Number(i[10]).toFixed(1)),
act_vs_prev_month_percent: String(Number(i[11]).toFixed(1)),
act_vs_mb_amount: String(Number(i[12]).toFixed(1)),
act_vs_mb_percent: String(Number(i[13]).toFixed(1)),
act_vs_rb_amount: String(Number(i[14]).toFixed(1)),
act_vs_rb_percent: String(Number(i[15]).toFixed(1))
"item_report_id": i[1],
"mtd_mb": i[6],
"mtd_rb": i[7],
"mtd_actual": i[8],
"act_previous_month": i[9],
"act_vs_prev_month_amount": i[10],
"act_vs_prev_month_percent": i[11],
"act_vs_mb_amount": i[12],
"act_vs_mb_percent": i[13],
"act_vs_rb_amount": i[14],
"act_vs_rb_percent": i[15]
})
})
let payload = {
......@@ -293,14 +361,22 @@ export default class FixedAssetsMovementMR extends Component {
})
}
closeAlert() {
this.setState({ alert: false })
}
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)
......@@ -317,8 +393,9 @@ export default class FixedAssetsMovementMR extends Component {
}
}
}
// handleValue(tableMeta, 2)
const handleValue = (data, type) => {
// console.log(data, type);
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] === item[2]) {
......@@ -327,22 +404,111 @@ export default class FixedAssetsMovementMR extends Component {
}
})
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
let a = dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
// console.log(indexParent);
return total
return a
}
const handleValueFormula = (data, type) => {
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 = ""
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[22] == item)
if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
} else {
if (index != -1) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex + type])
}
}
}
})
let array = arrayJumlah
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 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)
// 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)
} else {
total += Number(item)
}
}
})
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
// console.log(indexParent);
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total)
return a
}
const handleVariance = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[9])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 2) {
total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[6])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 3) {
total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[7])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
}
const handleVariancePercent = (tableMeta, dex, type) => {
let total = 0
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])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} 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])
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])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
}
......@@ -472,7 +638,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 6 ?
......@@ -483,7 +649,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 0)).toFixed(1)}
/>
</span> :
null
......@@ -503,7 +669,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 1)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
......@@ -560,7 +726,8 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
// value={Number(handleValue(tableMeta, 2)).toFixed(1)}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 6 ?
......@@ -571,7 +738,7 @@ 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)}
/>
</span> :
null
......@@ -606,7 +773,7 @@ export default class FixedAssetsMovementMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
......@@ -682,7 +849,8 @@ export default class FixedAssetsMovementMR extends Component {
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
customBodyRender: (val, tableMeta, updateValue) => {
// console.log(tableMeta);
return (
<div>
<div className="grid grid-3x content-center">
......@@ -693,35 +861,22 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={val}
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}
value={Number(tableMeta.rowData[10]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -730,35 +885,22 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={val}
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}
value={Number(tableMeta.rowData[11]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -771,35 +913,22 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={val}
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}
value={Number(tableMeta.rowData[12]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -808,35 +937,22 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={val}
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}
value={Number(tableMeta.rowData[13]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -849,35 +965,22 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={val}
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}
value={Number(tableMeta.rowData[14]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -886,35 +989,22 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={val}
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}
value={Number(tableMeta.rowData[15]).toFixed(1)}
value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
/>
}
/>
</div> :
null
</div>
}
</div>
</div>
......@@ -968,7 +1058,7 @@ export default class FixedAssetsMovementMR extends Component {
}]
const loadingComponent = (
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
......@@ -983,7 +1073,13 @@ export default class FixedAssetsMovementMR extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleFAMMR ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
......@@ -1122,7 +1218,7 @@ export default class FixedAssetsMovementMR extends Component {
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
this.backToMonthlyReport('draft')
})
}
>
......@@ -1139,7 +1235,7 @@ export default class FixedAssetsMovementMR extends Component {
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
......@@ -1156,7 +1252,127 @@ export default class FixedAssetsMovementMR extends Component {
{/* : null
} */}
</div>
</Paper> :
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadFAMMR('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadFAMMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div>
</div>
</Paper>
}
</div>
{this.state.visibleUpload && (
<div className="test app-popup-show">
......
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