mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-11 23:46:35 -04:00
Change register to show anticipated invoice number. (#3408)
This commit is contained in:
@@ -627,8 +627,7 @@ class Sales extends Secure_Controller
|
|||||||
if($this->sale_lib->is_invoice_mode())
|
if($this->sale_lib->is_invoice_mode())
|
||||||
{
|
{
|
||||||
$invoice_format = $this->config->item('sales_invoice_format');
|
$invoice_format = $this->config->item('sales_invoice_format');
|
||||||
|
// generate final invoice numbr (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way
|
||||||
// generate final invoice number (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way
|
|
||||||
if(!empty($invoice_format) && $invoice_number == NULL)
|
if(!empty($invoice_format) && $invoice_number == NULL)
|
||||||
{
|
{
|
||||||
// The user can retain the default encoded format or can manually override it. It still passes through the rendering step.
|
// The user can retain the default encoded format or can manually override it. It still passes through the rendering step.
|
||||||
@@ -1105,14 +1104,15 @@ class Sales extends Secure_Controller
|
|||||||
$data['items_module_allowed'] = $this->Employee->has_grant('items', $this->Employee->get_logged_in_employee_info()->person_id);
|
$data['items_module_allowed'] = $this->Employee->has_grant('items', $this->Employee->get_logged_in_employee_info()->person_id);
|
||||||
$data['change_price'] = $this->Employee->has_grant('sales_change_price', $this->Employee->get_logged_in_employee_info()->person_id);
|
$data['change_price'] = $this->Employee->has_grant('sales_change_price', $this->Employee->get_logged_in_employee_info()->person_id);
|
||||||
|
|
||||||
$invoice_number = $this->sale_lib->get_invoice_number();
|
$temp_invoice_number = $this->sale_lib->get_invoice_number();
|
||||||
|
$invoice_format = $this->config->item('sales_invoice_format');
|
||||||
|
|
||||||
if ($this->sale_lib->get_invoice_number() == NULL)
|
if ($temp_invoice_number == NULL || $temp_invoice_number == '')
|
||||||
{
|
{
|
||||||
$invoice_number = $this->config->item('sales_invoice_format');
|
$temp_invoice_number = $this->token_lib->render($invoice_format, array(), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['invoice_number'] = $invoice_number;
|
$data['invoice_number'] = $temp_invoice_number;
|
||||||
|
|
||||||
$data['print_after_sale'] = $this->sale_lib->is_print_after_sale();
|
$data['print_after_sale'] = $this->sale_lib->is_print_after_sale();
|
||||||
$data['price_work_orders'] = $this->sale_lib->is_price_work_orders();
|
$data['price_work_orders'] = $this->sale_lib->is_price_work_orders();
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ class Sale_lib
|
|||||||
if(!$keep_custom || empty($current_invoice_number))
|
if(!$keep_custom || empty($current_invoice_number))
|
||||||
{
|
{
|
||||||
$this->CI->session->set_userdata('sales_invoice_number', $invoice_number);
|
$this->CI->session->set_userdata('sales_invoice_number', $invoice_number);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class Token_lib
|
|||||||
/**
|
/**
|
||||||
* Expands all of the tokens found in a given text string and returns the results.
|
* Expands all of the tokens found in a given text string and returns the results.
|
||||||
*/
|
*/
|
||||||
public function render($tokened_text, $tokens = array())
|
public function render($tokened_text, $tokens = array(), $save = TRUE)
|
||||||
{
|
{
|
||||||
// Apply the transformation for the "%" tokens if any are used
|
// Apply the transformation for the "%" tokens if any are used
|
||||||
if(strpos($tokened_text, '%') !== FALSE)
|
if(strpos($tokened_text, '%') !== FALSE)
|
||||||
@@ -45,7 +45,7 @@ class Token_lib
|
|||||||
|
|
||||||
$token_values = array();
|
$token_values = array();
|
||||||
$tokens_to_replace = array();
|
$tokens_to_replace = array();
|
||||||
$this->generate($token_tree, $tokens_to_replace, $token_values, $tokens);
|
$this->generate($token_tree, $tokens_to_replace, $token_values, $tokens, $save);
|
||||||
|
|
||||||
return str_replace($tokens_to_replace, $token_values, $tokened_text);
|
return str_replace($tokens_to_replace, $token_values, $tokened_text);
|
||||||
}
|
}
|
||||||
@@ -135,12 +135,12 @@ class Token_lib
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate($used_tokens, &$tokens_to_replace, &$token_values, $tokens)
|
public function generate($used_tokens, &$tokens_to_replace, &$token_values, $tokens, $save = TRUE)
|
||||||
{
|
{
|
||||||
foreach($used_tokens as $token_code => $token_info)
|
foreach($used_tokens as $token_code => $token_info)
|
||||||
{
|
{
|
||||||
// Generate value here based on the key value
|
// Generate value here based on the key value
|
||||||
$token_value = $this->resolve_token($token_code);
|
$token_value = $this->resolve_token($token_code, array(), $save);
|
||||||
|
|
||||||
foreach($token_info as $length => $token_spec)
|
foreach($token_info as $length => $token_spec)
|
||||||
{
|
{
|
||||||
@@ -159,13 +159,13 @@ class Token_lib
|
|||||||
return $token_values;
|
return $token_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function resolve_token($token_code, $tokens = array())
|
private function resolve_token($token_code, $tokens = array(), $save = TRUE)
|
||||||
{
|
{
|
||||||
foreach(array_merge($tokens, Token::get_tokens()) as $token)
|
foreach(array_merge($tokens, Token::get_tokens()) as $token)
|
||||||
{
|
{
|
||||||
if($token->token_id() == $token_code)
|
if($token->token_id() == $token_code)
|
||||||
{
|
{
|
||||||
return $token->get_value();
|
return $token->get_value($save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,24 +80,33 @@ class Appconfig extends CI_Model
|
|||||||
return $this->db->empty_table('app_config');
|
return $this->db->empty_table('app_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function acquire_save_next_invoice_sequence()
|
public function acquire_next_invoice_sequence($save = TRUE)
|
||||||
{
|
{
|
||||||
$last_used = $this->get('last_used_invoice_number') + 1;
|
$last_used = $this->get('last_used_invoice_number') + 1;
|
||||||
$this->save('last_used_invoice_number', $last_used);
|
if($save)
|
||||||
|
{
|
||||||
|
$this->save('last_used_invoice_number', $last_used);
|
||||||
|
}
|
||||||
return $last_used;
|
return $last_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function acquire_save_next_quote_sequence()
|
public function acquire_next_quote_sequence($save = TRUE)
|
||||||
{
|
{
|
||||||
$last_used = $this->get('last_used_quote_number') + 1;
|
$last_used = $this->get('last_used_quote_number') + 1;
|
||||||
$this->save('last_used_quote_number', $last_used);
|
if($save)
|
||||||
|
{
|
||||||
|
$this->save('last_used_quote_number', $last_used);
|
||||||
|
}
|
||||||
return $last_used;
|
return $last_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function acquire_save_next_work_order_sequence()
|
public function acquire_next_work_order_sequence($save = TRUE)
|
||||||
{
|
{
|
||||||
$last_used = $this->get('last_used_work_order_number') + 1;
|
$last_used = $this->get('last_used_work_order_number') + 1;
|
||||||
$this->save('last_used_work_order_number', $last_used);
|
if($save)
|
||||||
|
{
|
||||||
|
$this->save('last_used_work_order_number', $last_used);
|
||||||
|
}
|
||||||
return $last_used;
|
return $last_used;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ class Token_invoice_sequence extends Token
|
|||||||
return 'ISEQ';
|
return 'ISEQ';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_value()
|
public function get_value($save = TRUE)
|
||||||
{
|
{
|
||||||
return $this->CI->Appconfig->acquire_save_next_invoice_sequence();
|
return $this->CI->Appconfig->acquire_next_invoice_sequence($save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ class Token_quote_sequence extends Token
|
|||||||
return 'QSEQ';
|
return 'QSEQ';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_value()
|
public function get_value($save = TRUE)
|
||||||
{
|
{
|
||||||
return $this->CI->Appconfig->acquire_save_next_quote_sequence();
|
return $this->CI->Appconfig->acquire_next_quote_sequence($save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ class Token_work_order_sequence extends Token
|
|||||||
return 'WSEQ';
|
return 'WSEQ';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_value()
|
public function get_value($save = TRUE)
|
||||||
{
|
{
|
||||||
return $this->CI->Appconfig->acquire_save_next_work_order_sequence();
|
return $this->CI->Appconfig->acquire_next_work_order_sequence($save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user