diff --git a/app/Http/Controllers/Api/InvoiceController.php b/app/Http/Controllers/Api/InvoiceController.php index 11dd1c2..bb5893d 100644 --- a/app/Http/Controllers/Api/InvoiceController.php +++ b/app/Http/Controllers/Api/InvoiceController.php @@ -16,7 +16,7 @@ class InvoiceController extends Controller { $from = $from . ' 00:00:00'; $end = $end . ' 23:59:59'; - return response()->json(Invoice::whereBetween('created_at', [$from, $end])->with('address')->orderBy('created_at', 'desc')->get()); + return response()->json(Invoice::whereBetween('created_at', [$from, $end])->with(['address', 'customer'])->orderBy('created_at', 'desc')->get()); } public function open(): JsonResponse diff --git a/resources/views/invoice/index.blade.php b/resources/views/invoice/index.blade.php index fb4219a..511e45b 100644 --- a/resources/views/invoice/index.blade.php +++ b/resources/views/invoice/index.blade.php @@ -42,22 +42,22 @@
{{ __('invoice.Invoice Number') }}
-
{{ __('common.Name') }}
-
{{ __('common.Email') }}
+
{{ __('customer.Customer') }}
+
{{ __('common.Name') }}
{{ __('invoice.State') }}
-
{{ __('invoice.Sum') }}
-
{{ __('common.Created at') }}
+
{{ __('invoice.Sum') }}
+
{{ __('common.Created at') }}
diff --git a/resources/views/payment/index.blade.php b/resources/views/payment/index.blade.php index be0511f..276a782 100644 --- a/resources/views/payment/index.blade.php +++ b/resources/views/payment/index.blade.php @@ -57,6 +57,17 @@ +
+ +
+
{{ __('invoice.Net') }}
+
+
{{ __('invoice.Tax') }}
+
+
{{ __('invoice.Sum') }}
+
+
+ @@ -72,6 +83,7 @@ end: "{{ \Illuminate\Support\Facades\Date::now()->format('Y-m-d') }}", payments: [], sum: 0, + tax: 0, init() { this.fetchPayments(); @@ -91,10 +103,13 @@ calculateSum() { this.sum = 0; + this.tax = 0; for (const [key, payment] of Object.entries(this.payments)) { - this.sum += parseFloat(payment.sum); + this.sum += parseFloat(payment.paid_amount); + this.tax += payment.invoice.tax * payment.paid_amount / payment.invoice.sum; } this.sum = this.sum.toFixed(2); + this.tax = this.tax.toFixed(2); } } }