mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-29 03:15:58 -04:00
Quote improvements
This commit is contained in:
@@ -454,19 +454,29 @@ class Sale extends CI_Model
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function get_invoice_number_for_year($year = '', $start_from = 0)
|
||||
{
|
||||
return $this->_get_number_for_year('invoice_number', $year, $start_from);
|
||||
}
|
||||
|
||||
public function get_quote_number_for_year($year = '', $start_from = 0)
|
||||
{
|
||||
return $this->_get_number_for_year('quote_number', $year, $start_from);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets invoice number by year
|
||||
*/
|
||||
public function get_invoice_number_for_year($year = '', $start_from = 0)
|
||||
public function _get_number_for_year($field, $year = '', $start_from = 0)
|
||||
{
|
||||
$year = $year == '' ? date('Y') : $year;
|
||||
$this->db->select('COUNT( 1 ) AS invoice_number_year');
|
||||
$this->db->select('COUNT( 1 ) AS number_year');
|
||||
$this->db->from('sales');
|
||||
$this->db->where('DATE_FORMAT(sale_time, "%Y" ) = ', $year);
|
||||
$this->db->where('invoice_number IS NOT NULL');
|
||||
$this->db->where("$field IS NOT NULL");
|
||||
$result = $this->db->get()->row_array();
|
||||
|
||||
return ($start_from + $result['invoice_number_year']);
|
||||
return ($start_from + $result['number_year']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
26
application/models/tokens/Token_year_quote_count.php
Normal file
26
application/models/tokens/Token_year_quote_count.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_year_quote_count class
|
||||
*/
|
||||
|
||||
class Token_year_quote_count extends Token
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->CI->load->model('Sale');
|
||||
}
|
||||
|
||||
public function token_id()
|
||||
{
|
||||
return 'QCO';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Sale->get_quote_number_for_year();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -33,11 +33,13 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="company-title">
|
||||
<pre><?php echo $this->config->item('company'); ?></pre>
|
||||
<pre><?php echo $company_info; ?></pre>
|
||||
<div id="company">
|
||||
<?php echo $this->config->item('company'); ?>
|
||||
<?php echo nl2br($company_info); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td id="meta">
|
||||
<table align="right">
|
||||
<table id="meta-content" align="right">
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $this->lang->line('sales_quote_number');?> </td>
|
||||
<td><div><?php echo $quote_number; ?></div></td>
|
||||
@@ -135,11 +137,10 @@
|
||||
</table>
|
||||
|
||||
<div id="terms">
|
||||
<textarea id="sale_return_policy">
|
||||
<div id="sale_return_policy">
|
||||
<h5>
|
||||
<textarea rows="5" cols="6"><?php echo nl2br($this->config->item('payment_message')); ?></textarea>
|
||||
<textarea rows="5" cols="6"><?php echo empty($comments) ? '' : $this->lang->line('sales_comments') . ': ' . $comments; ?></textarea>
|
||||
<textarea rows="5" cols="6"><?php echo $this->config->item('quote_default_comments'); ?></textarea>
|
||||
<div><?php echo nl2br($this->config->item('payment_message')); ?></div>
|
||||
<div><?php echo $this->lang->line('sales_comments') . ': ' . (empty($comments) ? $this->config->item('quote_default_comments') : $comments); ?></div>
|
||||
</h5>
|
||||
<?php echo nl2br($this->config->item('return_policy')); ?>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"codeigniter/framework": "^3.1.11",
|
||||
"dompdf/dompdf": "^0.7",
|
||||
"dompdf/dompdf": "^0.8.5",
|
||||
"tamtamchik/namecase": "^1.0",
|
||||
"paragonie/random_compat": "^2.0",
|
||||
"vlucas/phpdotenv": "^2.4"
|
||||
|
||||
Reference in New Issue
Block a user