Commit 18019e45 authored by Deni Rinaldi's avatar Deni Rinaldi

gatau ampe mana

parent 6dd51650
......@@ -256,6 +256,7 @@ const create = (type = "") => {
const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body)
const getHierarkiMontlyReportOI = (body) => api.post('transaction/monthly_report_oi/get_report_hierarki', body)
const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/get_report_hierarki', body)
const getLastPeriodMonthly = (idCompany) => api.get(`transaction/monthly_report/get_last_periode/${idCompany}`)
const checkApproverMonthly = () => api.get('transaction/monthly_report/is_approver')
const getCompanySubmittedMonthly = (body) => api.post('transaction/monthly_report/get_company_submitted', body)
......@@ -263,6 +264,7 @@ const create = (type = "") => {
const getMontlyReportAtt = (body) => api.post('transaction/monthly_report/get_report_attachment', body)
const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body)
const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`)
const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......@@ -397,6 +399,7 @@ const create = (type = "") => {
getDetailDocument,
deleteDocument,
createSubmitReport,
createMonthlyReportBS,
getSubmission,
checkUploadMB,
getAllOperatingInd,
......@@ -463,7 +466,8 @@ const create = (type = "") => {
getMonthlyReportID,
getReportHierarkiFR,
getDetailHierarkiCF,
getHierarkiMontlyReportPL
getHierarkiMontlyReportPL,
getHierarkiMontlyReportLOCF
}
}
......
......@@ -470,6 +470,19 @@ export default class MonthlyReport extends Component {
})
}
saveToMonthlyReport(){
this.setState({
visibleMonthlyReport: true,
visibleBS: false,
visiblePL: false,
visibleCAT: false,
visibleFAM: false,
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
})
}
clickDetail(item, id, revision, status) {
console.log(item)
this.setState({
......@@ -1037,7 +1050,7 @@ export default class MonthlyReport extends Component {
periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
// saveToMasterBudget={this.saveToMasterBudget.bind(this)}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleMonthlyReport: true })}
// getReport={this.getCompanyActive.bind(this)}
/>
......
import { createMuiTheme, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
import api from '../../api';
import NumberFormat from 'react-number-format';
import { type } from 'ramda';
import { PropagateLoader } from 'react-spinners';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -69,20 +72,20 @@ export default class BalanceSheetMR extends Component {
item.formula,
item.level,
item.description,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.master_budget === "" ? "0.0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "0.0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "0.0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "0.0" : item.balance_sheet.actual_previous_month === "" ? "0.0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "0.0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "0.0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "0.0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "0.0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "0.0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "0.0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "0.0" : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "0.0" : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "0.0" : item.balance_sheet.mtd_vs_rb,
item.balance_sheet.rolling_outlook === null ? "1.0" : item.balance_sheet.rolling_outlook === "" ? "1.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.master_budget === "" ? "2.0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "3.0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "4.0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "5.0" : item.balance_sheet.actual_previous_month === "" ? "5.0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "6.0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "7.0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "8.0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "9.0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "10.0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "11.0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "12.0" : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "13.0" : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "14.0" : item.balance_sheet.mtd_vs_rb,
])
}
if (item.children !== null) {
......@@ -101,20 +104,20 @@ export default class BalanceSheetMR extends Component {
item.formula,
item.level,
item.description,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.master_budget === "" ? "0.0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "0.0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "0.0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "0.0" : item.balance_sheet.actual_previous_month === "" ? "0.0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "0.0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "0.0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "0.0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "0.0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "0.0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "0.0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "0.0" : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "0.0" : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "0.0" : item.balance_sheet.mtd_vs_rb,
item.balance_sheet.rolling_outlook === null ? "1.0" : item.balance_sheet.rolling_outlook === "" ? "1.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.master_budget === "" ? "2.0" : item.balance_sheet.master_budget,
item.balance_sheet.rolling_budget === "" ? "3.0" : item.balance_sheet.rolling_budget,
item.balance_sheet.actual === "" ? "4.0" : item.balance_sheet.actual,
item.balance_sheet.actual_previous_month === null ? "5.0" : item.balance_sheet.actual_previous_month === "" ? "5.0" : item.balance_sheet.actual_previous_month,
item.balance_sheet.amount_act_vs_previous_month === "" ? "6.0" : item.balance_sheet.amount_act_vs_previous_month,
item.balance_sheet.percent_act_vs_previous_month === "" ? "7.0" : item.balance_sheet.percent_act_vs_previous_month,
item.balance_sheet.amount_act_vs_mb === "" ? "8.0" : item.balance_sheet.amount_act_vs_mb,
item.balance_sheet.percent_act_vs_mb === "" ? "9.0" : item.balance_sheet.percent_act_vs_mb,
item.balance_sheet.amount_act_vs_rb === "" ? "10.0" : item.balance_sheet.amount_act_vs_rb,
item.balance_sheet.percent_act_vs_rb === "" ? "11.0" : item.balance_sheet.percent_act_vs_rb,
item.balance_sheet.mtd_vs_previous_month === "" ? "12.0" : item.balance_sheet.mtd_vs_previous_month,
item.balance_sheet.mtd_vs_mb === "" ? "13.0" : item.balance_sheet.mtd_vs_mb,
item.balance_sheet.mtd_vs_rb === "" ? "14.0" : item.balance_sheet.mtd_vs_rb,
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -130,7 +133,127 @@ export default class BalanceSheetMR extends Component {
})
}
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_bs/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)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Monthly Report Balance Sheet.xlsx';
a.click();
}
}
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report_bs/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}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Monthly Report Balance Sheet.xlsx';
a.click();
}
}
backToMonthlyReport(type) {
console.log(this.state.dataTable);
let data = []
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[2],
"rolling_outlook": i[6],
"master_budget": i[7],
"rolling_budget": i[8],
"actual": i[9],
"actual_previous_month": i[10],
"amount_act_vs_previous_month": i[11],
"percent_act_vs_previous_month": i[12],
"amount_act_vs_mb": i[13],
"percent_act_vs_mb": i[14],
"amount_act_vs_rb": i[15],
"percent_act_vs_rb": i[16],
"mtd_vs_previous_month": i[17],
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
})
})
let payload = {
"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,
"balance_sheet": data
}
api.create('UPLOAD').createMonthlyReportBS(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.saveToMonthlyReport()
} else {
this.setState({ loading: false }, () => {
this.props.saveToMonthlyReport()
})
}
} else {
this.setState({ loading: false }, () => {
this.getSubmission()
document.body.style.overflow = 'unset';
})
}
})
}
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
let val = String(value).split(",").join("")
if (type === "actual") {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
} else {
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
let jagain = Number(dataTable2[indexParent][9]).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]);
// }
} else {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
}
}
}
const handleValue = (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
}
let columns = [
{
name: "",
......@@ -253,25 +376,123 @@ export default class BalanceSheetMR extends Component {
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[7]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
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)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[8]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 1)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[9]
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
value={Number(tableMeta.rowData[9]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[9]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
......@@ -293,9 +514,35 @@ export default class BalanceSheetMR extends Component {
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[10]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
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)}
/>
}
/>
</div>
}
</div>
)
......@@ -358,7 +605,7 @@ export default class BalanceSheetMR extends Component {
}
}),
customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta);
// console.log(tableMeta);
return (
<div>
<div className="grid grid-3x content-center">
......@@ -366,17 +613,69 @@ export default class BalanceSheetMR extends Component {
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[11]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
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)}
/>
}
/>
</div>
}
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[12]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 3)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
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)}
/>
}
/>
</div>
}
</div>
</div>
......@@ -386,17 +685,69 @@ export default class BalanceSheetMR extends Component {
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[13]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 4)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
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)}
/>
}
/>
</div>
}
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[14]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 5)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
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)}
/>
}
/>
</div>
}
</div>
</div>
......@@ -406,17 +757,69 @@ export default class BalanceSheetMR extends Component {
<div className="grid grid-2x content-center">
<div className="column-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[15]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 6)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
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)}
/>
}
/>
</div>
}
</div>
</div>
<div className="column-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[16]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[16]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
......@@ -463,25 +866,103 @@ export default class BalanceSheetMR extends Component {
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[17]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 7)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[17]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[18]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 8)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null :
tableMeta.rowData[19]
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 9)).toFixed(1)}
/>
</span> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[19]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
......@@ -538,8 +1019,20 @@ export default class BalanceSheetMR 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)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
{this.state.loading && loadingComponent}
<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>
......@@ -565,7 +1058,7 @@ export default class BalanceSheetMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
......@@ -593,7 +1086,12 @@ export default class BalanceSheetMR extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
......@@ -604,16 +1102,88 @@ export default class BalanceSheetMR extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</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%', marginTop: 20 }}>
<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.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('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.backToMonthlyReport('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>
{/* : null
} */}
</div>
</Paper>
</div>
......
......@@ -46,75 +46,75 @@ export default class ListOfCreditFacilities extends Component {
getItemHierarki() {
let payload = {
"report_id": 2,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"month": this.props.month.month_id
"months": this.props.month.month_id
}
api.create().getHierarkiMontlyReportBS(payload).then(response => {
api.create().getHierarkiMontlyReportLOCF(payload).then(response => {
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
// if (response.data) {
// let res = response.data.data
// const handlePushChild = (item) => {
// let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
// if (indexIDzz === -1) {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// ])
// }
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// }
// res.map((item, index) => {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// item.balance_sheet.rolling_outlook === null ? "0.0" : item.balance_sheet.rolling_outlook === "" ? "0.0" : item.balance_sheet.rolling_outlook,
// ])
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// })
this.setState({ dataTable, loading: false })
}
// }
})
}
......
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