New Backend changes
This commit is contained in:
@@ -37,20 +37,20 @@ const ownaccounts = ref([])
|
||||
const loading = ref(true)
|
||||
const setup = async () => {
|
||||
if(route.params.id) {
|
||||
itemInfo.value = (await supabase.from("bankstatements").select("*, statementallocations(*, cd_id(*), ii_id(*))").eq("id",route.params.id).single()).data //dataStore.bankstatements.find(i => i.id === Number(route.params.id))
|
||||
itemInfo.value = await useEntities("bankstatements").selectSingle(route.params.id,"*, statementallocations(*, cd_id(*), ii_id(*))", undefined, undefined, true)
|
||||
}
|
||||
if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
|
||||
|
||||
manualAllocationSum.value = calculateOpenSum.value
|
||||
|
||||
createddocuments.value = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)"))
|
||||
createddocuments.value = (await useEntities("createddocuments").select("*, statementallocations(*), customer(id,name)"))
|
||||
const documents = createddocuments.value.filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
|
||||
const incominginvoices = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(id,name)")).filter(i => i.state === "Gebucht")
|
||||
const incominginvoices = (await useEntities("incominginvoices").select("*, statementallocations(*), vendor(id,name)")).filter(i => i.state === "Gebucht")
|
||||
|
||||
accounts.value = (await supabase.from("accounts").select().order("number",{ascending: true})).data
|
||||
ownaccounts.value = (await supabase.from("ownaccounts").select()).data
|
||||
customers.value = (await supabase.from("customers").select()).data
|
||||
vendors.value = (await supabase.from("vendors").select()).data
|
||||
accounts.value = (await useEntities("accounts").selectSpecial("*","number",true))
|
||||
ownaccounts.value = (await useEntities("ownaccounts").select()).data
|
||||
customers.value = (await useEntities("customers").select()).data
|
||||
vendors.value = (await useEntities("vendors").select()).data
|
||||
|
||||
openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== useSum().getCreatedDocumentSum(i,createddocuments.value).toFixed(2))
|
||||
openDocuments.value = openDocuments.value.map(i => {
|
||||
@@ -69,15 +69,12 @@ const setup = async () => {
|
||||
allocatedIncomingInvoices.value = incominginvoices.filter(i => i.statementallocations.find(x => x.bs_id === itemInfo.value.id))
|
||||
console.log(allocatedDocuments.value)
|
||||
console.log(allocatedIncomingInvoices.value)
|
||||
//openIncomingInvoices.value = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(*)")).filter(i => i.statementallocations.length === 0 )
|
||||
openIncomingInvoices.value = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(*)")).filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getInvoiceSum(i,false))
|
||||
openIncomingInvoices.value = (await useEntities("incominginvoices").select("*, statementallocations(*), vendor(*)")).filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getInvoiceSum(i,false))
|
||||
//console.log(openIncomingInvoices.value)
|
||||
|
||||
// return incominginvoices.value.filter(i => bankstatements.value.filter(x => x.assignments.find(y => y.type === 'incomingInvoice' && y.id === i.id)).length === 0)
|
||||
|
||||
|
||||
let allocations = (await supabase.from("createddocuments").select(`*, statementallocations(*)`).eq("id",50)).data
|
||||
|
||||
loading.value = false
|
||||
|
||||
}
|
||||
@@ -149,7 +146,7 @@ const showMoreWithoutRecipe = ref(false)
|
||||
const showMoreText = ref(false)
|
||||
|
||||
const saveAllocation = async (allocation) => {
|
||||
|
||||
//TODO: BACKEND CHANGE SAVE/REMOVE
|
||||
console.log(allocation)
|
||||
|
||||
const {data,error} = await supabase.from("statementallocations").insert({
|
||||
@@ -354,7 +351,9 @@ const archiveStatement = async () => {
|
||||
<span class="font-semibold">Konto:</span>
|
||||
</td>
|
||||
<td>
|
||||
<!--
|
||||
{{dataStore.getBankAccountById(itemInfo.account) ? dataStore.getBankAccountById(itemInfo.account).name || separateIBAN(dataStore.getBankAccountById(itemInfo.account).iban) : ""}}
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr class="flex-row flex justify-between">
|
||||
|
||||
Reference in New Issue
Block a user