1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 14:42:42 +01:00
invoiceninja/app/Services/Template/TemplateMock.php

85 lines
372 KiB
PHP
Raw Normal View History

2023-09-27 12:36:08 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Services\Template;
use App\Models\Company;
use App\Services\Pdf\PdfMock;
class TemplateMock
{
2023-09-27 13:11:47 +02:00
public array $engines = [];
public array $variables = [];
public string $credit_data = '[{"id":"mWZdPwbKgR","user_id":"wMvbmOeYAl","project_id":"","assigned_user_id":"","vendor_id":"","amount":881.03,"balance":548.03,"client_id":"QJ0dN6dLOv","status_id":"3","design_id":"Wpmbk5ezJn","created_at":1695796650,"updated_at":1695799160,"archived_at":0,"is_deleted":false,"number":"0001","discount":2,"po_number":"Quisquam.","date":"2023-06-30","last_sent_date":"","next_send_date":"","reminder1_sent":"","reminder2_sent":"","reminder3_sent":"","reminder_last_sent":"","due_date":"2007-03-30","terms":"Voluptatem et aliquid enim dolorem rerum voluptatem. Doloremque magni nesciunt unde nobis omnis quas. Aut totam adipisci voluptatum explicabo qui fugit assumenda. Soluta architecto sit exercitationem amet doloribus ad vel qui. Eos porro qui voluptatum sint. Consequatur voluptatem eveniet vitae illo ea. Rem enim sit impedit odit.","public_notes":"","private_notes":"","uses_inclusive_taxes":false,"tax_name1":"GST","tax_rate1":10,"tax_name2":"VAT","tax_rate2":17.5,"tax_name3":"","tax_rate3":0,"total_taxes":190.03,"is_amount_discount":true,"footer":"","partial":0,"partial_due_date":"","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","has_tasks":false,"has_expenses":false,"custom_surcharge1":0,"custom_surcharge2":0,"custom_surcharge3":0,"custom_surcharge4":0,"custom_surcharge_tax1":false,"custom_surcharge_tax2":false,"custom_surcharge_tax3":false,"custom_surcharge_tax4":false,"line_items":[{"quantity":1,"cost":693,"product_key":"Sed.","notes":"Est sequi.","discount":0,"is_amount_discount":true,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":693,"gross_line_total":693,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"56","custom_value3":"Dolores porro quia.","custom_value4":"Perferendis itaque.","type_id":"1","product_cost":0,"tax_amount":0,"date":"","tax_id":"","task_id":"","expense_id":""}],"entity_type":"credit","exchange_rate":1,"paid_to_date":333,"subscription_id":"","client":{"id":"QJ0dN6dLOv","user_id":"wMvbmOeYAl","assigned_user_id":"","name":"Paucek and Sons","website":"http:\/\/www.wiegand.com\/sit-repellendus-enim-porro-aut-voluptas-voluptates.html","private_notes":"In nihil non voluptas voluptatibus molestiae et. Nihil labore eligendi omnis id. Et cumque reiciendis blanditiis fugiat.","balance":19958.86,"group_settings_id":"","paid_to_date":18895.75,"payment_balance":0,"credit_balance":573.53,"last_login":0,"size_id":"","public_notes":"","client_hash":"ngQe8O6SInYp1D0SKacHE8f6nzr3Gc1UkkoyGMKI","address1":"873","address2":"220 Hand Glen","phone":"","city":"Lake Kallie","state":"Ohio","postal_code":"77890","country_id":"535","industry_id":"","custom_value1":"1974-10-02 21:56:55","custom_value2":"Aqua","custom_value3":"modi","custom_value4":"xhomenick@hotmail.com","shipping_address1":"89064","shipping_address2":"87854 Meda Junction","shipping_city":"South Aryanna","shipping_state":"Connecticut","shipping_postal_code":"52527-1873","shipping_country_id":"4","settings":{"entity":"App\\Models\\Client","industry_id":"","size_id":"","currency_id":"1"},"is_deleted":false,"vat_number":"881403416","id_number":"MU19IWUA7340242407223765691CMM","updated_at":1695811138,"archived_at":0,"created_at":1695796650,"display_name":"Paucek and Sons","number":"0005","has_valid_vat_number":false,"is_tax_exempt":false,"routing_id":"","tax_info":{},"contacts":[{"id":"yMYerkEaOB","first_name":"Bret","last_name":"Beatty","email":"user@example.com","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":true,"is_locked":false,"phone":"1-985-403-1242","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G"},{"id":"gl9av2maG1","first_name":"Sandra","last_name":"Daniel","email":"linnie.aufderhar@example.net","created_at":1695796650,"updated_at":1695796650,"archived_at"
2023-09-28 11:53:10 +02:00
public string $payment_data = '[{ "id": "oBDbDxbl2E", "user_id": "wMvbmOeYAl", "assigned_user_id": "", "amount": 0, "refunded": 0, "applied": 0, "transaction_reference": "Manual entry", "transaction_id": "", "date": "2023-09-26", "is_manual": true, "created_at": 1695798370, "updated_at": 1695798370, "archived_at": 0, "is_deleted": false, "type_id": "", "invitation_id": "", "private_notes": "", "number": "0001", "custom_value1": "", "custom_value2": "", "custom_value3": "", "custom_value4": "", "client_id": "QJ0dN6dLOv", "client_contact_id": "", "company_gateway_id": "", "gateway_type_id": "", "status_id": "4", "project_id": "", "vendor_id": "", "currency_id": "1", "exchange_rate": 1, "exchange_currency_id": "", "client": { "id": "QJ0dN6dLOv", "user_id": "wMvbmOeYAl", "assigned_user_id": "", "name": "Paucek and Sons", "website": "http:\/\/www.wiegand.com\/sit-repellendus-enim-porro-aut-voluptas-voluptates.html", "private_notes": "In nihil non voluptas voluptatibus molestiae et. Nihil labore eligendi omnis id. Et cumque reiciendis blanditiis fugiat.", "balance": 19958.86, "group_settings_id": "", "paid_to_date": 18895.75, "payment_balance": 0, "credit_balance": 573.53, "last_login": 0, "size_id": "", "public_notes": "", "client_hash": "ngQe8O6SInYp1D0SKacHE8f6nzr3Gc1UkkoyGMKI", "address1": "873", "address2": "220 Hand Glen", "phone": "", "city": "Lake Kallie", "state": "Ohio", "postal_code": "77890", "country_id": "535", "industry_id": "", "custom_value1": "1974-10-02 21:56:55", "custom_value2": "Aqua", "custom_value3": "modi", "custom_value4": "xhomenick@hotmail.com", "shipping_address1": "89064", "shipping_address2": "87854 Meda Junction", "shipping_city": "South Aryanna", "shipping_state": "Connecticut", "shipping_postal_code": "52527-1873", "shipping_country_id": "4", "is_deleted": false, "vat_number": "881403416", "id_number": "MU19IWUA7340242407223765691CMM", "updated_at": 1695811138, "archived_at": 0, "created_at": 1695796650, "display_name": "Paucek and Sons", "number": "0005", "has_valid_vat_number": false, "is_tax_exempt": false, "routing_id": "", "tax_info": {}, "contacts": [{ "id": "yMYerkEaOB", "first_name": "Bret", "last_name": "Beatty", "email": "user@example.com", "created_at": 1695796650, "updated_at": 1695796650, "archived_at": 0, "is_primary": true, "is_locked": false, "phone": "1-985-403-1242", "custom_value1": "", "custom_value2": "", "custom_value3": "", "custom_value4": "", "contact_key": "juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G", "send_email": true, "last_login": 0, "password": "**********", "link": "http:\/\/ninja.test:8000\/client\/key_login\/juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G" }, { "id": "gl9av2maG1", "first_name": "Sandra", "last_name": "Daniel", "email": "linnie.aufderhar@example.net", "created_at": 1695796650, "updated_at": 1695796650, "archived_at": 0, "is_primary": false, "is_locked": false, "phone": "+17319151379", "custom_value1": "", "custom_value2": "", "custom_value3": "", "custom_value4": "", "contact_key": "sm53aNvvsGUmLXFku0RLPUrP0zLj3rzBcTaGMjHd", "send_email": true, "last_login": 0, "password": "**********", "link": "http:\/\/ninja.test:8000\/client\/key_login\/sm53aNvvsGUmLXFku0RLPUrP0zLj3rzBcTaGMjHd" }, { "id": "7LDdwpRe1Y", "first_name": "Leone", "last_name": "Bode", "email": "ipollich@example.org", "created_at": 1695796650, "updated_at": 1695796650, "archived_at": 0, "is_primary": false, "is_locked": false, "phone": "(424) 789-3412", "custom_value1": "", "custom_value2": "", "custom_value3": "", "custom_value4": "", "contact_key": "gDUwiOqRehgCHWbbctW8qgKiLmma3xvsZi10a5Ma", "send_email": true, "last_login": 0, "password": "**********", "link": "http:\/\/ninja.test:8000\/client\/key_login\/gDUwiOqRehgCHWbbctW8qgKiLmma3xvsZi10a5Ma" }], "documents": { "data": [] }, "gateway_tokens": { "data": [] } }, "invoices": [], "paymentables": [{ "id": "xYRdG7dDzO", "invoice_id": "mxkazm8eJ0", "amount": 0, "refunded": 0, "created_at": 1695798370, "updated_at": 1695798370, "archived_at": 0 }] }, { "id": "K4oeEva0By", "user_id": "wMvbmOeYAl", "assigned_user_id": "", "amount": 444, "
2023-09-27 13:11:47 +02:00
public string $purchase_order_data = '[{"id":"l4zbq2dprO","user_id":"wMvbmOeYAl","project_id":"","assigned_user_id":"","vendor_id":"xYRdG7dDzO","amount":14,"balance":0,"client_id":"","status_id":"1","design_id":"Wpmbk5ezJn","created_at":1695799265,"updated_at":1695799268,"archived_at":0,"is_deleted":false,"number":"0001","discount":0,"po_number":"","date":"2023-09-27","last_sent_date":"","next_send_date":"","reminder1_sent":"","reminder2_sent":"","reminder3_sent":"","reminder_last_sent":"","due_date":"2023-09-28","terms":"","public_notes":"","private_notes":"","uses_inclusive_taxes":false,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"total_taxes":0,"is_amount_discount":true,"footer":"","partial":0,"partial_due_date":"","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","has_tasks":false,"has_expenses":false,"custom_surcharge1":0,"custom_surcharge2":0,"custom_surcharge3":0,"custom_surcharge4":0,"custom_surcharge_tax1":false,"custom_surcharge_tax2":false,"custom_surcharge_tax3":false,"custom_surcharge_tax4":false,"line_items":[{"_id":"16ae59d4-60a8-4edf-b3a3-58882df1c5bf","quantity":1,"cost":14,"product_key":"enterprise_plan","product_cost":0,"notes":"The Enterprise Plan","discount":0,"is_amount_discount":true,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":"0","line_total":14,"gross_line_total":14,"date":"","custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"73","custom_value3":"Nesciunt sequi.","custom_value4":"Ratione inventore.","type_id":"1","tax_id":"1","tax_amount":0,"task_id":"","expense_id":""},{"_id":"c7ef7af8-2713-4376-89c5-6f2c9c148ea7","quantity":0,"cost":0,"product_key":"","product_cost":0,"notes":"","discount":0,"is_amount_discount":true,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":"0","line_total":0,"gross_line_total":0,"date":"","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","type_id":"1","tax_id":"1","tax_amount":0,"task_id":"","expense_id":""}],"entity_type":"purchaseOrder","exchange_rate":1,"paid_to_date":0,"subscription_id":"","expense_id":"","currency_id":"","vendor":{"id":"xYRdG7dDzO","user_id":"wMvbmOeYAl","assigned_user_id":"","name":"Dr. Ottilie Gorczany PhD","website":"http:\/\/www.kihn.biz\/","private_notes":"Ullam ullam aut sed accusantium. Et amet ut et cumque. Dolorem rem doloremque eius aut laudantium soluta nihil.","public_notes":"","last_login":0,"address1":"93105","address2":"797 Medhurst Radial Suite 030","phone":"","city":"Lamberttown","state":"Kentucky","postal_code":"86694-1500","country_id":"4","currency_id":"1","custom_value1":"Et similique.","custom_value2":"Ducimus est.","custom_value3":"Ut unde aut quia.","custom_value4":"Rerum odio maxime.","is_deleted":false,"vat_number":"Hic sed vel sint eos et.","id_number":"Quod aut autem.","updated_at":1695796653,"archived_at":0,"created_at":1695796652,"number":"0004","language_id":"","contacts":{"App\\Models\\VendorContact":[{"id":"VolejRRejN","first_name":"Aisha","last_name":"Jerde","send_email":true,"email":"mariam40@example.com","created_at":1695796652,"updated_at":1695796652,"archived_at":0,"is_primary":true,"phone":"+1-828-839-4171","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","link":"http:\/\/ninja.test:8000\/vendor\/key_login\/vqQKXcwO2WsvkN4MPOAS6fpirMZP7gfc","last_login":0},{"id":"WpmbkR5azJ","first_name":"Willy","last_name":"Jacobs","send_email":true,"email":"qwolff@example.org","created_at":1695796652,"updated_at":1695796652,"archived_at":0,"is_primary":false,"phone":"979.822.6527","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","link":"http:\/\/ninja.test:8000\/vendor\/key_login\/A8g2xp3OLbNzpWlfPGIML2lk1LYNFJpx","last_login":0}]},"documents":{"App\\Models\\Document":[]}}},{"id":"kzPdy7aQro","user_id":"wMvbmOeYAl","project_id":"","assigned_user_id":"","vendor_id":"xYRdG7dDzO","amount":24,"balance":24,"client_id":"","status_id":"2","design_id":"Wpmbk5ezJn","cre
2023-09-27 12:36:08 +02:00
2023-09-27 13:11:47 +02:00
public string $project_data = '[{"id":"qM7e5Ba2vp","user_id":"wMvbmOeYAl","assigned_user_id":"","client_id":"QJ0dN6dLOv","name":"Jace Windler DVM","number":"0002","created_at":1695797958,"updated_at":1695798905,"archived_at":0,"is_deleted":false,"task_rate":38,"due_date":"","private_notes":"Private Project Notes","public_notes":"Rerum voluptas incidunt velit.","budgeted_hours":826,"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","color":"#fff","current_hours":0,"client":{"id":"QJ0dN6dLOv","user_id":"wMvbmOeYAl","assigned_user_id":"","name":"Paucek and Sons","website":"http:\/\/www.wiegand.com\/sit-repellendus-enim-porro-aut-voluptas-voluptates.html","private_notes":"In nihil non voluptas voluptatibus molestiae et. Nihil labore eligendi omnis id. Et cumque reiciendis blanditiis fugiat.","balance":19958.86,"group_settings_id":"","paid_to_date":18895.75,"payment_balance":0,"credit_balance":573.53,"last_login":0,"size_id":"","public_notes":"","client_hash":"ngQe8O6SInYp1D0SKacHE8f6nzr3Gc1UkkoyGMKI","address1":"873","address2":"220 Hand Glen","phone":"","city":"Lake Kallie","state":"Ohio","postal_code":"77890","country_id":"535","industry_id":"","custom_value1":"1974-10-02 21:56:55","custom_value2":"Aqua","custom_value3":"modi","custom_value4":"xhomenick@hotmail.com","shipping_address1":"89064","shipping_address2":"87854 Meda Junction","shipping_city":"South Aryanna","shipping_state":"Connecticut","shipping_postal_code":"52527-1873","shipping_country_id":"4","settings":{"entity":"App\\Models\\Client","industry_id":"","size_id":"","currency_id":"1"},"is_deleted":false,"vat_number":"881403416","id_number":"MU19IWUA7340242407223765691CMM","updated_at":1695811138,"archived_at":0,"created_at":1695796650,"display_name":"Paucek and Sons","number":"0005","has_valid_vat_number":false,"is_tax_exempt":false,"routing_id":"","tax_info":{},"contacts":{"App\\Models\\ClientContact":[{"id":"yMYerkEaOB","first_name":"Bret","last_name":"Beatty","email":"user@example.com","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":true,"is_locked":false,"phone":"1-985-403-1242","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G"},{"id":"gl9av2maG1","first_name":"Sandra","last_name":"Daniel","email":"linnie.aufderhar@example.net","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":false,"is_locked":false,"phone":"+17319151379","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"sm53aNvvsGUmLXFku0RLPUrP0zLj3rzBcTaGMjHd","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/sm53aNvvsGUmLXFku0RLPUrP0zLj3rzBcTaGMjHd"},{"id":"7LDdwpRe1Y","first_name":"Leone","last_name":"Bode","email":"ipollich@example.org","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":false,"is_locked":false,"phone":"(424) 789-3412","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"gDUwiOqRehgCHWbbctW8qgKiLmma3xvsZi10a5Ma","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/gDUwiOqRehgCHWbbctW8qgKiLmma3xvsZi10a5Ma"}]},"documents":{"App\\Models\\Document":[]},"gateway_tokens":{"App\\Models\\ClientGatewayToken":[]}},"tasks":{"App\\Models\\Task":[{"id":"k8mepZ1bMy","user_id":"wMvbmOeYAl","assigned_user_id":"","number":"0009","description":"Tenetur molestiae voluptatem voluptate nostrum.","duration":0,"rate":0,"created_at":1695797958,"updated_at":1695798883,"archived_at":0,"invoice_id":"","client_id":"QJ0dN6dLOv","project_id":"qM7e5Ba2vp","is_deleted":false,"time_log":"[[1694933958,1695365958,\"description\",false]]","is_running":false,"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","status_id":"","status_sort_order":0,"is_date_based":fal
2023-09-27 12:36:08 +02:00
2023-09-27 13:11:47 +02:00
public string $task_data = '[{"id":"k8mepZ1bMy","user_id":"wMvbmOeYAl","assigned_user_id":"","number":"0009","description":"Tenetur molestiae voluptatem voluptate nostrum.","duration":0,"rate":0,"created_at":1695797958,"updated_at":1695798883,"archived_at":0,"invoice_id":"","client_id":"QJ0dN6dLOv","project_id":"qM7e5Ba2vp","is_deleted":false,"time_log":"[[1694933958,1695365958,\"description\",false]]","is_running":false,"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","status_id":"","status_sort_order":0,"is_date_based":false,"status_order":null,"date":"2023-09-16","client":{"id":"QJ0dN6dLOv","user_id":"wMvbmOeYAl","assigned_user_id":"","name":"Paucek and Sons","website":"http:\/\/www.wiegand.com\/sit-repellendus-enim-porro-aut-voluptas-voluptates.html","private_notes":"In nihil non voluptas voluptatibus molestiae et. Nihil labore eligendi omnis id. Et cumque reiciendis blanditiis fugiat.","balance":19958.86,"group_settings_id":"","paid_to_date":18895.75,"payment_balance":0,"credit_balance":573.53,"last_login":0,"size_id":"","public_notes":"","client_hash":"ngQe8O6SInYp1D0SKacHE8f6nzr3Gc1UkkoyGMKI","address1":"873","address2":"220 Hand Glen","phone":"","city":"Lake Kallie","state":"Ohio","postal_code":"77890","country_id":"535","industry_id":"","custom_value1":"1974-10-02 21:56:55","custom_value2":"Aqua","custom_value3":"modi","custom_value4":"xhomenick@hotmail.com","shipping_address1":"89064","shipping_address2":"87854 Meda Junction","shipping_city":"South Aryanna","shipping_state":"Connecticut","shipping_postal_code":"52527-1873","shipping_country_id":"4","settings":{"entity":"App\\Models\\Client","industry_id":"","size_id":"","currency_id":"1"},"is_deleted":false,"vat_number":"881403416","id_number":"MU19IWUA7340242407223765691CMM","updated_at":1695811138,"archived_at":0,"created_at":1695796650,"display_name":"Paucek and Sons","number":"0005","has_valid_vat_number":false,"is_tax_exempt":false,"routing_id":"","tax_info":{},"contacts":[{"id":"yMYerkEaOB","first_name":"Bret","last_name":"Beatty","email":"user@example.com","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":true,"is_locked":false,"phone":"1-985-403-1242","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/juMXBqyvDashDUvoYXsdcbZV2SRrFf0BOUFjsc6G"},{"id":"gl9av2maG1","first_name":"Sandra","last_name":"Daniel","email":"linnie.aufderhar@example.net","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":false,"is_locked":false,"phone":"+17319151379","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"sm53aNvvsGUmLXFku0RLPUrP0zLj3rzBcTaGMjHd","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/sm53aNvvsGUmLXFku0RLPUrP0zLj3rzBcTaGMjHd"},{"id":"7LDdwpRe1Y","first_name":"Leone","last_name":"Bode","email":"ipollich@example.org","created_at":1695796650,"updated_at":1695796650,"archived_at":0,"is_primary":false,"is_locked":false,"phone":"(424) 789-3412","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","contact_key":"gDUwiOqRehgCHWbbctW8qgKiLmma3xvsZi10a5Ma","send_email":true,"last_login":0,"password":"**********","link":"http:\/\/ninja.test:8000\/client\/key_login\/gDUwiOqRehgCHWbbctW8qgKiLmma3xvsZi10a5Ma"}],"documents":{"data":[]},"gateway_tokens":{"data":[]}},"project":{"id":"qM7e5Ba2vp","user_id":"wMvbmOeYAl","assigned_user_id":"","client_id":"QJ0dN6dLOv","name":"Jace Windler DVM","number":"0002","created_at":1695797958,"updated_at":1695798905,"archived_at":0,"is_deleted":false,"task_rate":38,"due_date":"","private_notes":"Private Project Notes","public_notes":"Rerum voluptas incidunt velit.","budgeted_hours":826,"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","color":"#fff","current_hours":0,"documents":{"data":[]}},"invoice":[]},{"id":"l4zbqQ3bp
2023-09-28 11:53:10 +02:00
public string $invoice_data = '[{ "id": "VWPe9rxaLy", "user_id": "wMvbmOeYAl", "project_id": "", "assigned_user_id": "", "amount": 9199.58, "balance": 9199.58, "client_id": "QJ0dN6dLOv", "vendor_id": "", "status_id": "2", "design_id": "Wpmbk5ezJn", "recurring_id": "", "created_at": 1695796650, "updated_at": 1695796654, "archived_at": 0, "is_deleted": false, "number": "0001", "discount": 0, "po_number": "", "date": "2023-08-01", "last_sent_date": "", "next_send_date": "", "due_date": "", "terms": "", "public_notes": "", "private_notes": "", "uses_inclusive_taxes": false, "tax_name1": "GST", "tax_rate1": 10, "tax_name2": "VAT", "tax_rate2": 17.5, "tax_name3": "", "tax_rate3": 0, "total_taxes": 2269.58, "is_amount_discount": true, "footer": "", "partial": 0, "partial_due_date": "", "custom_value1": "1991-04-30", "custom_value2": "yes", "custom_value3": "", "custom_value4": "", "has_tasks": false, "has_expenses": false, "custom_surcharge1": 0, "custom_surcharge2": 0, "custom_surcharge3": 0, "custom_surcharge4": 0, "exchange_rate": 1, "custom_surcharge_tax1": false, "custom_surcharge_tax2": false, "custom_surcharge_tax3": false, "custom_surcharge_tax4": false, "line_items": [{ "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": 0, "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": 0, "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "", "tax_rate1": 0, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": 0, "line_total": 693, "gross_line_total": 693, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 0, "date": "", "tax_id": "", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": 0, "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": 0, "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "
2023-09-27 12:36:08 +02:00
2023-09-27 13:11:47 +02:00
public string $quote_data = '[{ "id": "KGRb41dBLZ", "user_id": "wMvbmOeYAl", "assigned_user_id": "", "amount": 9199.58, "balance": 0, "client_id": "QJ0dN6dLOv", "status_id": "1", "design_id": "Wpmbk5ezJn", "invoice_id": "", "vendor_id": "", "updated_at": 1695799454, "archived_at": 0, "created_at": 1695799453, "number": "0006", "discount": 0, "po_number": "", "date": "2023-09-27", "last_sent_date": "", "next_send_date": "", "reminder1_sent": "", "reminder2_sent": "", "reminder3_sent": "", "reminder_last_sent": "", "due_date": "", "terms": "Default company quote terms", "public_notes": "", "private_notes": "", "is_deleted": false, "uses_inclusive_taxes": false, "tax_name1": "GST", "tax_rate1": 10, "tax_name2": "VAT", "tax_rate2": 17.5, "tax_name3": "", "tax_rate3": 0, "total_taxes": 2269.58, "is_amount_discount": true, "footer": "", "partial": 0, "partial_due_date": "", "custom_value1": "1991-04-30", "custom_value2": "yes", "custom_value3": "", "custom_value4": "", "has_tasks": false, "has_expenses": false, "custom_surcharge1": 0, "custom_surcharge2": 0, "custom_surcharge3": 0, "custom_surcharge4": 0, "custom_surcharge_tax1": false, "custom_surcharge_tax2": false, "custom_surcharge_tax3": false, "custom_surcharge_tax4": false, "line_items": [{ "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": "0", "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "1", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": "0", "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "1", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "", "tax_rate1": 0, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": "0", "line_total": 693, "gross_line_total": 693, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 0, "date": "", "tax_id": "1", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": "0", "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "1", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "Sed.", "notes": "Est sequi.", "discount": 0, "is_amount_discount": true, "tax_name1": "Sales Tax", "tax_rate1": 5, "tax_name2": "", "tax_rate2": 0, "tax_name3": "", "tax_rate3": 0, "sort_id": "0", "line_total": 693, "gross_line_total": 727.65, "custom_value1": "https:\/\/picsum.photos\/200", "custom_value2": "56", "custom_value3": "Dolores porro quia.", "custom_value4": "Perferendis itaque.", "type_id": "1", "product_cost": 0, "tax_amount": 34.65, "date": "", "tax_id": "1", "task_id": "", "expense_id": "" }, { "quantity": 1, "cost": 693, "product_key": "S
2023-09-27 13:32:17 +02:00
public function __construct(public Company $company)
2023-09-27 13:11:47 +02:00
{
}
public function init(): self
{
2023-09-27 12:36:08 +02:00
2023-09-27 13:11:47 +02:00
$this->variables = collect(['invoices', 'quotes', 'credits', 'purchase_orders'])->map(function ($type) {
return $this->createVariables($type);
2023-09-27 12:36:08 +02:00
})->toArray();
2023-09-27 13:44:09 +02:00
$this->engines['invoices'] = json_decode($this->invoice_data, true);
$this->engines['quotes'] = json_decode($this->quote_data, true);
$this->engines['credits'] = json_decode($this->credit_data, true);
$this->engines['tasks'] = json_decode($this->task_data, true);
$this->engines['projects'] = json_decode($this->project_data, true);
$this->engines['payments'] = json_decode($this->payment_data, true);
$this->engines['purchase_orders'] = json_decode($this->purchase_order_data, true);
2023-09-27 13:11:47 +02:00
return $this;
2023-09-27 12:36:08 +02:00
}
/**
* ['entity_type','design','settings_type','settings']
*
* @param string $type
* @return array
*/
private function createVariables(string $type): array
{
$data = [
'entity_type' => rtrim($type,"s"),
'design' => '',
'settings_type' => 'company',
'settings' => $this->company->settings,
];
2023-09-27 13:11:47 +02:00
$mock = (new PdfMock($data, $this->company));
$mock->settings = $this->company->settings;
$mock->build();
2023-09-27 12:36:08 +02:00
return [$type => $mock->getStubVariables()];
}
2023-09-27 13:11:47 +02:00
2023-09-27 12:36:08 +02:00
}