EDIT Graph
This commit is contained in:
@@ -14,8 +14,36 @@ let expenseData = ref({})
|
|||||||
const setup = async () => {
|
const setup = async () => {
|
||||||
let incomeRawData = (await supabase.from("createddocuments").select().eq("tenant",profileStore.currentTenant).in('type',['invoices','cancellationInvoices'])).data
|
let incomeRawData = (await supabase.from("createddocuments").select().eq("tenant",profileStore.currentTenant).in('type',['invoices','cancellationInvoices'])).data
|
||||||
let expenseRawData =(await supabase.from("incominginvoices").select().eq("tenant",profileStore.currentTenant)).data
|
let expenseRawData =(await supabase.from("incominginvoices").select().eq("tenant",profileStore.currentTenant)).data
|
||||||
|
let withoutInvoiceRawData = (await supabase.from("statementallocations").select().eq("tenant",profileStore.currentTenant).not("account","is",null)).data
|
||||||
|
|
||||||
|
let withoutInvoiceRawDataExpenses = []
|
||||||
|
let withoutInvoiceRawDataIncomes = []
|
||||||
|
|
||||||
|
withoutInvoiceRawData.forEach(i => {
|
||||||
|
if(i.amount > 0) {
|
||||||
|
withoutInvoiceRawDataIncomes.push({
|
||||||
|
id: i.id,
|
||||||
|
date: dayjs(i.created_at).format("DD-MM-YY"),
|
||||||
|
amount: Math.abs(i.amount),
|
||||||
|
bs_id: i.bs_id
|
||||||
|
})
|
||||||
|
} else if(i.amount < 0) {
|
||||||
|
withoutInvoiceRawDataExpenses.push({
|
||||||
|
id: i.id,
|
||||||
|
date: dayjs(i.created_at).format("DD-MM-YY"),
|
||||||
|
amount: Math.abs(i.amount),
|
||||||
|
bs_id: i.bs_id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/*withoutInvoiceRawDataExpenses.forEach(i => {
|
||||||
|
expenseData.value[i.date] ? expenseData.value[i.date] = Number((expenseData.value[i.date] + i.amount).toFixed(2)) : expenseData.value[i.date] = i.amount
|
||||||
|
})
|
||||||
|
|
||||||
|
withoutInvoiceRawDataIncomes.forEach(i => {
|
||||||
|
incomeData.value[i.date] ? incomeData.value[i.date] = Number((incomeData.value[i.date] + i.amount).toFixed(2)) : incomeData.value[i.date] = i.amount
|
||||||
|
})*/
|
||||||
|
|
||||||
expenseRawData = expenseRawData.filter(i => i.date).map(i => {
|
expenseRawData = expenseRawData.filter(i => i.date).map(i => {
|
||||||
let amount = 0
|
let amount = 0
|
||||||
@@ -55,6 +83,8 @@ const setup = async () => {
|
|||||||
}
|
}
|
||||||
Object.keys(expenseMonths).forEach(month => {
|
Object.keys(expenseMonths).forEach(month => {
|
||||||
let dates = Object.keys(expenseData.value).filter(i => i.split("-")[1] === month && i.split("-")[2] === dayjs().format("YY"))
|
let dates = Object.keys(expenseData.value).filter(i => i.split("-")[1] === month && i.split("-")[2] === dayjs().format("YY"))
|
||||||
|
console.log(dates)
|
||||||
|
|
||||||
|
|
||||||
dates.forEach(date => {
|
dates.forEach(date => {
|
||||||
if(expenseMonths[month]){
|
if(expenseMonths[month]){
|
||||||
|
|||||||
Reference in New Issue
Block a user