From 89024a173b66e2a0d2092e659818330a8ca599a6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 12:27:27 +1100 Subject: [PATCH 01/11] Update client paid to date for full amount with overpayments --- app/Services/Payment/UpdateInvoicePayment.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 1cbd644ad9..1a7529058e 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -55,6 +55,11 @@ class UpdateInvoicePayment $paid_amount = $paid_invoice->amount; } + $client + ->service() + ->updatePaidToDate($paid_amount) + ->save(); + /* Need to determine here is we have an OVER payment - if YES only apply the max invoice amount */ if($paid_amount > $invoice->partial && $paid_amount > $invoice->balance) $paid_amount = $invoice->balance; @@ -77,7 +82,6 @@ class UpdateInvoicePayment $client ->service() ->updateBalance($paid_amount * -1) - ->updatePaidToDate($paid_amount) ->save(); $pivot_invoice = $this->payment->invoices->first(function ($inv) use ($paid_invoice) { From ccbe8eb0c1d0cb5ad7bbd218a4df441d6981d627 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 14:07:15 +1100 Subject: [PATCH 02/11] Fixes for reminder templates --- app/DataMapper/EmailTemplateDefaults.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/DataMapper/EmailTemplateDefaults.php b/app/DataMapper/EmailTemplateDefaults.php index 8b9a9f7660..5b6f299580 100644 --- a/app/DataMapper/EmailTemplateDefaults.php +++ b/app/DataMapper/EmailTemplateDefaults.php @@ -185,8 +185,7 @@ class EmailTemplateDefaults public static function emailReminder1Template() { - return self::emailInvoiceTemplate(); - //return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailReminder2Subject() @@ -196,8 +195,7 @@ class EmailTemplateDefaults public static function emailReminder2Template() { - return self::emailInvoiceTemplate(); - //return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailReminder3Subject() @@ -207,8 +205,7 @@ class EmailTemplateDefaults public static function emailReminder3Template() { - return self::emailInvoiceTemplate(); - //return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailReminderEndlessSubject() @@ -218,8 +215,7 @@ class EmailTemplateDefaults public static function emailReminderEndlessTemplate() { - return self::emailInvoiceTemplate(); - return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailStatementSubject() From 895d78178d842370bbdb0c5b59ff933185188bdc Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 14:53:44 +1100 Subject: [PATCH 03/11] Update dev dependencies --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3895ca8e59..9d6a0aa368 100644 --- a/composer.json +++ b/composer.json @@ -87,10 +87,9 @@ "wildbit/swiftmailer-postmark": "^3.3" }, "require-dev": { - "php": "^7.3|^7.4|^8.0", + "php": "^7.4|^8.0", "anahkiasen/former": "^4.2", "barryvdh/laravel-debugbar": "^3.4", - "beyondcode/laravel-query-detector": "^1.5", "brianium/paratest": "^6.1", "darkaonline/l5-swagger": "^8.0", "facade/ignition": "^2.3.6", From a788410b6fbe5de8302f5957150894e1ce61ae58 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 15:39:56 +1100 Subject: [PATCH 04/11] Import company properties --- app/Jobs/Company/CompanyImport.php | 69 +++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index ffc88ff832..5041107ecc 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -149,6 +149,63 @@ class CompanyImport implements ShouldQueue 'system_logs', ]; + private $company_properties = [ + "convert_products", + "fill_products", + "update_products", + "show_product_details", + "client_can_register", + "custom_surcharge_taxes1", + "custom_surcharge_taxes2", + "custom_surcharge_taxes3", + "custom_surcharge_taxes4", + "show_product_cost", + "enabled_tax_rates", + "enabled_modules", + "enable_product_cost", + "enable_product_quantity", + "default_quantity", + "subdomain", + "size_id", + "first_day_of_week", + "first_month_of_year", + "portal_mode", + "portal_domain", + "enable_modules", + "custom_fields", + "industry_id", + "slack_webhook_url", + "google_analytics_key", + "created_at", + "updated_at", + "enabled_item_tax_rates", + "is_large", + "enable_shop_api", + "default_auto_bill", + "mark_expenses_invoiceable", + "mark_expenses_paid", + "invoice_expense_documents", + "auto_start_tasks", + "invoice_task_timelog", + "invoice_task_documents", + "show_tasks_table", + "is_disabled", + "default_task_is_date_based", + "enable_product_discount", + "calculate_expense_tax_by_amount", + "expense_inclusive_taxes", + "session_timeout", + "oauth_password_required", + "invoice_task_datelog", + "default_password_timeout", + "show_task_end_date", + "markdown_enabled", + "use_comma_as_decimal_place", + "report_include_drafts", + "client_registration_fields", + "convert_rate_to_client", + ]; + /** * Create a new job instance. * @@ -212,6 +269,7 @@ class CompanyImport implements ShouldQueue $this->preFlightChecks() ->purgeCompanyData() + ->importCompany() ->importData() ->postImportCleanup(); @@ -420,17 +478,24 @@ class CompanyImport implements ShouldQueue private function importCompany() { //$tmp_company = $this->backup_file->company; - $tmp_company = (object)$this->getObject("company"); + $tmp_company = (object)$this->getObject("company",true); $tmp_company->company_key = $this->createHash(); $tmp_company->db = config('database.default'); $tmp_company->account_id = $this->account->id; +nlog($tmp_company); + if(Ninja::isHosted()) $tmp_company->subdomain = MultiDB::randomSubdomainGenerator(); else $tmp_company->subdomain = ''; - $this->company = $tmp_company; + foreach($this->company_properties as $value){ + + $this->company->{$value} = $tmp_company->{$value}; + + } + $this->company->save(); return $this; From 73e837aecc62a61006d25220e80ff014fb5ada5b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 19 Mar 2022 09:10:39 +1100 Subject: [PATCH 05/11] FIxes for designs' --- resources/views/pdf-designs/bold.html | 3 ++- resources/views/pdf-designs/business.html | 3 ++- resources/views/pdf-designs/clean.html | 8 +++++--- resources/views/pdf-designs/creative.html | 3 ++- resources/views/pdf-designs/elegant.html | 3 ++- resources/views/pdf-designs/hipster.html | 1 + resources/views/pdf-designs/modern.html | 1 + resources/views/pdf-designs/plain.html | 3 ++- resources/views/pdf-designs/playful.html | 4 +++- resources/views/pdf-designs/tech.html | 3 ++- 10 files changed, 22 insertions(+), 10 deletions(-) diff --git a/resources/views/pdf-designs/bold.html b/resources/views/pdf-designs/bold.html index ddbf71e194..d648ae8fc8 100644 --- a/resources/views/pdf-designs/bold.html +++ b/resources/views/pdf-designs/bold.html @@ -22,6 +22,7 @@ @page { margin: 0 !important; + size: $page_size $page_layout; } p { @@ -159,7 +160,7 @@ } #table-totals { - margin-top: 1rem; + margin-top: 0rem; display: grid; grid-template-columns: 2fr 1fr; padding-top: .5rem; diff --git a/resources/views/pdf-designs/business.html b/resources/views/pdf-designs/business.html index dcc3206e82..984ac4fd1d 100644 --- a/resources/views/pdf-designs/business.html +++ b/resources/views/pdf-designs/business.html @@ -20,6 +20,7 @@ margin-right: $global_margin; margin-top: 0; margin-bottom: 0; + size: $page_size $page_layout; } p { @@ -253,7 +254,7 @@ .repeating-header-space, **/ .repeating-footer, .repeating-footer-space { - height: 160px; + height: 10px; } .repeating-header { position: fixed; diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index 0dc623d880..8ab0ec4c4b 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -20,8 +20,10 @@ margin-right: $global_margin; margin-top: 0; margin-bottom: 0; + size: $page_size $page_layout; } + p { margin: 0; padding: 0; @@ -119,7 +121,7 @@ [data-ref="table"] > tbody > tr > td { border-top: 1px solid #d8d8d8; border-bottom: 1px solid #d8d8d8; - padding: 1.5rem 1rem; + padding: 1rem 1rem; } [data-ref="table"] > tbody > tr > td:first-child { @@ -191,7 +193,7 @@ } #footer { - margin-top: 30px; + margin-top: 10px; } /** Markdown-specific styles. **/ @@ -222,7 +224,7 @@ .repeating-header-space, **/ .repeating-footer, .repeating-footer-space { - height: 160px; + height: 10px; } .repeating-header { position: fixed; diff --git a/resources/views/pdf-designs/creative.html b/resources/views/pdf-designs/creative.html index dc017018bd..bf5d1c0704 100644 --- a/resources/views/pdf-designs/creative.html +++ b/resources/views/pdf-designs/creative.html @@ -20,6 +20,7 @@ margin-right: $global_margin; margin-top: 0; margin-bottom: 0; + size: $page_size $page_layout; } p { @@ -206,7 +207,7 @@ .repeating-header-space, **/ .repeating-footer, .repeating-footer-space { - height: 160px; + height: 10px; } .repeating-header { position: fixed; diff --git a/resources/views/pdf-designs/elegant.html b/resources/views/pdf-designs/elegant.html index fc14396d24..8365b4e7b5 100644 --- a/resources/views/pdf-designs/elegant.html +++ b/resources/views/pdf-designs/elegant.html @@ -17,6 +17,7 @@ @page { margin: $global_margin; + size: $page_size $page_layout; } p { @@ -211,7 +212,7 @@ .repeating-header-space, **/ .repeating-footer, .repeating-footer-space { - height: 160px; + height: 10px; } .repeating-header { position: fixed; diff --git a/resources/views/pdf-designs/hipster.html b/resources/views/pdf-designs/hipster.html index df4101e703..57ba54d098 100644 --- a/resources/views/pdf-designs/hipster.html +++ b/resources/views/pdf-designs/hipster.html @@ -17,6 +17,7 @@ @page { margin: $global_margin; + size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/modern.html b/resources/views/pdf-designs/modern.html index 0f31218c90..826dd88a76 100644 --- a/resources/views/pdf-designs/modern.html +++ b/resources/views/pdf-designs/modern.html @@ -21,6 +21,7 @@ @page { margin: 0 !important; + size: $page_size $page_layout; } p { diff --git a/resources/views/pdf-designs/plain.html b/resources/views/pdf-designs/plain.html index 6fad8938d5..745bfb5910 100644 --- a/resources/views/pdf-designs/plain.html +++ b/resources/views/pdf-designs/plain.html @@ -22,6 +22,7 @@ margin-right: $global_margin; margin-top: 0; margin-bottom: 0; + size: $page_size $page_layout; } @@ -200,7 +201,7 @@ .repeating-header-space, **/ .repeating-footer, .repeating-footer-space { - height: 100px; + height: 10px; } .repeating-header { position: fixed; diff --git a/resources/views/pdf-designs/playful.html b/resources/views/pdf-designs/playful.html index d8712983e3..d5d0f3eba3 100644 --- a/resources/views/pdf-designs/playful.html +++ b/resources/views/pdf-designs/playful.html @@ -17,6 +17,8 @@ @page { margin: -0.25cm !important; + size: $page_size $page_layout; + } p { @@ -265,7 +267,7 @@ .repeating-footer, .repeating-footer-space { - height: 160px; + height: 10px; } .repeating-header { position: fixed; diff --git a/resources/views/pdf-designs/tech.html b/resources/views/pdf-designs/tech.html index 74c1df1adb..5a24a2eaf6 100644 --- a/resources/views/pdf-designs/tech.html +++ b/resources/views/pdf-designs/tech.html @@ -17,6 +17,7 @@ @page { margin: 0; + size: $page_size $page_layout; } @media print { @@ -235,7 +236,7 @@ .repeating-header-space, **/ .repeating-footer, .repeating-footer-space { - height: 160px; + height: 10px; } .repeating-header { position: fixed; From 923e360a544785ea399a211b03e31cad2fe52e1a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 19 Mar 2022 12:54:59 +1100 Subject: [PATCH 06/11] Fixes for designs --- resources/views/pdf-designs/business.html | 9 +++-- resources/views/pdf-designs/clean.html | 5 +++ resources/views/pdf-designs/creative.html | 5 +++ resources/views/pdf-designs/elegant.html | 5 +++ resources/views/pdf-designs/hipster.html | 7 +++- resources/views/pdf-designs/modern.html | 5 +++ resources/views/pdf-designs/plain.html | 7 ++-- resources/views/pdf-designs/playful.html | 42 ++++++++++++++--------- resources/views/pdf-designs/tech.html | 5 +++ 9 files changed, 69 insertions(+), 21 deletions(-) diff --git a/resources/views/pdf-designs/business.html b/resources/views/pdf-designs/business.html index 984ac4fd1d..2f6a426567 100644 --- a/resources/views/pdf-designs/business.html +++ b/resources/views/pdf-designs/business.html @@ -7,6 +7,11 @@ --line-height: 1.6; } + html { + width: 210mm; + height: 200mm; + } + body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -57,7 +62,7 @@ } .entity-issued-to { - margin-top: 3rem; + margin-top: 2rem; font-weight: bold; } @@ -162,7 +167,7 @@ } #table-totals { - margin-top: 1rem; + margin-top: 0.5rem; display: grid; grid-template-columns: 2fr 1fr; gap: 80px; diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index 8ab0ec4c4b..fe5109228a 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -7,6 +7,11 @@ --line-height: 1.6; } + html { + width: 210mm; + height: 200mm; + } + body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/resources/views/pdf-designs/creative.html b/resources/views/pdf-designs/creative.html index bf5d1c0704..49808d33f6 100644 --- a/resources/views/pdf-designs/creative.html +++ b/resources/views/pdf-designs/creative.html @@ -7,6 +7,11 @@ --line-height: 1.6; } + html { + width: 210mm; + height: 200mm; + } + body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/resources/views/pdf-designs/elegant.html b/resources/views/pdf-designs/elegant.html index 8365b4e7b5..7795518238 100644 --- a/resources/views/pdf-designs/elegant.html +++ b/resources/views/pdf-designs/elegant.html @@ -7,6 +7,11 @@ --line-height: 1.6; } + html { + width: 210mm; + height: 200mm; + } + body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/resources/views/pdf-designs/hipster.html b/resources/views/pdf-designs/hipster.html index 57ba54d098..a6a54310cc 100644 --- a/resources/views/pdf-designs/hipster.html +++ b/resources/views/pdf-designs/hipster.html @@ -7,6 +7,11 @@ --line-height: 1.6; } + html { + width: 210mm; + height: 200mm; + } + body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -101,7 +106,7 @@ } [data-ref="table"] { - margin-top: 3rem; + margin-top: 1rem; /* margin-bottom: 200px; */ min-width: 100%; table-layout: fixed; diff --git a/resources/views/pdf-designs/modern.html b/resources/views/pdf-designs/modern.html index 826dd88a76..da83b85bed 100644 --- a/resources/views/pdf-designs/modern.html +++ b/resources/views/pdf-designs/modern.html @@ -6,6 +6,11 @@ --secondary-color: $secondary_color; } + html { + width: 210mm; + height: 200mm; + } + body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/resources/views/pdf-designs/plain.html b/resources/views/pdf-designs/plain.html index 745bfb5910..2561aac89d 100644 --- a/resources/views/pdf-designs/plain.html +++ b/resources/views/pdf-designs/plain.html @@ -15,9 +15,12 @@ zoom: 80%; } + html { + width: 210mm; + height: 200mm; + } + @page { - position: absolute; - top: 0; margin-left: $global_margin; margin-right: $global_margin; margin-top: 0; diff --git a/resources/views/pdf-designs/playful.html b/resources/views/pdf-designs/playful.html index d5d0f3eba3..6b3be643a5 100644 --- a/resources/views/pdf-designs/playful.html +++ b/resources/views/pdf-designs/playful.html @@ -15,12 +15,18 @@ zoom: 80%; } + html { + width: 210mm; + height: 200mm; + } + @page { margin: -0.25cm !important; size: $page_size $page_layout; - + margin-top: 1rem; } + p { margin: 0; padding: 0; @@ -30,12 +36,12 @@ display: flex; justify-content: space-between; gap: 20px; - padding: 2rem 3rem; + padding: 1rem 0rem 0rem 2rem; } .header-wrapper .entity-details-wrapper { background-color: var(--primary-color); - padding: 1rem; + padding: 0.5rem; border-radius: 10px; } @@ -63,7 +69,7 @@ display: grid; grid-template-columns: 1fr 1fr; gap: 40px; - padding: 3rem; + padding: 1rem 0rem 0rem 2rem; } .contacts-wrapper .contact-label { @@ -77,7 +83,7 @@ .contacts-wrapper #client-details { display: flex; flex-direction: column; - margin-bottom: 1rem; + margin-bottom: 0.5rem; } .contacts-wrapper .company-info { @@ -101,8 +107,8 @@ } [data-ref="table"] { - padding-left: 3rem; - padding-right: 3rem; + padding-left: 2rem; + padding-right: 0rem; margin-top: 1rem; /* margin-bottom: 200px; */ min-width: 100%; @@ -156,13 +162,12 @@ } #table-totals { - margin-top: 1rem; + margin-top: 0.5rem; display: grid; grid-template-columns: 2fr 1fr; gap: 80px; - padding-left: 3rem; - padding-right: 3rem; - margin-right: .75rem; + padding-left: 2rem; + padding-right: 0rem; page-break-inside:auto; overflow: visible !important; } @@ -222,12 +227,14 @@ [data-ref="total_table-footer"] { text-align: left; - padding-left: 3rem; - padding-right: 3rem; + padding-left: 2rem; + padding-right: rem; } #footer { margin-top: 1rem; + page-break-inside:auto; + overflow: visible !important; } /** Markdown-specific styles. **/ @@ -262,12 +269,15 @@ .repeating-header, .repeating-header-space { - height: 50px; + height: 20px; + page-break-inside:avoid; + page-break-before:avoid; + page-break-after:avoid; } .repeating-footer, .repeating-footer-space { - height: 10px; + height: 20px; } .repeating-header { position: fixed; @@ -379,7 +389,7 @@ $entity_images -