From 14ae0900aea36afb7a8ffcd3c5561a1445e9cd62 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 7 Nov 2023 08:23:51 +1100 Subject: [PATCH] add auto bill options for reports --- app/Export/CSV/BaseExport.php | 5 +++++ app/Export/CSV/InvoiceExport.php | 4 ++++ app/Export/CSV/RecurringInvoiceExport.php | 4 ++++ app/Jobs/Report/PreviewReport.php | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index be8660a24cd1..a05e61e7b19e 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -168,6 +168,7 @@ class BaseExport 'tax_rate2' => 'invoice.tax_rate2', 'tax_rate3' => 'invoice.tax_rate3', 'recurring_invoice' => 'invoice.recurring_id', + 'auto_bill' => 'invoice.auto_bill_enabled', ]; protected array $recurring_invoice_report_keys = [ @@ -208,6 +209,9 @@ class BaseExport 'tax_rate1' => 'recurring_invoice.tax_rate1', 'tax_rate2' => 'recurring_invoice.tax_rate2', 'tax_rate3' => 'recurring_invoice.tax_rate3', + 'auto_bill' => 'recurring_invoice.auto_bill', + 'auto_bill_enabled' => 'recurring_invoice.auto_bill_enabled', + ]; protected array $purchase_order_report_keys = [ @@ -287,6 +291,7 @@ class BaseExport 'is_amount_discount' => 'item.is_amount_discount', 'line_total' => 'item.line_total', 'gross_line_total' => 'item.gross_line_total', + 'tax_amount' => 'item.tax_amount', ]; protected array $quote_report_keys = [ diff --git a/app/Export/CSV/InvoiceExport.php b/app/Export/CSV/InvoiceExport.php index 4773ec3aa2de..02cadb7ffe70 100644 --- a/app/Export/CSV/InvoiceExport.php +++ b/app/Export/CSV/InvoiceExport.php @@ -147,6 +147,10 @@ class InvoiceExport extends BaseExport $entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? ''; } + if (in_array('invoice.auto_bill_enabled', $this->input['report_keys'])) { + $entity['invoice.auto_bill_enabled'] = $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no'); + } + return $entity; } diff --git a/app/Export/CSV/RecurringInvoiceExport.php b/app/Export/CSV/RecurringInvoiceExport.php index b88601ba997b..02e51cac0380 100644 --- a/app/Export/CSV/RecurringInvoiceExport.php +++ b/app/Export/CSV/RecurringInvoiceExport.php @@ -153,6 +153,10 @@ class RecurringInvoiceExport extends BaseExport $entity['recurring_invoice.frequency_id'] = $invoice->frequencyForKey($invoice->frequency_id); } + if (in_array('recurring_invoice.auto_bill_enabled', $this->input['report_keys'])) { + $entity['recurring_invoice.auto_bill_enabled'] = $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no'); + } + return $entity; } } diff --git a/app/Jobs/Report/PreviewReport.php b/app/Jobs/Report/PreviewReport.php index 43fd133e888e..4177e0c20b99 100644 --- a/app/Jobs/Report/PreviewReport.php +++ b/app/Jobs/Report/PreviewReport.php @@ -44,7 +44,7 @@ class PreviewReport implements ShouldQueue else $report = $export->run(); - // nlog($report); + nlog($report); Cache::put($this->hash, $report, 60 * 60); }