update querry
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 4m25s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Successful in 45s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-23 21:37:41 +07:00
parent 90ceb2ec19
commit 6868533af2
9 changed files with 30 additions and 30 deletions

View File

@@ -23,7 +23,7 @@ public function view(): View
->select(
DB::raw('DATE(saleDate) as date'),
DB::raw('SUM(actual_total_amount) as total_sales'),
DB::raw('SUM(lossProfit) as total_sale_income')
DB::raw('SUM("lossProfit") as total_sale_income')
)
->where('business_id', $businessId)
->when($branchId, fn($q) => $q->where('branch_id', $branchId))

View File

@@ -24,8 +24,8 @@ public function view(): View
})
->select(
'product_id',
DB::raw('SUM(CASE WHEN lossProfit > 0 THEN lossProfit ELSE 0 END) as profit'),
DB::raw('SUM(CASE WHEN lossProfit < 0 THEN lossProfit ELSE 0 END) as loss')
DB::raw('SUM(CASE WHEN "lossProfit" > 0 THEN "lossProfit" ELSE 0 END) as profit'),
DB::raw('SUM(CASE WHEN "lossProfit" < 0 THEN "lossProfit" ELSE 0 END) as loss')
)
->groupBy('product_id')
->get();

View File

@@ -23,7 +23,7 @@ public function view(): View
$saleDetailsQuery = $product->saleDetails()
->with('sale:id,party_id,invoiceNumber,saleDate', 'sale.party:id,name')
->select('id', 'sale_id', 'product_id', 'quantities', 'lossprofit', 'price', 'productPurchasePrice');
->select('id', 'sale_id', 'product_id', 'quantities', 'lossProfit', 'price', 'productPurchasePrice');
$saleDetails = $saleDetailsQuery->get();