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

96 lines
185 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-11-28 14:27:04 +01:00
protected ?object $settings;
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
2023-11-27 12:20:58 +01:00
public string $payment_data = '[{"status":"Refunded","badge":"<h6><span class=\"badge badge-primary\">Refunded<\/span><\/h6>","amount":"$6,077.51","applied":"$6,077.51","balance":"-$6,077.51","refunded":"$6,077.51","amount_raw":"6077.510000","applied_raw":"6077.510000","refunded_raw":"6077.510000","balance_raw":-6077.51,"date":"30\/Sep\/2023","method":"EuroCard","currency":"USD","exchange_rate":1,"transaction_reference":"Manual entry","is_manual":1,"number":"0001","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","client":{"name":"cypress","balance":"0.000000","payment_balance":"0.000000","credit_balance":"11661.820000","vat_number":"VAT123"},"paymentables":[{"invoice":"0019","amount_raw":"6077.5100","refunded_raw":"6077.5100","net_raw":0,"amount":"$6,077.51","refunded":"$6,077.51","net":"$0.00","is_credit":false,"created_at":"01\/Oct\/2023","updated_at":"01\/Oct\/2023","timestamp":1696150843}]},{"status":"Refunded","badge":"<h6><span class=\"badge badge-primary\">Refunded<\/span><\/h6>","amount":"$4,090.64","applied":"$4,090.64","balance":"-$4,090.64","refunded":"$4,090.64","amount_raw":"4090.640000","applied_raw":"4090.640000","refunded_raw":"4090.640000","balance_raw":-4090.64,"date":"30\/Sep\/2023","method":"Discover Card","currency":"USD","exchange_rate":1,"transaction_reference":"Manual entry","is_manual":1,"number":"0002","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","client":{"name":"cypress","balance":"0.000000","payment_balance":"0.000000","credit_balance":"11661.820000","vat_number":"VAT123"},"paymentables":[{"invoice":"0020","amount_raw":"4090.6400","refunded_raw":"4090.6400","net_raw":0,"amount":"$4,090.64","refunded":"$4,090.64","net":"$0.00","is_credit":false,"created_at":"01\/Oct\/2023","updated_at":"01\/Oct\/2023","timestamp":1696150843}]},{"status":"Refunded","badge":"<h6><span class=\"badge badge-primary\">Refunded<\/span><\/h6>","amount":"$2,197.26","applied":"$2,197.26","balance":"-$2,197.26","refunded":"$2,197.26","amount_raw":"2197.260000","applied_raw":"2197.260000","refunded_raw":"2197.260000","balance_raw":-2197.26,"date":"30\/Sep\/2023","method":"Diners Card","currency":"USD","exchange_rate":1,"transaction_reference":"Manual entry","is_manual":1,"number":"0003","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","client":{"name":"Jakubowski Group","balance":"28296.170000","payment_balance":"0.000000","credit_balance":"1084.840000","vat_number":"VAT123"},"paymentables":[{"invoice":"0021","amount_raw":"2197.2600","refunded_raw":"2197.2600","net_raw":0,"amount":"$2,197.26","refunded":"$2,197.26","net":"$0.00","is_credit":false,"created_at":"01\/Oct\/2023","updated_at":"01\/Oct\/2023","timestamp":1696150843}]},{"status":"Partially Refunded","badge":"<h6><span class=\"badge badge-success\">Partially Refunded<\/span><\/h6>","amount":"$4,955.50","applied":"$4,955.50","balance":"-$66.00","refunded":"$66.00","amount_raw":"4955.500000","applied_raw":"4955.500000","refunded_raw":"66.000000","balance_raw":-66,"date":"30\/Sep\/2023","method":"Maestro","currency":"USD","exchange_rate":1,"transaction_reference":"Manual entry","is_manual":1,"number":"0004","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","client":{"name":"Jakubowski Group","balance":"28296.170000","payment_balance":"0.000000","credit_balance":"1084.840000","vat_number":"VAT123"},"paymentables":[{"invoice":"0022","amount_raw":"4955.5000","refunded_raw":"66.0000","net_raw":4889.5,"amount":"$4,955.50","refunded":"$66.00","net":"$4,889.50","is_credit":false,"created_at":"01\/Oct\/2023","updated_at":"01\/Oct\/2023","timestamp":1696150843}]},{"status":"Partially Refunded","badge":"<h6><span class=\"badge badge-success\">Partially Refunded<\/span><\/h6>","amount":"$2,290.75","applied":"$2,290.75","balance":"-$34.00","refunded":"$34.00","amount_raw":"2290.750000","applied_raw":"2290.750000","refunded_raw":"34.000000","balance_raw":-34,"date":"30\/Sep\/2023","method":"Diners Card","currency":"USD","exchange_rate":1,"transaction_reference":"Ma
2023-09-28 11:53:10 +02:00
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
2024-01-14 05:05:00 +01:00
2023-11-27 12:20:58 +01:00
public string $project_data = '[{"name":"Abel Moore","number":"0001","created_at":"19\/Nov\/2023","updated_at":"19\/Nov\/2023","task_rate":"$107.00","task_rate_raw":"107.000000","due_date":"25\/Nov\/2023","private_notes":"","public_notes":"Omnis modi optio maxime ut inventore.","budgeted_hours":339,"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","color":"#fff","current_hours":390,"tasks":[{"number":"0002","description":"Et dolorem nihil qui quas asperiores nulla aut praesentium. Ea quasi porro facere eligendi. Et assumenda illum nostrum natus repellat eveniet. Sequi odio nulla perspiciatis doloremque.","duration":966982,"rate":"$76.00","rate_raw":"76.000000","created_at":"19\/Nov\/2023","updated_at":"19\/Nov\/2023","date":"19\/Nov\/2023","project":[],"time_log":[{"start_date_raw":1700428466,"start_date":"19\/Nov\/2023 21:11:26","end_date_raw":1700492035,"end_date":"20\/Nov\/2023 14:11:55","description":"Nihil voluptas et sint et.","billable":true,"duration":63569},{"start_date_raw":1700492335,"start_date":"20\/Nov\/2023 14:11:55","end_date_raw":1700554011,"end_date":"21\/Nov\/2023 08:11:51","description":"Aut consequuntur aliquam earum aut reiciendis.","billable":false,"duration":61676},{"start_date_raw":1700554311,"start_date":"21\/Nov\/2023 08:11:51","end_date_raw":1700586651,"end_date":"21\/Nov\/2023 17:11:51","description":"Occaecati consectetur temporibus neque rerum sed rem iure.","billable":true,"duration":32340},{"start_date_raw":1700586951,"start_date":"21\/Nov\/2023 17:11:51","end_date_raw":1700644903,"end_date":"22\/Nov\/2023 09:11:43","description":"Ducimus voluptate aliquid aliquam nobis.","billable":true,"duration":57952},{"start_date_raw":1700645203,"start_date":"22\/Nov\/2023 09:11:43","end_date_raw":1700724132,"end_date":"23\/Nov\/2023 07:11:12","description":"Non ipsam consequatur voluptatem illum.","billable":true,"duration":78929},{"start_date_raw":1700724432,"start_date":"23\/Nov\/2023 07:11:12","end_date_raw":1700790596,"end_date":"24\/Nov\/2023 01:11:56","description":"Aspernatur quia voluptate molestias non.","billable":false,"duration":66164},{"start_date_raw":1700790896,"start_date":"24\/Nov\/2023 01:11:56","end_date_raw":1700812808,"end_date":"24\/Nov\/2023 08:11:08","description":"Sed quod omnis officiis asperiores natus facere minus nemo.","billable":false,"duration":21912},{"start_date_raw":1700813108,"start_date":"24\/Nov\/2023 08:11:08","end_date_raw":1700865275,"end_date":"24\/Nov\/2023 22:11:35","description":"Tenetur quaerat ea magni placeat.","billable":false,"duration":52167},{"start_date_raw":1700865575,"start_date":"24\/Nov\/2023 22:11:35","end_date_raw":1700888516,"end_date":"25\/Nov\/2023 05:11:56","description":"Sequi dolor laborum deserunt rerum.","billable":true,"duration":22941},{"start_date_raw":1700888816,"start_date":"25\/Nov\/2023 05:11:56","end_date_raw":1700933259,"end_date":"25\/Nov\/2023 17:11:39","description":"Est qui velit ipsum et nesciunt qui ut.","billable":true,"duration":44443},{"start_date_raw":1700933559,"start_date":"25\/Nov\/2023 17:11:39","end_date_raw":1700979107,"end_date":"26\/Nov\/2023 06:11:47","description":"Sint et quo quo.","billable":false,"duration":45548},{"start_date_raw":1700979407,"start_date":"26\/Nov\/2023 06:11:47","end_date_raw":1701002669,"end_date":"26\/Nov\/2023 12:11:29","description":"Omnis unde sit similique dolor fugit totam.","billable":true,"duration":23262},{"start_date_raw":1701002969,"start_date":"26\/Nov\/2023 12:11:29","end_date_raw":1701071339,"end_date":"27\/Nov\/2023 07:11:59","description":"Ducimus qui voluptas accusamus.","billable":true,"duration":68370},{"start_date_raw":1701071639,"start_date":"27\/Nov\/2023 07:11:59","end_date_raw":1701100825,"end_date":"27\/Nov\/2023 16:11:25","description":"Soluta sit non nobis ab et ad libero sint.","billable":false,"duration":29186},{"start_date_raw":1701101125,"start_date":"27\/Nov\/2023 16:11:25","end_date_raw":1701157799,"end_date":"28\/Nov\/2023 07:11:59","description":"Cumque dignissimos error qui ut.","billable":true,"duration":56674},{"sta
2023-09-27 12:36:08 +02:00
2023-11-27 12:20:58 +01:00
public string $task_data = '[{"number":"0001","description":"Reiciendis itaque molestias blanditiis cupiditate ea. Minus officiis natus itaque. Consectetur et aut veritatis quae ut esse ut. Accusantium dolore quaerat sit qui. Magni quia sunt corporis.","duration":149031,"rate":"$71.00","rate_raw":"71.000000","created_at":"19\/Nov\/2023","updated_at":"19\/Nov\/2023","date":"19\/Nov\/2023","project":[],"time_log":[{"start_date_raw":1700428466,"start_date":"19\/Nov\/2023 21:11:26","end_date_raw":1700470150,"end_date":"20\/Nov\/2023 08:11:10","description":"Assumenda nihil vitae odio voluptatem iusto ipsam repellendus.","billable":false,"duration":41684},{"start_date_raw":1700470450,"start_date":"20\/Nov\/2023 08:11:10","end_date_raw":1700485036,"end_date":"20\/Nov\/2023 12:11:16","description":"Adipisci amet optio tempore et.","billable":true,"duration":14586},{"start_date_raw":1700485336,"start_date":"20\/Nov\/2023 13:11:16","end_date_raw":1700572291,"end_date":"21\/Nov\/2023 13:11:31","description":"Ratione repellat saepe mollitia perspiciatis optio.","billable":false,"duration":86955},{"start_date_raw":1700572591,"start_date":"21\/Nov\/2023 13:11:31","end_date_raw":1700578397,"end_date":"21\/Nov\/2023 14:11:17","description":"Molestias perferendis ipsa odit id aut sunt.","billable":true,"duration":5806}],"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","status":"Done","user":{"name":"Laron Weissnat Danika Flatley","email":"small@example.com"},"client":{"name":"Medhurst Inc","balance":"37633.780000","payment_balance":"0.000000","credit_balance":"1025.100000","vat_number":"VAT123"}},{"number":"0002","description":"Et dolorem nihil qui quas asperiores nulla aut praesentium. Ea quasi porro facere eligendi. Et assumenda illum nostrum natus repellat eveniet. Sequi odio nulla perspiciatis doloremque.","duration":966982,"rate":"$76.00","rate_raw":"76.000000","created_at":"19\/Nov\/2023","updated_at":"19\/Nov\/2023","date":"19\/Nov\/2023","project":{"name":"Abel Moore","number":"0001","created_at":"19\/Nov\/2023","updated_at":"19\/Nov\/2023","task_rate":"$107.00","task_rate_raw":"107.000000","due_date":"25\/Nov\/2023","private_notes":"","public_notes":"Omnis modi optio maxime ut inventore.","budgeted_hours":339,"custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","color":"#fff","current_hours":390,"tasks":[],"client":{"name":"Hoeger, Hahn and Cole","balance":"0.000000","payment_balance":"0.000000","credit_balance":"1022.550000","vat_number":"VAT123"},"user":{"name":"Laron Weissnat Danika Flatley","email":"small@example.com"}},"time_log":[{"start_date_raw":1700428466,"start_date":"19\/Nov\/2023 21:11:26","end_date_raw":1700492035,"end_date":"20\/Nov\/2023 14:11:55","description":"Nihil voluptas et sint et.","billable":true,"duration":63569},{"start_date_raw":1700492335,"start_date":"20\/Nov\/2023 14:11:55","end_date_raw":1700554011,"end_date":"21\/Nov\/2023 08:11:51","description":"Aut consequuntur aliquam earum aut reiciendis.","billable":false,"duration":61676},{"start_date_raw":1700554311,"start_date":"21\/Nov\/2023 08:11:51","end_date_raw":1700586651,"end_date":"21\/Nov\/2023 17:11:51","description":"Occaecati consectetur temporibus neque rerum sed rem iure.","billable":true,"duration":32340},{"start_date_raw":1700586951,"start_date":"21\/Nov\/2023 17:11:51","end_date_raw":1700644903,"end_date":"22\/Nov\/2023 09:11:43","description":"Ducimus voluptate aliquid aliquam nobis.","billable":true,"duration":57952},{"start_date_raw":1700645203,"start_date":"22\/Nov\/2023 09:11:43","end_date_raw":1700724132,"end_date":"23\/Nov\/2023 07:11:12","description":"Non ipsam consequatur voluptatem illum.","billable":true,"duration":78929},{"start_date_raw":1700724432,"start_date":"23\/Nov\/2023 07:11:12","end_date_raw":1700790596,"end_date":"24\/Nov\/2023 01:11:56","description":"Aspernatur quia voluptate molestias non.","billable":false,"duration":66164},{"start_date_raw":1700790896,"start_date":"24\/Nov\/2023 01:11:56","end_date_raw":1700812808,"end_date":"24\/Nov\/2023 08:11:08","descr
2023-11-16 10:51:20 +01:00
2023-11-23 13:54:42 +01:00
public string $invoice_data = '[{"amount":"$6,054.13","balance":"$0.00","amount_raw":"6054.13","balance_raw":"0.000000","number":"0015","discount":1,"po_number":"","date":"20\/Sep\/2023","last_sent_date":"","next_send_date":"","due_date":"","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":"$444.13","total_taxes_raw":"444.130000","is_amount_discount":true,"footer":"","partial":"0.000000","partial_due_date":"","custom_value1":"1984-10-01","custom_value2":"no","custom_value3":"","custom_value4":"","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":"$935.00","product_key":"Et.","notes":"Illum similique.","discount":"$0.00","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":"$935.00","gross_line_total":"$981.75","custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"78","custom_value3":"Itaque laudantium.","custom_value4":"Qui voluptatem ea a.","type_id":"1","product_cost":"$0.00","tax_amount":"$46.75","date":"","tax_id":"","task_id":"","expense_id":"","cost_raw":935,"discount_raw":0,"line_total_raw":935,"gross_line_total_raw":981.75,"tax_amount_raw":46.75,"product_cost_raw":0},{"quantity":1,"cost":"$935.00","product_key":"Et.","notes":"Illum similique.","discount":"$0.00","is_amount_discount":true,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"$935.00","gross_line_total":"$935.00","custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"78","custom_value3":"Itaque laudantium.","custom_value4":"Qui voluptatem ea a.","type_id":"1","product_cost":"$0.00","tax_amount":"$0.00","date":"","tax_id":"","task_id":"","expense_id":"","cost_raw":935,"discount_raw":0,"line_total_raw":935,"gross_line_total_raw":935,"tax_amount_raw":0,"product_cost_raw":0},{"quantity":1,"cost":"$935.00","product_key":"Et.","notes":"Illum similique.","discount":"$0.00","is_amount_discount":true,"tax_name1":"GST","tax_rate1":10,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"$935.00","gross_line_total":"$1,028.50","custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"78","custom_value3":"Itaque laudantium.","custom_value4":"Qui voluptatem ea a.","type_id":"1","product_cost":"$0.00","tax_amount":"$93.50","date":"","tax_id":"","task_id":"","expense_id":"","cost_raw":935,"discount_raw":0,"line_total_raw":935,"gross_line_total_raw":1028.5,"tax_amount_raw":93.5,"product_cost_raw":0},{"quantity":1,"cost":"$935.00","product_key":"Et.","notes":"Illum similique.","discount":"$0.00","is_amount_discount":true,"tax_name1":"VAT","tax_rate1":17.5,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"$935.00","gross_line_total":"$1,098.63","custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"78","custom_value3":"Itaque laudantium.","custom_value4":"Qui voluptatem ea a.","type_id":"1","product_cost":"$0.00","tax_amount":"$163.63","date":"","tax_id":"","task_id":"","expense_id":"","cost_raw":935,"discount_raw":0,"line_total_raw":935,"gross_line_total_raw":1098.63,"tax_amount_raw":163.63,"product_cost_raw":0},{"quantity":1,"cost":"$935.00","product_key":"Et.","notes":"Illum similique.","discount":"$0.00","is_amount_discount":true,"tax_name1":"GST","tax_rate1":10,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"$935.00","gross_line_total":"$1,028.50","custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"78","custom_value3":"Itaque laudantium.","custom_value4":"Qui voluptatem ea a.","type_id":"1","product_cost":"$0.00","tax_amount":"$93.50","date":"","tax_id":"","task_id":"","expense_id":"","cost_raw":935,"discount_raw":0,"line_total_raw
2023-09-27 12:36:08 +02:00
public string $quote_data = '[{"id":1,"client_id":1,"user_id":1,"assigned_user_id":null,"company_id":1,"status_id":2,"project_id":null,"vendor_id":null,"recurring_id":null,"design_id":2,"invoice_id":null,"number":"0001","discount":1,"is_amount_discount":false,"po_number":"Molestias.","date":"1986-08-02","last_sent_date":null,"due_date":null,"next_send_date":null,"is_deleted":false,"line_items":[{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"VAT","tax_rate1":17.5,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":747.36,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":110.36,"date":"","tax_id":"","task_id":"","expense_id":""},{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"GST","tax_rate1":10,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":700.06,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":63.06,"date":"","tax_id":"","task_id":"","expense_id":""},{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":637,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":0,"date":"","tax_id":"","task_id":"","expense_id":""},{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"GST","tax_rate1":10,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":700.06,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":63.06,"date":"","tax_id":"","task_id":"","expense_id":""},{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"Sales Tax","tax_rate1":5,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":668.53,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":31.53,"date":"","tax_id":"","task_id":"","expense_id":""},{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"GST","tax_rate1":10,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":700.06,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":63.06,"date":"","tax_id":"","task_id":"","expense_id":""},{"quantity":1,"cost":637,"product_key":"Nisi.","notes":"Ut ipsa rerum.","discount":0,"is_amount_discount":false,"tax_name1":"Sales Tax","tax_rate1":5,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"sort_id":0,"line_total":"637.00","gross_line_total":668.53,"custom_value1":"https:\/\/picsum.photos\/200","custom_value2":"42","custom_value3":"Maxime dolores.","custom_value4":"Odio consequatur.","type_id":"1","product_cost":0,"tax_amount":31.53,"date":"","tax_id":"","task_id":"","expense_id":""}],"backup":null,"footer":null,"public_notes":null,"private_notes":null,"terms":null,"tax_name1":"GST","tax_rate1":"10.000000","tax_name2":"VAT","tax_rate2":"17.500000","ta
2024-01-14 05:05:00 +01:00
2023-09-27 13:32:17 +02:00
public function __construct(public Company $company)
2023-09-27 13:11:47 +02:00
{
}
2024-01-14 05:05:00 +01:00
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);
2023-11-16 07:54:56 +01:00
$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);
2023-09-27 13:44:09 +02:00
$this->engines['payments'] = json_decode($this->payment_data, true);
2023-11-16 07:54:56 +01:00
$this->engines['purchase_orders'] = json_decode($this->purchase_order_data, true);
2024-01-14 05:05:00 +01:00
// nlog("engines");
// nlog($this->engines);
2023-09-27 13:11:47 +02:00
return $this;
2024-01-14 05:05:00 +01:00
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
2023-10-26 04:57:44 +02:00
{
2023-09-27 12:36:08 +02:00
$data = [
2023-10-26 04:57:44 +02:00
'entity_type' => rtrim($type, "s"),
2023-09-27 12:36:08 +02:00
'design' => '',
'settings_type' => 'company',
2023-11-28 14:27:04 +01:00
'settings' => $this->settings ?? $this->company->settings,
2023-09-27 12:36:08 +02:00
];
2023-09-27 13:11:47 +02:00
$mock = (new PdfMock($data, $this->company));
2023-11-28 14:27:04 +01:00
$mock->settings = $this->settings ?? $this->company->settings;
2023-09-27 13:11:47 +02:00
$mock->build();
2023-09-27 12:36:08 +02:00
return [$type => $mock->getStubVariables()];
}
2023-11-28 14:27:04 +01:00
public function setSettings($settings): self
{
$this->settings = $settings;
return $this;
}
2023-09-27 13:11:47 +02:00
2023-10-26 04:57:44 +02:00
}