Commit 8d8f0fa2 authored by faisalhamdi's avatar faisalhamdi

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

parents b813942c 5b90dbfc
...@@ -312,7 +312,7 @@ export default class BudgetTahunan extends Component { ...@@ -312,7 +312,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget(data) { saveToMasterBudget(data) {
this.setState({ loading: true }) this.setState({ loading: true })
// console.log(JSON.stringify(data)); // console.log(JSON.stringify(data));
api.create().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.data.status === "success") { if (response.data.status === "success") {
......
...@@ -31,18 +31,7 @@ export default class BalanceSheet extends Component { ...@@ -31,18 +31,7 @@ export default class BalanceSheet extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
dataTable: [ dataTable: [],
// ["TOTAL ASSETS", "11,247,249", "10,702,196"],
// ["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"],
// ["Cash & Cash Equivalent", "1,464,571", "729,743"],
// ["Cash & Bank Balance", "938,707", "265,584"],
// ["Time & Call Deposit", "525,864", "464,159"],
// ["BI Deposit", "", ""],
// ["Marketable Securities", "150,250", "154,500"],
// ["Notes Receivable", "", ""],
// ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"],
],
visibleBalanceSheet: true, visibleBalanceSheet: true,
disabledSave: true disabledSave: true
} }
...@@ -66,12 +55,12 @@ export default class BalanceSheet extends Component { ...@@ -66,12 +55,12 @@ export default class BalanceSheet extends Component {
} }
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
console.log(response); console.log(response);
if (response.data) {
if (response.data.status === "success") {
let dataTable = [] let dataTable = []
response.data.data.map((item, index) => { let res = response.data.data
console.log(res)
if (item.children && item.children.length > 0) { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -96,564 +85,16 @@ export default class BalanceSheet extends Component { ...@@ -96,564 +85,16 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year item.balance_sheet.total_more_year
]) ])
item.children.map(i => {
if (i.children) {
if (i.children.length > 0) {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description,
i.balance_sheet.total_actual_before,
i.balance_sheet.january,
i.balance_sheet.february,
i.balance_sheet.march,
i.balance_sheet.april,
i.balance_sheet.may,
i.balance_sheet.june,
i.balance_sheet.july,
i.balance_sheet.august,
i.balance_sheet.september,
i.balance_sheet.october,
i.balance_sheet.november,
i.balance_sheet.december,
i.balance_sheet.total_current_year,
i.balance_sheet.total_next_year,
i.balance_sheet.total_more_year
])
i.children.map(val => {
if (val.children && val.children.length > 0) {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description,
val.balance_sheet.total_actual_before,
val.balance_sheet.january,
val.balance_sheet.february,
val.balance_sheet.march,
val.balance_sheet.april,
val.balance_sheet.may,
val.balance_sheet.june,
val.balance_sheet.july,
val.balance_sheet.august,
val.balance_sheet.september,
val.balance_sheet.october,
val.balance_sheet.november,
val.balance_sheet.december,
val.balance_sheet.total_current_year,
val.balance_sheet.total_next_year,
val.balance_sheet.total_more_year
])
val.children.map(items => {
if (items.children && items.children.length > 0) {
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description,
items.balance_sheet.total_actual_before,
items.balance_sheet.january,
items.balance_sheet.february,
items.balance_sheet.march,
items.balance_sheet.april,
items.balance_sheet.may,
items.balance_sheet.june,
items.balance_sheet.july,
items.balance_sheet.august,
items.balance_sheet.september,
items.balance_sheet.october,
items.balance_sheet.november,
items.balance_sheet.december,
items.balance_sheet.total_current_year,
items.balance_sheet.total_next_year,
items.balance_sheet.total_more_year
])
items.children.map(itemss => {
if (itemss.children && itemss.children.length > 0) {
dataTable.push([
itemss.type_report_id,
itemss.id,
itemss.parent,
itemss.formula,
itemss.level,
itemss.description,
itemss.balance_sheet.total_actual_before,
itemss.balance_sheet.january,
itemss.balance_sheet.february,
itemss.balance_sheet.march,
itemss.balance_sheet.april,
itemss.balance_sheet.may,
itemss.balance_sheet.june,
itemss.balance_sheet.july,
itemss.balance_sheet.august,
itemss.balance_sheet.september,
itemss.balance_sheet.october,
itemss.balance_sheet.november,
itemss.balance_sheet.december,
itemss.balance_sheet.total_current_year,
itemss.balance_sheet.total_next_year,
itemss.balance_sheet.total_more_year
])
itemss.children.map(item1 => {
if (item1.children && item1.children.length > 0) {
dataTable.push([
item1.type_report_id,
item1.id,
item1.parent,
item1.formula,
item1.level,
item1.description,
item1.balance_sheet.total_actual_before,
item1.balance_sheet.january,
item1.balance_sheet.february,
item1.balance_sheet.march,
item1.balance_sheet.april,
item1.balance_sheet.may,
item1.balance_sheet.june,
item1.balance_sheet.july,
item1.balance_sheet.august,
item1.balance_sheet.september,
item1.balance_sheet.october,
item1.balance_sheet.november,
item1.balance_sheet.december,
item1.balance_sheet.total_current_year,
item1.balance_sheet.total_next_year,
item1.balance_sheet.total_more_year
])
item1.children.map(item2 => {
if (item2.children && item2.children.length > 0) {
dataTable.push([
item2.type_report_id,
item2.id,
item2.parent,
item2.formula,
item2.level,
item2.description,
item2.balance_sheet.total_actual_before,
item2.balance_sheet.january,
item2.balance_sheet.february,
item2.balance_sheet.march,
item2.balance_sheet.april,
item2.balance_sheet.may,
item2.balance_sheet.june,
item2.balance_sheet.july,
item2.balance_sheet.august,
item2.balance_sheet.september,
item2.balance_sheet.october,
item2.balance_sheet.november,
item2.balance_sheet.december,
item2.balance_sheet.total_current_year,
item2.balance_sheet.total_next_year,
item2.balance_sheet.total_more_year
])
item2.children.map(item3 => {
if (item3.children && item3.children.length > 0) {
dataTable.push([
item3.type_report_id,
item3.id,
item3.parent,
item3.formula,
item3.level,
item3.description,
item3.balance_sheet.total_actual_before,
item3.balance_sheet.january,
item3.balance_sheet.february,
item3.balance_sheet.march,
item3.balance_sheet.april,
item3.balance_sheet.may,
item3.balance_sheet.june,
item3.balance_sheet.july,
item3.balance_sheet.august,
item3.balance_sheet.september,
item3.balance_sheet.october,
item3.balance_sheet.november,
item3.balance_sheet.december,
item3.balance_sheet.total_current_year,
item3.balance_sheet.total_next_year,
item3.balance_sheet.total_more_year
])
item3.children.map(item4 => {
if (item4.children && item4.children.length > 0) {
dataTable.push([
item4.type_report_id,
item4.id,
item4.parent,
item4.formula,
item4.level,
item4.description,
item4.balance_sheet.total_actual_before,
item4.balance_sheet.january,
item4.balance_sheet.february,
item4.balance_sheet.march,
item4.balance_sheet.april,
item4.balance_sheet.may,
item4.balance_sheet.june,
item4.balance_sheet.july,
item4.balance_sheet.august,
item4.balance_sheet.september,
item4.balance_sheet.october,
item4.balance_sheet.november,
item4.balance_sheet.december,
item4.balance_sheet.total_current_year,
item4.balance_sheet.total_next_year,
item4.balance_sheet.total_more_year
])
item4.children.map(item5 => {
if (item5.children && item5.children.length > 0) {
dataTable.push([
item5.type_report_id,
item5.id,
item5.parent,
item5.formula,
item5.level,
item5.description,
item5.balance_sheet.total_actual_before,
item5.balance_sheet.january,
item5.balance_sheet.february,
item5.balance_sheet.march,
item5.balance_sheet.april,
item5.balance_sheet.may,
item5.balance_sheet.june,
item5.balance_sheet.july,
item5.balance_sheet.august,
item5.balance_sheet.september,
item5.balance_sheet.october,
item5.balance_sheet.november,
item5.balance_sheet.december,
item5.balance_sheet.total_current_year,
item5.balance_sheet.total_next_year,
item5.balance_sheet.total_more_year
])
item5.children.map(item6 => {
if (item6.children && item.children.length > 0) {
dataTable.push([
item6.type_report_id,
item6.id,
item6.parent,
item6.formula,
item6.level,
item6.description,
item6.balance_sheet.total_actual_before,
item6.balance_sheet.january,
item6.balance_sheet.february,
item6.balance_sheet.march,
item6.balance_sheet.april,
item6.balance_sheet.may,
item6.balance_sheet.june,
item6.balance_sheet.july,
item6.balance_sheet.august,
item6.balance_sheet.september,
item6.balance_sheet.october,
item6.balance_sheet.november,
item6.balance_sheet.december,
item6.balance_sheet.total_current_year,
item6.balance_sheet.total_next_year,
item6.balance_sheet.total_more_year
])
} else {
dataTable.push([
item6.type_report_id,
item6.id,
item6.parent,
item6.formula,
item6.level,
item6.description,
item6.balance_sheet.total_actual_before,
item6.balance_sheet.january,
item6.balance_sheet.february,
item6.balance_sheet.march,
item6.balance_sheet.april,
item6.balance_sheet.may,
item6.balance_sheet.june,
item6.balance_sheet.july,
item6.balance_sheet.august,
item6.balance_sheet.september,
item6.balance_sheet.october,
item6.balance_sheet.november,
item6.balance_sheet.december,
item6.balance_sheet.total_current_year,
item6.balance_sheet.total_next_year,
item6.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
item5.type_report_id,
item5.id,
item5.parent,
item5.formula,
item5.level,
item5.description,
item5.balance_sheet.total_actual_before,
item5.balance_sheet.january,
item5.balance_sheet.february,
item5.balance_sheet.march,
item5.balance_sheet.april,
item5.balance_sheet.may,
item5.balance_sheet.june,
item5.balance_sheet.july,
item5.balance_sheet.august,
item5.balance_sheet.september,
item5.balance_sheet.october,
item5.balance_sheet.november,
item5.balance_sheet.december,
item5.balance_sheet.total_current_year,
item5.balance_sheet.total_next_year,
item5.balance_sheet.total_more_year
])
} }
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
}) })
} else {
dataTable.push([
item4.type_report_id,
item4.id,
item4.parent,
item4.formula,
item4.level,
item4.description,
item4.balance_sheet.total_actual_before,
item4.balance_sheet.january,
item4.balance_sheet.february,
item4.balance_sheet.march,
item4.balance_sheet.april,
item4.balance_sheet.may,
item4.balance_sheet.june,
item4.balance_sheet.july,
item4.balance_sheet.august,
item4.balance_sheet.september,
item4.balance_sheet.october,
item4.balance_sheet.november,
item4.balance_sheet.december,
item4.balance_sheet.total_current_year,
item4.balance_sheet.total_next_year,
item4.balance_sheet.total_more_year
])
} }
})
} else {
dataTable.push([
item3.type_report_id,
item3.id,
item3.parent,
item3.formula,
item3.level,
item3.description,
item3.balance_sheet.total_actual_before,
item3.balance_sheet.january,
item3.balance_sheet.february,
item3.balance_sheet.march,
item3.balance_sheet.april,
item3.balance_sheet.may,
item3.balance_sheet.june,
item3.balance_sheet.july,
item3.balance_sheet.august,
item3.balance_sheet.september,
item3.balance_sheet.october,
item3.balance_sheet.november,
item3.balance_sheet.december,
item3.balance_sheet.total_current_year,
item3.balance_sheet.total_next_year,
item3.balance_sheet.total_more_year
])
} }
})
} else {
dataTable.push([
item2.type_report_id,
item2.id,
item2.parent,
item2.formula,
item2.level,
item2.description,
item2.balance_sheet.total_actual_before,
item2.balance_sheet.january,
item2.balance_sheet.february,
item2.balance_sheet.march,
item2.balance_sheet.april,
item2.balance_sheet.may,
item2.balance_sheet.june,
item2.balance_sheet.july,
item2.balance_sheet.august,
item2.balance_sheet.september,
item2.balance_sheet.october,
item2.balance_sheet.november,
item2.balance_sheet.december,
item2.balance_sheet.total_current_year,
item2.balance_sheet.total_next_year,
item2.balance_sheet.total_more_year
])
} }
}) res.map((item, index) => {
} else {
dataTable.push([
item1.type_report_id,
item1.id,
item1.parent,
item1.formula,
item1.level,
item1.description,
item1.balance_sheet.total_actual_before,
item1.balance_sheet.january,
item1.balance_sheet.february,
item1.balance_sheet.march,
item1.balance_sheet.april,
item1.balance_sheet.may,
item1.balance_sheet.june,
item1.balance_sheet.july,
item1.balance_sheet.august,
item1.balance_sheet.september,
item1.balance_sheet.october,
item1.balance_sheet.november,
item1.balance_sheet.december,
item1.balance_sheet.total_current_year,
item1.balance_sheet.total_next_year,
item1.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
itemss.type_report_id,
itemss.id,
itemss.parent,
itemss.formula,
itemss.level,
itemss.description,
itemss.balance_sheet.total_actual_before,
itemss.balance_sheet.january,
itemss.balance_sheet.february,
itemss.balance_sheet.march,
itemss.balance_sheet.april,
itemss.balance_sheet.may,
itemss.balance_sheet.june,
itemss.balance_sheet.july,
itemss.balance_sheet.august,
itemss.balance_sheet.september,
itemss.balance_sheet.october,
itemss.balance_sheet.november,
itemss.balance_sheet.december,
itemss.balance_sheet.total_current_year,
itemss.balance_sheet.total_next_year,
itemss.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description,
items.balance_sheet.total_actual_before,
items.balance_sheet.january,
items.balance_sheet.february,
items.balance_sheet.march,
items.balance_sheet.april,
items.balance_sheet.may,
items.balance_sheet.june,
items.balance_sheet.july,
items.balance_sheet.august,
items.balance_sheet.september,
items.balance_sheet.october,
items.balance_sheet.november,
items.balance_sheet.december,
items.balance_sheet.total_current_year,
items.balance_sheet.total_next_year,
items.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description,
val.balance_sheet.total_actual_before,
val.balance_sheet.january,
val.balance_sheet.february,
val.balance_sheet.march,
val.balance_sheet.april,
val.balance_sheet.may,
val.balance_sheet.june,
val.balance_sheet.july,
val.balance_sheet.august,
val.balance_sheet.september,
val.balance_sheet.october,
val.balance_sheet.november,
val.balance_sheet.december,
val.balance_sheet.total_current_year,
val.balance_sheet.total_next_year,
val.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description,
i.balance_sheet.total_actual_before,
i.balance_sheet.january,
i.balance_sheet.february,
i.balance_sheet.march,
i.balance_sheet.april,
i.balance_sheet.may,
i.balance_sheet.june,
i.balance_sheet.july,
i.balance_sheet.august,
i.balance_sheet.september,
i.balance_sheet.october,
i.balance_sheet.november,
i.balance_sheet.december,
i.balance_sheet.total_current_year,
i.balance_sheet.total_next_year,
i.balance_sheet.total_more_year
])
}
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description,
i.balance_sheet.total_actual_before,
i.balance_sheet.january,
i.balance_sheet.february,
i.balance_sheet.march,
i.balance_sheet.april,
i.balance_sheet.may,
i.balance_sheet.june,
i.balance_sheet.july,
i.balance_sheet.august,
i.balance_sheet.september,
i.balance_sheet.october,
i.balance_sheet.november,
i.balance_sheet.december,
i.balance_sheet.total_current_year,
i.balance_sheet.total_next_year,
i.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -678,15 +119,17 @@ export default class BalanceSheet extends Component { ...@@ -678,15 +119,17 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year item.balance_sheet.total_more_year
]) ])
} if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
}) })
console.log(dataTable);
this.setState({ dataTable, loading: false })
} }
} else {
this.setState({ loading: false })
} }
}) })
this.setState({ dataTable, loading: false })
})
} }
handleValue(data) { handleValue(data) {
...@@ -908,6 +351,21 @@ export default class BalanceSheet extends Component { ...@@ -908,6 +351,21 @@ export default class BalanceSheet extends Component {
}) })
} }
async downloadAllData() {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Balance Sheet.xlsx';
a.click();
}
}
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
...@@ -2511,7 +1969,12 @@ export default class BalanceSheet extends Component { ...@@ -2511,7 +1969,12 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => null} onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
......
...@@ -524,16 +524,17 @@ export default class UserRole extends Component { ...@@ -524,16 +524,17 @@ export default class UserRole extends Component {
} }
uploadUser() { uploadUser() {
console.log(JSON.stringify(this.state.payload))
api.create().uploadUser(this.state.payload).then(response => { api.create().uploadUser(this.state.payload).then(response => {
this.setState({buttonError: false}) this.setState({buttonError: false})
console.log(response) console.log(JSON.stringify(response))
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getUser() this.getUser()
this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success', payload: [], rows: [], judul: '' }) this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success', payload: [], rows: [], judul: '' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', payload: [], rows: [], judul: '' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -543,10 +544,10 @@ export default class UserRole extends Component { ...@@ -543,10 +544,10 @@ export default class UserRole extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', payload: [], rows: [], judul: '' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', payload: [], rows: [], judul: '' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
......
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