Commit acdf1e07 authored by Riri Novita's avatar Riri Novita

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

parents 6b26d654 a9893a46
...@@ -170,6 +170,7 @@ const create = (type = "") => { ...@@ -170,6 +170,7 @@ const create = (type = "") => {
const getAllSettingByType = (body) => api.post('setting/get_all_setting_by_type', body) const getAllSettingByType = (body) => api.post('setting/get_all_setting_by_type', body)
const createAllItemReport = (body) => api.post('item_report/create_all_item_report', body) const createAllItemReport = (body) => api.post('item_report/create_all_item_report', body)
const deleteAllItemReport = (body) => api.post('/item_report/delete_all_item_report', body) const deleteAllItemReport = (body) => api.post('/item_report/delete_all_item_report', body)
const deleteAllItemReportLOCF = (body) => api.post('/item_report/delete_all_item_report_locf', body)
//PARAMETER //PARAMETER
const getAllParameter = () => api.get('/setting/get_all_setting') const getAllParameter = () => api.get('/setting/get_all_setting')
...@@ -210,6 +211,7 @@ const create = (type = "") => { ...@@ -210,6 +211,7 @@ const create = (type = "") => {
const getSubmitMonthlyReport = (body) => api.post('transaction/monthly_report/get_latest_periode_submit', body) const getSubmitMonthlyReport = (body) => api.post('transaction/monthly_report/get_latest_periode_submit', body)
const createPeriodeRevision = (body) => api.post('transaction/master_budget/create_periode_revision', body) const createPeriodeRevision = (body) => api.post('transaction/master_budget/create_periode_revision', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getIdDeleteFromExcelLOCF = (body) => api.post('transaction/locf/monthly_report/delete_from_excel', body)
const getDashboard = (body) => api.get('transaction/get_dashboard') const getDashboard = (body) => api.get('transaction/get_dashboard')
const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body) const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body)
const getDashboardUser = () => api.get('transaction/get_dashboard_sub_co') const getDashboardUser = () => api.get('transaction/get_dashboard_sub_co')
...@@ -551,7 +553,9 @@ const create = (type = "") => { ...@@ -551,7 +553,9 @@ const create = (type = "") => {
validateSubmitReportOI, validateSubmitReportOI,
getMonthlyOI, getMonthlyOI,
getParameterByGroupName, getParameterByGroupName,
getSubmitMonthlyReport getSubmitMonthlyReport,
getIdDeleteFromExcelLOCF,
deleteAllItemReportLOCF
} }
} }
......
...@@ -182,15 +182,15 @@ export default class BalanceSheetMR extends Component { ...@@ -182,15 +182,15 @@ export default class BalanceSheetMR extends Component {
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 (item.type_report_id === 3) { if (item.type_report_id === 3) {
if (item.balance_sheet.mtd_vs_previous_month == "" && Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) { // if (item.balance_sheet.mtd_vs_previous_month == "" && Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) {
err = true // err = true
} // }
if (item.balance_sheet.mtd_vs_mb == "" && Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) { if (item.balance_sheet.mtd_vs_mb == "" && Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) {
err = true err = true
} }
if (item.balance_sheet.mtd_vs_rb == "" && Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) { // if (item.balance_sheet.mtd_vs_rb == "" && Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) {
err = true // err = true
} // }
} }
if (indexIDzz === -1) { if (indexIDzz === -1) {
dataTable.push([ dataTable.push([
...@@ -230,15 +230,15 @@ export default class BalanceSheetMR extends Component { ...@@ -230,15 +230,15 @@ export default class BalanceSheetMR extends Component {
} }
res.map((item, index) => { res.map((item, index) => {
if (item.type_report_id === 3) { if (item.type_report_id === 3) {
if (item.balance_sheet.mtd_vs_previous_month == "" && Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) { // if (item.balance_sheet.mtd_vs_previous_month == "" && Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) {
err = true // err = true
} // }
if (item.balance_sheet.mtd_vs_mb == "" && Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) { if (item.balance_sheet.mtd_vs_mb == "" && Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) {
err = true err = true
} }
if (item.balance_sheet.mtd_vs_rb == "" && Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) { // if (item.balance_sheet.mtd_vs_rb == "" && Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) {
err = true // err = true
} // }
} }
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
...@@ -367,7 +367,13 @@ export default class BalanceSheetMR extends Component { ...@@ -367,7 +367,13 @@ export default class BalanceSheetMR extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBSMR: false, loading: true }) this.setState({ visibleUpload: false, visibleBSMR: false, loading: true })
let err = false
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
if (item.type_report_id === 3) {
if (item.mtd_vs_mb == "" && Number(item.percent_act_vs_mb) < this.state.minValue || Number(item.percent_act_vs_mb) > this.state.maxValue) {
err = true
}
}
return [ return [
item.type_report_id, item.type_report_id,
item.item_report_id, item.item_report_id,
...@@ -379,19 +385,19 @@ export default class BalanceSheetMR extends Component { ...@@ -379,19 +385,19 @@ export default class BalanceSheetMR extends Component {
item.master_budget === "" ? "" : item.master_budget, item.master_budget === "" ? "" : item.master_budget,
item.rolling_budget === "" ? "" : item.rolling_budget, item.rolling_budget === "" ? "" : item.rolling_budget,
item.actual === "" ? "" : item.actual, item.actual === "" ? "" : item.actual,
item.actual_previous_month === null ? "" : item.actual_previous_month === "" ? "" : item.actual_previous_month, item.actual_previous_month === null ? "0.0" : item.actual_previous_month === "" ? "0.0" : item.actual_previous_month,
// item.amount_act_vs_previous_month === "" ? "" : item.amount_act_vs_previous_month, item.amount_act_vs_previous_month === "" ? "0.0" : item.amount_act_vs_previous_month,
// item.percent_act_vs_previous_month === "" ? "" : item.percent_act_vs_previous_month, item.percent_act_vs_previous_month === "" ? "0.0" : item.percent_act_vs_previous_month,
// item.amount_act_vs_mb === "" ? "" : item.amount_act_vs_mb, item.amount_act_vs_mb === "" ? "0.0" : item.amount_act_vs_mb,
// item.percent_act_vs_mb === "" ? "9.0" : item.percent_act_vs_mb, item.percent_act_vs_mb === "" ? "0.0" : item.percent_act_vs_mb,
// item.amount_act_vs_rb === "" ? "1" : item.amount_act_vs_rb, item.amount_act_vs_rb === "" ? "0.0" : item.amount_act_vs_rb,
// item.percent_act_vs_rb === "" ? "" : item.percent_act_vs_rb, item.percent_act_vs_rb === "" ? "0.0" : item.percent_act_vs_rb,
0, // 0,
0, // 0,
0, // 0,
0, // 0,
0, // 0,
0, // 0,
item.mtd_vs_previous_month, item.mtd_vs_previous_month,
item.mtd_vs_mb, item.mtd_vs_mb,
item.mtd_vs_rb, item.mtd_vs_rb,
...@@ -533,11 +539,12 @@ export default class BalanceSheetMR extends Component { ...@@ -533,11 +539,12 @@ export default class BalanceSheetMR extends Component {
dataTable.map((i, index) => { dataTable.map((i, index) => {
if(i[0] === 3) { if(i[0] === 3) {
// console.log(i); // console.log(i);
if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) { // if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
console.log('msk 1'); // console.log('msk 1');
// console.log(i); // // console.log(i);
err = true // err = true
} else if ( i[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) { // } else
if ( i[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
console.log('msk 2'); console.log('msk 2');
err = true err = true
} }
...@@ -2113,30 +2120,30 @@ export default class BalanceSheetMR extends Component { ...@@ -2113,30 +2120,30 @@ export default class BalanceSheetMR extends Component {
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
control={ control={
tableMeta.rowData[17] === "" && (Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue) ? // tableMeta.rowData[17] === "" && (Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue) ?
<LightTooltip title={"MTD Explanation vs Prev Month is Reqiured"} arrow> // <LightTooltip title={"MTD Explanation vs Prev Month is Reqiured"} arrow>
<Input // <Input
disableUnderline={true} // disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)} // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// disabled={false} // // disabled={false}
multiline={true} // multiline={true}
defaultValue={tableMeta.rowData[17]} // defaultValue={tableMeta.rowData[17]}
inputProps={{ // inputProps={{
style: { // style: {
color: "#5198ea", // color: "#5198ea",
textAlign: 'left', // textAlign: 'left',
backgroundColor: '#ffac99' // backgroundColor: '#ffac99'
} // }
}} // }}
onBlur={(event) => { // onBlur={(event) => {
handleText(event.target.value, tableMeta, 17) // handleText(event.target.value, tableMeta, 17)
}} // }}
/> // />
</LightTooltip> // </LightTooltip>
: // :
// tableMeta.rowData[0] === 7 ? // tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 17)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 17)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(tableMeta, 17)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 17)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat // <NumberFormat
......
...@@ -52,8 +52,41 @@ export default class CashFlowMR extends Component { ...@@ -52,8 +52,41 @@ export default class CashFlowMR extends Component {
} }
componentDidMount() { componentDidMount() {
this.getItemHierarki() // this.getItemHierarki()
// this.getSettingControl() this.getSettingControl()
}
getSettingControl() {
let body = {
group: 'THRESHOLD_CONTROL',
company_id: this.props.company.company_id,
type: 'CASH_FLOW'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({
minValue: response.data.data[0] ? response.data.data[0].min_value : null,
maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
}, () => {
this.getItemHierarki()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
} }
getItemHierarki() { getItemHierarki() {
...@@ -180,7 +213,7 @@ export default class CashFlowMR extends Component { ...@@ -180,7 +213,7 @@ export default class CashFlowMR extends Component {
let tst = '@' + String(item).replace('[M-1]', '[M1]') let tst = '@' + String(item).replace('[M-1]', '[M1]')
// console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
// console.log(tableMeta); // console.log(tableMeta);
console.log(tst); // console.log(tst);
let indexID = dataTable2[tableMeta.rowIndex][6].formula.findIndex((val) => val.item_formula == tst) let indexID = dataTable2[tableMeta.rowIndex][6].formula.findIndex((val) => val.item_formula == tst)
// console.log(indexID); // console.log(indexID);
...@@ -450,7 +483,7 @@ export default class CashFlowMR extends Component { ...@@ -450,7 +483,7 @@ export default class CashFlowMR extends Component {
// console.log(tableMeta); // console.log(tableMeta);
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ||tableMeta.rowData[0] === 7 ? {tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
...@@ -460,7 +493,55 @@ export default class CashFlowMR extends Component { ...@@ -460,7 +493,55 @@ export default class CashFlowMR extends Component {
disabled={true} disabled={true}
value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)} value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
/> />
</span> : null} </span>
:
tableMeta.rowData[0] === 7 ?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
// <NumberFormat
// thousandSeparator={true}
// style={{ color: Number(handleValueFormula(tableMeta, 6)).toFixed(1) > Number(this.state.minValue) || Number(handleValueFormula(tableMeta, 6)).toFixed(1) < Number(this.state.maxValue) ? 'red' : 'black' , fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(tableMeta, 6)).toFixed(1)}
// />
// </span>
(Number(handleValueFormula(tableMeta, 6)).toFixed(1) > Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 6)).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(tableMeta, 6)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? null : `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(tableMeta, 6)).toFixed(1)}
/>
</LightTooltip>
: null}
</div> </div>
) )
} }
......
...@@ -117,6 +117,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -117,6 +117,7 @@ export default class ListOfCreditFacilities extends Component {
updateBy: '-', updateBy: '-',
notes: "", notes: "",
viewOnly: true, viewOnly: true,
dataDelete: []
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -164,7 +165,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -164,7 +165,7 @@ export default class ListOfCreditFacilities extends Component {
checkStatus = false checkStatus = false
} }
this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus}) // this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus})
} }
getItemHierarki() { getItemHierarki() {
...@@ -494,6 +495,21 @@ export default class ListOfCreditFacilities extends Component { ...@@ -494,6 +495,21 @@ export default class ListOfCreditFacilities extends Component {
} }
checkUpload() { checkUpload() {
let dataDelete = []
api.create().getIdDeleteFromExcelLOCF(this.state.payload).then((response) => {
console.log(response)
// if (response.data) {
// // // // // // console.log(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().checkUploadMonthlyReportLOCF(this.state.payload).then(response => { api.create().checkUploadMonthlyReportLOCF(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)
...@@ -620,7 +636,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -620,7 +636,7 @@ export default class ListOfCreditFacilities extends Component {
) )
} }
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, dataDelete: [] }, () => {
this.handleCalculate() this.handleCalculate()
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[23].length > 0) { if (item[23].length > 0) {
...@@ -1344,7 +1360,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1344,7 +1360,7 @@ export default class ListOfCreditFacilities extends Component {
const handleAction = (typeReport, tableMeta, typeButton) => { const handleAction = (typeReport, tableMeta, typeButton) => {
// console.log(typeReport) // console.log(typeReport)
if (typeReport == 3) { if (typeReport == 3) {
if (dataTable2.length == 1) { if (dataTable2.length == 2) {
if (typeButton == 'add') { if (typeButton == 'add') {
return true return true
} else { } else {
...@@ -1546,28 +1562,59 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1546,28 +1562,59 @@ export default class ListOfCreditFacilities extends Component {
} }
const handleDelete = (index) => { const handleDelete = (index) => {
// if (dataTable2[index][1] !== "") { let dataDelete = this.state.dataDelete
// dataDelete.push(dataTable2[index][1])
// }
let berapaInput = 0 let berapaInput = 0
dataTable2.map((items,indexs) => { dataTable2.map((items,indexs) => {
if (items[0] == 3) { if (items[0] == 3) {
berapaInput += 1 berapaInput += 1
} }
}) })
let rowSblmnya = dataTable2[index-1] == undefined? false : String(dataTable2[index-1][6].value).includes(dataTable2[index][6].value)
if (berapaInput > 1) { dataDelete.push(dataTable2[index][1])
if (String(dataTable2[index+1][6].value).includes('Total') && !rowSblmnya) {
dataTable2.splice(index, 2) let prevData = dataTable2[index-1] == undefined? null : dataTable2[index-1][6]
} else { let currentData = dataTable2[index][6]
dataTable2.splice(index, 1) let nextData = dataTable2[index+1] == undefined? null : dataTable2[index+1][6]
if (nextData == null) {
dataTable2.splice(index,1)
} else if (nextData.value.includes('Total')) {
if (prevData !== null && currentData == null) {
dataTable2.splice(index,1)
} else if (prevData !== null && prevData.value == currentData.value) {
dataTable2.splice(index,1)
} else if (dataTable2.length > 3) {
if (prevData == null) {
if (nextData.value.includes('Grand')) {
dataTable2.splice(index,1)
} else {
dataTable2.splice(index,2)
}
} else {
dataTable2.splice(index,2)
}
} else if (dataTable2.length == 3) {
if (prevData == null) {
if (nextData.value.includes('Grand')) {
dataTable2.splice(index,1)
} else {
dataTable2.splice(index,3)
dataTable2.push(
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "0.00", "", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", 0 ],
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
)
}
} else {
dataTable2.splice(index,1)
}
} }
} else { } else {
this.setState({snekbar: true, snekbarMsg: 'Datatable Cannot be Empty'}) dataTable2.splice(index,1)
} }
this.setState({ dataTable: dataTable2,}, () => { this.setState({ dataTable: dataTable2, dataDelete }, () => {
setTimeout(() => { setTimeout(() => {
console.log(this.state.dataDelete)
this.setState({ loading: false }) this.setState({ loading: false })
}, 100) }, 100)
}) })
......
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