Commit 3b2e5ca5 authored by EKSAD's avatar EKSAD

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

parents ce343f1d 1c026c14
...@@ -199,14 +199,16 @@ const create = (type = "") => { ...@@ -199,14 +199,16 @@ const create = (type = "") => {
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body) const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
const getMonthTransaction = () => api.get('transaction/get_default_month') const getMonthTransaction = () => api.get('transaction/get_default_month')
const countingFormula = (body) => api.post('transaction/counting_formula', body) const countingFormula = (body) => api.post('transaction/counting_formula', body)
const submitMasterBudget = (body) => api.post('transaction/master_budget/submit_master_budget', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body) const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_operating_indicator_report_hierarki', body) const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_operating_indicator_report_hierarki', body)
const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_submission_report', body) const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_submission_report', body)
const checkUploadOperatingInd = (body) => api.post('transaction/operating_indicator/check_import', body) const checkUploadOperatingInd = (body) => api.post('transaction/operating_indicator/check_import', body)
const uploadOperatingInd = (body) => api.post('transaction/operating_indicator/import_operating_indicator', body) const uploadOperatingInd = (body) => api.post('transaction/operating_indicator/import_operating_indicator', body)
const getDashboard = (body) => api.get('transaction/master_budget/get_dashboard')
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -352,7 +354,10 @@ const create = (type = "") => { ...@@ -352,7 +354,10 @@ const create = (type = "") => {
checkUploadOperatingInd, checkUploadOperatingInd,
uploadOperatingInd, uploadOperatingInd,
getLastestUpdateMB, getLastestUpdateMB,
countingFormula countingFormula,
submitMasterBudget,
getIdDeleteFromExcel,
getDashboard
} }
} }
......
...@@ -17,6 +17,7 @@ import { format } from 'date-fns'; ...@@ -17,6 +17,7 @@ import { format } from 'date-fns';
import Constant from '../library/Constant'; import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader" import PropagateLoader from "react-spinners/PropagateLoader"
import CashFlow from './BudgetTahunan/CashFlow'; import CashFlow from './BudgetTahunan/CashFlow';
import { validate } from '@material-ui/pickers';
var ct = require("../library/CustomTable"); var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -289,7 +290,7 @@ export default class BudgetTahunan extends Component { ...@@ -289,7 +290,7 @@ export default class BudgetTahunan extends Component {
visibleTP: false, visibleTP: false,
visibleCF: false, visibleCF: false,
}) })
} else if (item === "Cash Flow"){ } else if (item === "Cash Flow") {
this.setState({ this.setState({
visibleBudgetTahunan: false, visibleBudgetTahunan: false,
visibleBS: false, visibleBS: false,
...@@ -372,6 +373,21 @@ export default class BudgetTahunan extends Component { ...@@ -372,6 +373,21 @@ export default class BudgetTahunan extends Component {
}) })
} }
validate() {
let array = []
this.state.dataTable.map(item => {
if (item[3].includes("not-yet") || item[3].includes("draft")) {
array.push(item[3])
} else {
array.push(item[3])
}
})
if (array.includes("not-yet" || "draft")) {
console.log('gagal');
} else {
console.log('masuk');
}
}
render() { render() {
const columns = ["#", "Report Type", const columns = ["#", "Report Type",
...@@ -606,9 +622,19 @@ export default class BudgetTahunan extends Component { ...@@ -606,9 +622,19 @@ export default class BudgetTahunan extends Component {
</div> </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' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
>
<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' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div> </div>
</button>
</div> </div>
</Paper> </Paper>
......
...@@ -284,6 +284,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -284,6 +284,19 @@ export default class CorporateAnnualTarget extends Component {
} }
checkUpload() { checkUpload() {
let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
if (response.data) {
let idDelete = response.data.data.item_report_id
if (idDelete.length > 0) {
idDelete.map((item,index) => {
dataDelete.push(item)
})
this.setState({dataDelete})
}
}
})
api.create().checkUploadMB(this.state.payload).then(response => { 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) console.log(response)
...@@ -343,11 +356,24 @@ export default class CorporateAnnualTarget extends Component { ...@@ -343,11 +356,24 @@ export default class CorporateAnnualTarget extends Component {
} }
uploadCAT(type) { uploadCAT(type) {
let payload = {"item_report_id": this.state.dataDelete}
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
this.functionUpload(type)
})
} else {
this.functionUpload(type)
}
}
functionUpload(type) {
let data = [] let data = []
console.log(this.state.dataTable) console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
"item_report_id": i[0], "item_report_id": i[1],
"item_report": String(i[6]), "item_report": String(i[6]),
"weight": String(i[7]), "weight": String(i[7]),
"uom": String(i[8]), "uom": String(i[8]),
...@@ -534,6 +560,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -534,6 +560,7 @@ export default class CorporateAnnualTarget extends Component {
// }) // })
}) })
} else { } else {
console.log('sini jing')
// api.create().validateSubmitReport(payloadBro).then((response) => { // api.create().validateSubmitReport(payloadBro).then((response) => {
// console.log(response) // console.log(response)
// if (response.data.data.result) { // if (response.data.data.result) {
...@@ -732,7 +759,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -732,7 +759,7 @@ export default class CorporateAnnualTarget extends Component {
const handleAction = (idParent) => { const handleAction = (idParent) => {
if (idParent !== null) { if (idParent !== null) {
let indexsss = dataTable2.findIndex((val) => val[1] == idParent) let indexsss = dataTable2.findIndex((val) => val[1] == idParent)
if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL PERSPECTIVE') { if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
return true return true
} else { } else {
return false return false
...@@ -1901,7 +1928,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1901,7 +1928,7 @@ export default class CorporateAnnualTarget extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleCAT? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}> {this.state.visibleCAT? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget Submission - Corporate Annual Target</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Corporate Annual Target</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
...@@ -2068,6 +2095,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2068,6 +2095,7 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
......
...@@ -89,7 +89,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -89,7 +89,7 @@ export default class FixedAssetsMovement extends Component {
} }
// console.log(payload); // console.log(payload);
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
console.log(response); // console.log(response);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
...@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component {
item.fixed_asset_movement.december, item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year, item.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year, item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year item.fixed_asset_movement.total_more_year,
item.order
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -152,7 +153,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -152,7 +153,8 @@ export default class FixedAssetsMovement extends Component {
item.fixed_asset_movement.december, item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year, item.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year, item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year item.fixed_asset_movement.total_more_year,
item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -329,6 +331,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -329,6 +331,7 @@ export default class FixedAssetsMovement extends Component {
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.order,
item.error item.error
] ]
}) })
...@@ -346,7 +349,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -346,7 +349,7 @@ export default class FixedAssetsMovement extends Component {
}) })
} }
uploadFAM() { uploadFAM(type) {
let data = [] let data = []
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
...@@ -374,7 +377,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -374,7 +377,8 @@ export default class FixedAssetsMovement extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
fixed_asset_movement: data fixed_asset_movement: data,
status: type
} }
console.log(data); console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
...@@ -500,7 +504,69 @@ export default class FixedAssetsMovement extends Component { ...@@ -500,7 +504,69 @@ export default class FixedAssetsMovement extends Component {
// console.log(indexParent); // console.log(indexParent);
return a return a
} }
const handleFormula = (data, tableMeta) => { const handleFormula = (data, tableMeta, month) => {
let rilFormula = String(tableMeta.rowData[3])
if (rilFormula.includes("#")) {
if (this.props.status === "not-yet") {
let splitOrder = String(tableMeta.rowData[3]).split('@')
for (let index = 0; index < splitOrder.length; index++) {
if (splitOrder[index] === "") {
} else {
if (splitOrder[index].includes('#')) {
} else {
let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let reg = /^\d+$/
splitOperator.map((item) => {
if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item)
if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
}
}
})
}
}
}
let body = {
"submission_id": null,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response);
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
return response.data.data.result
}, 2000);
}
}
})
} else {
let body = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
return response.data.data.result
}, 2000);
}
}
})
}
} else {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
...@@ -542,7 +608,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -542,7 +608,7 @@ export default class FixedAssetsMovement extends Component {
}) })
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a return a
}
} }
const columns = [{ const columns = [{
name: "", name: "",
...@@ -581,6 +647,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -581,6 +647,7 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{/* {console.log(tableMeta.rowData)} */}
{tableMeta.rowData[22] ? {tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ? tableMeta.rowData[22].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
...@@ -691,15 +758,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -691,15 +758,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -780,15 +846,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -780,15 +846,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -869,15 +934,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -869,15 +934,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 3)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -958,15 +1022,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -958,15 +1022,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 4)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1047,15 +1110,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1047,15 +1110,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 5)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1136,15 +1198,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1136,15 +1198,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 6)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1225,15 +1286,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1225,15 +1286,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 7)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1314,15 +1374,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1314,15 +1374,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 8)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1403,15 +1462,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1403,15 +1462,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 9)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1492,15 +1550,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1492,15 +1550,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 10)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1581,15 +1638,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1581,15 +1638,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1670,15 +1726,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1670,15 +1726,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1797,15 +1852,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1797,15 +1852,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -1886,15 +1940,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -1886,15 +1940,14 @@ export default class FixedAssetsMovement extends Component {
null null
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
// <NumberFormat <NumberFormat
// thousandSeparator={true} thousandSeparator={true}
// style={{ 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" type="text"
// placeholder="" placeholder=""
// disabled={true} disabled={true}
// value={handleFormula(value, tableMeta)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
// /> />
null
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
// <NumberFormat // <NumberFormat
...@@ -2046,7 +2099,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -2046,7 +2099,7 @@ export default class FixedAssetsMovement extends Component {
}, 100); }, 100);
})} })}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
...@@ -2071,8 +2124,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -2071,8 +2124,8 @@ export default class FixedAssetsMovement extends Component {
}) })
}} }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
<button <button
...@@ -2159,7 +2212,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -2159,7 +2212,7 @@ export default class FixedAssetsMovement extends Component {
})} })}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
...@@ -2182,8 +2235,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -2182,8 +2235,8 @@ export default class FixedAssetsMovement extends Component {
}) })
}} }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
<button <button
......
...@@ -121,7 +121,8 @@ export default class TaxPlanning extends Component { ...@@ -121,7 +121,8 @@ export default class TaxPlanning extends Component {
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf}, {tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf},
item.tax_planning.total_current_year, item.tax_planning.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf}, {tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf} {tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf},
item.order
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -158,7 +159,8 @@ export default class TaxPlanning extends Component { ...@@ -158,7 +159,8 @@ export default class TaxPlanning extends Component {
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf}, {tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf},
item.tax_planning.total_current_year, item.tax_planning.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf}, {tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf} {tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf},
item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -800,7 +802,7 @@ export default class TaxPlanning extends Component { ...@@ -800,7 +802,7 @@ export default class TaxPlanning extends Component {
let reg = /^\d+$/ let reg = /^\d+$/
splitOperator.map((item) => { splitOperator.map((item) => {
if (reg.test(item) === true) { if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item) let i = dataTable2.findIndex((val) => val[24] == item)
if (i > 0) { if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex]) rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
} }
...@@ -846,7 +848,7 @@ export default class TaxPlanning extends Component { ...@@ -846,7 +848,7 @@ export default class TaxPlanning extends Component {
let arrayFormula = kondisi.match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = kondisi.match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[23] == item) let index = dataTable2.findIndex((val) => val[24] == item)
if (index > 0) { if (index > 0) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex]) arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else { } else {
......
...@@ -282,9 +282,11 @@ export default class EditManagementDoc extends Component { ...@@ -282,9 +282,11 @@ export default class EditManagementDoc extends Component {
const formData = new FormData(); const formData = new FormData();
if (this.state.file == this.state.filePath){ if (this.state.file == this.state.filePath){
formData.append("updated", 0); formData.append("updated", 0);
} formData.append("file", null);
} else {
formData.append("updated", 1); formData.append("updated", 1);
formData.append("file", this.state.file); formData.append("file", this.state.file);
}
formData.append("companyId", this.state.getPerusahaan.company_id); formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("settingId", this.state.getDocument.document_category_id); formData.append("settingId", this.state.getDocument.document_category_id);
formData.append("documentMonth", this.state.monthId.month_id); formData.append("documentMonth", this.state.monthId.month_id);
...@@ -295,7 +297,12 @@ export default class EditManagementDoc extends Component { ...@@ -295,7 +297,12 @@ export default class EditManagementDoc extends Component {
this.setState({ formData }, () => { this.setState({ formData }, () => {
this.props.updateDocument(this.state.formData) this.props.updateDocument(this.state.formData)
}) })
console.log(JSON.stringify(formData)) var object = {};
formData.forEach(function(value, key){
object[key] = value;
});
var json = JSON.stringify(object);
console.log(json)
} }
} }
......
...@@ -13,7 +13,8 @@ class HomePage extends Component { ...@@ -13,7 +13,8 @@ class HomePage extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
userData: null userData: null,
listDashboard: []
} }
} }
...@@ -28,10 +29,24 @@ class HomePage extends Component { ...@@ -28,10 +29,24 @@ class HomePage extends Component {
} }
} }
}) })
this.getDashboard()
}
getDashboard() {
let listDashboard = []
api.create().getDashboard().then((response) => {
if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data
data.map((item,index) => {
listDashboard.push([index+1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status])
})
this.setState({listDashboard})
}
})
} }
render() { render() {
const columns = ["#", "Nama Perusahaan", "Revisi", "Status", { const columns = ["#", "ID", "Nama Perusahaan", "Jenis Report", "Revisi", "Status", {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
...@@ -123,7 +138,7 @@ class HomePage extends Component { ...@@ -123,7 +138,7 @@ class HomePage extends Component {
<div> <div>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={data} data={this.state.listDashboard}
columns={columns} columns={columns}
options={options} options={options}
/> />
......
...@@ -2,7 +2,6 @@ import React, { Component } from 'react'; ...@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core';
import MUIDataTable from 'mui-datatables'; import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images'; import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet';
import api from '../api'; import api from '../api';
import Autocomplete from '@material-ui/lab/Autocomplete'; import Autocomplete from '@material-ui/lab/Autocomplete';
import { titleCase } from '../library/Utils'; import { titleCase } from '../library/Utils';
...@@ -13,6 +12,7 @@ import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget'; ...@@ -13,6 +12,7 @@ import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../library/Upload"; import UploadFile from "../library/Upload";
import { format } from 'date-fns'; import { format } from 'date-fns';
import BalanceSheetMR from './MonthlyReport/BalanceSheetMR';
export default class MonthlyReport extends Component { export default class MonthlyReport extends Component {
constructor(props) { constructor(props) {
...@@ -161,8 +161,12 @@ export default class MonthlyReport extends Component { ...@@ -161,8 +161,12 @@ export default class MonthlyReport extends Component {
}) })
} }
clickDetail(item, id) { clickDetail(item, id, revision, status) {
this.setState({ report_id: id }) this.setState({
report_id: id,
revisionTable: revision,
status: status
}, () => {
if (item === 'Balance Sheet') { if (item === 'Balance Sheet') {
this.setState({ this.setState({
visibleMonthlyReport: false, visibleMonthlyReport: false,
...@@ -209,6 +213,7 @@ export default class MonthlyReport extends Component { ...@@ -209,6 +213,7 @@ export default class MonthlyReport extends Component {
visibleTP: false visibleTP: false
}) })
} }
})
} }
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
...@@ -312,9 +317,9 @@ export default class MonthlyReport extends Component { ...@@ -312,9 +317,9 @@ export default class MonthlyReport extends Component {
cursor: tableMeta.rowData[5] ? 'pointer' : null, cursor: tableMeta.rowData[5] ? 'pointer' : null,
borderColor: 'transparent' borderColor: 'transparent'
}} }}
// onClick={() => onClick={() =>
// tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4]) : null tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) : null
// } }
> >
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
</button> </button>
...@@ -530,10 +535,18 @@ export default class MonthlyReport extends Component { ...@@ -530,10 +535,18 @@ export default class MonthlyReport extends Component {
)} )}
{this.state.visibleBS && ( {this.state.visibleBS && (
<BalanceSheet <BalanceSheetMR
open={this.props.open}
report_id={this.state.report_id} report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company} company={this.state.company}
onClickClose={() => this.setState({ visibleBS: false, visibleMonthlyReport: true })} revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
// saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
// getReport={this.getCompanyActive.bind(this)}
/> />
)} )}
{this.state.visiblePL && ( {this.state.visiblePL && (
......
import { createMuiTheme, MuiThemeProvider, Paper, Typography } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
const options = ct.customOptionsFixedColumn();
const style = {
position: "sticky",
left: 0,
zIndex: 101,
background: "white",
};
const style2 = {
position: "sticky",
background: "white",
zIndex: 100,
top: 0
};
export default class BalanceSheetMR extends Component {
render() {
let columns = [
"Account",
{
name: "Rolling Outlook (FY2021)",
options: {
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{val}
</div>
)
}
}
},
{
name: `Month To Date (MTD)`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */}
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid" }}>
<span>{"Master Budget (MB)"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid" }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"Actual"}</span>
</div>
</div>
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div>
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.a}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.b}
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{val.c}
</div>
</div>
</div>
</div>
)
}
}
},
{
name: "Actual Previous Month",
options: {
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{val}
</div>
)
}
}
},
{
name: `Variance`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs Previous Month"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<span>{"%"}</span>
</div>
</div>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs MB"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<span>{"%"}</span>
</div>
</div>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs RB"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<span>{"%"}</span>
</div>
</div>
</div>
</div>
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div>
<div className="grid grid-3x content-center">
<div className="col-1">
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.a}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.b}
</div>
</div>
</div>
</div>
<div className="col-2">
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.c}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.d}
</div>
</div>
</div>
</div>
<div className="col-3">
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.e}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.f}
</div>
</div>
</div>
</div>
</div>
</div>
)
}
}
},
]
let data = [
["Total Assets", "1", { a: "2", b: "3", c: "4" }, "5", { a: "6", b: "7", c: "8", d: "9", e: "10", f: "11" }],
["Total Assets", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]
]
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
</div>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={data}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
</div>
</Paper>
</div>
</div>
)
}
}
...@@ -261,6 +261,12 @@ export default class OperatingIndicator extends Component { ...@@ -261,6 +261,12 @@ export default class OperatingIndicator extends Component {
}) })
} }
saveOperatingInd(payload) {
api.create().createOpetaingInd(payload).then((response) => {
this.getReport()
})
}
render() { render() {
const columns = ["#", "Jenis Laporan", const columns = ["#", "Jenis Laporan",
// { // {
...@@ -453,6 +459,9 @@ export default class OperatingIndicator extends Component { ...@@ -453,6 +459,9 @@ export default class OperatingIndicator extends Component {
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
onClickClose={() => this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true }, this.forceUpdate())} onClickClose={() => this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true }, this.forceUpdate())}
getReport={() => this.getReport()}
saveOperatingInd={this.saveOperatingInd.bind(this)}
/> />
} }
......
...@@ -43,7 +43,7 @@ export default class BalanceSheet extends Component { ...@@ -43,7 +43,7 @@ export default class BalanceSheet extends Component {
// ["Accounts Receivable", "172,031", "97,112"], // ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"], // ["Trade Receivables - Third Party", "142,668", "77,480"],
], ],
visibleBalanceSheet: true, visibleOI: true,
disabledSave: true disabledSave: true
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
...@@ -66,9 +66,10 @@ export default class BalanceSheet extends Component { ...@@ -66,9 +66,10 @@ export default class BalanceSheet extends Component {
} }
console.log(payload) console.log(payload)
api.create().getOperatingIndDetail(payload).then(response => { api.create().getOperatingIndDetail(payload).then(response => {
console.log(response)
let dataTable = [] let dataTable = []
let res = response.data.data let res = response.data.data
console.log(res) // console.log(res)
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
...@@ -141,7 +142,7 @@ export default class BalanceSheet extends Component { ...@@ -141,7 +142,7 @@ export default class BalanceSheet extends Component {
} }
createData() { createData(type) {
let payloadMB = [] let payloadMB = []
this.state.dataTable.map((item,index) => { this.state.dataTable.map((item,index) => {
payloadMB.push({ payloadMB.push({
...@@ -167,14 +168,13 @@ export default class BalanceSheet extends Component { ...@@ -167,14 +168,13 @@ export default class BalanceSheet extends Component {
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
"status":"submitted", "status": type,
"master_budget": payloadMB "master_budget": payloadMB
} }
console.log('=========================') console.log('=========================')
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
api.create().createOpetaingInd(payload).then((response) => { this.props.saveOperatingInd(payload)
console.log(response) this.props.onClickClose()
})
} }
handleValue(data) { handleValue(data) {
...@@ -242,7 +242,7 @@ export default class BalanceSheet extends Component { ...@@ -242,7 +242,7 @@ export default class BalanceSheet extends Component {
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
) )
res = await res.blob() res = await res.blob()
console.log(res) console.log(res)
...@@ -250,7 +250,27 @@ export default class BalanceSheet extends Component { ...@@ -250,7 +250,27 @@ export default class BalanceSheet extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Template Balance Sheet.xlsx'; a.download = 'Template Master Budget Operating Indicator.xlsx';
a.click();
}
}
async downloadAllData() {
console.log('masuk')
// let bram = [this.props.submissionID,this.props.report_id,this.props.company.company_id,this.props.periode,this.props.revision]
// console.log(bram)
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/transaction/operating_indicator/export_master_budget?operating_indicator_id=&&report_id=${this.props.data.operatingIndID}&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
)
res = await res.blob()
console.log(res)
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Master Budget Operating Indicator.xlsx';
a.click(); a.click();
} }
} }
...@@ -270,46 +290,46 @@ export default class BalanceSheet extends Component { ...@@ -270,46 +290,46 @@ export default class BalanceSheet extends Component {
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), order: i[0] === undefined ? "0" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report_id: i[1] === undefined ? "0" : String(i[1]).trim(),
total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(), item_report: i[2] === undefined ? "0" : String(i[2]).trim(),
january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(), uom: i[3] === undefined ? "" : String(i[3]).trim(),
february: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(), // total_actual_before: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(), january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(), february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(), march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(), april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(), may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(), june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(), july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(), august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(), september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(), october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(), november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
total_next_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(), december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
total_more_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim() total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
}) })
} }
}) })
let body = { let body = {
company_id: this.props.company.company_id, company_id: this.props.data.company.company_id,
periode: this.props.periode, periode: this.props.data.periode,
report_id: this.props.report_id, report_id: this.props.data.report_id,
master_budget: payload master_budget: payload
} }
// console.log(JSON.stringify(body)) console.log(resp.rows[1][0])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
} }
}); });
} }
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadOperatingInd(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true }) this.setState({ visibleUpload: false, visibleOI: false, loading: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
item.type_report_id, item.type_report_id,
...@@ -318,6 +338,7 @@ export default class BalanceSheet extends Component { ...@@ -318,6 +338,7 @@ export default class BalanceSheet extends Component {
item.formula, item.formula,
item.level, item.level,
item.item_report, item.item_report,
item.uom,
item.total_actual_before, item.total_actual_before,
item.january, item.january,
item.february, item.february,
...@@ -343,33 +364,83 @@ export default class BalanceSheet extends Component { ...@@ -343,33 +364,83 @@ export default class BalanceSheet extends Component {
}) })
} }
uploadOI(type) {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"item_report": String(i[5]),
"total_actual_before": String(i[7]),
"january": String(i[8]),
"february": String(i[9]),
"march": String(i[10]),
"april": String(i[11]),
"may": String(i[12]),
"june": String(i[13]),
"july": String(i[14]),
"august": String(i[15]),
"september": String(i[16]),
"october": String(i[17]),
"november": String(i[18]),
"december": String(i[19]),
"total_current_year": String(i[20])
})
})
let body = {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
status: type,
master_budget: data
}
console.log(data);
console.log(JSON.stringify(body))
api.create('UPLOAD').uploadOperatingInd(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
}
} else {
alert(response.problem)
}
})
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
// let data = this.state.dataTable2 let total = 0
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = dataTable2[indexParent][tableMeta.columnIndex]
a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
dataTable2[tableMeta.rowIndex].map((item,index) => {
if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == ""? 0 : item
total += Number(valItem)
} }
})
dataTable2[tableMeta.rowIndex][20] = total
console.log(dataTable2[tableMeta.rowIndex])
} }
const handleValue = (data) => {
const handleValue = (value, tableMeta) => {
let val = String(value).split(",").join("")
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
if (data.rowData[1] == item[2]) { dataTable2[tableMeta.rowIndex].map((item,index) => {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == ""? 0 : item
total += Number(valItem)
} }
}) })
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2]) dataTable2[tableMeta.rowIndex][20] = total
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total) return total
// console.log(indexParent);
return a
} }
const handleFormula = (data, tableMeta) => { const handleFormula = (data, tableMeta) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
...@@ -503,13 +574,27 @@ export default class BalanceSheet extends Component { ...@@ -503,13 +574,27 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
<NumberFormat <FormControlLabel
thousandSeparator={true} style={{ margin: 0 }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // value={value}
control={
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} defaultValue={value}
color={"#5198ea"}
value={value} value={value}
disabled={true}
// onBlur={(event) => {
// console.log(event.target.value)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
// }}
/>
}
/> />
</div> </div>
) )
...@@ -540,7 +625,7 @@ export default class BalanceSheet extends Component { ...@@ -540,7 +625,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Jan 2021", name: `Jan ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -581,7 +666,7 @@ export default class BalanceSheet extends Component { ...@@ -581,7 +666,7 @@ export default class BalanceSheet extends Component {
} }
} }
, { , {
name: "Feb 2021", name: `Feb ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -621,7 +706,7 @@ export default class BalanceSheet extends Component { ...@@ -621,7 +706,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Mar 2021", name: `Mar ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -661,7 +746,7 @@ export default class BalanceSheet extends Component { ...@@ -661,7 +746,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Apr 2021", name: `Apr ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -701,7 +786,7 @@ export default class BalanceSheet extends Component { ...@@ -701,7 +786,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "May 2021", name: `May ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -741,7 +826,7 @@ export default class BalanceSheet extends Component { ...@@ -741,7 +826,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Jun 2021", name: `Jun ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -781,7 +866,7 @@ export default class BalanceSheet extends Component { ...@@ -781,7 +866,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Jul 2021", name: `Jul ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -821,7 +906,7 @@ export default class BalanceSheet extends Component { ...@@ -821,7 +906,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Aug 2021", name: `Aug ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -861,7 +946,7 @@ export default class BalanceSheet extends Component { ...@@ -861,7 +946,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Sep 2021", name: `Sep ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -901,7 +986,7 @@ export default class BalanceSheet extends Component { ...@@ -901,7 +986,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Oct 2021", name: `Oct ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -941,7 +1026,7 @@ export default class BalanceSheet extends Component { ...@@ -941,7 +1026,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Nov 2021", name: `Nov ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -981,7 +1066,7 @@ export default class BalanceSheet extends Component { ...@@ -981,7 +1066,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Dec 2021", name: `Dec ${this.props.data.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1021,7 +1106,7 @@ export default class BalanceSheet extends Component { ...@@ -1021,7 +1106,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "31 Dec 2022 Total", name: `31 Dec ${this.props.data.periode}\nTotal`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -1045,7 +1130,8 @@ export default class BalanceSheet extends Component { ...@@ -1045,7 +1130,8 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={handleValue(value, tableMeta)}
disabled={true}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1082,20 +1168,19 @@ export default class BalanceSheet extends Component { ...@@ -1082,20 +1168,19 @@ export default class BalanceSheet extends Component {
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <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> <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
</div> </div>
{this.state.loading && loadingComponent}
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBalanceSheet === true ? {this.state.visibleOI === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Operating Indicator</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Operating Indicator</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.data.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
...@@ -1136,7 +1221,7 @@ export default class BalanceSheet extends Component { ...@@ -1136,7 +1221,7 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() => this.downloadAllData()}
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
...@@ -1147,87 +1232,86 @@ export default class BalanceSheet extends Component { ...@@ -1147,87 +1232,86 @@ export default class BalanceSheet extends Component {
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider>} </MuiThemeProvider>
</div> </div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x">
<div className="col-1"> <div className="col-1">
<button <button
className="button"
type="button" type="button"
onClick={() => this.backToMasterBudget('draft')}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none'
}} }}
onClick={() =>
this.setState({ loading: true, visibleOI: true }, () => {
setTimeout(() => {
this.getDataDetail()
}, 100)
})}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
className="button"
type="button" type="button"
style={{ onClick={() =>
backgroundColor: 'transparent', this.setState({ loading: true }, () => {
cursor: 'pointer', setTimeout(() => {
borderColor: 'transparent', this.setState({ loading: false, buttonError: false })
outline: 'none', }, 100);
marginRight: 20 })
}} }
onClick={() => { style={{ marginRight: 20 }}
this.props.onClickClose()
}}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => this.setState({ loading: true }, () => {
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, disabledSave: false }) this.createData("draft")
}, 100); }, 100);
}) })}
}}
> >
<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' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div> </div>
</button> </button>
<button <button
type="button" type="button"
// disabled={this.state.disabledSave} disabled={this.state.buttonError}
onClick={() => this.createData()} onClick={() => this.setState({ loading: true }, () => {
style={{ setTimeout(() => {
backgroundColor: 'transparent', this.createData("submitted")
cursor: this.state.disabledSave === true ? 'default' : 'pointer', }, 100);
borderColor: 'transparent', })}
outline: 'none',
// marginRight: 20
}}
> >
<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' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button> </button>
</div> </div>
...@@ -1238,65 +1322,98 @@ export default class BalanceSheet extends Component { ...@@ -1238,65 +1322,98 @@ export default class BalanceSheet extends Component {
<div> <div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider>} </MuiThemeProvider>
</div> </div>
)} )}
</div> </div>
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}> <div className="grid grid-2x">
<div className="col-1">
<button <button
className="button"
type="button" type="button"
onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())} style={{
style={{ marginRight: 20 }} backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() =>
this.setState({ loading: true, visibleOI: true }, () => {
setTimeout(() => {
this.getDataDetail()
}, 100)
})}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960'}}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
</button> </button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
type="button" type="button"
disabled={this.state.buttonError == true ? true : false} onClick={() =>
onClick={() => null} this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
}, 100);
})
}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
marginRight: 20
}} }}
onClick={() => { onClick={() => this.setState({ loading: true }, () => {
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: false }) this.uploadOI("draft")
}, 100); }, 100);
}) })}
}} >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("submitted")
}, 100);
})}
> >
<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' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button> </button>
</div> </div>
</div> </div>
</div>
</Paper>} </Paper>}
</div> </div>
...@@ -1329,7 +1446,7 @@ export default class BalanceSheet extends Component { ...@@ -1329,7 +1446,7 @@ export default class BalanceSheet extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => { onUpload={() => {
this.state.judul === "MASTER BUDGET - OPERATING INDICATOR" ? this.state.judul === "OPERATING INDICATOR - MASTER BUDGET" ?
this.checkUpload() : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}} }}
......
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