Commit bf34a703 authored by rifkaki's avatar rifkaki

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

parents 4d3faaf4 e5196900
...@@ -241,11 +241,13 @@ const create = (type = "") => { ...@@ -241,11 +241,13 @@ const create = (type = "") => {
const getReportPLDetailMB = (body) => api.post('/transaction/db_profit_loss_detail/master_budget/get_report_hierarki', body) const getReportPLDetailMB = (body) => api.post('/transaction/db_profit_loss_detail/master_budget/get_report_hierarki', body)
const getReportPLDetailMR = (body) => api.post('/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki', body) const getReportPLDetailMR = (body) => api.post('/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki', body)
const getReportPL = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body) const getReportPL = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
const getReportFR = (body) => api.post('/transaction/db_ratio/get_report_hierarki', body)
const getHierarkiCreateReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/get_report_hierarki', body) const getHierarkiCreateReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/get_report_hierarki', body)
const getHierarkiCreateReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body) const getHierarkiCreateReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body)
const createReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/create_submission_report', body) const createReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/create_submission_report', body)
const createReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/create_monthly_report', body) const createReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/create_monthly_report', body)
const getPLID = (body) => api.post('/transaction/db_profit_loss/get_profit_loss_id', body) const getPLID = (body) => api.post('/transaction/db_profit_loss/get_profit_loss_id', body)
const getFRID = (body) => api.post('/transaction/db_ratio/get_ratio_id', body)
// const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body) // const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
// const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body) // const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body) const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body)
...@@ -634,11 +636,13 @@ const create = (type = "") => { ...@@ -634,11 +636,13 @@ const create = (type = "") => {
getReportBSSuma, getReportBSSuma,
getDashboardCAT, getDashboardCAT,
getReportPL, getReportPL,
getReportFR,
getHierarkiCreateReportPLMB, getHierarkiCreateReportPLMB,
getHierarkiCreateReportPLMR, getHierarkiCreateReportPLMR,
createReportPLMB, createReportPLMB,
createReportPLMR, createReportPLMR,
getPLID, getPLID,
getFRID,
getHierarkiReportHistorical, getHierarkiReportHistorical,
getHierarkiReportMTD, getHierarkiReportMTD,
getHierarkiReportYtd getHierarkiReportYtd
......
...@@ -415,7 +415,8 @@ class HomePage extends Component { ...@@ -415,7 +415,8 @@ class HomePage extends Component {
pathname: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? `/home/master-budget/` : `/home/monthly-report/`, pathname: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? `/home/master-budget/` : `/home/monthly-report/`,
state: { state: {
userType: 'approver', userType: 'approver',
rawData: this.state.rawData[tableMeta.rowIndex] rawData: this.state.rawData[tableMeta.rowIndex],
month: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? null : this.state.month
} }
}}> }}>
<button <button
...@@ -791,7 +792,8 @@ class HomePage extends Component { ...@@ -791,7 +792,8 @@ class HomePage extends Component {
pathname: `/home/monthly-report/`, pathname: `/home/monthly-report/`,
state: { state: {
userType: 'user', userType: 'user',
rawData: item rawData: item,
month: this.state.month
} }
}}> }}>
<button <button
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -73,7 +73,8 @@ export default class MonthlyReport extends Component { ...@@ -73,7 +73,8 @@ export default class MonthlyReport extends Component {
textRevision: '', textRevision: '',
dbCF: [], dbCF: [],
PLBSFAMSubmitted: false, PLBSFAMSubmitted: false,
PLID: null PLID: null,
monthHome: null
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -116,8 +117,11 @@ export default class MonthlyReport extends Component { ...@@ -116,8 +117,11 @@ export default class MonthlyReport extends Component {
this.setState({ loading: true }) this.setState({ loading: true })
this.props.selectIndex('Monthly Report') this.props.selectIndex('Monthly Report')
if (this.props.location.state !== undefined) { if (this.props.location.state !== undefined) {
// console.log(this.props); console.log(this.props);
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => { if (this.props.location.state.month != null || this.props.location.state.month != undefined) {
this.setState({monthHome: this.props.location.state.month})
}
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData}, () => {
this.getPermission() this.getPermission()
}) })
} else { } else {
...@@ -322,7 +326,12 @@ export default class MonthlyReport extends Component { ...@@ -322,7 +326,12 @@ export default class MonthlyReport extends Component {
}; };
let index = data.findIndex((val) => val.month_name == month) let index = data.findIndex((val) => val.month_name == month)
console.log(index); console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => { let indexMonthHome = -1
if (this.state.monthHome != null) {
indexMonthHome = monthData.findIndex((val) => val.month_id == this.state.monthHome.month_id)
}
console.log(indexMonthHome)
this.setState({ listMonth: defaultProps, month: indexMonthHome == -1? (index == -1 ? monthData[0] : monthData[index]) : monthData[indexMonthHome] }, () => {
// if (this.state.isApprover === true) { // if (this.state.isApprover === true) {
// if (this.state.submittedOnly) { // if (this.state.submittedOnly) {
// console.log('masuk cuk') // console.log('masuk cuk')
......
...@@ -70,11 +70,13 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -70,11 +70,13 @@ export default class CorporateAnnualTargetMR extends Component {
judulColumn: null, judulColumn: null,
get_for: "view", get_for: "view",
parameterScore: [], parameterScore: [],
parameterPerfom: [],
totalScore: 0, totalScore: 0,
perfomanceScore: '', perfomanceScore: '',
buttonError: true, buttonError: true,
viewOnly: true, viewOnly: true,
aa: 0 aa: 0,
perfomanceScoreColor: '#fff'
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -85,6 +87,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -85,6 +87,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.getKPIType() this.getKPIType()
this.getMaxAch() this.getMaxAch()
this.getParameterGroup() this.getParameterGroup()
this.getParameterGroupPerfom()
this.handleViewOnly() this.handleViewOnly()
} }
...@@ -139,6 +142,17 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -139,6 +142,17 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
} }
getParameterGroupPerfom() {
api.create().getParameterByGroupName({
"group_name": "PERFORMANCE_KPI"
}).then((response) => {
console.log(response.data)
if (response.data) {
this.setState({ parameterPerfom: response.data.data })
}
})
}
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -704,7 +718,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -704,7 +718,7 @@ export default class CorporateAnnualTargetMR extends Component {
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') { if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalSW = 0 totalSW = 0
} else { } else {
totalSW = (Number(totalScorez) * Number(handlePercent) / 1000) totalSW = (Number(totalScorez) * Number(handlePercent) / 100)
} }
totalSW = Number(totalSW).toFixed(2) totalSW = Number(totalSW).toFixed(2)
if (item[0] !== 1 && item[0] !== 4) { if (item[0] !== 1 && item[0] !== 4) {
...@@ -747,6 +761,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -747,6 +761,7 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(datatable3); // console.log(datatable3);
let totalWeightz = Number(totalWeight) / 100 let totalWeightz = Number(totalWeight) / 100
let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2) let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)
console.log(totalz)
let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz
if (R.equals(totalz, NaN) || R.equals(totalz, "NaN")) { if (R.equals(totalz, NaN) || R.equals(totalz, "NaN")) {
...@@ -755,24 +770,45 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -755,24 +770,45 @@ export default class CorporateAnnualTargetMR extends Component {
lastTotal = totalz lastTotal = totalz
} }
// console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)) console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
if (lastTotal >= 1.00 && lastTotal <= 2.00) {
perfomanceScore = 'K' let listPerfomanceDefault = this.state.parameterPerfom.filter((val) => String(val.company_name).toLocaleLowerCase() == "default")
} else if (lastTotal >= 2.01 && lastTotal <= 2.75) { let performanceScore = ''
perfomanceScore = 'C' let perfomanceScoreColor = '#fff'
} else if (lastTotal >= 2.76 && lastTotal <= 3.00) { if (listPerfomanceDefault.length > 0) {
perfomanceScore = 'B-' listPerfomanceDefault.map((item, index) => {
} else if (lastTotal >= 3.01 && lastTotal <= 3.75) { console.log(Number(lastTotal))
perfomanceScore = 'B' console.log(Number(item.min_value))
} else if (lastTotal >= 3.76 && lastTotal <= 4.00) { console.log(Number(item.max_value))
perfomanceScore = 'B+' if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) {
} else if (lastTotal >= 4.01 && lastTotal <= 4.75) { console.log('masuk')
perfomanceScore = 'BS' perfomanceScore = item.description
} else if (lastTotal >= 4.76 && lastTotal <= 5.00) { perfomanceScoreColor = item.value
perfomanceScore = 'IST'
} }
})
}
// console.log(Number(lastTotal))
console.log(this.state.parameterPerfom)
console.log(listPerfomanceDefault)
console.log(perfomanceScore)
console.log(perfomanceScoreColor)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
// perfomanceScore = 'C'
// } else if (lastTotal >= 2.76 && lastTotal <= 3.00) {
// perfomanceScore = 'B-'
// } else if (lastTotal >= 3.01 && lastTotal <= 3.75) {
// perfomanceScore = 'B'
// } else if (lastTotal >= 3.76 && lastTotal <= 4.00) {
// perfomanceScore = 'B+'
// } else if (lastTotal >= 4.01 && lastTotal <= 4.75) {
// perfomanceScore = 'BS'
// } else if (lastTotal >= 4.76 && lastTotal <= 5.00) {
// perfomanceScore = 'IST'
// }
setTimeout(() => { setTimeout(() => {
this.setState({ totalScore: lastTotal, perfomanceScore, loading: false}, () => { this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor}, () => {
this.setState({loading: true}) this.setState({loading: true})
setTimeout(() => { setTimeout(() => {
this.setState({loading: false}) this.setState({loading: false})
...@@ -1871,7 +1907,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1871,7 +1907,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ padding: 5 }}> <div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div> </div>
<div style={{ borderStyle: 'solid', backgroundColor: this.handleBackgroundPerf(this.state.totalScore), borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}> <div style={{ borderStyle: 'solid', backgroundColor: this.state.perfomanceScoreColor, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
{!this.state.loading && ( {!this.state.loading && (
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography> <Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography>
)} )}
...@@ -2039,7 +2075,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -2039,7 +2075,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ padding: 5 }}> <div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div> </div>
<div style={{ borderStyle: 'solid', backgroundColor: this.handleBackgroundPerf(this.state.totalScore), borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}> <div style={{ borderStyle: 'solid', backgroundColor: this.state.perfomanceScoreColor, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography> <Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography>
</div> </div>
</div> </div>
......
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