Fixed Counter Bankstatements
This commit is contained in:
@@ -25,8 +25,8 @@ const setupPage = async () => {
|
|||||||
})
|
})
|
||||||
draftInvoicesCount.value = draftDocuments.length
|
draftInvoicesCount.value = draftDocuments.length
|
||||||
|
|
||||||
let bankstatements = await useSupabaseSelect("bankstatements","*, statementallocations(*)","date",true)
|
let bankstatements = (await useSupabaseSelect("bankstatements","*, statementallocations(*)","date",true)).filter(i => !i.archived)
|
||||||
unallocatedStatements.value = bankstatements.filter(i => calculateOpenSum(i) !== 0).length
|
unallocatedStatements.value = bankstatements.filter(i => Number(calculateOpenSum(i)) !== 0).length
|
||||||
}
|
}
|
||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
@@ -42,7 +42,7 @@ const getDocumentSum = (doc) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const calculateOpenSum = (statement) => {
|
const calculateOpenSum = (statement) => {
|
||||||
let startingAmount = statement.amount || 0
|
/*let startingAmount = statement.amount || 0
|
||||||
|
|
||||||
statement.statementallocations.forEach(item => {
|
statement.statementallocations.forEach(item => {
|
||||||
if(item.cd_id) {
|
if(item.cd_id) {
|
||||||
@@ -52,7 +52,15 @@ const calculateOpenSum = (statement) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return startingAmount.toFixed(2)
|
return startingAmount.toFixed(2)*/
|
||||||
|
|
||||||
|
let startingAmount = 0
|
||||||
|
|
||||||
|
statement.statementallocations.forEach(item => {
|
||||||
|
startingAmount += Math.abs(item.amount)
|
||||||
|
})
|
||||||
|
|
||||||
|
return (Math.abs(statement.amount) - startingAmount).toFixed(2)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user