mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-08-05 07:32:14 +00:00
feat(expenses): add tax tracking and reporting (#737)
This commit is contained in:
committed by
GitHub
parent
3455ceb594
commit
885042f13a
@@ -40,16 +40,22 @@ class TaxSummaryReportController extends Controller
|
||||
|
||||
App::setLocale($locale);
|
||||
|
||||
$taxTypes = Tax::with('taxType', 'invoice', 'invoiceItem')
|
||||
$taxTypes = Tax::with('taxType')
|
||||
->whereCompany($company->id)
|
||||
->whereInvoicesFilters($request->only(['from_date', 'to_date']))
|
||||
->taxAttributes()
|
||||
->get();
|
||||
|
||||
$totalAmount = 0;
|
||||
foreach ($taxTypes as $taxType) {
|
||||
$totalAmount += $taxType->total_tax_amount;
|
||||
}
|
||||
$totalAmount = (int) $taxTypes->sum('total_tax_amount');
|
||||
|
||||
$expenseTaxTypes = Tax::with('taxType')
|
||||
->whereCompany($company->id)
|
||||
->whereExpensesFilters($request->only(['from_date', 'to_date']))
|
||||
->taxAttributes()
|
||||
->get();
|
||||
|
||||
$totalExpenseTaxAmount = (int) $expenseTaxTypes->sum('total_tax_amount');
|
||||
$netTaxAmount = $totalAmount - $totalExpenseTaxAmount;
|
||||
|
||||
$dateFormat = CompanySetting::getSetting('carbon_date_format', $company->id);
|
||||
$from_date = Carbon::createFromFormat('Y-m-d', $request->from_date)->translatedFormat($dateFormat);
|
||||
@@ -75,6 +81,9 @@ class TaxSummaryReportController extends Controller
|
||||
view()->share([
|
||||
'taxTypes' => $taxTypes,
|
||||
'totalTaxAmount' => $totalAmount,
|
||||
'expenseTaxTypes' => $expenseTaxTypes,
|
||||
'totalExpenseTaxAmount' => $totalExpenseTaxAmount,
|
||||
'netTaxAmount' => $netTaxAmount,
|
||||
'colorSettings' => $colorSettings,
|
||||
'company' => $company,
|
||||
'from_date' => $from_date,
|
||||
|
||||
Reference in New Issue
Block a user