Commit 59f8a8a3 authored by Riri Novita's avatar Riri Novita

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

Currency MB PL

See merge request !1796
parents 7b6bd245 d9163c6c
...@@ -96,7 +96,20 @@ export default class BudgetTahunan extends Component { ...@@ -96,7 +96,20 @@ export default class BudgetTahunan extends Component {
isCheckAll: false, isCheckAll: false,
downloadedFileReportId: null, downloadedFileReportId: null,
arrayReport: [], arrayReport: [],
popupDownload: false popupDownload: false,
defaultCurrency: null,
dataCurrency: [],
currency: [],
dataCurrency: [
{
"id": 1,
"value": "IDR"
},
{
"id": 2,
"value": "USD",
}
]
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -248,7 +261,6 @@ export default class BudgetTahunan extends Component { ...@@ -248,7 +261,6 @@ export default class BudgetTahunan extends Component {
this.setState({ listCompany: defaultProps, company: indexID == null ? (this.state.company !== null ? this.state.company : companyData[0]) : companyData[indexID] }, () => { this.setState({ listCompany: defaultProps, company: indexID == null ? (this.state.company !== null ? this.state.company : companyData[0]) : companyData[indexID] }, () => {
// this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => { // this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// // // console.log(response.data.data);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
} else { } else {
...@@ -299,6 +311,7 @@ export default class BudgetTahunan extends Component { ...@@ -299,6 +311,7 @@ export default class BudgetTahunan extends Component {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"report_type": "Master Budget", "report_type": "Master Budget",
"currency_id": this.state.defaultCurrency.id
} }
console.log(payload); console.log(payload);
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
...@@ -366,7 +379,6 @@ export default class BudgetTahunan extends Component { ...@@ -366,7 +379,6 @@ export default class BudgetTahunan extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => { this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
this.getReport()
this.getReportAttachment() this.getReportAttachment()
}) })
} else { } else {
...@@ -383,6 +395,52 @@ export default class BudgetTahunan extends Component { ...@@ -383,6 +395,52 @@ export default class BudgetTahunan extends Component {
}) })
} }
getCurrency(companyID) {
// console.log(companyID);
api.create().getDetailPerusahaan(companyID).then(response => {
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
let data = response.data.data
let datas = []
if (response.data.data.currency.length > 0) {
response.data.data.currency.map((item) => {
console.log(item);
datas.push({
id: item.currencyId,
value: item.currencyName
})
})
}
let index = datas.findIndex((val) => val.id == response.data.data.default_currency)
this.setState({
defaultCurrencyID: response.data.data.default_currency,
currency: datas,
defaultCurrency: index == -1 ? null : datas[index]
}, () => {
this.getReport()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
getDetailUser() { getDetailUser() {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
...@@ -432,6 +490,7 @@ export default class BudgetTahunan extends Component { ...@@ -432,6 +490,7 @@ export default class BudgetTahunan extends Component {
let index = arrayBaru.findIndex((val) => val.company_id == comID) let index = arrayBaru.findIndex((val) => val.company_id == comID)
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => { this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => {
this.getLastPeriod() this.getLastPeriod()
console.log(this.state.company.company_id);
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -504,6 +563,7 @@ export default class BudgetTahunan extends Component { ...@@ -504,6 +563,7 @@ export default class BudgetTahunan extends Component {
this.getCompanySubmitted() this.getCompanySubmitted()
} else { } else {
this.getRevision() this.getRevision()
this.getCurrency(this.state.company.company_id)
} }
}) })
} }
...@@ -2877,8 +2937,8 @@ export default class BudgetTahunan extends Component { ...@@ -2877,8 +2937,8 @@ export default class BudgetTahunan extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ display: "flex"}}> <div style={{ display: "flex" }}>
<div style={{ marginRight: 50}}> <div style={{ marginRight: 50 }}>
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
...@@ -2899,27 +2959,45 @@ export default class BudgetTahunan extends Component { ...@@ -2899,27 +2959,45 @@ export default class BudgetTahunan extends Component {
value={this.state.periode} value={this.state.periode}
/> />
</div> </div>
{/* <div> <div style={{ width: 255 }}>
<Autocomplete <Autocomplete
{...this.state.listPeriode} id="tipe"
id="currency"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
} else {
this.setState({ visibleTableHistory: false })
this.getRevision()
}
})}
disabled={this.state.intent === 'Home' ? true : false}
disableClearable disableClearable
style={{ width: 250 }} options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => this.clearError())}
renderInput={(params) => renderInput={(params) =>
<TextField {...params} label="Currency" margin="normal" style={{ marginTop: 7 }} <TextField
/>} {...params}
value={this.state.periode} variant="standard"
label="Default Currency"
margin="normal"
style={{ marginTop: 6 }}
// InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
// InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/> />
</div> */} }
/>
{/* <Autocomplete
options={this.state.dataCurrency}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ currency: newInputValue })}
renderInput={(params) => (
<TextField
{...params}
variant="standard"
label="Currency"
margin="normal"
style={{ marginTop: 0 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
)}
value={this.state.currency == null ? "IDR" : this.state.currency}
/> */}
</div>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
...@@ -2930,6 +3008,7 @@ export default class BudgetTahunan extends Component { ...@@ -2930,6 +3008,7 @@ export default class BudgetTahunan extends Component {
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false }) this.setState({ visibleTableHistory: false })
// this.getLastPeriod() // this.getLastPeriod()
this.getCurrency(newInputValue.company_id)
this.getRevision() this.getRevision()
})} })}
disableClearable disableClearable
...@@ -3305,6 +3384,7 @@ export default class BudgetTahunan extends Component { ...@@ -3305,6 +3384,7 @@ export default class BudgetTahunan extends Component {
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
company={this.state.company} company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
...@@ -3327,6 +3407,7 @@ export default class BudgetTahunan extends Component { ...@@ -3327,6 +3407,7 @@ export default class BudgetTahunan extends Component {
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
company={this.state.company} company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID} submissionID={this.state.submissionID}
......
...@@ -81,7 +81,8 @@ export default class ProfitLoss extends Component { ...@@ -81,7 +81,8 @@ export default class ProfitLoss extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id
} }
api.create().getLastestUpdateMB(payload).then(response => { api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) { if (response.data) {
...@@ -110,10 +111,10 @@ export default class ProfitLoss extends Component { ...@@ -110,10 +111,10 @@ export default class ProfitLoss extends Component {
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id
} }
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
let dataTable = [] let dataTable = []
this.setState({ visibleProfitLoss: true }) this.setState({ visibleProfitLoss: true })
if (response.data) { if (response.data) {
......
...@@ -78,10 +78,10 @@ export default class Perusahaan extends Component { ...@@ -78,10 +78,10 @@ export default class Perusahaan extends Component {
"company_name": item[0] === undefined ? "" : item[0], "company_name": item[0] === undefined ? "" : item[0],
"company_parent": item[1] === undefined ? "" : item[1], "company_parent": item[1] === undefined ? "" : item[1],
"unit_bisnis": item[2] === undefined ? "" : item[2], "unit_bisnis": item[2] === undefined ? "" : item[2],
"start_date": item[3] === undefined ? "" : item[3], "currency": item[3] === undefined ? "" :item[3],
"end_date": item[4] === undefined ? "" :item[4], "default_currency": item[4] === undefined ? "" :item[4],
"currency": item[5] === undefined ? "" :item[5], "start_date": item[5] === undefined ? "" : item[5],
"default_currency": item[6] === undefined ? "" :item[6], "end_date": item[6] === undefined ? "" :item[6]
}) })
} }
}) })
...@@ -106,10 +106,10 @@ export default class Perusahaan extends Component { ...@@ -106,10 +106,10 @@ export default class Perusahaan extends Component {
item.company_name, item.company_name,
item.company_parent, item.company_parent,
item.unit_bisnis, item.unit_bisnis,
item.start_date,
item.end_date,
item.currency, item.currency,
item.default_currency, item.default_currency,
item.start_date,
item.end_date,
item.error item.error
] ]
}) })
...@@ -190,12 +190,12 @@ export default class Perusahaan extends Component { ...@@ -190,12 +190,12 @@ export default class Perusahaan extends Component {
} }
}, },
{ {
name: "Valid From", name: "Currency",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[7] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('start_date')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('unit_bisnis'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
...@@ -203,24 +203,24 @@ export default class Perusahaan extends Component { ...@@ -203,24 +203,24 @@ export default class Perusahaan extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="startdate"> <a data-tip={tableMeta.rowData[7][check].message} data-for="unit_bisnis">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="unit_bisnis" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
} }
}, },
{ {
name: "Valid To", name: "Default Currency",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[7] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('end_date')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('unit_bisnis'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
...@@ -228,24 +228,24 @@ export default class Perusahaan extends Component { ...@@ -228,24 +228,24 @@ export default class Perusahaan extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[7][check].message} data-for="unit_bisnis">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="unit_bisnis" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
} }
}, },
{ {
name: "Currency", name: "Valid From",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[7] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('unit_bisnis')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('start_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
...@@ -253,24 +253,24 @@ export default class Perusahaan extends Component { ...@@ -253,24 +253,24 @@ export default class Perusahaan extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="unit_bisnis"> <a data-tip={tableMeta.rowData[7][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="unit_bisnis" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
} }
}, },
{ {
name: "Default Currency", name: "Valid To",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[7] != null) { if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('unit_bisnis')) check = tableMeta.rowData[7].findIndex((val) => val.field.includes('end_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
...@@ -278,12 +278,12 @@ export default class Perusahaan extends Component { ...@@ -278,12 +278,12 @@ export default class Perusahaan extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[7] != null && check > -1 ? {tableMeta.rowData[7] != null && check > -1 ?
<a data-tip={tableMeta.rowData[7][check].message} data-for="unit_bisnis"> <a data-tip={tableMeta.rowData[7][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="unit_bisnis" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div > </div >
); );
} }
......
...@@ -218,7 +218,7 @@ export default class BalanceSheetRO extends Component { ...@@ -218,7 +218,7 @@ export default class BalanceSheetRO extends Component {
this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year, item.balance_sheet.total_current_year === "" ? "0" : Number(item.balance_sheet.total_current_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
...@@ -254,7 +254,7 @@ export default class BalanceSheetRO extends Component { ...@@ -254,7 +254,7 @@ export default class BalanceSheetRO extends Component {
this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1), this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year, item.balance_sheet.total_current_year === "" ? "0" : Number(item.balance_sheet.total_current_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
...@@ -268,7 +268,7 @@ export default class BalanceSheetRO extends Component { ...@@ -268,7 +268,7 @@ export default class BalanceSheetRO extends Component {
} }
} }
}) })
console.log(dataTable) // console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else { } else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -466,7 +466,7 @@ export default class BalanceSheetRO extends Component { ...@@ -466,7 +466,7 @@ export default class BalanceSheetRO extends Component {
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
// console.log(resp.rows[2]); console.log(isi);
let payload = [] let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -491,6 +491,7 @@ export default class BalanceSheetRO extends Component { ...@@ -491,6 +491,7 @@ export default class BalanceSheetRO extends Component {
}) })
} }
}) })
console.log(payload);
let body = { let body = {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
...@@ -509,7 +510,6 @@ export default class BalanceSheetRO extends Component { ...@@ -509,7 +510,6 @@ export default class BalanceSheetRO extends Component {
checkUpload() { checkUpload() {
api.create().checkImportRollingOutlookBS(this.state.payload).then(response => { api.create().checkImportRollingOutlookBS(this.state.payload).then(response => {
this.props.refresh() this.props.refresh()
console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBSRO: false, loading: true }) this.setState({ visibleUpload: false, visibleBSRO: false, loading: true })
...@@ -540,7 +540,7 @@ export default class BalanceSheetRO extends Component { ...@@ -540,7 +540,7 @@ export default class BalanceSheetRO extends Component {
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1), item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1), item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1), item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1),
item.total_december_year === "" ? "0" : item.total_december_year, item.total_december_year === "" ? "0" : Number(item.total_december_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong, item.condition_if_wrong,
...@@ -549,12 +549,12 @@ export default class BalanceSheetRO extends Component { ...@@ -549,12 +549,12 @@ export default class BalanceSheetRO extends Component {
}) })
console.log(dataTable) console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => {
this.state.dataTable.map(item => { // this.state.dataTable.map(item => {
// if (item[24].length > 0) { // if (item[24].length > 0) {
// // console.log('masuk') // // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true }) // this.setState({ buttonError: true, errorPreview: true })
// } // }
}) // })
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
}) })
} }
...@@ -668,9 +668,6 @@ export default class BalanceSheetRO extends Component { ...@@ -668,9 +668,6 @@ export default class BalanceSheetRO extends Component {
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
// if (data.rowData[5] == 'Retained Earnings') {
// console.log(item[data.columnIndex].value)
// }
if (data.rowData[1] === item[2]) { if (data.rowData[1] === item[2]) {
let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex]) let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex])
total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal
......
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