mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix custom field issue and report issues
This commit is contained in:
committed by
Mohit Panjwani
parent
7b6a88ad4e
commit
603bf637a7
@ -47,7 +47,7 @@ class CustomerSalesReportController extends Controller
|
||||
foreach ($customers as $customer) {
|
||||
$customerTotalAmount = 0;
|
||||
foreach ($customer->invoices as $invoice) {
|
||||
$customerTotalAmount += $invoice->total;
|
||||
$customerTotalAmount += $invoice->base_total;
|
||||
}
|
||||
$customer->totalAmount = $customerTotalAmount;
|
||||
$totalAmount += $customerTotalAmount;
|
||||
|
||||
@ -34,7 +34,7 @@ class ProfitLossReportController extends Controller
|
||||
$invoicesAmount = Invoice::whereCompanyId($company->id)
|
||||
->applyFilters($request->only(['from_date', 'to_date']))
|
||||
->wherePaidStatus(Invoice::STATUS_PAID)
|
||||
->sum('total');
|
||||
->sum('base_total');
|
||||
|
||||
$expenseCategories = Expense::with('category')
|
||||
->whereCompanyId($company->id)
|
||||
|
||||
@ -226,7 +226,7 @@ class Expense extends Model implements HasMedia
|
||||
$query->select(
|
||||
DB::raw('
|
||||
count(*) as expenses_count,
|
||||
sum(amount) as total_amount,
|
||||
sum(base_amount) as total_amount,
|
||||
expense_category_id')
|
||||
)
|
||||
->groupBy('expense_category_id');
|
||||
|
||||
@ -75,7 +75,7 @@ class InvoiceItem extends Model
|
||||
public function scopeItemAttributes($query)
|
||||
{
|
||||
$query->select(
|
||||
DB::raw('sum(quantity) as total_quantity, sum(total) as total_amount, invoice_items.name')
|
||||
DB::raw('sum(quantity) as total_quantity, sum(base_total) as total_amount, invoice_items.name')
|
||||
)->groupBy('invoice_items.name');
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ class Tax extends Model
|
||||
public function scopeTaxAttributes($query)
|
||||
{
|
||||
$query->select(
|
||||
DB::raw('sum(amount) as total_tax_amount, tax_type_id')
|
||||
DB::raw('sum(base_amount) as total_tax_amount, tax_type_id')
|
||||
)->groupBy('tax_type_id');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user