diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 5a957a8f8fcd..ee9afae8ec9a 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -481,7 +481,14 @@ class CompanySettings extends BaseSettings public $enable_e_invoice = false; + public $statement_design_id = 'VolejRejNm'; + + public $delivery_note_design_id = 'VolejRejNm'; + + public $classification = ''; // individual, business, partnership, trust, charity, government, other + public static $casts = [ + 'classification' => 'string', 'enable_e_invoice' => 'bool', 'default_expense_payment_type_id' => 'string', 'e_invoice_type' => 'string', @@ -711,6 +718,8 @@ class CompanySettings extends BaseSettings 'portal_custom_js' => 'string', 'client_portal_enable_uploads' => 'bool', 'purchase_order_number_counter' => 'integer', + 'statement_design_id' => 'string', + 'delivery_note_design_id' => 'string', ]; public static $free_plan_casts = [ @@ -765,6 +774,8 @@ class CompanySettings extends BaseSettings 'quote_design_id', 'credit_design_id', 'purchase_order_design_id', + 'statement_design_id', + 'delivery_note_design_id', ]; // /** @@ -977,6 +988,15 @@ class CompanySettings extends BaseSettings '$total', '$credit.balance', ], + 'statement_details' => [ + '$statement_date', + '$balance' + ], + 'delivery_note_columns' => [ + '$product.item', + '$product.description', + '$product.quantity', + ], ]; return json_decode(json_encode($variables)); diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 8a8226e09e1d..2852345f2f7a 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -1318,7 +1318,6 @@ class PdfBuilder { $elements = []; - foreach ($variables as $variable) { $_variable = explode('.', $variable)[1]; $_customs = ['custom1', 'custom2', 'custom3', 'custom4']; diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index d0e54a9b1891..9f90a9a2fa25 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -322,8 +322,9 @@ class Design extends BaseDesign public function entityDetails(): array { if ($this->type === 'statement') { - // $s_date = $this->translateDate(now(), $this->client->date_format(), $this->client->locale()); + $variables = $this->context['pdf_variables']['statement_details'] ?? []; + $s_date = $this->translateDate($this->options['start_date'], $this->client->date_format(), $this->client->locale()) . " - " . $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale()); return [