Commit 16fdd7e0 authored by Deni Rinaldi's avatar Deni Rinaldi

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

parents 500da2f9 8c6e3f42
......@@ -275,9 +275,11 @@ const create = (type = "") => {
const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
const checkUploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/check_import', body)
const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body)
const checkUploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/check_import', body)
const uploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/import_monthly_report', body)
const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body)
const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
......@@ -492,12 +494,14 @@ const create = (type = "") => {
getHierarkiMontlyReportCAT,
checkUploadMonthlyReportTP,
checkUploadMonthlyReportFAM,
checkUploadMonthlyReportOI,
uploadMonthlyReportPL,
getMonthlyReport,
checkUploadMonthlyReportBS,
uploadMonthlyReportBS,
uploadMonthlyReportFAM,
uploadMonthlyReportTP,
uploadMonthlyReportOI,
getHierarkiMontlyReportCF
}
}
......
......@@ -67,7 +67,9 @@ export default class BudgetTahunan extends Component {
minDateRevision: new Date(),
maxDateRevision: new Date(),
btnApprove: false,
isAdmin: false
isAdmin: false,
btncreate: false,
loadview: false
}
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this);
......@@ -181,6 +183,34 @@ export default class BudgetTahunan extends Component {
})
}
getPermission() {
let payload = {
menu: "master budget & cat"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btncreate: response.data.data.create,
loadview: response.data.data.view
})
} 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' })
}
})
}
getCompanySubmitted() {
let body = {
"periode": this.state.periode.periode
......@@ -1518,6 +1548,8 @@ export default class BudgetTahunan extends Component {
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
btncreate={this.state.btncreate}
loadview={this.state.loadview}
/>
)
}
......
......@@ -54,12 +54,43 @@ export default class MonthlyReport extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
btncreate: false,
loadview: false
}
this.fileHandler = this.fileHandler.bind(this);
}
getPermission() {
let payload = {
menu: "monthly report"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btncreate: response.data.data.create,
loadview: response.data.data.view
})
} 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' })
}
})
}
componentDidMount() {
this.getChecApprover()
this.getPermission()
this.setState({ loading: true })
// this.getCompanyActive()
}
......@@ -70,13 +101,13 @@ export default class MonthlyReport extends Component {
if (response.data) {
if (response.data.status === "success") {
// console.log(response);
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true }, () =>
this.getPeriode())
} else {
// if (response.data.data.is_approver === true) {
// this.setState({ isApprover: true, checkApprover: true }, () =>
// this.getPeriode())
// } else {
this.setState({ isApprover: false, checkApprover: false }, () =>
this.getCompanyActive())
}
// }
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -1108,6 +1139,8 @@ export default class MonthlyReport extends Component {
month={this.state.month}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleMonthlyReport: true })}
btncreate={this.state.btncreate}
loadview={this.state.loadview}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
......
......@@ -237,6 +237,135 @@ export default class OperatingIndicatorMR extends Component {
this.props.onClickClose()
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
console.log(resp)
if (err) {
// // console.log(err);
}
else {
let isi = resp.rows.slice(3)
// // console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
order: i[0] === undefined ? "" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
actual: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
})
}
})
let body = {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
monthly_report: payload
}
console.log(body)
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
}
});
}
checkUpload() {
api.create().checkUploadMonthlyReportOI(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleOI: false, loading: true })
let total = 0
let dataTable = response.data.data.map((item, index) => {
console.log(item);
if (item.type_report_id != null) {
total += 1
}
return [
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.item_report,
item.uom,
item.rolling_outlook,
item.master_budget,
item.rolling_budget,
item.actual,
item.amount_act_vs_mb,
item.percent_act_vs_mb,
item.amount_act_vs_rb,
item.percent_act_vs_rb,
item.mtd_vs_mb,
item.mtd_vs_rb,
item.order,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, templateNull : total > 0 ? true : false })
}
}
})
}
uploadOI(type) {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
uom: String(i[6]),
rolling_outlook: String(Number(i[7]).toFixed(1)),
master_budget: String(Number(i[8]).toFixed(1)),
rolling_budget: String(Number(i[9]).toFixed(1)),
actual: String(Number(i[10]).toFixed(1)),
amount_act_vs_mb: String(Number(i[11]).toFixed(1)),
percent_act_vs_mb: String(Number(i[12]).toFixed(1)),
amount_act_vs_rb: String(Number(i[13]).toFixed(1)),
percent_act_vs_rb: String(Number(i[14]).toFixed(1)),
mtd_vs_mb: String(Number(i[15]).toFixed(1)),
mtd_vs_rb: String(Number(i[16]).toFixed(1)),
})
})
let body = {
company_id: this.props.data.company.company_id,
operating_indicator_id: this.props.data.operatingIndID,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
status: type,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
monthly_report: data
}
console.log(data);
// // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMonthlyReportOI(body).then(response => {
// // console.log(response);
this.setState({ loading: false })
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
}
} else {
alert(response.problem)
}
})
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let dataTable2 = this.state.dataTable
const handleValue = (data, type) => {
......@@ -472,7 +601,7 @@ export default class OperatingIndicatorMR extends Component {
}
}
}, {
name: "Rolling Outlook (FY2021)",
name: `Rolling Outlook (FY ${this.props.periode})`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#07a7d0', width: 96, borderLeft: '1px #fff solid', borderRight: '1px #fff solid' }}>
......@@ -544,15 +673,15 @@ export default class OperatingIndicatorMR extends Component {
{/* <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", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 40, fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Master Budget (MB)"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', height: '100%' }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Actual"}</span>
</div>
</div>
......@@ -1318,7 +1447,7 @@ export default class OperatingIndicatorMR extends Component {
onClick={() =>
this.setState({ loading: true, visibleOI: true }, () => {
setTimeout(() => {
this.getDataDetail()
this.getItemHierarki()
}, 100)
})}
>
......@@ -1424,7 +1553,7 @@ export default class OperatingIndicatorMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MONTHLY REPORT - OPERATING INDICATOR" ?
this.state.judul === "MONTHLY REPORT - MONTHLY REPORT" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
......@@ -742,15 +742,15 @@ export default class ProfitLossMR extends Component {
{/* <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", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 40, fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Master Budget (MB)"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', height: '100%' }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"Actual"}</span>
</div>
</div>
......@@ -1716,6 +1716,7 @@ export default class ProfitLossMR extends Component {
</MuiThemeProvider>
)}
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="grid grid-2x" style={{ marginTop: 20 }}>
......
......@@ -62,6 +62,7 @@ export default class TaxPlanningMR extends Component {
this.getSettingControl()
// this.getItemHierarki()
// this.getLatestUpdate()
console.log(this.props.loadview)
}
getSettingControl() {
......@@ -1112,7 +1113,7 @@ export default class TaxPlanningMR extends Component {
}
}
}, {
name: `Trial Balance (Fiscal) Actual MTD`,
name: `Trial Balance (Fiscal) Actual YTD`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
......@@ -1243,7 +1244,7 @@ export default class TaxPlanningMR extends Component {
}
}
}, {
name: `Trial Balance (Fiscal) MB MTD`,
name: `Trial Balance (Fiscal) MB YTD`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
......@@ -1455,6 +1456,7 @@ export default class TaxPlanningMR extends Component {
: */}
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{/* {((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && ( */}
{this.props.btncreate === true &&
<div>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -1471,8 +1473,10 @@ export default class TaxPlanningMR extends Component {
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div>
}
{/* )} */}
{/* {((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && ( */}
{this.props.btncreate === true &&
<div>
<a data-tip={'Upload'} data-for="upload">
<button
......@@ -1491,27 +1495,32 @@ export default class TaxPlanningMR extends Component {
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
}
{/* )} */}
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})
}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{(this.props.loadview === true || this.props.btncreate === true) && (
<div>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})
}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
)}
</div>
{/* } */}
</div>
......@@ -1553,6 +1562,7 @@ export default class TaxPlanningMR extends Component {
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
{this.props.btncreate === true &&
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
......@@ -1630,6 +1640,7 @@ export default class TaxPlanningMR extends Component {
</div>
</button>
</div>
}
{/* : null } */}
</div>
</Paper>
......
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