Commit 922d32d3 authored by Riri Novita's avatar Riri Novita

Update Stopper

parent 8d8eba06
......@@ -667,7 +667,8 @@ export default class BudgetTahunan extends Component {
"report": 'ratio',
"submissionId": this.state.submissionID,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id
"companyId": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id,
}
// console.log(bodyRatioBs);
api.create().triggerRatioMB(bodyRatioBs).then((res) => {
......@@ -725,6 +726,7 @@ export default class BudgetTahunan extends Component {
"revision": Number(this.state.lastRevision),
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id,
"submission_id": this.state.submissionID
}
api.create().getDetailReportCF(payload).then(response => {
......@@ -1350,6 +1352,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id,
"submission_id": this.state.PLID,
"currency_id": this.state.defaultCurrency.id,
"months": 0,
"quarter": 0,
}
......@@ -1811,6 +1814,7 @@ export default class BudgetTahunan extends Component {
"report_id": 28,
"status": "submitted",
"profit_loss_id": this.state.PLID,
"currency_id": this.state.defaultCurrency.id,
"profit_loss_mb": this.state.dbPL,
"months": 0,
}
......@@ -1857,6 +1861,7 @@ export default class BudgetTahunan extends Component {
"revision": Number(this.state.lastRevision),
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id,
"submission_id": this.state.submissionID,
}
api.create().getHierarkiCreateReportFRMB(payload).then(response => {
......@@ -2068,6 +2073,7 @@ export default class BudgetTahunan extends Component {
"report_id": 29,
"status": "submitted",
"ratio_id": this.state.FRID,
"currency_id": this.state.defaultCurrency.id,
"ratio_mb": this.state.dbFR,
"months": 0,
}
......
......@@ -777,6 +777,7 @@ export default class FixedAssetsMovementMR extends Component {
}
const handleVariance = (tableMeta, dex, type) => {
console.log(tableMeta);
let total = 0
// if (dex === 1) {
// total = Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[9]) == NaN? "0.0" : Number(tableMeta.rowData[8]) - Number(tableMeta.rowData[9])
......
......@@ -737,7 +737,8 @@ export default class MonthlyReport extends Component {
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
"months": this.state.month.month_id,
"currency_id": this.state.defaultCurrency.id
}
api.create().triggerHistoricalRatio(bodyRatioLocf).then((res) => {
console.log(res)
......@@ -749,7 +750,8 @@ export default class MonthlyReport extends Component {
"monthlyReportId": this.state.monthlyReportId,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"months": this.state.month.month_id
"months": this.state.month.month_id,
"currency_id": this.state.defaultCurrency.id
}
api.create().triggerRatioFromLOCF(bodyRatioBs).then((res) => {
console.log(res)
......@@ -1537,7 +1539,8 @@ export default class MonthlyReport extends Component {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id
"company_id": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id
}
console.log(payloadID);
api.create().getPLID(payloadID).then(response => {
......@@ -1555,7 +1558,8 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"quarter": 0,
"report_id": 28,
"submission_id": this.state.PLID
"submission_id": this.state.PLID,
"currency_id": this.state.defaultCurrency.id
}
api.create().getHierarkiCreateReportPLMR(payload).then((response) => {
......@@ -1950,7 +1954,8 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"quarter": 0,
"profit_loss_id": this.state.PLID,
"profit_loss_mr": this.state.dbPL
"profit_loss_mr": this.state.dbPL,
"currency_id": this.state.defaultCurrency.id
}
api.create().createReportPLMR(payload).then((res) => {
console.log(res)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -420,19 +420,23 @@ export default class ProfitLossMR extends Component {
this.props.saveToMonthlyReport()
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
this.props.saveToMonthlyReport()
})
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
this.props.saveToMonthlyReport()
})
}
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
this.setState({ alert: true, messageAlert: "Error saving data. Please try again", tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
}
})
}
......@@ -482,6 +486,7 @@ export default class ProfitLossMR extends Component {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
console.log(this.props.monthlyReportId);
api.create().checkUploadMonthlyReportPL(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
......@@ -594,14 +599,18 @@ export default class ProfitLossMR extends Component {
// this.props.onClickClose()
// this.props.getReport()
} else {
this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
// alert(response.data.status)
}
} else {
......@@ -665,9 +674,9 @@ export default class ProfitLossMR extends Component {
"currency_id": this.props.defaultCurrency.id,
"profit_loss": data
}
// console.log(JSON.stringify(payload));
console.log(JSON.stringify(payload));
api.create().validateSubmitReportPL(payload).then((response) => {
console.log(response.data.data.result)
console.log(response)
console.log(err);
if (response.data) {
if (response.data.status === "success") {
......@@ -2472,7 +2481,7 @@ export default class ProfitLossMR extends Component {
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false })}
onClick={() => this.setState({ visibleAlertSave: false, loading: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
......
import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, createMuiTheme, withStyles, Checkbox, MuiThemeProvider } from '@material-ui/core';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, createMuiTheme, withStyles, Checkbox, MuiThemeProvider, Snackbar } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import Images from '../../assets/Images';
import OperatingIndicatorDetail from './OperatingIndicatorDetail'
......@@ -15,6 +15,7 @@ import OperatingIndicatorMR from '../MonthlyReport/OperatingIndicatorMR';
import OperatingIndicatorRO from '../RollingOutlook/OperatingIndicatorRO';
import { PhotoSizeSelectLargeTwoTone, ThreeSixty } from '@material-ui/icons';
import { startTransition } from 'react';
import { PropagateLoader } from 'react-spinners';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -46,6 +47,7 @@ export default class OperatingIndicator extends Component {
listPeriode: null,
periode: null,
month: null,
loading: false,
quartal: null,
listCompany: null,
company: null,
......@@ -66,7 +68,21 @@ export default class OperatingIndicator extends Component {
isCheckAll: false,
downloadedFileReportId: null,
arrayReport: [],
popupDownload: false
popupDownload: false,
defaultCurrency: null,
dataCurrency: [],
currency: [],
visibleAlertSave: false,
dataCurrency: [
{
"id": 1,
"value": "IDR"
},
{
"id": 2,
"value": "USD",
}
]
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -136,6 +152,7 @@ export default class OperatingIndicator extends Component {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"report_type": "operating indicator",
"currency_id": this.state.defaultCurrency.id
}
console.log(payload);
api.create().getAllOperatingInd(payload).then(response => {
......@@ -243,6 +260,7 @@ export default class OperatingIndicator extends Component {
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : arrayBaru[0] }, () => {
this.getLastPeriod()
this.getCurrency(this.state.company.company_id)
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -260,6 +278,51 @@ export default class OperatingIndicator extends Component {
})
}
getCurrency(companyID) {
console.log(companyID);
api.create().getDetailPerusahaan(companyID).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
let data = response.data.data
let datas = []
if (response.data.data.currency.length > 0) {
response.data.data.currency.map((item) => {
// console.log(item);
datas.push({
id: item.currencyId,
value: item.currencyName
})
})
}
let index = datas.findIndex((val) => val.id == response.data.data.default_currency)
this.setState({
defaultCurrencyID: response.data.data.default_currency,
currency: datas,
defaultCurrency: index == -1 ? null : datas[index]
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
......@@ -316,9 +379,9 @@ export default class OperatingIndicator extends Component {
// console.log(response.data.data)
this.getLatestPeriodSubmit()
if (response.data.data) {
this.setState({ operatingIndID: response.data.data.operating_indicator_id })
this.setState({ operatingIndID: response.data.data.operating_indicator_id, loading: false })
} else {
this.setState({ operatingIndID: null })
this.setState({ operatingIndID: null, loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -474,8 +537,24 @@ export default class OperatingIndicator extends Component {
saveOperatingInd(payload) {
api.create().createOpetaingInd(payload).then((response) => {
console.log(response);
this.getReport()
this.getOperatingID()
if (response.data) {
if (response.data.status === "success") {
this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true, loading: false }, () =>
this.getOperatingID(),
this.getReport()
)
} else {
if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
}
} else {
this.setState({ alert: true, messageAlert: "Error saving data. Please try again", tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
}
})
}
......@@ -578,7 +657,7 @@ export default class OperatingIndicator extends Component {
// }
async handleGenerateReport(data) {
let { selectReport, operatingIndID, company, periode, downloadedFileReportId } = this.state
let { selectReport, operatingIndID, company, periode, downloadedFileReportId, defaultCurrency } = this.state
if (selectReport.length > 0) {
let result = []
console.log('mulai hit')
......@@ -603,10 +682,10 @@ export default class OperatingIndicator extends Component {
String(report[1]).toLocaleLowerCase().includes('dec') ? 12 : null
if (String(report[1]).toLocaleLowerCase().includes('master budget')) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
)
if (res.status === 200) {
......@@ -614,9 +693,9 @@ export default class OperatingIndicator extends Component {
}
} else if (String(report[1]).toLocaleLowerCase().includes('monthly report')) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&months=${month}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
)
if (res.status === 200) {
......@@ -624,9 +703,9 @@ export default class OperatingIndicator extends Component {
}
} else if (String(report[1]).toLocaleLowerCase().includes('rolling outlook')) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID == null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${operatingIndID === null ? "" : operatingIndID}&&report_id=${report[3]}&&company_id=${company.company_id}&&year=${periode.periode}&&quartal=${quarter}&&download_file_report_id=${downloadedFileReportId}&&currency_id=${defaultCurrency.id}`
)
if (res.status === 200) {
......@@ -872,8 +951,27 @@ export default class OperatingIndicator extends Component {
{ value: '0', label: '0' },
{ value: '1', label: '1' },
]
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={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.loading && loadingComponent}
{this.state.visibleOperatingIndicator && (
<div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
......@@ -885,11 +983,11 @@ export default class OperatingIndicator extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Operating Indicator</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<div style={{ display: 'flex' }}>
<Autocomplete
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true }, () => {
this.getOperatingID()
// this.getReportAttachment()
})}
......@@ -900,13 +998,28 @@ export default class OperatingIndicator extends Component {
renderInput={(params) => <TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode}
/>
<Autocomplete
id="tipe"
disableClearable
options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
// onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue })}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue, loading: true }, () => {
this.getOperatingID()
})}
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Currency" margin="normal" style={{ marginTop: 7, marginLeft: 20 }} />}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listCompany}
id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
onChange={(event, newInputValue) => this.setState({ company: newInputValue, loading: true }, () => {
this.getOperatingID()
this.getCurrency(newInputValue.company_id)
// this.getReportAttachment()
})}
clearOnEscape
......@@ -983,6 +1096,8 @@ export default class OperatingIndicator extends Component {
data={this.state.dataDetail}
height={this.props.height}
width={this.props.width}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
onClickClose={() => this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID()
this.forceUpdate()
......@@ -1001,6 +1116,8 @@ export default class OperatingIndicator extends Component {
width={this.props.width}
months={this.state.months}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
onClickClose={() => this.setState({ visibleDetailMonthly: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID()
this.forceUpdate()
......@@ -1020,6 +1137,8 @@ export default class OperatingIndicator extends Component {
width={this.props.width}
quartal={this.state.quartal}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
onClickClose={() => this.setState({ visibleDetailRolling: false, visibleOperatingIndicator: true }, () => {
this.getOperatingID()
this.forceUpdate()
......@@ -1093,6 +1212,42 @@ export default class OperatingIndicator extends Component {
</div>
</div>
)}
{this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false})}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
</div >
);
}
......
......@@ -10,12 +10,16 @@ import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
// import { Alert } from '@material-ui/lab';
import Constant from '../../library/Constant';
import MuiAlert from '@material-ui/lab/Alert';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
const options = ct.customOptionsFixedColumn();
const style = {
position: "sticky",
......@@ -60,7 +64,12 @@ export default class BalanceSheet extends Component {
emptyData: false,
updateBy: [],
notesUpdate: '-',
templateNull: true
templateNull: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false,
alert: false,
tipeAlert: '',
messageAlert: '',
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -105,12 +114,13 @@ export default class BalanceSheet extends Component {
}
getDataDetail() {
this.setState({ loading: true })
// this.setState({ loading: true })
let payload = {
"operating_indicator_id": this.props.data.operatingIndID,
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode
"periode": this.props.data.periode,
"currency_id": this.props.defaultCurrency.id,
}
console.log(payload)
api.create().getOperatingIndDetail(payload).then(response => {
......@@ -229,6 +239,7 @@ export default class BalanceSheet extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"master_budget": payloadMB
}
......@@ -236,7 +247,8 @@ export default class BalanceSheet extends Component {
// // console.log('=========================')
// console.log(JSON.stringify(payload))
this.props.saveOperatingInd(payload)
this.props.onClickClose()
this.setState({ loading: false })
// this.props.onClickClose()
}
handleValue(data) {
......@@ -265,42 +277,6 @@ export default class BalanceSheet extends Component {
}
}
backToMasterBudget(type) {
let data = []
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
})
})
// let payload = {
// "submission_id": this.props.submissionID,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "status": type,
// "balance_sheet": data
// }
// // // // console.log(data);
// this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
downloadTemplate = async () => {
let res = await fetch(
......@@ -389,8 +365,12 @@ export default class BalanceSheet extends Component {
}
checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
// // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadOperatingInd(this.state.payload).then(response => {
api.create().checkUploadOperatingInd(payload).then(response => {
// // // console.log(JSON.stringify(this.state.payload));
// // console.log('===============')
console.log(response)
......@@ -466,20 +446,27 @@ export default class BalanceSheet extends Component {
operating_indicator_id: this.props.data.operatingIndID,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
currency_id: this.props.defaultCurrency.id,
status: type,
master_budget: data
}
// // console.log(data);
// // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadOperatingInd(body).then(response => {
// // console.log(response);
console.log(response);
this.setState({ loading: false })
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
console.log(response.data.message);
if (response.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
// alert(response.data.status)
}
} else {
alert(response.problem)
......@@ -1879,42 +1866,23 @@ export default class BalanceSheet extends Component {
)
}
}
},{
name: `31 Dec ${Number(this.props.data.periode)+1}\nTotal`,
}, {
name: `31 Dec ${Number(this.props.data.periode) + 1}\nTotal`,
// name: `31 Dec 2023\nTotal`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null
:
tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
}
/>
</div>
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1925,19 +1893,82 @@ export default class BalanceSheet extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
}, {
name: `31 Dec ${Number(this.props.data.periode) + 2}\nTotal`,
// name: `31 Dec 2024\nTotal`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null
:
tableMeta.rowData[0] == 2 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1945,43 +1976,18 @@ export default class BalanceSheet extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
}
},{
name: `31 Dec ${Number(this.props.data.periode)+2}\nTotal`,
// name: `31 Dec 2024\nTotal`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
null
</div>
:
tableMeta.rowData[0] == 2 ?
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1992,66 +1998,47 @@ export default class BalanceSheet extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>
:
(tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
}
/>
</div>)
}
</div>
)
}
},
}
},
{
name: "",
options: {
......@@ -2378,21 +2365,60 @@ export default class BalanceSheet extends Component {
</button>
</div>
</div>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MASTER BUDGET - OPERATING INDICATOR" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
<div style={{ padding: '25px 30px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MASTER BUDGET - OPERATING INDICATOR" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
</div>
<div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
</div>
</div>
)}
{this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div>
</div>
)}
......
......@@ -625,7 +625,8 @@ export default class OutlookPA extends Component {
"report": 'ratio',
"outlookPaId": this.state.outlook_pa_id,
"companyId": this.state.company.company_id,
"periode": this.state.periode.periode
"periode": this.state.periode.periode,
"currency_id": this.state.defaultCurrency.id,
}
api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
console.log(res)
......@@ -993,7 +994,8 @@ export default class OutlookPA extends Component {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id
"company_id": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id,
}
console.log(payloadID);
api.create().getPLID(payloadID).then(response => {
......@@ -1010,6 +1012,7 @@ export default class OutlookPA extends Component {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id,
"outlook_pa_id": this.state.PLID,
"currency_id": this.state.defaultCurrency.id,
}
api.create().getHierarkiDBPLOLPA(payload).then(response => {
// console.log(response);
......@@ -1470,6 +1473,7 @@ export default class OutlookPA extends Component {
"status": "submitted",
"profit_loss_id": this.state.PLID,
"profit_loss_olpa": this.state.dbPL,
"currency_id": this.state.defaultCurrency.id,
}
console.log(this.state.dbPL)
// console.log(JSON.stringify(payload))
......
......@@ -52,7 +52,12 @@ export default class OperatingIndicatorRO extends Component {
judulColumn: null,
saveDraft: true,
viewOnly: true,
get_for: 'view'
get_for: 'view',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false,
alert: false,
tipeAlert: '',
messageAlert: '',
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -152,7 +157,8 @@ export default class OperatingIndicatorRO extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"quartal": this.props.quartal,
"get_for": this.state.get_for
"get_for": this.state.get_for,
"currency_id": this.props.defaultCurrency.id,
}
console.log(payload)
api.create().getHierarkiRollingOI(payload).then(response => {
......@@ -274,6 +280,7 @@ export default class OperatingIndicatorRO extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"quartal": this.props.quartal,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"rolling_outlook": payloadRO
}
......
......@@ -331,7 +331,8 @@ export default class RollingOutlook extends Component {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"report_type": "Rolling Outlook",
"quartal": this.state.quarter.value
"quartal": this.state.quarter.value,
"currency_id": this.state.defaultCurrency.id
}
let dataHardcode = []
api.create().getRollingOutlookReport(payload).then(response => {
......@@ -659,7 +660,8 @@ export default class RollingOutlook extends Component {
"rollingOutlookId": this.state.rollingOutlookID,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"quartal": this.state.quarter.value
"quartal": this.state.quarter.value,
"currency_id": this.state.defaultCurrency.id
}
api.create().triggerRatioRO(bodyRatioBs).then((res) => {
console.log(res)
......@@ -1017,7 +1019,8 @@ export default class RollingOutlook extends Component {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id
"company_id": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id
}
console.log(payloadID);
api.create().getPLID(payloadID).then(response => {
......@@ -1035,6 +1038,7 @@ export default class RollingOutlook extends Component {
"company_id": this.state.company.company_id,
"quartal": this.state.quarter.value,
"rolling_outlook_id": this.state.PLID,
"currency_id": this.state.defaultCurrency.id
}
api.create().getHierarkiDBPLRO(payload).then(response => {
// console.log(response);
......@@ -1496,6 +1500,7 @@ export default class RollingOutlook extends Component {
"profit_loss_id": this.state.PLID,
"profit_loss_ro": this.state.dbPL,
"quartal": this.state.quarter.value,
"currency_id": this.state.defaultCurrency.id
}
console.log(this.state.dbPL)
// console.log(JSON.stringify(payload))
......
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