Logo, Template and Invoice stuff

This commit is contained in:
WBLKLeipe 2021-11-30 15:50:43 +01:00
parent 92f048c4bd
commit 928086953c
4 changed files with 21 additions and 14 deletions

View file

@ -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=

View file

@ -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");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -140,7 +140,7 @@
<tr>
<td class="border-0 pl-0" width="70%">
<h4 class="text-uppercase">
<strong>{{ $invoice->name }}</strong>
<strong>{{ $invoice->name }}</strong> {{$invoice->getSerialNumber()}}
</h4>
</td>
<td class="border-0 pl-0">