Commit 5664fe87 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-' into 'master'

+_+

See merge request !681
parents e34859c4 6dd51650
...@@ -252,10 +252,17 @@ const create = (type = "") => { ...@@ -252,10 +252,17 @@ const create = (type = "") => {
const checkApproverOLPA = () => api.get('transaction/outlook_pa/is_approver') const checkApproverOLPA = () => api.get('transaction/outlook_pa/is_approver')
// Monthly // Monthly
const getMonthlyReportID = (body) => api.post('transaction/monthly_report_bs/get_monthly_report_id', body) const getMonthlyReportID = (body) => api.post('transaction/monthly_report/get_monthly_report_id', body)
const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body) 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 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 getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/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)
const historyApprovalMonthly = (body) => api.post('transaction/monthly_report/history_approval', body)
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}`)
// MonthlyPL // MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body) const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
...@@ -415,6 +422,13 @@ const create = (type = "") => { ...@@ -415,6 +422,13 @@ const create = (type = "") => {
approvalSubmission, approvalSubmission,
getCompanySubmitted, getCompanySubmitted,
getLastPeriod, getLastPeriod,
getLastPeriodMonthly,
checkApproverMonthly,
getCompanySubmittedMonthly,
historyApprovalMonthly,
uploadAttachmentMonthly,
getMontlyReportAtt,
deleteAttachmentMonthly,
getSubmitMasterBudget, getSubmitMasterBudget,
createPeriodeRevision, createPeriodeRevision,
getLastestUpdateOI, getLastestUpdateOI,
......
...@@ -648,7 +648,7 @@ export default class BudgetTahunan extends Component { ...@@ -648,7 +648,7 @@ export default class BudgetTahunan extends Component {
} }
else { else {
const formData = new FormData(); const formData = new FormData();
formData.append("revision", Number(this.state.revision.revision)); formData.append("revision", Number(this.state.lastRevision));
formData.append("companyId", this.state.company.company_id); formData.append("companyId", this.state.company.company_id);
formData.append("periode", Number(this.state.periode.periode)); formData.append("periode", Number(this.state.periode.periode));
formData.append("file", event); formData.append("file", event);
......
...@@ -57,8 +57,38 @@ export default class MonthlyReport extends Component { ...@@ -57,8 +57,38 @@ export default class MonthlyReport extends Component {
} }
componentDidMount() { componentDidMount() {
this.getChecApprover()
this.setState({ loading: true }) this.setState({ loading: true })
this.getCompanyActive() // this.getCompanyActive()
}
getChecApprover() {
api.create().checkApproverMonthly().then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
// console.log(response);
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () =>
this.getPeriode())
} else {
this.setState({ isApprover: false, checkApprover: false }, () =>
this.getCompanyActive())
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
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' })
}
})
} }
getReportAttachment() { getReportAttachment() {
...@@ -66,8 +96,9 @@ export default class MonthlyReport extends Component { ...@@ -66,8 +96,9 @@ export default class MonthlyReport extends Component {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"revision": this.state.revision.revision, "revision": this.state.revision.revision,
"months": this.state.month.month_id
} }
api.create().getMasterBudgetAtt(payload).then(response => { api.create().getMontlyReportAtt(payload).then(response => {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data }) this.setState({ listAttachment: response.data.data })
...@@ -182,7 +213,7 @@ export default class MonthlyReport extends Component { ...@@ -182,7 +213,7 @@ export default class MonthlyReport extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month) let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month)
console.log(index); console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => { this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => {
this.getPeriode() this.getLastPeriod()
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -200,13 +231,34 @@ export default class MonthlyReport extends Component { ...@@ -200,13 +231,34 @@ export default class MonthlyReport extends Component {
}) })
} }
getLastPeriod() {
api.create().getLastPeriodMonthly(this.state.company.company_id).then(response => {
console.log(response);
if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.getPeriode()
})
}
})
}
getPeriode() { getPeriode() {
api.create().getPeriodeTransaction().then(response => { api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date let currentYear = new Date().getFullYear()
let year = format(dateNow, 'yyyy')
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let data = response.data.data let data = []
response.data.data.map((item) => {
if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
data.push(item)
}
} else {
if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
data.push(item)
}
}
})
let periodeData = data.map((item) => { let periodeData = data.map((item) => {
return { return {
periode: item, periode: item,
...@@ -216,9 +268,18 @@ export default class MonthlyReport extends Component { ...@@ -216,9 +268,18 @@ export default class MonthlyReport extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let index = data.sort((a, b) => a - b).findIndex((val) => val == year) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => { let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
this.getRevision() // console.log(data)
console.log(this.state.lastPeriod)
// console.log(periodeData)
console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -236,6 +297,62 @@ export default class MonthlyReport extends Component { ...@@ -236,6 +297,62 @@ export default class MonthlyReport extends Component {
}) })
} }
getCompanySubmitted() {
let body = {
"periode": this.state.periode.periode
}
api.create().getCompanySubmittedMonthly(body).then(response => {
// // console.log(response);
if (response.data) {
if (response.data.status === 'success') {
if (response.data.data.length > 0) {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
let defaultProps = {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
}
let indexID = null
if (this.state.rawData !== undefined) {
indexID = companyData.findIndex((val) => val.company_id == this.state.rawData.company_id)
}
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// // console.log(response.data.data);
if (response.data.data.length > 0) {
this.getRevision()
} else {
this.setState({ listRevision: null, revision: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false })
}
//
})
} else {
this.setState({ listRevision: null, revision: null, dataTable: [], checkApprover: false, lastRevision: "", visibleTableHistory: false, loading: false }, () => {
document.body.style.overflow = 'unset';
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
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', listCompany: null, company: null })
}
})
}
onClickClose() { onClickClose() {
this.setState({}) this.setState({})
} }
...@@ -282,17 +399,35 @@ export default class MonthlyReport extends Component { ...@@ -282,17 +399,35 @@ export default class MonthlyReport extends Component {
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"months": this.state.month.month_id "months": this.state.month.month_id,
"is_approver": this.state.isApprover
} }
api.create().getMonthlyReportID(payload).then(response => { api.create().getMonthlyReportID(payload).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ this.setState({
submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
lastRevision: response.data.data.last_revision,
btnApprove: response.data.data.is_submit,
monthlyReportId: response.data.data ? response.data.data.monthly_report_id : null monthlyReportId: response.data.data ? response.data.data.monthly_report_id : null
}, () => { }, () => {
// // console.log(this.state.lastStatus);
this.historyApproval()
// this.getLatestPeriodSubmit()
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
api.create().checkApproverMonthly().then(response => {
// // console.log(response);
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true })
} else {
this.setState({ isApprover: false, checkApprover: false })
}
})
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -310,6 +445,31 @@ export default class MonthlyReport extends Component { ...@@ -310,6 +445,31 @@ export default class MonthlyReport extends Component {
}) })
} }
historyApproval() {
let body = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"months": this.state.month.month_id
}
api.create().historyApprovalMonthly(body).then(response => {
console.log(response);
if (response.data.data) {
if (response.data.data.length > 0) {
let dataTableHistory = response.data.data.map(item => {
return [
item.pic,
item.status_approval,
item.remarks,
item.item_revision,
item.history_approval_date
]
})
this.setState({ dataTableHistory, visibleTableHistory: true })
}
}
})
}
clickDetail(item, id, revision, status) { clickDetail(item, id, revision, status) {
console.log(item) console.log(item)
this.setState({ this.setState({
...@@ -412,17 +572,19 @@ export default class MonthlyReport extends Component { ...@@ -412,17 +572,19 @@ export default class MonthlyReport extends Component {
} }
else { else {
const formData = new FormData(); const formData = new FormData();
formData.append("revision", Number(this.state.revisi)); formData.append("revision", Number(this.state.lastRevision));
formData.append("companyId", this.state.company.company_id); formData.append("companyId", this.state.company.company_id);
formData.append("periode", Number(this.state.periode.periode)); formData.append("periode", Number(this.state.periode.periode));
formData.append("file", event); formData.append("file", event);
formData.append("months", this.state.month.month_id)
this.setState({ formData }) this.setState({ formData })
} }
}) })
} }
uploadAttachment(formData) { uploadAttachment(formData) {
api.create().uploadAttachment(formData).then(response => { api.create().uploadAttachmentMonthly(formData).then(response => {
console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ visibleUpload: false }, () => { this.setState({ visibleUpload: false }, () => {
...@@ -440,12 +602,45 @@ export default class MonthlyReport extends Component { ...@@ -440,12 +602,45 @@ export default class MonthlyReport extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
// console.log(response) // console.log(response)
}) })
} }
deleteAttachment(item) {
api.create().deleteAttachmentMonthly(item.attachment_id).then(response => {
// // console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.getMonthlyReportID()
}
}
})
}
async downloadAttachment(fileurl, name) {
let length = name.split(".").length
let fileType = name.split(".")[length - 1]
// // console.log(fileType);
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
// // console.log(url);
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
)
res = await res.blob()
this.setState({ loading: false }, ()=> {
document.body.style.overflow = 'unset';
})
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Monthly Report Attachment.xlsx';
a.click();
}
}
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
...@@ -544,6 +739,10 @@ export default class MonthlyReport extends Component { ...@@ -544,6 +739,10 @@ export default class MonthlyReport extends Component {
options: { display: false } options: { display: false }
}] }]
const columnsHistory = [
"Name", "Status", "Remarks", "Revision Item", "Date"
]
const options = { const options = {
filter: false, filter: false,
sort: false, sort: false,
...@@ -556,6 +755,19 @@ export default class MonthlyReport extends Component { ...@@ -556,6 +755,19 @@ export default class MonthlyReport extends Component {
search: false search: false
} }
const optionsHistory = {
filter: false,
sort: false,
responsive: "scroll",
print: false,
download: false,
selectableRows: false,
viewColumns: false,
pagination: true,
search: false,
rowsPerPage: 5
}
const loadingComponent = ( 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: '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 <PropagateLoader
...@@ -654,42 +866,120 @@ export default class MonthlyReport extends Component { ...@@ -654,42 +866,120 @@ export default class MonthlyReport extends Component {
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography> <Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div> </div>
<div style={{ width: '50%' }}> {!this.state.isApprover && (this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && (
<button <div style={{ width: '50%' }}>
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: this.state.isSubmit === false ? 'default' : 'pointer',
outline: 'none' borderColor: 'transparent',
}} outline: 'none'
onClick={() => this.setState({ visibleUpload: true })} }}
> onClick={() => this.state.isSubmit === false ? null : this.setState({ visibleUpload: true })}
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography> >
</button> <Typography style={{ fontSize: '16px', color: this.state.isSubmit === false ? 'GrayText' : '#5198ea' }}>Upload File</Typography>
</div> </button>
</div>
)}
</div> </div>
<div style={{ display: 'flex', marginTop: 10 }}> <div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}> <div style={{ width: '50%', paddingLeft: 20 }}>
{this.state.listAttachment.length > 0 ? {this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => { this.state.listAttachment.map((item, index) => {
return ( return (
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>{item.attachment_name}</Typography> <div style={{ display: 'flex' }}>
) <Typography style={{ fontSize: '13px', color: '#4b4b4b', width: 25 }}>{index + 1}. </Typography>
})
: null <button
} style={{
</div> backgroundColor: 'transparent',
<div style={{ width: '50%' }}> cursor: 'pointer',
{this.state.listAttachment.length > 0 ? borderColor: 'transparent',
this.state.listAttachment.map((item) => { outline: 'none',
return ( display: 'grid'
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography> }}
onClick={() => {
this.downloadAttachment(item.attachment_url, item.attachment_name)
}}
>
<div>
<Typography style={{ fontSize: '13px', color: '#5198ea' }}> {item.attachment_name}</Typography>
</div>
</button>
</div>
) )
}) })
: null : null
} }
</div> </div>
{!this.state.isApprover && (this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && (
<div style={{ width: '50%' }}>
{
this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<button
style={{
backgroundColor: 'transparent',
cursor: this.state.isSubmit === false ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
display: 'grid'
}}
onClick={() => this.state.isSubmit === false ? null : this.deleteAttachment(item)}
>
<Typography style={{ fontSize: '13px', color: this.state.isSubmit === false ? 'GrayText' : '#ff3939' }}>Delete</Typography>
</button>
)
})
: null
}
</div>
)}
</div> </div>
{this.state.checkApprover === true ?
this.state.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> : this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> : this.state.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus}`}</span>
</div> : null
:
this.state.lastStatus === 'SUBMITTED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> :
this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> :
this.state.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>NEED REVISION</span>
</div> :
this.state.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>APPROVED</span>
</div> : null
}
{this.state.visibleTableHistory && (
<div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTableHistory}
columns={columnsHistory}
options={optionsHistory}
/>
</MuiThemeProvider>
</div>
)}
</div> </div>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......
...@@ -52,7 +52,7 @@ export default class BalanceSheetMR extends Component { ...@@ -52,7 +52,7 @@ export default class BalanceSheetMR extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId, "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().getHierarkiMontlyReportBS(payload).then(response => {
console.log(response); console.log(response);
...@@ -70,25 +70,19 @@ export default class BalanceSheetMR extends Component { ...@@ -70,25 +70,19 @@ export default class BalanceSheetMR extends Component {
item.level, item.level,
item.description, 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.master_budget === "" ? "0.0" : item.balance_sheet.master_budget,
mb: item.balance_sheet.master_budget === "" ? "0.0" : item.balance_sheet.master_budget, item.balance_sheet.rolling_budget === "" ? "0.0" : item.balance_sheet.rolling_budget,
rb: item.balance_sheet.rolling_budget === "" ? "0.0" : item.balance_sheet.rolling_budget, item.balance_sheet.actual === "" ? "0.0" : item.balance_sheet.actual,
actual: 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.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,
aavpm: 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,
pavpm: 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,
aavmb: 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,
pavmb: 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,
aavrb: 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,
pavrb: 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,
mtdvpm: item.balance_sheet.mtd_vs_previous_month === "" ? "0.0" : item.balance_sheet.mtd_vs_previous_month,
mtdvmb: item.balance_sheet.mtd_vs_mb === "" ? "0.0" : item.balance_sheet.mtd_vs_mb,
mtdvrb: item.balance_sheet.mtd_vs_rb === "" ? "0.0" : item.balance_sheet.mtd_vs_rb,
}
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -108,25 +102,19 @@ export default class BalanceSheetMR extends Component { ...@@ -108,25 +102,19 @@ export default class BalanceSheetMR extends Component {
item.level, item.level,
item.description, 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.master_budget === "" ? "0.0" : item.balance_sheet.master_budget,
mb: item.balance_sheet.master_budget === "" ? "0.0" : item.balance_sheet.master_budget, item.balance_sheet.rolling_budget === "" ? "0.0" : item.balance_sheet.rolling_budget,
rb: item.balance_sheet.rolling_budget === "" ? "0.0" : item.balance_sheet.rolling_budget, item.balance_sheet.actual === "" ? "0.0" : item.balance_sheet.actual,
actual: 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.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,
aavpm: 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,
pavpm: 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,
aavmb: 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,
pavmb: 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,
aavrb: 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,
pavrb: 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,
mtdvpm: item.balance_sheet.mtd_vs_previous_month === "" ? "0.0" : item.balance_sheet.mtd_vs_previous_month,
mtdvmb: item.balance_sheet.mtd_vs_mb === "" ? "0.0" : item.balance_sheet.mtd_vs_mb,
mtdvrb: item.balance_sheet.mtd_vs_rb === "" ? "0.0" : item.balance_sheet.mtd_vs_rb,
}
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -136,6 +124,7 @@ export default class BalanceSheetMR extends Component { ...@@ -136,6 +124,7 @@ export default class BalanceSheetMR extends Component {
} }
} }
}) })
console.log(dataTable);
this.setState({ dataTable, loading: false }) this.setState({ dataTable, loading: false })
} }
}) })
...@@ -266,7 +255,7 @@ export default class BalanceSheetMR extends Component { ...@@ -266,7 +255,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.mb tableMeta.rowData[7]
} }
</div> </div>
</div> </div>
...@@ -274,7 +263,7 @@ export default class BalanceSheetMR extends Component { ...@@ -274,7 +263,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.rb tableMeta.rowData[8]
} }
</div> </div>
</div> </div>
...@@ -282,7 +271,7 @@ export default class BalanceSheetMR extends Component { ...@@ -282,7 +271,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.actual tableMeta.rowData[9]
} }
</div> </div>
</div> </div>
...@@ -306,7 +295,7 @@ export default class BalanceSheetMR extends Component { ...@@ -306,7 +295,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val tableMeta.rowData[10]
} }
</div> </div>
) )
...@@ -369,6 +358,7 @@ export default class BalanceSheetMR extends Component { ...@@ -369,6 +358,7 @@ export default class BalanceSheetMR extends Component {
} }
}), }),
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta);
return ( return (
<div> <div>
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
...@@ -378,7 +368,7 @@ export default class BalanceSheetMR extends Component { ...@@ -378,7 +368,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.aavpm tableMeta.rowData[11]
} }
</div> </div>
</div> </div>
...@@ -386,7 +376,7 @@ export default class BalanceSheetMR extends Component { ...@@ -386,7 +376,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.pavpm tableMeta.rowData[12]
} }
</div> </div>
</div> </div>
...@@ -398,7 +388,7 @@ export default class BalanceSheetMR extends Component { ...@@ -398,7 +388,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.aavmb tableMeta.rowData[13]
} }
</div> </div>
</div> </div>
...@@ -406,7 +396,7 @@ export default class BalanceSheetMR extends Component { ...@@ -406,7 +396,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.pavmb tableMeta.rowData[14]
} }
</div> </div>
</div> </div>
...@@ -418,7 +408,7 @@ export default class BalanceSheetMR extends Component { ...@@ -418,7 +408,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.aavrb tableMeta.rowData[15]
} }
</div> </div>
</div> </div>
...@@ -426,7 +416,7 @@ export default class BalanceSheetMR extends Component { ...@@ -426,7 +416,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.pavrb tableMeta.rowData[16]
} }
</div> </div>
</div> </div>
...@@ -467,6 +457,7 @@ export default class BalanceSheetMR extends Component { ...@@ -467,6 +457,7 @@ export default class BalanceSheetMR extends Component {
} }
}), }),
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
// console.log(tableMeta.rowData);
return ( return (
<div> <div>
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
...@@ -474,7 +465,7 @@ export default class BalanceSheetMR extends Component { ...@@ -474,7 +465,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.mtdvpm tableMeta.rowData[17]
} }
</div> </div>
</div> </div>
...@@ -482,7 +473,7 @@ export default class BalanceSheetMR extends Component { ...@@ -482,7 +473,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.mtdvmb tableMeta.rowData[18]
} }
</div> </div>
</div> </div>
...@@ -490,7 +481,7 @@ export default class BalanceSheetMR extends Component { ...@@ -490,7 +481,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null : null :
val.mtdvrb tableMeta.rowData[19]
} }
</div> </div>
</div> </div>
...@@ -499,7 +490,52 @@ export default class BalanceSheetMR extends Component { ...@@ -499,7 +490,52 @@ export default class BalanceSheetMR extends Component {
) )
} }
} }
}, }, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}
] ]
return ( return (
......
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