Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions application/helpers/pdf_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,41 @@ function generate_quote_pdf($quote_id, $stream = true, $quote_template = null)

return pdf_create($html, trans('quote') . '_' . str_replace(array('\\', '/'), '_', $quote->quote_number), $stream, $quote->quote_password);
}

/**
* Generate the PDF for the statement
*
* @param Mdl_Clients $client
* @param Mdl_Statement $statement
* @param $notes
*
* @return string
* @throws \Mpdf\MpdfException
*/
function generate_statement_pdf($client, $statement, $notes)
{
$CI = &get_instance();

// Override language with system language
set_language($client->client_language);

$statement_template = "InvoicePlane";
if (!$statement_template) {
$statement_template = $CI->mdl_settings->setting('pdf_statement_template');
}

$data = array(
'client' => $client,
'statement' => $statement,
'notes' => $notes,
);

$html = $CI->load->view('statement_templates/pdf/' . $statement_template, $data, true);

$CI->load->helper('mpdf');

$pdf_password = null;
$stream = true;

return pdf_create($html, trans('statement') . '_' . str_replace(array('\\', '/'), '_', $statement->GetStatement_number()), $stream, $pdf_password);
}
9 changes: 9 additions & 0 deletions application/language/english/ip_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
'invoice_items' => 'Invoice Items',
'invoice_logo' => 'Invoice Logo',
'invoice_not_found' => 'Invoice Not Found',
'invoice_number' => 'Invoice Number',
'invoice_overview' => 'Invoice Overview',
'invoice_overview_period' => 'Invoice Overview Period',
'invoice_password' => 'PDF password (optional)',
Expand All @@ -272,6 +273,7 @@
'invoice_tax_rate' => 'Invoice Tax Rate',
'invoice_template' => 'Invoice Template',
'invoice_terms' => 'Invoice Terms',
'invoice_total' => 'Invoice Total',
'invoiced' => 'Invoiced',
'invoiceplane_news' => 'InvoicePlane News',
'invoices' => 'Invoices',
Expand Down Expand Up @@ -436,6 +438,7 @@
'record_successfully_updated' => 'Record successfully updated',
'recurring' => 'Recurring',
'recurring_invoices' => 'Recurring Invoices',
'reference' => 'Reference',
'reject' => 'Reject',
'reject_this_quote' => 'Reject This Quote',
'rejected' => 'Rejected',
Expand Down Expand Up @@ -512,6 +515,11 @@
'sql_file' => 'SQL File',
'start_date' => 'Start Date',
'state' => 'State',
'statement' => 'Statement',
'statement_date' => 'Statement Date',
'statement_end_date' => 'Statement End Date',
'statement_number' => 'Statement Number',
'statement_start_date' => 'Statement Start Date',
'status' => 'Status',
'stop' => 'Stop',
'street_address' => 'Street Address',
Expand Down Expand Up @@ -550,6 +558,7 @@
'total_balance' => 'Total Balance',
'total_billed' => 'Total Billed',
'total_paid' => 'Total Paid',
'transaction_type' => 'Transaction Type',
'try_again' => 'Try Again',
'type' => 'Type',
'unknown' => 'Unknown',
Expand Down
5 changes: 5 additions & 0 deletions application/modules/clients/views/partial_client_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
</button>
</form>
</li>
<li>
<a href="<?php echo site_url('statements/view/' . $client->client_id); ?>">
<i class="fa fa-eye fa-margin"></i> <?php _trans('statement'); ?>
</a>
</li>
</ul>
</div>
</td>
Expand Down
21 changes: 21 additions & 0 deletions application/modules/invoices/models/Mdl_invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,27 @@ public function by_client($client_id)
return $this;
}

/**
* Filter query in a date range.
* The filter can be open ended on one end by not supplied a value
* Dates must be in unixtime format
*
* @param time $start_date
* @param time $end_date
* @return Mdl_Invoices
*/
public function by_date_range($start_date = null, $end_date = null)
{
if (!empty($start_date)) {
$this->filter_where("invoice_date_created >= '" . $start_date . "' ");
}
if (!empty($end_date)) {
$this->filter_where("invoice_date_created <= '" . $end_date . "' ");
}

return $this;
}

/**
* @param $invoice_id
*/
Expand Down
21 changes: 21 additions & 0 deletions application/modules/payments/models/Mdl_payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,25 @@ public function by_client($client_id)
return $this;
}

/**
* Filter query in a date range.
* The filter can be open ended on one end by not supplied a value
* Dates must be in unixtime format
*
* @param time $start_date
* @param time $end_date
* @return Mdl_Payments
*/
public function by_date_range($start_date = null, $end_date = null)
{
if (!empty($start_date)) {
$this->filter_where("payment_date >= '" . $start_date . "' ");
}
if (!empty($end_date)) {
$this->filter_where("payment_date <= '" . $end_date . "' ");
}

return $this;
}

}
Loading