Commit c800d368 authored by r.kurnia's avatar r.kurnia

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents d891d47e 6323df73
......@@ -224,6 +224,7 @@ const create = (type = "") => {
const getLastestUpdateOI = (body) => api.post('transaction/operating_indicator/get_latest_update', body)
const getLastPeriodeOI = (idCompany) => api.post(`transaction/master_budget/get_last_periode/${idCompany}`)
const getReportHierarkiPL = (body) => api.post('transaction/db_report_detail/get_report_hierarki', body)
const getReportHierarkiFR = (body) => api.post('transaction/db_ratio/get_report_hierarki', body)
//CASH FLOW
const getDetailReportCF = (body) => api.post('/transaction/cash_flow/get_report_hierarki', body)
......@@ -431,7 +432,8 @@ const create = (type = "") => {
getLastPeriodOI,
getDashboardUser,
getDetailReportCF,
getReportHierarkiPL
getReportHierarkiPL,
getReportHierarkiFR
}
}
......
......@@ -95,6 +95,8 @@ export default class BudgetTahunan extends Component {
checkApprover() {
api.create().checkApprover().then(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 }, () =>
......@@ -103,6 +105,19 @@ export default class BudgetTahunan extends Component {
this.setState({ isApprover: false, checkApprover: false }, () =>
this.getDetailUser())
}
} 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'})
}
})
}
......@@ -382,7 +397,18 @@ export default class BudgetTahunan extends Component {
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getSubmission()
})
} 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', listRevision: null, revision: null })
}
})
}
......@@ -423,10 +449,18 @@ export default class BudgetTahunan extends Component {
})
})
} else {
this.setState({ submissionID: null, loading: false }, ()=> {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', submissionID: null, loading: false }, () => {
document.body.style.overflow = 'unset';
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' })
}
})
}
......
......@@ -8,8 +8,9 @@ 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 * as R from 'ramda'
import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../library/Constant';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -23,6 +24,9 @@ const LightTooltip = withStyles((theme) => ({
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",
......@@ -50,7 +54,10 @@ export default class BalanceSheet extends Component {
handleTekTekTek: 0,
saveDraft: true,
minValue: "0",
maxValue: "0"
maxValue: "0",
alert: false,
tipeAlert: '',
messageAlert: '',
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -68,13 +75,28 @@ export default class BalanceSheet extends Component {
}
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
this.getItemHierarki()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false})
}
})
}
......@@ -92,7 +114,18 @@ export default class BalanceSheet extends Component {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -194,6 +227,10 @@ export default class BalanceSheet extends Component {
}
}
closeAlert() {
this.setState({ alert: false })
}
backToMasterBudget(type) {
let data = []
this.state.dataTable.map(i => {
......@@ -296,7 +333,6 @@ export default class BalanceSheet extends Component {
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
......@@ -341,7 +377,18 @@ export default class BalanceSheet extends Component {
})
// console.log(this.state.dataTable);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -385,11 +432,17 @@ export default class BalanceSheet extends Component {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ loading: false })
alert(response.problem)
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -446,16 +499,27 @@ export default class BalanceSheet extends Component {
}
api.create().validateSubmitReport(payload).then((response) => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
closeAlert() {
this.setState({ alert: false })
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false})
}
})
}
render() {
......
import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import { createMuiTheme, FormControlLabel, MuiThemeProvider, Paper, Snackbar, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import NumberFormat from 'react-number-format';
......@@ -7,6 +7,8 @@ import api from '../../api';
import Images from '../../assets/Images';
import * as R from 'ramda'
import { PropagateLoader } from 'react-spinners';
import Constant from '../../library/Constant';
import { Alert } from '@material-ui/lab';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -78,7 +80,10 @@ export default class CashFlow extends Component {
// console.log(JSON.stringify(payload))
api.create().getDetailReportCF(payload).then(response => {
let dataTable = []
console.log(response)
// console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
let res = response.data.data
const handlePushChild = (item) => {
dataTable.push([
......@@ -156,6 +161,22 @@ export default class CashFlow extends Component {
}
})
this.setState({ dataTable, loading: false, dataReal: res, editable: true })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -180,6 +201,10 @@ export default class CashFlow extends Component {
}
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let dataTable2 = this.state.dataTable
let loading = false
......@@ -2049,6 +2074,11 @@ export default class CashFlow extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={3000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
......
......@@ -104,12 +104,15 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
// // console.log(JSON.stringify(payload))
console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
// // console.log(response)
// // console.log(response)\
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -221,6 +224,24 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs)
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -352,9 +373,10 @@ export default class CorporateAnnualTarget extends Component {
})
// console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => {
// // // console.log(JSON.stringify(this.state.payload));
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if (response.data) {
if (response. ok) {
if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false })
......@@ -428,7 +450,21 @@ export default class CorporateAnnualTarget extends Component {
})
// // // console.log(this.state.dataTable);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -493,14 +529,25 @@ export default class CorporateAnnualTarget extends Component {
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
alert(response.problem)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
......@@ -746,7 +793,6 @@ export default class CorporateAnnualTarget extends Component {
}, 1000);
}
})
// alert(response.data.message)
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
......
......@@ -278,7 +278,8 @@ export default class SubHolding extends Component {
})
} else if (this.state.report.value === 2) {
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
console.log(payload);
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -449,6 +450,93 @@ export default class SubHolding extends Component {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
} else if (this.state.report.value === 4) {
api.create().getReportHierarkiFR(payload).then(response => {
// console.log(payload);
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.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
Number(item.ratio.january).toFixed(1),
Number(item.ratio.february).toFixed(1),
Number(item.ratio.march).toFixed(1),
Number(item.ratio.april).toFixed(1),
Number(item.ratio.may).toFixed(1),
Number(item.ratio.june).toFixed(1),
Number(item.ratio.july).toFixed(1),
Number(item.ratio.august).toFixed(1),
Number(item.ratio.september).toFixed(1),
Number(item.ratio.october).toFixed(1),
Number(item.ratio.november).toFixed(1),
Number(item.ratio.december).toFixed(1),
Number(item.ratio.total_current_year).toFixed(1),
Number(item.ratio.total_next_year).toFixed(1),
Number(item.ratio.total_more_year).toFixed(1),
item.order,
item.condition_it_should_be,
item.condition_if_wrong
])
}
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.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
Number(item.ratio.january).toFixed(1),
Number(item.ratio.february).toFixed(1),
Number(item.ratio.march).toFixed(1),
Number(item.ratio.april).toFixed(1),
Number(item.ratio.may).toFixed(1),
Number(item.ratio.june).toFixed(1),
Number(item.ratio.july).toFixed(1),
Number(item.ratio.august).toFixed(1),
Number(item.ratio.september).toFixed(1),
Number(item.ratio.october).toFixed(1),
Number(item.ratio.november).toFixed(1),
Number(item.ratio.december).toFixed(1),
Number(item.ratio.total_current_year).toFixed(1),
Number(item.ratio.total_next_year).toFixed(1),
Number(item.ratio.total_more_year).toFixed(1),
item.order,
item.condition_it_should_be,
item.condition_if_wrong
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
}
......@@ -463,7 +551,7 @@ export default class SubHolding extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report DB Balance Sheet.xlsx';
a.download = 'Report DB Profit & Loss Detail.xlsx';
a.click();
}
} else if (this.state.report.value === 2) {
......@@ -479,7 +567,7 @@ export default class SubHolding extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report DB Profit & Loss Detail.xlsx';
a.download = 'Report DB Balance Sheet.xlsx';
a.click();
}
} else if (this.state.report.value === 3) {
......@@ -495,6 +583,19 @@ export default class SubHolding extends Component {
a.download = 'Report DB Profit & Loss.xlsx';
a.click();
}
} else if (this.state.report.value === 4) {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/db_report_detail/export_master_budget?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.lastRevision}`
)
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 = 'Report DB Financial Ratio.xlsx';
a.click();
}
} else {
setTimeout(() => {
this.setState({ loading: false })
......
This diff is collapsed.
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