Commit 6b571570 authored by faisalhamdi's avatar faisalhamdi

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

parents 9bc58438 ee35d2a5
......@@ -259,6 +259,7 @@ const create = (type = "") => {
const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/get_report_hierarki', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/monthly_report/cat/get_report_hierarki', body)
const getLastPeriodMonthly = (idCompany) => api.get(`transaction/monthly_report/get_last_periode/${idCompany}`)
const checkApproverMonthly = () => api.get('transaction/monthly_report/is_approver')
const getCompanySubmittedMonthly = (body) => api.post('transaction/monthly_report/get_company_submitted', body)
......@@ -487,6 +488,7 @@ const create = (type = "") => {
getHierarkiMontlyReportPL,
getHierarkiMontlyReportLOCF,
getHierarkiMontlyReportFAM,
getHierarkiMontlyReportCAT,
checkUploadMonthlyReportTP,
checkUploadMonthlyReportFAM,
uploadMonthlyReportPL,
......
......@@ -18,6 +18,7 @@ import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../library/Constant';
import OperatingIndicatorMR from './MonthlyReport/OperatingIndicatorMR';
import CorporateAnnualTargetMR from './MonthlyReport/CorporateAnnualTargetMR';
import CashFlowMR from './MonthlyReport/CashFlowMR';
var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -45,6 +46,7 @@ export default class MonthlyReport extends Component {
visibleFAM: false,
visibleCAT: false,
visibleOI: false,
visibleCF: false,
listAttachment: [],
visibleUpload: false,
lastRevision: 0,
......@@ -471,7 +473,7 @@ export default class MonthlyReport extends Component {
})
}
saveToMonthlyReport(){
saveToMonthlyReport() {
this.setState({
visibleMonthlyReport: true,
visibleBS: false,
......@@ -481,7 +483,7 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
}, ()=> {
}, () => {
this.getMonthlyReportID()
})
}
......@@ -503,6 +505,7 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
visibleCF: false,
})
} else if (item === 'Profit Loss') {
this.setState({
......@@ -514,6 +517,7 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
visibleCF: false,
})
} else if (item === 'Tax Planning') {
this.setState({
......@@ -525,6 +529,7 @@ export default class MonthlyReport extends Component {
visibleTP: true,
visibleLOCF: false,
visibleOI: false,
visibleCF: false,
})
} else if (item === 'Fixed Assets Movement') {
this.setState({
......@@ -547,6 +552,7 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
visibleCF: false,
})
} else if (item === 'List of Credit Facilities') {
this.setState({
......@@ -558,6 +564,7 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: true,
visibleOI: false,
visibleCF: false,
})
} else if (item === 'Operating Indicator') {
this.setState({
......@@ -569,6 +576,19 @@ export default class MonthlyReport extends Component {
visibleTP: false,
visibleLOCF: false,
visibleOI: true,
visibleCF: false,
})
} else if (item === 'Cash Flow') {
this.setState({
visibleMonthlyReport: false,
visibleBS: false,
visiblePL: false,
visibleCAT: false,
visibleFAM: false,
visibleTP: false,
visibleLOCF: false,
visibleOI: false,
visibleCF: true,
})
}
})
......@@ -645,7 +665,7 @@ export default class MonthlyReport extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/monthly_report/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
)
res = await res.blob()
this.setState({ loading: false }, ()=> {
this.setState({ loading: false }, () => {
document.body.style.overflow = 'unset';
})
if (res.size > 0) {
......@@ -1088,7 +1108,7 @@ export default class MonthlyReport extends Component {
month={this.state.month}
saveToMonthlyReport={this.saveToMonthlyReport.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleMonthlyReport: true })}
// getReport={this.getCompanyActive.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
{this.state.visibleFAM && (
......@@ -1152,6 +1172,21 @@ export default class MonthlyReport extends Component {
onClickClose={() => this.setState({ visibleOI: false, visibleMonthlyReport: true })}
/>
)}
{this.state.visibleCF && (
<CashFlowMR
open={this.props.open}
report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
monthlyReportId={this.state.monthlyReportId}
month={this.state.month}
onClickClose={() => this.setState({ visibleCF: false, visibleMonthlyReport: true })}
/>
)}
</div >
);
}
......
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
import api from '../../api';
import NumberFormat from 'react-number-format';
import * as R from 'ramda';
import { PropagateLoader } from 'react-spinners';
import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant';
import UploadFile from "../../library/Upload";
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
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 CashFlowMR extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [],
loading: false,
visibleCFMR: true,
// valueThreshold: 0,
minValue: 0,
maxValue: 0
}
}
render() {
let dataTable = [
["1", "2", "2", "2", "2", "2", "3"],
["1", "2", "2", "2", "2", "2", "3"],
]
let columns = [
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "Account",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{tableMeta.rowData[0] === null ?
tableMeta.rowData[4] == 0 ?
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(val).toUpperCase()}</span>
</LightTooltip> :
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
}
</div>
)
}
}
}, {
name: "Actual",
options: {
customHeadRender: (columnMeta) => (
// dataTable2.length > 0 ?
// <TableCell style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell> :
<TableCell style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({
style: {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
}
}),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value}
</div>
)
}
}
}
]
const loadingComponent = (
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
{this.state.loading && loadingComponent}
<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 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Cash Flow</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'} 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>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</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') ? */}
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<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>
</div>
</button>
</div>
{/* <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
}, 100);
})
}}
>
<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' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('draft')
})
}
>
<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.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<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 & Complete</Typography>
</div>
</button>
</div> */}
</div>
{/* : null
} */}
</div>
</Paper>
</div>
</div>
);
}
}
......@@ -66,10 +66,10 @@ export default class CorporateAnnualTargetMR extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"month": this.props.month
"months": this.props.month.month_id
}
api.create().getDetailReportMB(payload).then(response => {
api.create().getHierarkiMontlyReportCAT(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
......@@ -79,27 +79,27 @@ export default class CorporateAnnualTargetMR extends Component {
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
// let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
if (item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataInternalBsn.push({
id: item.id,
name: item.description,
check: false
})
}
}
// if (item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
// if (item.type_report_id !== 4) {
// dataInternalBsn.push({
// id: item.id,
// name: item.description,
// check: false
// })
// }
// }
if (item.parent_name == 'CUSTOMER PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataCustomerPrs.push({
id: item.id,
name: item.description,
check: false
})
}
}
// if (item.parent_name == 'CUSTOMER PERSPECTIVE') {
// if (item.type_report_id !== 4) {
// dataCustomerPrs.push({
// id: item.id,
// name: item.description,
// check: false
// })
// }
// }
dataTable.push([
item.type_report_id,
......@@ -107,31 +107,17 @@ export default class CorporateAnnualTargetMR extends Component {
item.parent,
item.formula,
item.level,
"",
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.cat.weight).indexOf(".") == -1 ? item.cat.weight : `${Number(item.weight) * 100}%`),
parentTrue ? item.cat.uom : item.uom,
parentTrue ? item.cat.kpi_type == "" ? null : { value: item.cat.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue ? item.cat.max_ach == "" ? null : { value: titleCase(item.cat.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1),
item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1),
item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1),
item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1),
item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1),
item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1),
item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1),
item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1),
item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1),
item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1),
item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic,
item.cat.pic
item.corporate_annual_target.weight === null ? "0" : item.corporate_annual_target.weight === "" ? "0" : item.corporate_annual_target.weight,
item.corporate_annual_target.jenis_kpi === null ? "0" : item.corporate_annual_target.jenis_kpi === "" ? "0" : item.corporate_annual_target.jenis_kpi,
item.corporate_annual_target.max_ach === null ? "0" : item.corporate_annual_target.max_ach === "" ? "0" : item.corporate_annual_target.max_ach,
item.corporate_annual_target.formula_ytd === null ? "0" : item.corporate_annual_target.formula_ytd === "" ? "0" : item.corporate_annual_target.formula_ytd,
item.corporate_annual_target.actual_monthly === null ? "0" : item.corporate_annual_target.actual_monthly === "" ? "0" : item.corporate_annual_target.actual_monthly,
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly === "" ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly === "" ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score === "" ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight === "" ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "0" : item.corporate_annual_target.notes === "" ? "0" : item.corporate_annual_target.notes,
])
}
if (item.children !== null) {
......@@ -148,32 +134,17 @@ export default class CorporateAnnualTargetMR extends Component {
item.id,
item.parent,
item.formula,
item.level,
"",
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.cat.weight,
item.cat.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1),
item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1),
item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1),
item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1),
item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1),
item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1),
item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1),
item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1),
item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1),
item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1),
item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic,
item.cat.pic
item.corporate_annual_target.weight === null ? "0" : item.corporate_annual_target.weight === "" ? "0" : item.corporate_annual_target.weight,
item.corporate_annual_target.jenis_kpi === null ? "0" : item.corporate_annual_target.jenis_kpi === "" ? "0" : item.corporate_annual_target.jenis_kpi,
item.corporate_annual_target.max_ach === null ? "0" : item.corporate_annual_target.max_ach === "" ? "0" : item.corporate_annual_target.max_ach,
item.corporate_annual_target.formula_ytd === null ? "0" : item.corporate_annual_target.formula_ytd === "" ? "0" : item.corporate_annual_target.formula_ytd,
item.corporate_annual_target.actual_monthly === null ? "0" : item.corporate_annual_target.actual_monthly === "" ? "0" : item.corporate_annual_target.actual_monthly,
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly === "" ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly === "" ? "0" : item.corporate_annual_target.achivement_monthly,
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score === "" ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight === "" ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "0" : item.corporate_annual_target.notes === "" ? "0" : item.corporate_annual_target.notes,
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -401,30 +372,30 @@ export default class CorporateAnnualTargetMR extends Component {
}
let columns = [
// {
// name: "",
// options: {
// display: false
// }
// },
// {
// name: "",
// options: {
// display: false
// }
// },
// {
// name: "",
// options: {
// display: false
// }
// },
// {
// name: "",
// options: {
// display: false
// }
// },
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
// {
// name: "",
// options: {
......@@ -1031,7 +1002,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={data}
data={dataTable2}
columns={columns}
options={options}
/>
......
......@@ -47,23 +47,41 @@ export default class TaxPlanningMR extends Component {
visibleTP: true,
disabledSave: true,
editable: false,
buttonError: false,
judulColumn: null,
updateBy: '-',
buttonDraft: true,
handleTekTekTek: 0,
saveDraft: true
saveDraft: true,
buttonError: true
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
}
componentDidMount() {
this.getItemHierarki()
this.getSettingControl()
// this.getItemHierarki()
// this.getLatestUpdate()
}
getSettingControl() {
let body = {
group: 'THRESHOLD_CONTROL',
company_id: this.props.company.company_id,
type: 'TAX_PLANNING'
}
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
this.getItemHierarki()
})
})
}
getLatestUpdate() {
let payload = {
"report_id": 5,
......@@ -95,7 +113,7 @@ export default class TaxPlanningMR extends Component {
}
api.create().getHierarkiMontlyReportTP(payload).then(response => {
console.log(response);
console.log(payload);
// console.log(payload);
let dataTable = []
if (response.data) {
if (response.data.status == 'success') {
......@@ -120,6 +138,7 @@ export default class TaxPlanningMR extends Component {
},
item.tax_planning.trial_balance_fiscal_actual === null ? "0.0" : item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual,
item.tax_planning.trial_balance_fiscal_mb === null ? "0.0" : item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb,
item.tax_planning.actual_formula,
item.order,
{ tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf },
{ tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf },
......@@ -151,6 +170,7 @@ export default class TaxPlanningMR extends Component {
},
item.tax_planning.trial_balance_fiscal_actual === null ? "0.0" : item.tax_planning.trial_balance_fiscal_actual === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_actual,
item.tax_planning.trial_balance_fiscal_mb === null ? "0.0" : item.tax_planning.trial_balance_fiscal_mb === "" ? "0.0" : item.tax_planning.trial_balance_fiscal_mb,
item.tax_planning.actual_formula,
item.order,
{ tbc: item.condition_it_should_be_tax.value_tbc, fcp: item.condition_it_should_be_tax.value_fc, tbf: item.condition_it_should_be_tax.value_tbf },
{ tbc: item.condition_if_wrong_tax.value_tbc, fcp: item.condition_if_wrong_tax.value_fc, tbf: item.condition_if_wrong_tax.value_tbf },
......@@ -163,7 +183,7 @@ export default class TaxPlanningMR extends Component {
}
}
})
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
this.setState({ dataTable, loading: false, editable: true })
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -175,25 +195,12 @@ export default class TaxPlanningMR extends Component {
})
}
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
this.setState({ dataTable, loading: false, editable: true })
}
console.log(this.state.dataTable)
// console.log(this.state.dataTable)
})
}
handleValue(data) {
let total = 0
this.state.dataTable.map((item, index) => {
if (data.rowData[4] == item[5]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
}
})
let indexParent = this.state.dataTable.findIndex((val) => val[4] === this.state.dataTable[data.rowIndex][5])
let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
// console.log(indexParent);
return a
}
handleChange(value, tableMeta) {
let val = String(value).split(",").join("")
let data = this.state.dataTable
......@@ -236,7 +243,7 @@ export default class TaxPlanningMR extends Component {
}
api.create('UPLOAD').createMonthlyReportTP(payload).then(response => {
console.log(payload);
// console.log(payload);
console.log(response);
if (response.data) {
if (response.data.status === "success") {
......@@ -302,7 +309,7 @@ export default class TaxPlanningMR extends Component {
checkUpload() {
api.create().checkUploadMonthlyReportTP(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
// console.log(this.state.payload)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
......@@ -338,7 +345,7 @@ export default class TaxPlanningMR extends Component {
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
}
})
console.log(this.state.dataTable);
// console.log(this.state.dataTable);
})
}
}
......@@ -368,8 +375,8 @@ export default class TaxPlanningMR extends Component {
}
// console.log(data);
api.create('UPLOAD').uploadMonthlyReportTP(body).then(response => {
console.log(body);
console.log(JSON.stringify(body));
// console.log(body);
// console.log(JSON.stringify(body));
console.log(response);
if (response.data) {
if (response.data.status === "success") {
......@@ -420,7 +427,7 @@ export default class TaxPlanningMR extends Component {
// this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// // alert("Type Input Can't be Empty")
// } else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
this.setState({ loading: false, editable: true, saveDraft: false, buttonError: false })
// }
// })
}
......@@ -516,7 +523,7 @@ export default class TaxPlanningMR extends Component {
if (String(item).includes('#')) {
let splitform = String(item).split('#')
if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') {
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
let indexID = dataTable2.findIndex((val) => val[13] == splitform[0])
if (indexID !== -1) {
let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
let valuezz = data.value == undefined ? data : data.value
......@@ -541,19 +548,19 @@ export default class TaxPlanningMR extends Component {
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
let data = tableMeta.rowData[12]
// console.log(data);
let indexID = data.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = data.formula[indexID].value
let valuezz = data[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
}
} else {
let indexID = dataTable2.findIndex((val) => val[24] == item)
let indexID = dataTable2.findIndex((val) => val[13] == item)
if (indexID !== -1) {
if (dataTable2[indexID][24] == tableMeta.rowData[24]) {
if (dataTable2[indexID][13] == tableMeta.rowData[13]) {
anjay.push(0)
} else {
// console.log(dataTable2[indexID][tableMeta.columnIndex]);
......@@ -922,7 +929,7 @@ export default class TaxPlanningMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value.tbc).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
/>
}
/>
......@@ -974,7 +981,7 @@ export default class TaxPlanningMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.fcp}
value={value.tbc}
control={
<NumberFormat
thousandSeparator={true}
......@@ -982,7 +989,7 @@ export default class TaxPlanningMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value.fcp).toFixed(1)}
value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
/>
}
/>
......@@ -1030,54 +1037,71 @@ export default class TaxPlanningMR extends Component {
/>
</div>
:
// tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleTotal(tableMeta, 6)).toFixed(1)}
// />
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleTotal(tableMeta, 6)).toFixed(1)}
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value.tbc}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
}
/>
:
tableMeta.rowData[3] === 7 ? null
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
// </LightTooltip>
:
null
</div>
:
tableMeta.rowData[3] === 7 ? null
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
// </LightTooltip>
:
null
}
</div>
</div>
......@@ -1558,9 +1582,8 @@ export default class TaxPlanningMR extends Component {
className="button"
type="button"
onClick={() =>
// null
// this.state.saveDraft === true ?
// null :
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => {
......
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