finishing to dev
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m41s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 42s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-14 22:50:44 +07:00
parent 2fabdf8fc9
commit 8307b9e66d
212 changed files with 2451 additions and 4493 deletions

View File

@@ -33,14 +33,14 @@ public function lossProfitDetails()
$query->where('business_id', $businessId);
})
->whereDate('created_at', '<', $today)
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
->sum(DB::raw('productPurchasePrice * productStock'));
// Closing stock (up to today) from stocks table
$closing_stock_by_purchase = Stock::whereHas('product', function ($query) use ($businessId) {
$query->where('business_id', $businessId);
})
->whereDate('created_at', '<=', $today)
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
->sum(DB::raw('productPurchasePrice * productStock'));
$total_purchase_price = (clone $purchaseQuery)->sum('totalAmount');
$total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge');
@@ -59,13 +59,13 @@ public function lossProfitDetails()
$query->where('business_id', $businessId);
})
->whereDate('created_at', '<', $today)
->sum(DB::raw('"productSalePrice" * "productStock"'));
->sum(DB::raw('productSalePrice * productStock'));
$closing_stock_by_sale = Stock::whereHas('product', function ($query) use ($businessId) {
$query->where('business_id', $businessId);
})
->whereDate('created_at', '<=', $today)
->sum(DB::raw('"productSalePrice" * "productStock"'));
->sum(DB::raw('productSalePrice * productStock'));
$total_sale_price = (clone $salesQuery)->sum('totalAmount');
$total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge');
@@ -135,14 +135,14 @@ public function lossProfitFilter(Request $request)
$q->where('business_id', $businessId);
})
->whereDate('created_at', '<', $startDate)
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
->sum(DB::raw('productPurchasePrice * productStock'));
// Closing stock by purchase (up to end date)
$closing_stock_by_purchase = Stock::whereHas('product', function ($q) use ($businessId) {
$q->where('business_id', $businessId);
})
->whereDate('created_at', '<=', $endDate)
->sum(DB::raw('"productPurchasePrice" * "productStock"'));
->sum(DB::raw('productPurchasePrice * productStock'));
$total_purchase_price = (clone $purchaseQuery)->sum('totalAmount');
$total_purchase_shipping_charge = (clone $purchaseQuery)->sum('shipping_charge');
@@ -159,14 +159,14 @@ public function lossProfitFilter(Request $request)
$q->where('business_id', $businessId);
})
->whereDate('created_at', '<', $startDate)
->sum(DB::raw('"productSalePrice" * "productStock"'));
->sum(DB::raw('productSalePrice * productStock'));
// Closing stock by sale
$closing_stock_by_sale = Stock::whereHas('product', function ($q) use ($businessId) {
$q->where('business_id', $businessId);
})
->whereDate('created_at', '<=', $endDate)
->sum(DB::raw('"productSalePrice" * "productStock"'));
->sum(DB::raw('productSalePrice * productStock'));
$total_sale_price = (clone $salesQuery)->sum('totalAmount');
$total_sale_shipping_charge = (clone $salesQuery)->sum('shipping_charge');