diff --git a/.env.example b/.env.example index c7016a83..88982091 100644 --- a/.env.example +++ b/.env.example @@ -23,6 +23,12 @@ PAYPAL_SECRET= PAYPAL_CLIENT_ID= PAYPAL_EMAIL= +#INVOICE RELATED - put every value in quotes "" +COMPANY_PHONE= +COMPANY_ADRESS= +COMPANY_VAT_ID= +INVOICE_PREFIX= + #set-up for extra discord verification DISCORD_CLIENT_ID= DISCORD_CLIENT_SECRET= diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index a24ecbbe..960d720a 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -198,30 +198,31 @@ class PaymentController extends Controller event(new UserUpdateCreditsEvent($user)); //create invoice + $lastInvoiceID = \App\Models\invoice::where("invoice_name","like","%".now()->format('mY')."%")->max("id"); + $newInvoiceID = $lastInvoiceID + 1; + $seller = new Party([ - 'name' => 'Hafuga Company', - 'phone' => '+49 12346709', - 'address' => 'Deutschlandstr 4, 66666 Hell', + 'name' => env("APP_NAME", "Controlpanel.gg"), + 'phone' => env("COMPANY_PHONE",""), + 'address' => env("COMPANY_ADRESS",""), 'custom_fields' => [ - 'UST_ID' => '365#GG', - 'E-Mail' => 'invoice@hafuga.de', + 'VAT ID' => env("COMPANY_VAT_ID",""), + 'E-Mail' => env("MAIL_FROM_ADDRESS", "company@mail.com"), + "Web" => env("APP_URL","https://controlpanel.gg") ], ]); $customer = new Buyer([ - 'name' => 'Not Dennis', + 'name' => $user->name, 'custom_fields' => [ - 'email' => 'customer@google.de', - 'order number' => '> 654321 <', + 'E-Mail' => $user->email, + 'Client ID' => $user->id, ], ]); $item = (new InvoiceItem())->title($paypalProduct->description)->pricePerUnit($paypalProduct->price); - $lastInvoiceID = \App\Models\invoice::where("invoice_name","like","%".now()->format('M')."%")->max("id"); - $newInvoiceID = $lastInvoiceID + 1; - $invoice = Invoice::make() ->buyer($customer) ->seller($seller) @@ -231,10 +232,10 @@ class PaymentController extends Controller ->addItem($item) ->status(__('invoices::invoice.paid')) - ->series(now()->format('M_Y')) + ->series(now()->format('mY')) ->delimiter("-") ->sequence($newInvoiceID) - ->serialNumberFormat('{SEQUENCE} - {SERIES}') + ->serialNumberFormat(env("INVOICE_PREFIX","").'-{SERIES}{SEQUENCE}') ->logo(public_path('vendor/invoices/logo.png')) ->save("local"); diff --git a/public/vendor/invoices/logo.png b/public/vendor/invoices/logo.png index 6e5fa7c6..f2afb9c3 100644 Binary files a/public/vendor/invoices/logo.png and b/public/vendor/invoices/logo.png differ diff --git a/resources/views/vendor/invoices/templates/default.blade.php b/resources/views/vendor/invoices/templates/default.blade.php index c288a766..deaaf97a 100644 --- a/resources/views/vendor/invoices/templates/default.blade.php +++ b/resources/views/vendor/invoices/templates/default.blade.php @@ -140,7 +140,7 @@

- {{ $invoice->name }} + {{ $invoice->name }} {{$invoice->getSerialNumber()}}