Commit 178f6a45 authored by Riri Novita's avatar Riri Novita

Currency - View MB

parent 64eada77
...@@ -63,6 +63,7 @@ export default class BalanceSheet extends Component { ...@@ -63,6 +63,7 @@ export default class BalanceSheet extends Component {
} }
componentDidMount() { componentDidMount() {
console.log(this.props);
this.getLatestUpdate() this.getLatestUpdate()
this.getSettingControl() this.getSettingControl()
} }
...@@ -75,7 +76,7 @@ export default class BalanceSheet extends Component { ...@@ -75,7 +76,7 @@ export default class BalanceSheet extends Component {
} }
api.create().getAllSettingByType(body).then(response => { api.create().getAllSettingByType(body).then(response => {
// console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ this.setState({
...@@ -106,7 +107,8 @@ export default class BalanceSheet extends Component { ...@@ -106,7 +107,8 @@ export default class BalanceSheet 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) {
...@@ -137,7 +139,8 @@ export default class BalanceSheet extends Component { ...@@ -137,7 +139,8 @@ export default class BalanceSheet 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
} }
let response = await api.create().getDetailReportMB(payload) let response = await api.create().getDetailReportMB(payload)
console.log(response); console.log(response);
......
...@@ -123,8 +123,8 @@ export default class BudgetTahunan extends Component { ...@@ -123,8 +123,8 @@ export default class BudgetTahunan extends Component {
}) })
this.props.selectIndex('Master Budget & CAT') this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) {
console.log(this.props); console.log(this.props);
if (this.props.location.state !== undefined) {
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => { 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()
// this.checkApprover() // this.checkApprover()
...@@ -140,7 +140,6 @@ export default class BudgetTahunan extends Component { ...@@ -140,7 +140,6 @@ export default class BudgetTahunan extends Component {
menu: "Master Budget & CAT" menu: "Master Budget & CAT"
} }
api.create().getPermission(payload).then(response => { api.create().getPermission(payload).then(response => {
// console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -202,7 +201,7 @@ export default class BudgetTahunan extends Component { ...@@ -202,7 +201,7 @@ export default class BudgetTahunan extends Component {
checkApprover() { checkApprover() {
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
console.log(response.data.data) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
...@@ -313,17 +312,19 @@ export default class BudgetTahunan extends Component { ...@@ -313,17 +312,19 @@ export default class BudgetTahunan extends Component {
"report_type": "Master Budget", "report_type": "Master Budget",
"currency_id": this.state.defaultCurrency.id "currency_id": this.state.defaultCurrency.id
} }
console.log(payload); // console.log(payload);
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C') let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C')
let status_approv = '' let status_approv = ''
if (String(item.current_status).toLocaleUpperCase().includes('CC')) { if (String(item.current_status).toLocaleUpperCase().includes('CC')) {
// console.log("tes 1");
status_approv = `${String(item.current_status).substr(0, indexC)}${String(item.current_status).substr(indexC + 1, String(item.current_status).length)}` status_approv = `${String(item.current_status).substr(0, indexC)}${String(item.current_status).substr(indexC + 1, String(item.current_status).length)}`
} else { } else {
// console.log("tes 2");
status_approv = String(item.current_status) status_approv = String(item.current_status)
} }
const handleOpbal = (item) => { const handleOpbal = (item) => {
...@@ -345,6 +346,7 @@ export default class BudgetTahunan extends Component { ...@@ -345,6 +346,7 @@ export default class BudgetTahunan extends Component {
item.revision item.revision
] ]
}) })
// console.log(dataTable);
let dataTableRevision = [] let dataTableRevision = []
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.report_name !== 'Cash Flow') { if (item.report_name !== 'Cash Flow') {
...@@ -375,11 +377,12 @@ export default class BudgetTahunan extends Component { ...@@ -375,11 +377,12 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getSubmitMasterBudget(body).then(response => { api.create().getSubmitMasterBudget(body).then(response => {
console.log(response); // console.log(response);
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.getReportAttachment() this.getReportAttachment()
this.getReport()
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -405,7 +408,7 @@ export default class BudgetTahunan extends Component { ...@@ -405,7 +408,7 @@ export default class BudgetTahunan extends Component {
let datas = [] let datas = []
if (response.data.data.currency.length > 0) { if (response.data.data.currency.length > 0) {
response.data.data.currency.map((item) => { response.data.data.currency.map((item) => {
console.log(item); // console.log(item);
datas.push({ datas.push({
id: item.currencyId, id: item.currencyId,
value: item.currencyName value: item.currencyName
...@@ -459,7 +462,7 @@ export default class BudgetTahunan extends Component { ...@@ -459,7 +462,7 @@ export default class BudgetTahunan extends Component {
getCompanyActive() { getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { api.create().getPerusahaanActive().then((response) => {
console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
...@@ -490,7 +493,6 @@ export default class BudgetTahunan extends Component { ...@@ -490,7 +493,6 @@ 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' }, () => {
...@@ -522,7 +524,7 @@ export default class BudgetTahunan extends Component { ...@@ -522,7 +524,7 @@ export default class BudgetTahunan extends Component {
getPeriode() { getPeriode() {
api.create().getPeriodeTransaction().then(response => { api.create().getPeriodeTransaction().then(response => {
console.log(response); // console.log(response);
// let dateNow = new Date // let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy') // let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
let currentYear = new Date().getFullYear() let currentYear = new Date().getFullYear()
...@@ -553,11 +555,12 @@ export default class BudgetTahunan extends Component { ...@@ -553,11 +555,12 @@ export default class BudgetTahunan extends Component {
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// // console.log(this.props.location.state.rawData) // // console.log(this.props.location.state.rawData)
console.log(this.state.lastPeriod) // console.log(this.state.lastPeriod)
console.log(periode) // console.log(periode)
console.log(index) // console.log(index)
// console.log(periodeData) // console.log(periodeData)
// // // console.log(index) // // // console.log(index)
console.log(this.state.isApprover);
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) { if (this.state.isApprover === true) {
this.getCompanySubmitted() this.getCompanySubmitted()
...@@ -641,9 +644,9 @@ export default class BudgetTahunan extends Component { ...@@ -641,9 +644,9 @@ export default class BudgetTahunan extends Component {
// this.getCashFlow(type) // this.getCashFlow(type)
// this.getPL(type) // this.getPL(type)
if (this.state.isAdmin) { if (this.state.isAdmin) {
console.log('masuk') // console.log('masuk')
api.create().getListApprover('master_budget', this.state.submissionID).then((response) => { api.create().getListApprover('master_budget', this.state.submissionID).then((response) => {
console.log(response) // console.log(response)
if (response.data.data) { if (response.data.data) {
let dataListApprover = [] let dataListApprover = []
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
...@@ -667,7 +670,7 @@ export default class BudgetTahunan extends Component { ...@@ -667,7 +670,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"companyId": this.state.company.company_id "companyId": this.state.company.company_id
} }
console.log(bodyRatioBs); // console.log(bodyRatioBs);
api.create().triggerRatioMB(bodyRatioBs).then((res) => { api.create().triggerRatioMB(bodyRatioBs).then((res) => {
console.log(res) console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -677,8 +680,9 @@ export default class BudgetTahunan extends Component { ...@@ -677,8 +680,9 @@ export default class BudgetTahunan extends Component {
} }
// this.getFR(type) // this.getFR(type)
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
// // console.log(this.state.btncreate); console.log(this.state.btnedit)
// // console.log(this.state.btnedit) console.log(this.state.btncreate);
console.log(response);
if (this.state.btncreate === true && this.state.btnedit === true) { if (this.state.btncreate === true && this.state.btnedit === true) {
this.setState({ isApprover: false }, () => { this.setState({ isApprover: false }, () => {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
...@@ -806,7 +810,7 @@ export default class BudgetTahunan extends Component { ...@@ -806,7 +810,7 @@ export default class BudgetTahunan extends Component {
} }
} }
}) })
console.log(dataTable) // console.log(dataTable)
this.setState({ dbCF: dataTable }, () => { this.setState({ dbCF: dataTable }, () => {
this.olahDataCashFlow(this.state.dbCF, type) this.olahDataCashFlow(this.state.dbCF, type)
}) })
...@@ -1182,7 +1186,7 @@ export default class BudgetTahunan extends Component { ...@@ -1182,7 +1186,7 @@ export default class BudgetTahunan extends Component {
} }
olahDataCashFlowOneMore(list, type) { olahDataCashFlowOneMore(list, type) {
console.log(list) // console.log(list)
let listCF = [] let listCF = []
list.map((item, index) => { list.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) { if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
...@@ -1279,14 +1283,14 @@ export default class BudgetTahunan extends Component { ...@@ -1279,14 +1283,14 @@ export default class BudgetTahunan extends Component {
}) })
console.log(listCF) // console.log(listCF)
this.setState({ dbCF: listCF }, () => { this.setState({ dbCF: listCF }, () => {
// if (this.state.submissionID != null) { // if (this.state.submissionID != null) {
// this.createCashFlow() // this.createCashFlow()
// } // }
// if (type != undefined) { // if (type != undefined) {
// if (type == 'BS' || type == 'FAM' || type == 'PL') { // if (type == 'BS' || type == 'FAM' || type == 'PL') {
console.log('tarik sis') // console.log('tarik sis')
// this.createCashFlow() // this.createCashFlow()
// } // }
// } // }
...@@ -1295,7 +1299,7 @@ export default class BudgetTahunan extends Component { ...@@ -1295,7 +1299,7 @@ export default class BudgetTahunan extends Component {
createCashFlow(payload) { createCashFlow(payload) {
api.create().createReportCF(payload).then((res) => { api.create().createReportCF(payload).then((res) => {
console.log(res) // console.log(res)
this.getSubmission() this.getSubmission()
// if (response.data) { // if (response.data) {
// if (response.data.status === "success") { // if (response.data.status === "success") {
...@@ -1322,7 +1326,7 @@ export default class BudgetTahunan extends Component { ...@@ -1322,7 +1326,7 @@ export default class BudgetTahunan extends Component {
} }
console.log(payloadID); console.log(payloadID);
api.create().getPLID(payloadID).then(response => { api.create().getPLID(payloadID).then(response => {
console.log(response); // console.log(response);
if (response) { if (response) {
PLID = response.data.data == null ? null : response.data.data.profit_loss_id PLID = response.data.data == null ? null : response.data.data.profit_loss_id
} else { } else {
...@@ -1343,7 +1347,7 @@ export default class BudgetTahunan extends Component { ...@@ -1343,7 +1347,7 @@ export default class BudgetTahunan extends Component {
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
// let dataTable = [] // let dataTable = []
console.log(response) // console.log(response)
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
dataTable.push([ dataTable.push([
...@@ -1635,13 +1639,13 @@ export default class BudgetTahunan extends Component { ...@@ -1635,13 +1639,13 @@ export default class BudgetTahunan extends Component {
} }
}) })
if (String(tableMeta[5]) == "Cost of Goods Sold (COGS)" && column == 20) { // if (String(tableMeta[5]) == "Cost of Goods Sold (COGS)" && column == 20) {
console.log(splitFormula) // console.log(splitFormula)
console.log(baru) // console.log(baru)
console.log(anjay) // console.log(anjay)
console.log(anjay2) // console.log(anjay2)
console.log(total) // console.log(total)
} // }
total = R.equals(total, NaN) ? "0.0" : total total = R.equals(total, NaN) ? "0.0" : total
return total return total
} }
...@@ -1781,7 +1785,7 @@ export default class BudgetTahunan extends Component { ...@@ -1781,7 +1785,7 @@ export default class BudgetTahunan extends Component {
// } // }
if (type != undefined) { if (type != undefined) {
if (type == 'PL') { if (type == 'PL') {
console.log('tarik sis') // console.log('tarik sis')
this.createDBPL() this.createDBPL()
} }
} }
...@@ -1802,7 +1806,7 @@ export default class BudgetTahunan extends Component { ...@@ -1802,7 +1806,7 @@ export default class BudgetTahunan extends Component {
// console.log(this.state.dbCF) // console.log(this.state.dbCF)
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().createReportPLMB(payload).then((res) => { api.create().createReportPLMB(payload).then((res) => {
console.log(res) // console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
// if (response.data) { // if (response.data) {
// if (response.data.status === "success") { // if (response.data.status === "success") {
...@@ -1822,15 +1826,15 @@ export default class BudgetTahunan extends Component { ...@@ -1822,15 +1826,15 @@ export default class BudgetTahunan extends Component {
} }
getFR(type) { getFR(type) {
console.log("get FR"); // console.log("get FR");
let FRID = null let FRID = null
let payloadID = { let payloadID = {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"company_id": this.state.company.company_id "company_id": this.state.company.company_id
} }
console.log(payloadID); // console.log(payloadID);
api.create().getFRID(payloadID).then(response => { api.create().getFRID(payloadID).then(response => {
console.log(response); // console.log(response);
if (response) { if (response) {
FRID = response.data.data == null ? null : response.data.data.ratio_id FRID = response.data.data == null ? null : response.data.data.ratio_id
} else { } else {
...@@ -1849,11 +1853,11 @@ export default class BudgetTahunan extends Component { ...@@ -1849,11 +1853,11 @@ export default class BudgetTahunan extends Component {
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
// let dataTable = [] // let dataTable = []
console.log(response) // console.log(response)
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
if (item.description == 'Return on Invested Capital - YTD (ROIC)') { if (item.description == 'Return on Invested Capital - YTD (ROIC)') {
console.log(item.ratio.january) // console.log(item.ratio.january)
} }
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
...@@ -1924,7 +1928,7 @@ export default class BudgetTahunan extends Component { ...@@ -1924,7 +1928,7 @@ export default class BudgetTahunan extends Component {
} }
}) })
this.setState({ dbFR: dataTable, loading: false }, () => { this.setState({ dbFR: dataTable, loading: false }, () => {
console.log(this.state.dbFR) // console.log(this.state.dbFR)
this.olahDataFR(this.state.dbFR, type) this.olahDataFR(this.state.dbFR, type)
}) })
} else { } else {
...@@ -2035,8 +2039,8 @@ export default class BudgetTahunan extends Component { ...@@ -2035,8 +2039,8 @@ export default class BudgetTahunan extends Component {
}) })
console.log(listFR) // console.log(listFR)
console.log('subOD', this.state.submissionID) // console.log('subOD', this.state.submissionID)
this.setState({ dbFR: listFR }, () => { this.setState({ dbFR: listFR }, () => {
if (this.state.submissionID != null) { if (this.state.submissionID != null) {
this.createDBFR() this.createDBFR()
...@@ -2045,7 +2049,7 @@ export default class BudgetTahunan extends Component { ...@@ -2045,7 +2049,7 @@ export default class BudgetTahunan extends Component {
} }
createDBFR() { createDBFR() {
console.log("create FR"); // console.log("create FR");
let payload = { let payload = {
// "submission_id": this.state.submissionID, // "submission_id": this.state.submissionID,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
...@@ -2059,7 +2063,7 @@ export default class BudgetTahunan extends Component { ...@@ -2059,7 +2063,7 @@ export default class BudgetTahunan extends Component {
// console.log(this.state.dbCF) // console.log(this.state.dbCF)
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().createReportFRMB(payload).then((res) => { api.create().createReportFRMB(payload).then((res) => {
console.log(res) // console.log(res)
// if (response.data) { // if (response.data) {
// if (response.data.status === "success") { // if (response.data.status === "success") {
// this.props.saveToMonthlyReport() // this.props.saveToMonthlyReport()
...@@ -2109,7 +2113,7 @@ export default class BudgetTahunan extends Component { ...@@ -2109,7 +2113,7 @@ export default class BudgetTahunan extends Component {
async setHeaderTokenSuperadmin(type) { async setHeaderTokenSuperadmin(type) {
let realToken = await localStorage.getItem(Constant.TOKEN) let realToken = await localStorage.getItem(Constant.TOKEN)
api.create().getIdToken(this.state.approver.userId).then((response) => { api.create().getIdToken(this.state.approver.userId).then((response) => {
console.log(response.data.data.token) // console.log(response.data.data.token)
localStorage.setItem(Constant.TOKEN, response.data.data.token) localStorage.setItem(Constant.TOKEN, response.data.data.token)
this.approvalSubmission(type, realToken) this.approvalSubmission(type, realToken)
}) })
...@@ -2140,12 +2144,12 @@ export default class BudgetTahunan extends Component { ...@@ -2140,12 +2144,12 @@ export default class BudgetTahunan extends Component {
"min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'), "min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'),
"max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD') "max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD')
} }
console.log(payload) // console.log(payload)
// // console.log(this.props.location); // // console.log(this.props.location);
console.log(body) // console.log(body)
setTimeout(() => { setTimeout(() => {
api.create().approvalSubmission(body).then((res) => { api.create().approvalSubmission(body).then((res) => {
console.log(res) // console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (this.state.isAdmin && type == 'approve') { if (this.state.isAdmin && type == 'approve') {
...@@ -2309,10 +2313,10 @@ export default class BudgetTahunan extends Component { ...@@ -2309,10 +2313,10 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
}) })
console.log(data); // console.log(data);
// // // console.log(JSON.stringify(data)); // // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => { api.create('UPLOAD').createSubmitReport(data).then(response => {
console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -2426,7 +2430,7 @@ export default class BudgetTahunan extends Component { ...@@ -2426,7 +2430,7 @@ export default class BudgetTahunan extends Component {
} }
handleSelectAll(data) { handleSelectAll(data) {
console.log(this.state.isCheckAll); // console.log(this.state.isCheckAll);
if (this.state.isCheckAll) { if (this.state.isCheckAll) {
let checkAll = [] let checkAll = []
this.setState({ selectReport: checkAll, isCheckAll: false }) this.setState({ selectReport: checkAll, isCheckAll: false })
...@@ -2443,7 +2447,7 @@ export default class BudgetTahunan extends Component { ...@@ -2443,7 +2447,7 @@ export default class BudgetTahunan extends Component {
checkAll.splice(index, 1) checkAll.splice(index, 1)
} }
}) })
console.log(checkAll); // console.log(checkAll);
this.setState({ selectReport: checkAll, isCheckAll: isAllDetail }) this.setState({ selectReport: checkAll, isCheckAll: isAllDetail })
} }
} }
...@@ -2463,7 +2467,7 @@ export default class BudgetTahunan extends Component { ...@@ -2463,7 +2467,7 @@ export default class BudgetTahunan extends Component {
} }
let isCheckAll = selectReport.length === this.state.dataTable.length let isCheckAll = selectReport.length === this.state.dataTable.length
this.setState({ selectReport, isCheckAll }) this.setState({ selectReport, isCheckAll })
console.log(selectReport); // console.log(selectReport);
} }
handleDownloadReport(tableMeta) { handleDownloadReport(tableMeta) {
...@@ -2476,9 +2480,9 @@ export default class BudgetTahunan extends Component { ...@@ -2476,9 +2480,9 @@ export default class BudgetTahunan extends Component {
"quartal": "", "quartal": "",
"type_report_name": "Master Budget" "type_report_name": "Master Budget"
} }
console.log(payload); // console.log(payload);
api.create().createDownloadFile(payload).then((response) => { api.create().createDownloadFile(payload).then((response) => {
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -2517,7 +2521,7 @@ export default class BudgetTahunan extends Component { ...@@ -2517,7 +2521,7 @@ export default class BudgetTahunan extends Component {
let { selectReport, submissionID, company, periode, month, downloadedFileReportId } = this.state let { selectReport, submissionID, company, periode, month, downloadedFileReportId } = this.state
if (selectReport.length > 0) { if (selectReport.length > 0) {
let result = [] let result = []
console.log('mulai hit') // console.log('mulai hit')
for (const items of selectReport) { for (const items of selectReport) {
let datas = data.findIndex((val) => val[4] == items) let datas = data.findIndex((val) => val[4] == items)
let report = data[datas] let report = data[datas]
...@@ -2533,7 +2537,6 @@ export default class BudgetTahunan extends Component { ...@@ -2533,7 +2537,6 @@ export default class BudgetTahunan extends Component {
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
} }
console.log(res)
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
...@@ -2549,14 +2552,13 @@ export default class BudgetTahunan extends Component { ...@@ -2549,14 +2552,13 @@ export default class BudgetTahunan extends Component {
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
} }
console.log(res)
if (res.status === 200) { if (res.status === 200) {
result = [...result, res]; result = [...result, res];
} }
} }
} }
console.log('ini result', result); // console.log('ini result', result);
// every untuk cek ke setiap result di dalam array // every untuk cek ke setiap result di dalam array
if (result.every((e) => e.status == 200)) { if (result.every((e) => e.status == 200)) {
this.handleZip(); this.handleZip();
...@@ -2600,9 +2602,9 @@ export default class BudgetTahunan extends Component { ...@@ -2600,9 +2602,9 @@ export default class BudgetTahunan extends Component {
} }
async handleZip() { async handleZip() {
console.log('mulai zip') // console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => { api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -2966,7 +2968,7 @@ export default class BudgetTahunan extends Component { ...@@ -2966,7 +2968,7 @@ export default class BudgetTahunan extends Component {
options={this.state.currency} options={this.state.currency}
getOptionLabel={(option) => option.value} getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency} value={this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => this.clearError())} onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue })}
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
{...params} {...params}
...@@ -3408,6 +3410,7 @@ export default class BudgetTahunan extends Component { ...@@ -3408,6 +3410,7 @@ export default class BudgetTahunan extends Component {
width={this.props.width} width={this.props.width}
company={this.state.company} company={this.state.company}
defaultCurrency={this.state.defaultCurrency} defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
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}
...@@ -3430,6 +3433,7 @@ export default class BudgetTahunan extends Component { ...@@ -3430,6 +3433,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}
...@@ -3452,6 +3456,7 @@ export default class BudgetTahunan extends Component { ...@@ -3452,6 +3456,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}
...@@ -3474,6 +3479,7 @@ export default class BudgetTahunan extends Component { ...@@ -3474,6 +3479,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}
...@@ -3499,6 +3505,7 @@ export default class BudgetTahunan extends Component { ...@@ -3499,6 +3505,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}
......
...@@ -77,7 +77,8 @@ export default class CashFlow extends Component { ...@@ -77,7 +77,8 @@ export default class CashFlow 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
} }
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
// if (this.props.status === 'CLOSED') { // if (this.props.status === 'CLOSED') {
......
...@@ -105,7 +105,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -105,7 +105,8 @@ export default class CorporateAnnualTarget 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
} }
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
...@@ -1006,7 +1007,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1006,7 +1007,8 @@ export default class CorporateAnnualTarget 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) {
......
...@@ -65,7 +65,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -65,7 +65,8 @@ export default class FixedAssetsMovement 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) {
...@@ -96,7 +97,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -96,7 +97,8 @@ export default class FixedAssetsMovement 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); console.log(response);
......
...@@ -8,7 +8,7 @@ import Images from '../../assets/Images'; ...@@ -8,7 +8,7 @@ import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab'; import { Alert, Autocomplete } from '@material-ui/lab';
import * as R from 'ramda'; import * as R from 'ramda';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
...@@ -63,7 +63,8 @@ export default class ProfitLoss extends Component { ...@@ -63,7 +63,8 @@ export default class ProfitLoss extends Component {
updateBy: [], updateBy: [],
buttonDraft: true, buttonDraft: true,
handleDoubleClick: 0, handleDoubleClick: 0,
fromUpload: false fromUpload: false,
defaultCurrencyUpload: this.props.defaultCurrency
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -349,14 +350,18 @@ export default class ProfitLoss extends Component { ...@@ -349,14 +350,18 @@ export default class ProfitLoss extends Component {
profit_loss: payload, profit_loss: payload,
status: 'submitted' status: 'submitted'
} }
// console.log(isi) console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
} }
}); });
} }
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { let payload = {
...this.state.payload,
currency_id : this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -3193,6 +3198,31 @@ export default class ProfitLoss extends Component { ...@@ -3193,6 +3198,31 @@ export default class ProfitLoss extends Component {
</button> </button>
</div> </div>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 30px' }}>
<div className="column-1">
<Autocomplete
id="tipe"
disableClearable
options={this.props.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrencyUpload}
onChange={(event, newInputValue) => this.setState({ defaultCurrencyUpload: newInputValue })}
renderInput={(params) =>
<TextField
{...params}
variant="standard"
label="Default Currency"
margin="normal"
style={{ marginBottom: 10 }}
// InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
// InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div style={{ padding: '10px 30px' }}>
<UploadFile <UploadFile
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
...@@ -3209,6 +3239,8 @@ export default class ProfitLoss extends Component { ...@@ -3209,6 +3239,8 @@ export default class ProfitLoss extends Component {
}} }}
/> />
</div> </div>
</div>
</div> </div>
)} )}
</div> </div>
......
...@@ -92,7 +92,8 @@ export default class TaxPlanning extends Component { ...@@ -92,7 +92,8 @@ export default class TaxPlanning 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 => {
console.log(response) console.log(response)
...@@ -124,7 +125,8 @@ export default class TaxPlanning extends Component { ...@@ -124,7 +125,8 @@ export default class TaxPlanning 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); console.log(response);
......
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