diff --git a/app/Http/Controllers/Api/IncomingController.php b/app/Http/Controllers/Api/IncomingController.php index a388ac7..b52a6b5 100644 --- a/app/Http/Controllers/Api/IncomingController.php +++ b/app/Http/Controllers/Api/IncomingController.php @@ -24,6 +24,25 @@ class IncomingController extends Controller return response()->json(Incoming::whereBetween('issue_date', [$from, $end])->with(['supplier'])->orderBy('issue_date', 'desc')->get()); } + /** + * Display a listing of the resource. + */ + public function payment($from = null, $end = null): JsonResponse + { + Option::updateOrCreate(['name' => 'incoming_payments_from'], ['value' => $from]); + Option::updateOrCreate(['name' => 'incoming_payments_end'], ['value' => $end]); + + return response()->json(Incoming::whereBetween('pay_date', [$from, $end])->with(['supplier'])->orderBy('pay_date', 'desc')->get()); + } + + /** + * Display a listing of the resource that are not paid. + */ + public function open(): JsonResponse + { + return response()->json(Incoming::where('pay_date', '=', null)->orderBy('issue_date', 'desc')->with(['supplier'])->get()); + } + /** * Process an upload file for the resource. */ diff --git a/app/Http/Controllers/IncomingController.php b/app/Http/Controllers/IncomingController.php index 210216c..6548fff 100644 --- a/app/Http/Controllers/IncomingController.php +++ b/app/Http/Controllers/IncomingController.php @@ -29,6 +29,26 @@ class IncomingController extends Controller return view('incoming.index', ['first' => $first, 'last' => $last]); } + /** + * Display a listing of the resource. + */ + public function payment(): View + { + if (Option::where('name', '=', 'incoming_payments_from')->count() > 0) { + $first = Option::where('name', '=', 'incoming_payments_from')->first()->value; + } else { + $first = Date::now()->firstOfMonth()->format('Y-m-d'); + } + + if (Option::where('name', '=', 'incoming_payments_end')->count() > 0) { + $last = Option::where('name', '=', 'incoming_payments_end')->first()->value; + } else { + $last = Date::now()->format('Y-m-d'); + } + + return view('incoming.payment', ['first' => $first, 'last' => $last]); + } + /** * Show the form for creating a new resource. */ @@ -37,6 +57,15 @@ class IncomingController extends Controller return view('incoming.create'); } + + /** + * Show the form for creating a new resource. + */ + public function createPayment(): View + { + return view('incoming.create-payment'); + } + /** * Show the form for uploading a new resource. */ diff --git a/lang/de/excel.php b/lang/de/excel.php index 4fe41df..602ce97 100644 --- a/lang/de/excel.php +++ b/lang/de/excel.php @@ -19,8 +19,8 @@ return [ 'Generate' => 'Generieren', 'Outgoing invoices' => 'Ausgangsrechnungen', 'Incoming payments' => 'Zahlungseingang', - 'Incoming by issue date' => 'Eingang nach Rechnungsdatum', - 'Outgoing by pay date' => 'Eingang nach Zahlungsdatum', + 'Incoming invoices' => 'Eingangrechnungen', + 'Outgoing payments' => 'Zahlungsausgang', ]; diff --git a/lang/de/incoming.php b/lang/de/incoming.php index c3049bd..d502a68 100644 --- a/lang/de/incoming.php +++ b/lang/de/incoming.php @@ -26,5 +26,12 @@ return [ 'Select supplier' => 'Lieferant wählen', 'Create incoming' => 'Neue Eingangsrechnung anlegen', 'Incoming invoices' => 'Eingangsrechnungen', + 'Incoming payments' => 'Zahlungsausgang', + 'Add new payment' => 'Neuen Zahlungsausgang erstellen', + 'Add new payment by clicking add' => 'Durch Klick auf "Anlegen" neuen Zahlungsausgang erstellen', + 'Create new payment' => 'Neuen Zahlungsausgang anlegen', + 'Select invoice' => 'Eingangsrechnung auswählen', + 'Select your invoice for payment' => 'Wähle die Rechnung für den Zahlungsasusgang aus' + ]; diff --git a/lang/de/invoice.php b/lang/de/invoice.php index eab27d9..39962aa 100644 --- a/lang/de/invoice.php +++ b/lang/de/invoice.php @@ -68,7 +68,7 @@ return [ 'Sent menually' => 'Manuell versendet', 'Payment' => 'Zahlung', 'Payment for invoice' => 'Zahlung zur Rechnung', - 'Payments' => 'Zahlungen', + 'Payments' => 'Zahlungseingang', 'Existing payments' => 'Bestehende Zahlungseingänge', 'Add new payment' => 'Neuen Zahlungseingang erstellen', 'Add new payment by clicking add' => 'Durch Klick auf "Anlegen" neuen Zahlungseingang erstellen', @@ -105,5 +105,6 @@ return [ 'Cash discount sum' => 'Skonto-Summe', 'Cash discount until' => 'Skonto bis', 'Cash discount terms in days' => 'Skontogültigkeit in Tagen', + 'No invoices' => 'Keine Rechnungen vorhanden', ]; diff --git a/resources/views/excel.blade.php b/resources/views/excel.blade.php index ca76cad..937c9d0 100644 --- a/resources/views/excel.blade.php +++ b/resources/views/excel.blade.php @@ -29,8 +29,8 @@ diff --git a/resources/views/incoming/create-payment.blade.php b/resources/views/incoming/create-payment.blade.php new file mode 100644 index 0000000..1574c39 --- /dev/null +++ b/resources/views/incoming/create-payment.blade.php @@ -0,0 +1,77 @@ + + +

+ {{ __('incoming.Create new payment') }} +

+
+ +
+
+ + +
+
+
+
+

+ {{ __('incoming.Select invoice') }} +

+

+ {{ __('incoming.Select your invoice for payment') }} +

+
+ +
+ {{ __('invoice.No invoices') }} +
+ + +
{{ __('invoice.Invoice Number') }}
+
{{ __('supplier.Supplier') }}
+
{{ __('invoice.Sum') }}
+
{{ __('common.Created at') }}
+
+ + + +
+
+
+ +
+
+ + +
+ + diff --git a/resources/views/incoming/payment.blade.php b/resources/views/incoming/payment.blade.php new file mode 100644 index 0000000..2f96a72 --- /dev/null +++ b/resources/views/incoming/payment.blade.php @@ -0,0 +1,133 @@ + + +
+

+ {{ __('incoming.Incoming') }} +

+ + + +
+
+ +
+
+ +
+
+
+
+

+ {{ __('incoming.Add new payment') }} +

+

+ {{ __("incoming.Add new payment by clicking add") }} +

+
+ {{ __('form.Add') }} +
+
+
+ +
+
+
+
+

+ {{ __('incoming.Existing invoices') }} +

+
+ + + + +
+
+ + +
{{ __('invoice.Invoice Number') }}
+
{{ __('supplier.Supplier') }}
+
{{ __('invoice.Sum') }}
+
{{ __('common.Created at') }}
+
{{ __('common.Paid at') }}
+
+ + + +
+ +
+
{{ __('invoice.Net') }}
+
+
+
+
{{ __('invoice.Tax') }}
+
+
+
+
{{ __('invoice.Sum') }}
+
+
+ +
+
+
+ + +
+
+
+ + diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index b6eefbc..db73ccd 100644 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -66,6 +66,9 @@ {{ __('incoming.Incoming invoices') }} + + {{ __('incoming.Incoming payments') }} + {{ __('supplier.Suppliers') }} diff --git a/resources/views/payment/create.blade.php b/resources/views/payment/create.blade.php index 9647019..d508ce7 100644 --- a/resources/views/payment/create.blade.php +++ b/resources/views/payment/create.blade.php @@ -17,11 +17,15 @@ {{ __('invoice.Select invoice') }}

- {{ __("invoice.Select your invoice for payment") }} + {{ __('invoice.Select your invoice for payment') }}

-
+
+ {{ __('invoice.No invoices') }} +
+ +