Browse Source

First COmmit

1day2die 3 years ago
parent
commit
c3a777bdf4

+ 44 - 3
app/Http/Controllers/Admin/PaymentController.php

@@ -18,12 +18,16 @@ use Illuminate\Http\JsonResponse;
 use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Auth;
+use LaravelDaily\Invoices\Classes\Party;
 use PayPalCheckoutSdk\Core\PayPalHttpClient;
 use PayPalCheckoutSdk\Core\PayPalHttpClient;
 use PayPalCheckoutSdk\Core\ProductionEnvironment;
 use PayPalCheckoutSdk\Core\ProductionEnvironment;
 use PayPalCheckoutSdk\Core\SandboxEnvironment;
 use PayPalCheckoutSdk\Core\SandboxEnvironment;
 use PayPalCheckoutSdk\Orders\OrdersCaptureRequest;
 use PayPalCheckoutSdk\Orders\OrdersCaptureRequest;
 use PayPalCheckoutSdk\Orders\OrdersCreateRequest;
 use PayPalCheckoutSdk\Orders\OrdersCreateRequest;
 use PayPalHttp\HttpException;
 use PayPalHttp\HttpException;
+use LaravelDaily\Invoices\Invoice;
+use LaravelDaily\Invoices\Classes\Buyer;
+use LaravelDaily\Invoices\Classes\InvoiceItem;
 
 
 class PaymentController extends Controller
 class PaymentController extends Controller
 {
 {
@@ -93,7 +97,7 @@ class PaymentController extends Controller
                 'shipping_preference'  => 'NO_SHIPPING'
                 'shipping_preference'  => 'NO_SHIPPING'
             ]
             ]
 
 
-        
+
         ];
         ];
 
 
 
 
@@ -164,7 +168,7 @@ class PaymentController extends Controller
                         $user->update(['server_limit' => Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
                         $user->update(['server_limit' => Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
                     }
                     }
                 }
                 }
-                
+
                 //update role
                 //update role
                 if ($user->role == 'member') {
                 if ($user->role == 'member') {
                     $user->update(['role' => 'client']);
                     $user->update(['role' => 'client']);
@@ -191,8 +195,45 @@ class PaymentController extends Controller
 
 
                 event(new UserUpdateCreditsEvent($user));
                 event(new UserUpdateCreditsEvent($user));
 
 
+                //create invoice
+                $seller = new Party([
+                    'name'          => 'Dennis L',
+                    'phone'         => '1234513',
+                    'address'       => 'Deutschlandstr 4, 66666 Hell',
+                    'custom_fields' => [
+                        'UST_ID' => '365#GG',
+                    ],
+                ]);
+
+
+
+                $customer = new Buyer([
+                    'name'          => 'Dennis Leipe',
+                    'custom_fields' => [
+                        'email' => 'dleipe@hafuga.de',
+                        'order number' => '> 654321 <',
+                    ],
+                ]);
+                $item = (new InvoiceItem())->title($paypalProduct->description)->pricePerUnit($paypalProduct->price);
+
+                $invoice = Invoice::make()
+                    ->buyer($customer)
+                    ->seller($seller)
+                    ->discountByPercent(0)
+                    ->taxRate(floatval($paypalProduct->getTaxPercent()))
+                    ->shipping(0)
+                    ->addItem($item)
+                    ->series('BIG')
+
+                    ->status(__('invoices::invoice.paid'))
+                    ->sequence(667)
+                    ->serialNumberFormat('{SEQUENCE}/{SERIES}')
+
+                    ->save('public');
+
+
                 //redirect back to home
                 //redirect back to home
-                return redirect()->route('home')->with('success', 'Your credit balance has been increased!');
+                return redirect()->route('home')->with('success', 'Your credit balance has been increased! Invoice: '.$invoice->url());
             }
             }
 
 
             // If call returns body in response, you can get the deserialized version from the result attribute of the response
             // If call returns body in response, you can get the deserialized version from the result attribute of the response

+ 1 - 0
composer.json

@@ -19,6 +19,7 @@
         "laravel/framework": "^8.12",
         "laravel/framework": "^8.12",
         "laravel/tinker": "^2.5",
         "laravel/tinker": "^2.5",
         "laravel/ui": "^3.2",
         "laravel/ui": "^3.2",
+        "laraveldaily/laravel-invoices": "^2.0",
         "paypal/paypal-checkout-sdk": "^1.0",
         "paypal/paypal-checkout-sdk": "^1.0",
         "paypal/rest-api-sdk-php": "^1.14",
         "paypal/rest-api-sdk-php": "^1.14",
         "socialiteproviders/discord": "^4.1",
         "socialiteproviders/discord": "^4.1",

+ 335 - 2
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
         "This file is @generated automatically"
     ],
     ],
-    "content-hash": "500346cc4a4a83b162e07bb0071d1602",
+    "content-hash": "51c5797dc1629fe1f42b1fdc91c6e5d8",
     "packages": [
     "packages": [
         {
         {
             "name": "asm89/stack-cors",
             "name": "asm89/stack-cors",
@@ -62,6 +62,72 @@
             },
             },
             "time": "2021-03-11T06:42:03+00:00"
             "time": "2021-03-11T06:42:03+00:00"
         },
         },
+        {
+            "name": "barryvdh/laravel-dompdf",
+            "version": "v0.9.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/barryvdh/laravel-dompdf.git",
+                "reference": "5b99e1f94157d74e450f4c97e8444fcaffa2144b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/5b99e1f94157d74e450f4c97e8444fcaffa2144b",
+                "reference": "5b99e1f94157d74e450f4c97e8444fcaffa2144b",
+                "shasum": ""
+            },
+            "require": {
+                "dompdf/dompdf": "^1",
+                "illuminate/support": "^5.5|^6|^7|^8",
+                "php": "^7.1 || ^8.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "0.9-dev"
+                },
+                "laravel": {
+                    "providers": [
+                        "Barryvdh\\DomPDF\\ServiceProvider"
+                    ],
+                    "aliases": {
+                        "PDF": "Barryvdh\\DomPDF\\Facade"
+                    }
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Barryvdh\\DomPDF\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Barry vd. Heuvel",
+                    "email": "barryvdh@gmail.com"
+                }
+            ],
+            "description": "A DOMPDF Wrapper for Laravel",
+            "keywords": [
+                "dompdf",
+                "laravel",
+                "pdf"
+            ],
+            "support": {
+                "issues": "https://github.com/barryvdh/laravel-dompdf/issues",
+                "source": "https://github.com/barryvdh/laravel-dompdf/tree/v0.9.0"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/barryvdh",
+                    "type": "github"
+                }
+            ],
+            "time": "2020-12-27T12:05:53+00:00"
+        },
         {
         {
             "name": "biscolab/laravel-recaptcha",
             "name": "biscolab/laravel-recaptcha",
             "version": "5.0.1",
             "version": "5.0.1",
@@ -780,6 +846,73 @@
             ],
             ],
             "time": "2020-05-25T17:44:05+00:00"
             "time": "2020-05-25T17:44:05+00:00"
         },
         },
+        {
+            "name": "dompdf/dompdf",
+            "version": "v1.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/dompdf/dompdf.git",
+                "reference": "de4aad040737a89fae2129cdeb0f79c45513128d"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/dompdf/dompdf/zipball/de4aad040737a89fae2129cdeb0f79c45513128d",
+                "reference": "de4aad040737a89fae2129cdeb0f79c45513128d",
+                "shasum": ""
+            },
+            "require": {
+                "ext-dom": "*",
+                "ext-mbstring": "*",
+                "phenx/php-font-lib": "^0.5.2",
+                "phenx/php-svg-lib": "^0.3.3",
+                "php": "^7.1 || ^8.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "^1.3",
+                "phpunit/phpunit": "^7.5 || ^8 || ^9",
+                "squizlabs/php_codesniffer": "^3.5"
+            },
+            "suggest": {
+                "ext-gd": "Needed to process images",
+                "ext-gmagick": "Improves image processing performance",
+                "ext-imagick": "Improves image processing performance",
+                "ext-zlib": "Needed for pdf stream compression"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Dompdf\\": "src/"
+                },
+                "classmap": [
+                    "lib/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-2.1"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Ménager",
+                    "email": "fabien.menager@gmail.com"
+                },
+                {
+                    "name": "Brian Sweeney",
+                    "email": "eclecticgeek@gmail.com"
+                },
+                {
+                    "name": "Gabriel Bull",
+                    "email": "me@gabrielbull.com"
+                }
+            ],
+            "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
+            "homepage": "https://github.com/dompdf/dompdf",
+            "support": {
+                "issues": "https://github.com/dompdf/dompdf/issues",
+                "source": "https://github.com/dompdf/dompdf/tree/v1.1.1"
+            },
+            "time": "2021-11-24T00:45:04+00:00"
+        },
         {
         {
             "name": "dragonmantank/cron-expression",
             "name": "dragonmantank/cron-expression",
             "version": "v3.1.0",
             "version": "v3.1.0",
@@ -1763,6 +1896,71 @@
             },
             },
             "time": "2021-05-25T16:45:33+00:00"
             "time": "2021-05-25T16:45:33+00:00"
         },
         },
+        {
+            "name": "laraveldaily/laravel-invoices",
+            "version": "2.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/LaravelDaily/laravel-invoices.git",
+                "reference": "88c472680951acc57ccf179711add7d8dda36821"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/LaravelDaily/laravel-invoices/zipball/88c472680951acc57ccf179711add7d8dda36821",
+                "reference": "88c472680951acc57ccf179711add7d8dda36821",
+                "shasum": ""
+            },
+            "require": {
+                "barryvdh/laravel-dompdf": "^0.9",
+                "illuminate/http": "^5.5|^6|^7|^8",
+                "illuminate/support": "^5.5|^6|^7|^8",
+                "php": ">=7.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^8.4",
+                "symfony/var-dumper": "^5.0"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "LaravelDaily\\Invoices\\InvoiceServiceProvider"
+                    ],
+                    "aliases": {
+                        "Invoice": "LaravelDaily\\Invoices\\Facades\\Invoice"
+                    }
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "LaravelDaily\\Invoices\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "GPL-3.0-only"
+            ],
+            "authors": [
+                {
+                    "name": "David Lun",
+                    "email": "mysticcode@gmail.com",
+                    "homepage": "https://lun.lt",
+                    "role": "Developer"
+                }
+            ],
+            "description": "Missing invoices for Laravel",
+            "homepage": "https://github.com/LaravelDaily/laravel-invoices",
+            "keywords": [
+                "invoice",
+                "invoices",
+                "laravel"
+            ],
+            "support": {
+                "issues": "https://github.com/LaravelDaily/laravel-invoices/issues",
+                "source": "https://github.com/LaravelDaily/laravel-invoices/tree/2.2.0"
+            },
+            "time": "2021-09-29T08:31:40+00:00"
+        },
         {
         {
             "name": "league/commonmark",
             "name": "league/commonmark",
             "version": "1.6.2",
             "version": "1.6.2",
@@ -2601,6 +2799,92 @@
             "abandoned": true,
             "abandoned": true,
             "time": "2019-01-04T20:04:25+00:00"
             "time": "2019-01-04T20:04:25+00:00"
         },
         },
+        {
+            "name": "phenx/php-font-lib",
+            "version": "0.5.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PhenX/php-font-lib.git",
+                "reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/ca6ad461f032145fff5971b5985e5af9e7fa88d8",
+                "reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8",
+                "shasum": ""
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8.35 || ^5 || ^6 || ^7"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "FontLib\\": "src/FontLib"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-3.0"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Ménager",
+                    "email": "fabien.menager@gmail.com"
+                }
+            ],
+            "description": "A library to read, parse, export and make subsets of different types of font files.",
+            "homepage": "https://github.com/PhenX/php-font-lib",
+            "support": {
+                "issues": "https://github.com/PhenX/php-font-lib/issues",
+                "source": "https://github.com/PhenX/php-font-lib/tree/0.5.2"
+            },
+            "time": "2020-03-08T15:31:32+00:00"
+        },
+        {
+            "name": "phenx/php-svg-lib",
+            "version": "0.3.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PhenX/php-svg-lib.git",
+                "reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/f627771eb854aa7f45f80add0f23c6c4d67ea0f2",
+                "reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.4 || ^8.0",
+                "sabberworm/php-css-parser": "^8.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^9.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Svg\\": "src/Svg"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-3.0"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Ménager",
+                    "email": "fabien.menager@gmail.com"
+                }
+            ],
+            "description": "A library to read, parse and export to PDF SVG files.",
+            "homepage": "https://github.com/PhenX/php-svg-lib",
+            "support": {
+                "issues": "https://github.com/PhenX/php-svg-lib/issues",
+                "source": "https://github.com/PhenX/php-svg-lib/tree/0.3.4"
+            },
+            "time": "2021-10-18T02:13:32+00:00"
+        },
         {
         {
             "name": "phpoption/phpoption",
             "name": "phpoption/phpoption",
             "version": "1.7.5",
             "version": "1.7.5",
@@ -3262,6 +3546,55 @@
             ],
             ],
             "time": "2020-08-18T17:17:46+00:00"
             "time": "2020-08-18T17:17:46+00:00"
         },
         },
+        {
+            "name": "sabberworm/php-css-parser",
+            "version": "8.3.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sabberworm/PHP-CSS-Parser.git",
+                "reference": "d217848e1396ef962fb1997cf3e2421acba7f796"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/d217848e1396ef962fb1997cf3e2421acba7f796",
+                "reference": "d217848e1396ef962fb1997cf3e2421acba7f796",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.2"
+            },
+            "require-dev": {
+                "codacy/coverage": "^1.4",
+                "phpunit/phpunit": "~4.8"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "Sabberworm\\CSS": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Raphael Schweikert"
+                }
+            ],
+            "description": "Parser for CSS Files written in PHP",
+            "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser",
+            "keywords": [
+                "css",
+                "parser",
+                "stylesheet"
+            ],
+            "support": {
+                "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues",
+                "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.3.1"
+            },
+            "time": "2020-06-01T09:10:00+00:00"
+        },
         {
         {
             "name": "socialiteproviders/discord",
             "name": "socialiteproviders/discord",
             "version": "4.1.1",
             "version": "4.1.1",
@@ -8931,5 +9264,5 @@
         "ext-intl": "*"
         "ext-intl": "*"
     },
     },
     "platform-dev": [],
     "platform-dev": [],
-    "plugin-api-version": "2.0.0"
+    "plugin-api-version": "2.1.0"
 }
 }

+ 97 - 0
config/invoices.php

@@ -0,0 +1,97 @@
+<?php
+
+return [
+    'date' => [
+        /*
+         * Carbon date format
+         */
+        'format' => 'Y-m-d',
+        /*
+         * Due date for payment since invoice's date.
+         */
+        'pay_until_days' => 7,
+    ],
+
+    'serial_number' => [
+        'series'   => 'AA',
+        'sequence' => 1,
+        /*
+         * Sequence will be padded accordingly, for ex. 00001
+         */
+        'sequence_padding' => 5,
+        'delimiter'        => '.',
+        /*
+         * Supported tags {SERIES}, {DELIMITER}, {SEQUENCE}
+         * Example: AA.00001
+         */
+        'format' => '{SERIES}{DELIMITER}{SEQUENCE}',
+    ],
+
+    'currency' => [
+        'code' => 'eur',
+        /*
+         * Usually cents
+         * Used when spelling out the amount and if your currency has decimals.
+         *
+         * Example: Amount in words: Eight hundred fifty thousand sixty-eight EUR and fifteen ct.
+         */
+        'fraction' => 'ct.',
+        'symbol'   => '€',
+        /*
+         * Example: 19.00
+         */
+        'decimals' => 2,
+        /*
+         * Example: 1.99
+         */
+        'decimal_point' => '.',
+        /*
+         * By default empty.
+         * Example: 1,999.00
+         */
+        'thousands_separator' => '',
+        /*
+         * Supported tags {VALUE}, {SYMBOL}, {CODE}
+         * Example: 1.99 €
+         */
+        'format' => '{VALUE} {SYMBOL}',
+    ],
+
+    'paper' => [
+        // A4 = 210 mm x 297 mm = 595 pt x 842 pt
+        'size'        => 'a4',
+        'orientation' => 'portrait',
+    ],
+
+    'disk' => 'local',
+
+    'seller' => [
+        /*
+         * Class used in templates via $invoice->seller
+         *
+         * Must implement LaravelDaily\Invoices\Contracts\PartyContract
+         *      or extend LaravelDaily\Invoices\Classes\Party
+         */
+        'class' => \LaravelDaily\Invoices\Classes\Seller::class,
+
+        /*
+         * Default attributes for Seller::class
+         */
+        'attributes' => [
+            'name'          => 'Towne, Smith and Ebert',
+            'address'       => '89982 Pfeffer Falls Damianstad, CO 66972-8160',
+            'code'          => '41-1985581',
+            'vat'           => '123456789',
+            'phone'         => '760-355-3930',
+            'custom_fields' => [
+                /*
+                 * Custom attributes for Seller::class
+                 *
+                 * Used to display additional info on Seller section in invoice
+                 * attribute => value
+                 */
+                'SWIFT' => 'BANK101',
+            ],
+        ],
+    ],
+];

BIN
public/vendor/invoices/sample-logo.png


+ 38 - 0
resources/lang/vendor/invoices/en/invoice.php

@@ -0,0 +1,38 @@
+<?php
+
+return [
+    /*
+    |--------------------------------------------------------------------------
+    | Invoice Language Lines
+    |--------------------------------------------------------------------------
+    */
+
+    'invoice'                => 'Invoice',
+    'serial'                 => 'Serial No.',
+    'date'                   => 'Invoice date',
+    'seller'                 => 'Seller',
+    'buyer'                  => 'Buyer',
+    'address'                => 'Address',
+    'code'                   => 'Code',
+    'vat'                    => 'VAT code',
+    'phone'                  => 'Phone',
+    'description'            => 'Description',
+    'units'                  => 'Units',
+    'quantity'               => 'Qty',
+    'price'                  => 'Price',
+    'discount'               => 'Discount',
+    'tax'                    => 'Tax',
+    'sub_total'              => 'Sub total',
+    'total_discount'         => 'Total discount',
+    'taxable_amount'         => 'Taxable amount',
+    'total_taxes'            => 'Total taxes',
+    'tax_rate'               => 'Tax rate',
+    'total_amount'           => 'Total amount',
+    'pay_until'              => 'Please pay until',
+    'amount_in_words'        => 'Amount in words',
+    'amount_in_words_format' => '%s %s and %s %s',
+    'notes'                  => 'Notes',
+    'shipping'               => 'Shipping',
+    'paid'                   => 'Paid',
+    'due'                    => 'Due',
+];

+ 38 - 0
resources/lang/vendor/invoices/nl/invoice.php

@@ -0,0 +1,38 @@
+<?php
+
+return [
+    /*
+    |--------------------------------------------------------------------------
+    | Factuur Taal Lijnen
+    |--------------------------------------------------------------------------
+    */
+
+    'invoice'                => 'Factuur',
+    'serial'                 => 'Factuurnummer',
+    'date'                   => 'Factuurdatum',
+    'seller'                 => 'Leverancier',
+    'buyer'                  => 'Afnemer',
+    'address'                => 'Adres',
+    'code'                   => 'Code',
+    'vat'                    => 'Btw-identificatienummer',
+    'phone'                  => 'Telefoonnummer',
+    'description'            => 'Omschrijving',
+    'units'                  => 'Eenheid',
+    'quantity'               => 'Aantal',
+    'price'                  => 'Prijs',
+    'discount'               => 'Korting',
+    'tax'                    => 'Belasting',
+    'sub_total'              => 'Subtotaal',
+    'total_discount'         => 'Totale korting',
+    'taxable_amount'         => 'Belastbaar bedrag',
+    'total_taxes'            => 'Totaal belastingen',
+    'tax_rate'               => 'Belastingtarief',
+    'total_amount'           => 'Totaalbedrag',
+    'pay_until'              => 'Gelieve te betalen voor',
+    'amount_in_words'        => 'Totaalbedrag in woorden',
+    'amount_in_words_format' => '%s %s en %s %s',
+    'notes'                  => 'Opmerkingen',
+    'shipping'               => 'Verzending',
+    'paid'                   => 'Betaald',
+    'due'                    => 'Openstaand',
+];

+ 386 - 0
resources/views/vendor/invoices/templates/default.blade.php

@@ -0,0 +1,386 @@
+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <title>{{ $invoice->name }}</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+
+        <style type="text/css" media="screen">
+            html {
+                font-family: sans-serif;
+                line-height: 1.15;
+                margin: 0;
+            }
+
+            body {
+                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+                font-weight: 400;
+                line-height: 1.5;
+                color: #212529;
+                text-align: left;
+                background-color: #fff;
+                font-size: 10px;
+                margin: 36pt;
+            }
+
+            h4 {
+                margin-top: 0;
+                margin-bottom: 0.5rem;
+            }
+
+            p {
+                margin-top: 0;
+                margin-bottom: 1rem;
+            }
+
+            strong {
+                font-weight: bolder;
+            }
+
+            img {
+                vertical-align: middle;
+                border-style: none;
+            }
+
+            table {
+                border-collapse: collapse;
+            }
+
+            th {
+                text-align: inherit;
+            }
+
+            h4, .h4 {
+                margin-bottom: 0.5rem;
+                font-weight: 500;
+                line-height: 1.2;
+            }
+
+            h4, .h4 {
+                font-size: 1.5rem;
+            }
+
+            .table {
+                width: 100%;
+                margin-bottom: 1rem;
+                color: #212529;
+            }
+
+            .table th,
+            .table td {
+                padding: 0.75rem;
+                vertical-align: top;
+            }
+
+            .table.table-items td {
+                border-top: 1px solid #dee2e6;
+            }
+
+            .table thead th {
+                vertical-align: bottom;
+                border-bottom: 2px solid #dee2e6;
+            }
+
+            .mt-5 {
+                margin-top: 3rem !important;
+            }
+
+            .pr-0,
+            .px-0 {
+                padding-right: 0 !important;
+            }
+
+            .pl-0,
+            .px-0 {
+                padding-left: 0 !important;
+            }
+
+            .text-right {
+                text-align: right !important;
+            }
+
+            .text-center {
+                text-align: center !important;
+            }
+
+            .text-uppercase {
+                text-transform: uppercase !important;
+            }
+            * {
+                font-family: "DejaVu Sans";
+            }
+            body, h1, h2, h3, h4, h5, h6, table, th, tr, td, p, div {
+                line-height: 1.1;
+            }
+            .party-header {
+                font-size: 1.5rem;
+                font-weight: 400;
+            }
+            .total-amount {
+                font-size: 12px;
+                font-weight: 700;
+            }
+            .border-0 {
+                border: none !important;
+            }
+            .cool-gray {
+                color: #6B7280;
+            }
+        </style>
+    </head>
+
+    <body>
+        {{-- Header --}}
+        @if($invoice->logo)
+            <img src="{{ $invoice->getLogo() }}" alt="logo" height="100">
+        @endif
+
+        <table class="table mt-5">
+            <tbody>
+                <tr>
+                    <td class="border-0 pl-0" width="70%">
+                        <h4 class="text-uppercase">
+                            <strong>{{ $invoice->name }}</strong>
+                        </h4>
+                    </td>
+                    <td class="border-0 pl-0">
+                        @if($invoice->status)
+                            <h4 class="text-uppercase cool-gray">
+                                <strong>{{ $invoice->status }}</strong>
+                            </h4>
+                        @endif
+                        <p>{{ __('invoices::invoice.serial') }} <strong>{{ $invoice->getSerialNumber() }}</strong></p>
+                        <p>{{ __('invoices::invoice.date') }}: <strong>{{ $invoice->getDate() }}</strong></p>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+
+        {{-- Seller - Buyer --}}
+        <table class="table">
+            <thead>
+                <tr>
+                    <th class="border-0 pl-0 party-header" width="48.5%">
+                        {{ __('invoices::invoice.seller') }}
+                    </th>
+                    <th class="border-0" width="3%"></th>
+                    <th class="border-0 pl-0 party-header">
+                        {{ __('invoices::invoice.buyer') }}
+                    </th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td class="px-0">
+                        @if($invoice->seller->name)
+                            <p class="seller-name">
+                                <strong>{{ $invoice->seller->name }}</strong>
+                            </p>
+                        @endif
+
+                        @if($invoice->seller->address)
+                            <p class="seller-address">
+                                {{ __('invoices::invoice.address') }}: {{ $invoice->seller->address }}
+                            </p>
+                        @endif
+
+                        @if($invoice->seller->code)
+                            <p class="seller-code">
+                                {{ __('invoices::invoice.code') }}: {{ $invoice->seller->code }}
+                            </p>
+                        @endif
+
+                        @if($invoice->seller->vat)
+                            <p class="seller-vat">
+                                {{ __('invoices::invoice.vat') }}: {{ $invoice->seller->vat }}
+                            </p>
+                        @endif
+
+                        @if($invoice->seller->phone)
+                            <p class="seller-phone">
+                                {{ __('invoices::invoice.phone') }}: {{ $invoice->seller->phone }}
+                            </p>
+                        @endif
+
+                        @foreach($invoice->seller->custom_fields as $key => $value)
+                            <p class="seller-custom-field">
+                                {{ ucfirst($key) }}: {{ $value }}
+                            </p>
+                        @endforeach
+                    </td>
+                    <td class="border-0"></td>
+                    <td class="px-0">
+                        @if($invoice->buyer->name)
+                            <p class="buyer-name">
+                                <strong>{{ $invoice->buyer->name }}</strong>
+                            </p>
+                        @endif
+
+                        @if($invoice->buyer->address)
+                            <p class="buyer-address">
+                                {{ __('invoices::invoice.address') }}: {{ $invoice->buyer->address }}
+                            </p>
+                        @endif
+
+                        @if($invoice->buyer->code)
+                            <p class="buyer-code">
+                                {{ __('invoices::invoice.code') }}: {{ $invoice->buyer->code }}
+                            </p>
+                        @endif
+
+                        @if($invoice->buyer->vat)
+                            <p class="buyer-vat">
+                                {{ __('invoices::invoice.vat') }}: {{ $invoice->buyer->vat }}
+                            </p>
+                        @endif
+
+                        @if($invoice->buyer->phone)
+                            <p class="buyer-phone">
+                                {{ __('invoices::invoice.phone') }}: {{ $invoice->buyer->phone }}
+                            </p>
+                        @endif
+
+                        @foreach($invoice->buyer->custom_fields as $key => $value)
+                            <p class="buyer-custom-field">
+                                {{ ucfirst($key) }}: {{ $value }}
+                            </p>
+                        @endforeach
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+
+        {{-- Table --}}
+        <table class="table table-items">
+            <thead>
+                <tr>
+                    <th scope="col" class="border-0 pl-0">{{ __('invoices::invoice.description') }}</th>
+                    @if($invoice->hasItemUnits)
+                        <th scope="col" class="text-center border-0">{{ __('invoices::invoice.units') }}</th>
+                    @endif
+                    <th scope="col" class="text-center border-0">{{ __('invoices::invoice.quantity') }}</th>
+                    <th scope="col" class="text-right border-0">{{ __('invoices::invoice.price') }}</th>
+                    @if($invoice->hasItemDiscount)
+                        <th scope="col" class="text-right border-0">{{ __('invoices::invoice.discount') }}</th>
+                    @endif
+                    @if($invoice->hasItemTax)
+                        <th scope="col" class="text-right border-0">{{ __('invoices::invoice.tax') }}</th>
+                    @endif
+                    <th scope="col" class="text-right border-0 pr-0">{{ __('invoices::invoice.sub_total') }}</th>
+                </tr>
+            </thead>
+            <tbody>
+                {{-- Items --}}
+                @foreach($invoice->items as $item)
+                <tr>
+                    <td class="pl-0">
+                        {{ $item->title }}
+
+                        @if($item->description)
+                            <p class="cool-gray">{{ $item->description }}</p>
+                        @endif
+                    </td>
+                    @if($invoice->hasItemUnits)
+                        <td class="text-center">{{ $item->units }}</td>
+                    @endif
+                    <td class="text-center">{{ $item->quantity }}</td>
+                    <td class="text-right">
+                        {{ $invoice->formatCurrency($item->price_per_unit) }}
+                    </td>
+                    @if($invoice->hasItemDiscount)
+                        <td class="text-right">
+                            {{ $invoice->formatCurrency($item->discount) }}
+                        </td>
+                    @endif
+                    @if($invoice->hasItemTax)
+                        <td class="text-right">
+                            {{ $invoice->formatCurrency($item->tax) }}
+                        </td>
+                    @endif
+
+                    <td class="text-right pr-0">
+                        {{ $invoice->formatCurrency($item->sub_total_price) }}
+                    </td>
+                </tr>
+                @endforeach
+                {{-- Summary --}}
+                @if($invoice->hasItemOrInvoiceDiscount())
+                    <tr>
+                        <td colspan="{{ $invoice->table_columns - 2 }}" class="border-0"></td>
+                        <td class="text-right pl-0">{{ __('invoices::invoice.total_discount') }}</td>
+                        <td class="text-right pr-0">
+                            {{ $invoice->formatCurrency($invoice->total_discount) }}
+                        </td>
+                    </tr>
+                @endif
+                @if($invoice->taxable_amount)
+                    <tr>
+                        <td colspan="{{ $invoice->table_columns - 2 }}" class="border-0"></td>
+                        <td class="text-right pl-0">{{ __('invoices::invoice.taxable_amount') }}</td>
+                        <td class="text-right pr-0">
+                            {{ $invoice->formatCurrency($invoice->taxable_amount) }}
+                        </td>
+                    </tr>
+                @endif
+                @if($invoice->tax_rate)
+                    <tr>
+                        <td colspan="{{ $invoice->table_columns - 2 }}" class="border-0"></td>
+                        <td class="text-right pl-0">{{ __('invoices::invoice.tax_rate') }}</td>
+                        <td class="text-right pr-0">
+                            {{ $invoice->tax_rate }}%
+                        </td>
+                    </tr>
+                @endif
+                @if($invoice->hasItemOrInvoiceTax())
+                    <tr>
+                        <td colspan="{{ $invoice->table_columns - 2 }}" class="border-0"></td>
+                        <td class="text-right pl-0">{{ __('invoices::invoice.total_taxes') }}</td>
+                        <td class="text-right pr-0">
+                            {{ $invoice->formatCurrency($invoice->total_taxes) }}
+                        </td>
+                    </tr>
+                @endif
+                @if($invoice->shipping_amount)
+                    <tr>
+                        <td colspan="{{ $invoice->table_columns - 2 }}" class="border-0"></td>
+                        <td class="text-right pl-0">{{ __('invoices::invoice.shipping') }}</td>
+                        <td class="text-right pr-0">
+                            {{ $invoice->formatCurrency($invoice->shipping_amount) }}
+                        </td>
+                    </tr>
+                @endif
+                    <tr>
+                        <td colspan="{{ $invoice->table_columns - 2 }}" class="border-0"></td>
+                        <td class="text-right pl-0">{{ __('invoices::invoice.total_amount') }}</td>
+                        <td class="text-right pr-0 total-amount">
+                            {{ $invoice->formatCurrency($invoice->total_amount) }}
+                        </td>
+                    </tr>
+            </tbody>
+        </table>
+
+        @if($invoice->notes)
+            <p>
+                {{ trans('invoices::invoice.notes') }}: {!! $invoice->notes !!}
+            </p>
+        @endif
+
+        <p>
+            {{ trans('invoices::invoice.amount_in_words') }}: {{ $invoice->getTotalAmountInWords() }}
+        </p>
+        <p>
+            {{ trans('invoices::invoice.pay_until') }}: {{ $invoice->getPayUntilDate() }}
+        </p>
+
+        <script type="text/php">
+            if (isset($pdf) && $PAGE_COUNT > 1) {
+                $text = "Page {PAGE_NUM} / {PAGE_COUNT}";
+                $size = 10;
+                $font = $fontMetrics->getFont("Verdana");
+                $width = $fontMetrics->get_text_width($text, $font, $size) / 2;
+                $x = ($pdf->get_width() - $width);
+                $y = $pdf->get_height() - 35;
+                $pdf->page_text($x, $y, $text, $font, $size);
+            }
+        </script>
+    </body>
+</html>