mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-07 15:23:50 -04:00
@@ -8,7 +8,7 @@
|
||||
|
|
||||
|
|
||||
*/
|
||||
$config['application_version'] = '3.1.1';
|
||||
$config['application_version'] = '3.2.0';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -206,6 +206,7 @@ class Config extends Secure_Controller
|
||||
$data['register_mode_options'] = $this->sale_lib->get_register_mode_options();
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
$data['tax_codes'] = $this->get_tax_code_options();
|
||||
$data['show_office_group'] = $this->Module->get_show_office_group();
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
@@ -308,6 +309,8 @@ class Config extends Secure_Controller
|
||||
'custom10_name' => $this->input->post('custom10_name')
|
||||
);
|
||||
|
||||
$this->Module->set_show_office_group($this->input->post('show_office_group') != NULL);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
@@ -841,7 +844,10 @@ class Config extends Secure_Controller
|
||||
'invoice_email_message' => $this->input->post('invoice_email_message'),
|
||||
'line_sequence' => $this->input->post('line_sequence'),
|
||||
'last_used_invoice_number' =>$this->input->post('last_used_invoice_number'),
|
||||
'last_used_quote_number' =>$this->input->post('last_used_quote_number')
|
||||
'last_used_quote_number' =>$this->input->post('last_used_quote_number'),
|
||||
'work_order_enable' => $this->input->post('work_order_enable') != NULL,
|
||||
'work_order_format' => $this->input->post('work_order_format'),
|
||||
'last_used_work_order_number' =>$this->input->post('last_used_work_order_number')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
|
||||
@@ -61,6 +61,7 @@ class Employees extends Persons
|
||||
{
|
||||
$module->module_id = $this->xss_clean($module->module_id);
|
||||
$module->grant = $this->xss_clean($this->Employee->has_grant($module->module_id, $person_info->person_id));
|
||||
$module->menu_group = $this->xss_clean($this->Employee->get_menu_group($module->module_id, $person_info->person_id));
|
||||
|
||||
$modules[] = $module;
|
||||
}
|
||||
@@ -134,6 +135,16 @@ class Employees extends Persons
|
||||
'comments' => $this->input->post('comments'),
|
||||
);
|
||||
$grants_data = $this->input->post('grants') != NULL ? $this->input->post('grants') : array();
|
||||
$menu_groups = $this->input->post('menu_groups') != NULL ? $this->input->post('menu_groups') : array();
|
||||
|
||||
$grants_array = array();
|
||||
foreach ($grants_data as $key => $value)
|
||||
{
|
||||
$grants = array();
|
||||
$grants['permission_id'] = $value;
|
||||
$grants['menu_group'] = $menu_groups[$key];
|
||||
$grants_array[] = $grants;
|
||||
}
|
||||
|
||||
//Password has been changed OR first time password set
|
||||
if($this->input->post('password') != '')
|
||||
@@ -149,7 +160,7 @@ class Employees extends Persons
|
||||
$employee_data = array('username' => $this->input->post('username'));
|
||||
}
|
||||
|
||||
if($this->Employee->save_employee($person_data, $employee_data, $grants_data, $employee_id))
|
||||
if($this->Employee->save_employee($person_data, $employee_data, $grants_array, $employee_id))
|
||||
{
|
||||
// New employee
|
||||
if($employee_id == -1)
|
||||
|
||||
@@ -4,6 +4,11 @@ require_once("Secure_Controller.php");
|
||||
|
||||
class Home extends Secure_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct(NULL, NULL, 'home');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('home');
|
||||
|
||||
24
application/controllers/Office.php
Normal file
24
application/controllers/Office.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Office extends Secure_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('office', NULL, 'office');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('office');
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->track_page('logout', 'logout');
|
||||
|
||||
$this->Employee->logout();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -358,6 +358,7 @@ class Reports extends Secure_Controller
|
||||
$stock_locations['all'] = $this->lang->line('reports_all');
|
||||
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
|
||||
$data['mode'] = 'sale';
|
||||
$data['sale_type_options'] = $this->get_sale_type_options();
|
||||
|
||||
$this->load->view('reports/date_input', $data);
|
||||
}
|
||||
@@ -370,6 +371,7 @@ class Reports extends Secure_Controller
|
||||
$stock_locations['all'] = $this->lang->line('reports_all');
|
||||
$data['stock_locations'] = array_reverse($stock_locations, TRUE);
|
||||
$data['mode'] = 'sale';
|
||||
$data['sale_type_options'] = $this->get_sale_type_options();
|
||||
|
||||
$this->load->view('reports/date_input', $data);
|
||||
}
|
||||
@@ -711,6 +713,7 @@ class Reports extends Secure_Controller
|
||||
$customers[$customer->person_id] = $this->xss_clean($customer->first_name . ' ' . $customer->last_name);
|
||||
}
|
||||
$data['specific_input_data'] = $customers;
|
||||
$data['sale_type_options'] = $this->get_sale_type_options();
|
||||
|
||||
$this->load->view('reports/specific_input', $data);
|
||||
}
|
||||
@@ -735,6 +738,7 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$summary_data[] = $this->xss_clean(array(
|
||||
'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')),
|
||||
'type_code' => $row['type_code'],
|
||||
'sale_date' => $row['sale_date'],
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'employee_name' => $row['employee_name'],
|
||||
@@ -796,6 +800,7 @@ class Reports extends Secure_Controller
|
||||
$employees[$employee->person_id] = $this->xss_clean($employee->first_name . ' ' . $employee->last_name);
|
||||
}
|
||||
$data['specific_input_data'] = $employees;
|
||||
$data['sale_type_options'] = $this->get_sale_type_options();
|
||||
|
||||
$this->load->view('reports/specific_input', $data);
|
||||
}
|
||||
@@ -820,6 +825,7 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$summary_data[] = $this->xss_clean(array(
|
||||
'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')),
|
||||
'type_code' => $row['type_code'],
|
||||
'sale_date' => $row['sale_date'],
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'customer_name' => $row['customer_name'],
|
||||
@@ -881,7 +887,8 @@ class Reports extends Secure_Controller
|
||||
$discounts[$i] = $i . '%';
|
||||
}
|
||||
$data['specific_input_data'] = $discounts;
|
||||
|
||||
$data['sale_type_options'] = $this->get_sale_type_options();
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$this->load->view('reports/specific_input', $data);
|
||||
@@ -907,6 +914,7 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$summary_data[] = $this->xss_clean(array(
|
||||
'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')),
|
||||
'type_code' => $row['type_code'],
|
||||
'sale_date' => $row['sale_date'],
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'customer_name' => $row['customer_name'],
|
||||
@@ -987,6 +995,24 @@ class Reports extends Secure_Controller
|
||||
echo json_encode(array($sale_id => $summary_data));
|
||||
}
|
||||
|
||||
public function get_sale_type_options()
|
||||
{
|
||||
$sale_type_options = array();
|
||||
$sale_type_options['complete'] = $this->lang->line('reports_complete');
|
||||
$sale_type_options['sales'] = $this->lang->line('reports_completed_sales');
|
||||
if($this->config->item('invoice_enable') == '1')
|
||||
{
|
||||
$sale_type_options['quotes'] = $this->lang->line('reports_quotes');
|
||||
if($this->config->item('work_order_enable') == '1')
|
||||
{
|
||||
$sale_type_options['work_orders'] = $this->lang->line('reports_work_orders');
|
||||
$sale_type_options['canceled'] = $this->lang->line('reports_canceled');
|
||||
}
|
||||
}
|
||||
$sale_type_options['returns'] = $this->lang->line('reports_returns');
|
||||
return $sale_type_options;
|
||||
}
|
||||
|
||||
public function detailed_sales($start_date, $end_date, $sale_type, $location_id = 'all')
|
||||
{
|
||||
$inputs = array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id);
|
||||
@@ -1010,6 +1036,7 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$summary_data[] = $this->xss_clean(array(
|
||||
'id' => $row['sale_id'],
|
||||
'type_code' => $row['type_code'],
|
||||
'sale_date' => $row['sale_date'],
|
||||
'quantity' => to_quantity_decimals($row['items_purchased']),
|
||||
'employee_name' => $row['employee_name'],
|
||||
|
||||
@@ -147,13 +147,36 @@ class Sales extends Secure_Controller
|
||||
|
||||
public function change_mode()
|
||||
{
|
||||
$mode = $this->input->post('mode');
|
||||
$this->sale_lib->set_mode($mode);
|
||||
|
||||
if($mode == 'sale')
|
||||
{
|
||||
$this->sale_lib->set_sale_type(SALE_TYPE_POS);
|
||||
}
|
||||
else if($mode == 'sale_quote')
|
||||
{
|
||||
$this->sale_lib->set_sale_type(SALE_TYPE_QUOTE);
|
||||
}
|
||||
else if($mode == 'sale_work_order')
|
||||
{
|
||||
$this->sale_lib->set_sale_type(SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
else if($mode == 'sale_invoice')
|
||||
{
|
||||
$this->sale_lib->set_sale_type(SALE_TYPE_INVOICE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sale_lib->set_sale_type(SALE_SALE);
|
||||
}
|
||||
|
||||
$stock_location = $this->input->post('stock_location');
|
||||
if(!$stock_location || $stock_location == $this->sale_lib->get_sale_location())
|
||||
{
|
||||
$mode = $this->input->post('mode');
|
||||
$this->sale_lib->set_mode($mode);
|
||||
$dinner_table = $this->input->post('dinner_table');
|
||||
$this->sale_lib->set_dinner_table($dinner_table);
|
||||
|
||||
}
|
||||
elseif($this->Stock_location->is_allowed_location($stock_location, 'sales'))
|
||||
{
|
||||
@@ -163,6 +186,34 @@ class Sales extends Secure_Controller
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function change_register_mode($sale_type)
|
||||
{
|
||||
if($sale_type == SALE_TYPE_POS)
|
||||
{
|
||||
$this->sale_lib->set_mode('sale');
|
||||
}
|
||||
elseif($sale_type == SALE_TYPE_QUOTE)
|
||||
{
|
||||
$this->sale_lib->set_mode('sale_quote');
|
||||
}
|
||||
elseif($sale_type == SALE_TYPE_WORK_ORDER)
|
||||
{
|
||||
$this->sale_lib->set_mode('sale_work_order');
|
||||
}
|
||||
elseif($sale_type == SALE_TYPE_INVOICE)
|
||||
{
|
||||
$this->sale_lib->set_mode('sale_invoice');
|
||||
}
|
||||
elseif($sale_type == SALE_TYPE_RETURN)
|
||||
{
|
||||
$this->sale_lib->set_mode('return');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sale_lib->set_mode('sale');
|
||||
}
|
||||
}
|
||||
|
||||
public function set_comment()
|
||||
{
|
||||
$this->sale_lib->set_comment($this->input->post('comment'));
|
||||
@@ -189,6 +240,11 @@ class Sales extends Secure_Controller
|
||||
$this->sale_lib->set_print_after_sale($this->input->post('sales_print_after_sale'));
|
||||
}
|
||||
|
||||
public function set_price_work_orders()
|
||||
{
|
||||
$this->sale_lib->set_price_work_orders($this->input->post('price_work_orders'));
|
||||
}
|
||||
|
||||
public function set_email_receipt()
|
||||
{
|
||||
$this->sale_lib->set_email_receipt($this->input->post('email_receipt'));
|
||||
@@ -443,6 +499,8 @@ class Sales extends Secure_Controller
|
||||
|
||||
public function complete()
|
||||
{
|
||||
$sale_id = $this->sale_lib->get_sale_id();
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
$data = array();
|
||||
$data['dinner_table'] = $this->sale_lib->get_dinner_table();
|
||||
$data['cart'] = $this->sale_lib->get_cart();
|
||||
@@ -463,10 +521,15 @@ class Sales extends Secure_Controller
|
||||
$data['cur_giftcard_value'] = $this->sale_lib->get_giftcard_remainder();
|
||||
$data['cur_rewards_value'] = $this->sale_lib->get_rewards_remainder();
|
||||
$data['print_after_sale'] = $this->sale_lib->is_print_after_sale();
|
||||
$data['price_work_orders'] = $this->sale_lib->is_price_work_orders();
|
||||
$data['email_receipt'] = $this->sale_lib->get_email_receipt();
|
||||
$customer_id = $this->sale_lib->get_customer();
|
||||
$data["invoice_number"] = $this->sale_lib->get_invoice_number();
|
||||
$data["quote_number"] = $this->sale_lib->get_quote_number();
|
||||
$invoice_number = $this->sale_lib->get_invoice_number();
|
||||
$data["invoice_number"] = $invoice_number;
|
||||
$work_order_number = $this->sale_lib->get_work_order_number();
|
||||
$data["work_order_number"] = $work_order_number;
|
||||
$quote_number = $this->sale_lib->get_quote_number();
|
||||
$data["quote_number"] = $quote_number;
|
||||
$customer_info = $this->_load_customer_data($customer_id, $data);
|
||||
if($customer_info != NULL)
|
||||
{
|
||||
@@ -501,13 +564,26 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
$data['amount_change'] = $data['amount_due'] * -1;
|
||||
|
||||
if($this->sale_lib->is_invoice_mode() || $data['invoice_number_enabled'] == TRUE)
|
||||
$data['print_price_info'] = TRUE;
|
||||
|
||||
if($this->sale_lib->is_sale_by_receipt_mode() && $this->input->post('sales_invoice_enable') == '1' )
|
||||
{
|
||||
$pos_invoice = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pos_invoice = FALSE;
|
||||
}
|
||||
|
||||
if($this->sale_lib->is_invoice_mode() || $pos_invoice)
|
||||
{
|
||||
// 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($this->sale_lib->is_sale_by_receipt_mode())
|
||||
if($pos_invoice)
|
||||
{
|
||||
// The user can retain the default encoded format or can manually override it. It still passes through the rendering step.
|
||||
$this->sale_lib->set_invoice_number($this->input->post('invoice_number'), $keep_custom = TRUE);
|
||||
$invoice_format = $this->sale_lib->get_invoice_number();
|
||||
// If the user blanks out the invoice number and doesn't put anything in there then revert back to the default format encoding
|
||||
if(empty($invoice_format))
|
||||
{
|
||||
$invoice_format = $this->config->item('sales_invoice_format');
|
||||
@@ -517,10 +593,11 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$invoice_format = $this->config->item('sales_invoice_format');
|
||||
}
|
||||
$invoice_number = $this->token_lib->render($invoice_format);
|
||||
|
||||
// TODO If duplicate invoice then determine the number of employees and repeat until until success or tried the number of employees (if QSEQ was used).
|
||||
if($this->Sale->check_invoice_number_exists($invoice_number))
|
||||
$invoice_number = $this->token_lib->render($invoice_format);
|
||||
$data['invoice_number'] = $invoice_number;
|
||||
|
||||
if($sale_id == -1 && $this->Sale->check_invoice_number_exists($invoice_number))
|
||||
{
|
||||
$data['error'] = $this->lang->line('sales_invoice_number_duplicate');
|
||||
$this->_reload($data);
|
||||
@@ -529,9 +606,10 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$data['invoice_number'] = $invoice_number;
|
||||
$data['sale_status'] = COMPLETED;
|
||||
$sale_type = SALE_TYPE_INVOICE;
|
||||
|
||||
// Save the data to the sales table
|
||||
$data['sale_id_num'] = $this->Sale->save($data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $data["quote_number"], $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
$data['sale_id_num'] = $this->Sale->save($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
$data['sale_id'] = 'POS ' . $data['sale_id_num'];
|
||||
|
||||
// Resort and filter cart lines for printing
|
||||
@@ -551,10 +629,53 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($this->sale_lib->is_work_order_mode())
|
||||
{
|
||||
|
||||
if(!($data['price_work_orders'] == 1))
|
||||
{
|
||||
$data['print_price_info'] = FALSE;
|
||||
}
|
||||
|
||||
$data['sales_work_order'] = $this->lang->line('sales_work_order');
|
||||
$data['work_order_number_label'] = $this->lang->line('sales_work_order_number');
|
||||
|
||||
if($work_order_number == NULL)
|
||||
{
|
||||
// generate work order number
|
||||
$work_order_format = $this->config->item('work_order_format');
|
||||
$work_order_number = $this->token_lib->render($work_order_format);
|
||||
}
|
||||
|
||||
if($sale_id == -1 && $this->Sale->check_work_order_number_exists($work_order_number))
|
||||
{
|
||||
$data['error'] = $this->lang->line('sales_work_order_number_duplicate');
|
||||
$this->_reload($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['work_order_number'] = $work_order_number;
|
||||
$data['sale_status'] = SUSPENDED;
|
||||
$sale_type = SALE_TYPE_WORK_ORDER;
|
||||
|
||||
$data['sale_id_num'] = $this->Sale->save($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
$this->sale_lib->set_suspended_id($data['sale_id_num']);
|
||||
|
||||
$data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']);
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$data['barcode'] = NULL;
|
||||
|
||||
$this->load->view('sales/work_order', $data);
|
||||
$this->sale_lib->clear_mode();
|
||||
$this->sale_lib->clear_all();
|
||||
}
|
||||
}
|
||||
elseif($this->sale_lib->is_quote_mode())
|
||||
{
|
||||
$invoice_number = NULL;
|
||||
$quote_number = $this->sale_lib->get_quote_number();
|
||||
$data['sales_quote'] = $this->lang->line('sales_quote');
|
||||
$data['quote_number_label'] = $this->lang->line('sales_quote_number');
|
||||
|
||||
if($quote_number == NULL)
|
||||
{
|
||||
@@ -563,19 +684,18 @@ class Sales extends Secure_Controller
|
||||
$quote_number = $this->token_lib->render($quote_format);
|
||||
}
|
||||
|
||||
// TODO If duplicate quote then determine the number of employees and repeat until until success or tried the number of employees (if QSEQ was used).
|
||||
if($this->Sale->check_quote_number_exists($quote_number))
|
||||
if($sale_id == -1 && $this->Sale->check_quote_number_exists($quote_number))
|
||||
{
|
||||
$data['error'] = $this->lang->line('sales_quote_number_duplicate');
|
||||
$this->_reload($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['invoice_number'] = $invoice_number;
|
||||
$data['quote_number'] = $quote_number;
|
||||
$data['sale_status'] = SUSPENDED;
|
||||
$sale_type = SALE_TYPE_QUOTE;
|
||||
|
||||
$data['sale_id_num'] = $this->Sale->save($data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $quote_number, $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
$data['sale_id_num'] = $this->Sale->save($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
$this->sale_lib->set_suspended_id($data['sale_id_num']);
|
||||
|
||||
$data['cart'] = $this->sale_lib->sort_and_filter_cart($data['cart']);
|
||||
@@ -592,8 +712,17 @@ class Sales extends Secure_Controller
|
||||
else
|
||||
{
|
||||
// Save the data to the sales table
|
||||
$data['sale_status'] = '0'; // Complete
|
||||
$data['sale_id_num'] = $this->Sale->save($data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], NULL, NULL, $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
$data['sale_status'] = COMPLETED;
|
||||
if($this->sale_lib->is_return_mode())
|
||||
{
|
||||
$sale_type = SALE_TYPE_RETURN;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_type = SALE_TYPE_POS;
|
||||
}
|
||||
|
||||
$data['sale_id_num'] = $this->Sale->save($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $data['taxes']);
|
||||
|
||||
$data['sale_id'] = 'POS ' . $data['sale_id_num'];
|
||||
|
||||
@@ -801,6 +930,8 @@ class Sales extends Secure_Controller
|
||||
));
|
||||
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['sale_id']);
|
||||
$data['print_after_sale'] = FALSE;
|
||||
$data['price_work_orders'] = FALSE;
|
||||
|
||||
if($this->sale_lib->get_mode() == 'sale_invoice')
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_invoice');
|
||||
@@ -809,29 +940,26 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_quote');
|
||||
}
|
||||
elseif($this->sale_lib->get_mode() == 'sale_work_order')
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_work_order');
|
||||
}
|
||||
|
||||
return $this->xss_clean($data);
|
||||
}
|
||||
|
||||
private function _reload($data = array())
|
||||
{
|
||||
$sale_id = $this->session->userdata('sale_id');
|
||||
if($sale_id == '')
|
||||
{
|
||||
$sale_id = -1;
|
||||
$this->session->set_userdata('sale_id', -1);
|
||||
}
|
||||
$data['cart'] = $this->sale_lib->get_cart();
|
||||
$customer_info = $this->_load_customer_data($this->sale_lib->get_customer(), $data, TRUE);
|
||||
|
||||
if($this->config->item('invoice_enable') == '0')
|
||||
{
|
||||
$data['modes'] = array(
|
||||
'sale' => $this->lang->line('sales_sale'),
|
||||
'return' => $this->lang->line('sales_return'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['modes'] = array(
|
||||
'sale' => $this->lang->line('sales_sale'),
|
||||
'sale_invoice' => $this->lang->line('sales_sale_by_invoice'),
|
||||
'sale_quote' => $this->lang->line('sales_quote'),
|
||||
'return' => $this->lang->line('sales_return'));
|
||||
}
|
||||
$data['modes'] = $this->sale_lib->get_register_mode_options();
|
||||
$data['mode'] = $this->sale_lib->get_mode();
|
||||
$data['empty_tables'] = $this->sale_lib->get_empty_tables();
|
||||
$data['selected_table'] = $this->sale_lib->get_dinner_table();
|
||||
@@ -841,6 +969,8 @@ class Sales extends Secure_Controller
|
||||
$data['taxes'] = $this->sale_lib->get_taxes();
|
||||
$data['discount'] = $this->sale_lib->get_discount();
|
||||
$data['payments'] = $this->sale_lib->get_payments();
|
||||
// sale_type (0=pos, 1=invoice, 2=work order, 3=quote, 4=return
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
|
||||
// Returns 'subtotal', 'total', 'cash_total', 'payment_total', 'amount_due', 'cash_amount_due', 'payments_cover_total'
|
||||
$totals = $this->sale_lib->get_totals();
|
||||
@@ -878,11 +1008,6 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$data['payment_options'] = $this->Sale->get_payment_options();
|
||||
}
|
||||
$quote_number = $this->sale_lib->get_quote_number();
|
||||
if($quote_number != NULL)
|
||||
{
|
||||
$data['quote_number'] = $quote_number;
|
||||
}
|
||||
|
||||
$data['items_module_allowed'] = $this->Employee->has_grant('items', $this->Employee->get_logged_in_employee_info()->person_id);
|
||||
|
||||
@@ -894,8 +1019,13 @@ class Sales extends Secure_Controller
|
||||
|
||||
$data['invoice_number_enabled'] = $this->sale_lib->is_invoice_mode();
|
||||
$data['print_after_sale'] = $this->sale_lib->is_print_after_sale();
|
||||
$data['quote_or_invoice_mode'] = $data['mode'] == 'sale_invoice' || $data['mode'] == 'sale_quote';
|
||||
$data['sales_or_return_mode'] = $data['mode'] == 'sale' || $data['mode'] == 'return';
|
||||
$data['price_work_orders'] = $this->sale_lib->is_price_work_orders();
|
||||
|
||||
$data['pos_mode'] = $data['mode'] == 'sale' || $data['mode'] == 'return';
|
||||
|
||||
$data['quote_number'] = $this->sale_lib->get_quote_number();
|
||||
$data['work_order_number'] = $this->sale_lib->get_work_order_number();
|
||||
|
||||
if($this->sale_lib->get_mode() == 'sale_invoice')
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_invoice');
|
||||
@@ -904,6 +1034,10 @@ class Sales extends Secure_Controller
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_quote');
|
||||
}
|
||||
elseif($this->sale_lib->get_mode() == 'sale_work_order')
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_work_order');
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['mode_label'] = $this->lang->line('sales_receipt');
|
||||
@@ -978,70 +1112,33 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function save($sale_id = -1)
|
||||
/**
|
||||
* This is used to cancel a suspended pos sale, quote.
|
||||
* Completed sales (POS Sales or Invoiced Sales) can not be removed from the system
|
||||
* Work orders can be canceled but are not physically removed from the sales history
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
$newdate = $this->input->post('date');
|
||||
$date_formatter = date_create_from_format($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), $newdate);
|
||||
$sale_data = array(
|
||||
'sale_time' => $date_formatter->format('Y-m-d H:i:s'),
|
||||
'customer_id' => $this->input->post('customer_id') != '' ? $this->input->post('customer_id') : NULL,
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment'),
|
||||
'invoice_number' => $this->input->post('invoice_number') != '' ? $this->input->post('invoice_number') : NULL
|
||||
);
|
||||
|
||||
// go through all the payment type input from the form, make sure the form matches the name and iterator number
|
||||
$payments = array();
|
||||
$number_of_payments = $this->input->post('number_of_payments');
|
||||
for($i = 0; $i < $number_of_payments; ++$i)
|
||||
$sale_id = $this->sale_lib->get_sale_id();
|
||||
if($sale_id != -1 && $sale_id != '')
|
||||
{
|
||||
$payment_amount = $this->input->post('payment_amount_' . $i);
|
||||
$payment_type = $this->input->post('payment_type_' . $i);
|
||||
// remove any 0 payment if by mistake any was introduced at sale time
|
||||
if($payment_amount != 0)
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
if($sale_type == SALE_TYPE_WORK_ORDER)
|
||||
{
|
||||
// search for any payment of the same type that was already added, if that's the case add up the new payment amount
|
||||
$key = FALSE;
|
||||
if(!empty($payments))
|
||||
{
|
||||
// search in the multi array the key of the entry containing the current payment_type
|
||||
// NOTE: in PHP5.5 the array_map could be replaced by an array_column
|
||||
$key = array_search($payment_type, array_map(function ($v)
|
||||
{
|
||||
return $v['payment_type'];
|
||||
}, $payments));
|
||||
}
|
||||
|
||||
// if no previous payment is found add a new one
|
||||
if($key === FALSE)
|
||||
{
|
||||
$payments[] = array('payment_type' => $payment_type, 'payment_amount' => $payment_amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add up the new payment amount to an existing payment type
|
||||
$payments[$key]['payment_amount'] += $payment_amount;
|
||||
}
|
||||
$this->Sale->update_sale_status($sale_id, CANCELED);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Sale->delete($sale_id, FALSE);
|
||||
$this->session->set_userdata('sale_id', -1);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->Sale->update($sale_id, $sale_data, $payments))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('sales_successfully_updated'), 'id' => $sale_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('sales_unsuccessfully_updated'), 'id' => $sale_id));
|
||||
}
|
||||
}
|
||||
|
||||
public function cancel()
|
||||
{
|
||||
$this->sale_lib->clear_all();
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function discard_quote()
|
||||
public function discard_suspended_sale()
|
||||
{
|
||||
$suspended_id = $this->sale_lib->get_suspended_id();
|
||||
$this->sale_lib->clear_all();
|
||||
@@ -1049,8 +1146,15 @@ class Sales extends Secure_Controller
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend the current sale.
|
||||
* If the current sale is already suspended then update the existing suspended sale.
|
||||
* Otherwise create it as a new suspended sale
|
||||
*/
|
||||
public function suspend()
|
||||
{
|
||||
$mode = $this->sale_lib->get_mode();
|
||||
$sale_id = $this->sale_lib->get_sale_id();
|
||||
$dinner_table = $this->sale_lib->get_dinner_table();
|
||||
$cart = $this->sale_lib->get_cart();
|
||||
$payments = $this->sale_lib->get_payments();
|
||||
@@ -1058,13 +1162,20 @@ class Sales extends Secure_Controller
|
||||
$customer_id = $this->sale_lib->get_customer();
|
||||
$customer_info = $this->Customer->get_info($customer_id);
|
||||
$invoice_number = $this->sale_lib->get_invoice_number();
|
||||
$work_order_number = $this->sale_lib->get_work_order_number();
|
||||
$quote_number = $this->sale_lib->get_quote_number();
|
||||
$sale_id = $this->sale_lib->get_sale_id();
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
if($sale_type == '')
|
||||
{
|
||||
$sale_type = SALE_TYPE_POS;
|
||||
}
|
||||
$comment = $this->sale_lib->get_comment();
|
||||
$sale_status = $this->sale_lib->is_quote_mode() ? QUOTE : SUSPENDED;
|
||||
$sale_status = SUSPENDED;
|
||||
|
||||
$data = array();
|
||||
$sales_taxes = array();
|
||||
if($this->Sale->save($sale_status, $cart, $customer_id, $employee_id, $comment, $invoice_number, $quote_number, $payments, $dinner_table, $sales_taxes) == '-1')
|
||||
if($this->Sale->save($sale_id, $sale_status, $cart, $customer_id, $employee_id, $comment, $invoice_number, $work_order_number, $quote_number, $sale_type, $payments, $dinner_table, $sales_taxes) == '-1')
|
||||
{
|
||||
$data['error'] = $this->lang->line('sales_unsuccessfully_suspended_sale');
|
||||
}
|
||||
@@ -1077,6 +1188,9 @@ class Sales extends Secure_Controller
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* List suspended sales
|
||||
*/
|
||||
public function suspended()
|
||||
{
|
||||
$customer_id = $this->sale_lib->get_customer();
|
||||
@@ -1087,8 +1201,8 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
|
||||
/*
|
||||
* We will eventually drop the current set of "suspended" tables since suspended sales
|
||||
* are now stored in the sales tables with a sale_status value of suspended.
|
||||
* Unsuspended sales are now left in the tables and are only removed
|
||||
* when they are intentionally cancelled.
|
||||
*/
|
||||
public function unsuspend()
|
||||
{
|
||||
@@ -1098,9 +1212,11 @@ class Sales extends Secure_Controller
|
||||
if($sale_id > 0)
|
||||
{
|
||||
$this->sale_lib->copy_entire_sale($sale_id);
|
||||
$this->Sale->delete_suspended_sale($sale_id);
|
||||
}
|
||||
|
||||
// Set current register mode to reflect that of unsuspended order type
|
||||
$this->change_register_mode($this->sale_lib->get_sale_type());
|
||||
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class Secure_Controller extends CI_Controller
|
||||
* Controllers that are considered secure extend Secure_Controller, optionally a $module_id can
|
||||
* be set to also check if a user can access a particular module in the system.
|
||||
*/
|
||||
public function __construct($module_id = NULL, $submodule_id = NULL)
|
||||
public function __construct($module_id = NULL, $submodule_id = NULL, $menu_group = NULL)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -28,7 +28,24 @@ class Secure_Controller extends CI_Controller
|
||||
}
|
||||
|
||||
// load up global data visible to all the loaded views
|
||||
$data['allowed_modules'] = $this->Module->get_allowed_modules($logged_in_employee_info->person_id);
|
||||
|
||||
$this->load->library('session');
|
||||
if($menu_group == NULL)
|
||||
{
|
||||
$menu_group = $this->session->userdata('menu_group');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_userdata('menu_group', $menu_group);
|
||||
}
|
||||
if($menu_group == 'home')
|
||||
{
|
||||
$data['allowed_modules'] = $this->Module->get_allowed_home_modules($logged_in_employee_info->person_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['allowed_modules'] = $this->Module->get_allowed_office_modules($logged_in_employee_info->person_id);
|
||||
}
|
||||
$data['user_info'] = $logged_in_employee_info;
|
||||
$data['controller_name'] = $module_id;
|
||||
|
||||
|
||||
@@ -140,8 +140,9 @@ $lang["config_invoice_enable"] = "Enable Invoicing";
|
||||
$lang["config_invoice_printer"] = "Invoice Printer";
|
||||
$lang["config_jsprintsetup_required"] = "Warning! This disabled functionality will only work if you have the FireFox jsPrintSetup addon installed. Save anyway?";
|
||||
$lang["config_language"] = "Language";
|
||||
$lang["config_last_used_invoice_number"] = "Last Used Invoice Number";
|
||||
$lang["config_last_used_quote_number"] = "Last Used Quote Number";
|
||||
$lang["config_last_used_invoice_number"] = "Last used Invoice Number";
|
||||
$lang["config_last_used_quote_number"] = "Last used Quote Number";
|
||||
$lang["config_last_used_work_order_number"] = "Last used W/O Number";
|
||||
$lang["config_left"] = "Left";
|
||||
$lang["config_license"] = "License";
|
||||
$lang["config_license_configuration"] = "License Statement";
|
||||
@@ -225,6 +226,7 @@ $lang["config_sales_invoice_format"] = "Sales Invoice Format";
|
||||
$lang["config_sales_quote_format"] = "Sales Quote Format";
|
||||
$lang["config_saved_successfully"] = "Configuration saved successfully";
|
||||
$lang["config_saved_unsuccessfully"] = "Configuration saved unsuccessfully";
|
||||
$lang["config_show_office_group"] = "Show office icon";
|
||||
$lang["config_statistics"] = "Send Statistics";
|
||||
$lang["config_statistics_tooltip"] = "Send statistics for development and feature improvement purposes";
|
||||
$lang["config_stock_location"] = "Stock location";
|
||||
@@ -245,3 +247,5 @@ $lang["config_thousands_separator"] = "Thousands Separator";
|
||||
$lang["config_timezone"] = "Timezone";
|
||||
$lang["config_top"] = "Top";
|
||||
$lang["config_website"] = "Website";
|
||||
$lang["config_work_order_enable"] = "Work Order Support";
|
||||
$lang["config_work_order_format"] = "Work Order Format";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
$lang["module_both"] = "Both";
|
||||
$lang["module_config"] = "Configuration";
|
||||
$lang["module_config_desc"] = "Change the OSPOS's Configuration";
|
||||
$lang["module_customers"] = "Customers";
|
||||
@@ -9,6 +10,7 @@ $lang["module_employees_desc"] = "Add, Update, Delete, and Search Employees";
|
||||
$lang["module_giftcards"] = "Gift Cards";
|
||||
$lang["module_giftcards_desc"] = "Add, Update, Delete and Search Gift Cards";
|
||||
$lang["module_home"] = "Home";
|
||||
$lang["module_home_desc"] = "List home menu modules";
|
||||
$lang["module_item_kits"] = "Item Kits";
|
||||
$lang["module_item_kits_desc"] = "Add, Update, Delete and Search Item Kits";
|
||||
$lang["module_items"] = "Items";
|
||||
@@ -17,6 +19,8 @@ $lang["module_messages"] = "Messages";
|
||||
$lang["module_messages_desc"] = "Send Messages to Customers, Suppliers and Employees";
|
||||
$lang["module_migrate"] = "Migrate";
|
||||
$lang["module_migrate_desc"] = "Update the OSPOS Database";
|
||||
$lang["module_office"] = "Office";
|
||||
$lang["module_office_desc"] = "List office menu modules";
|
||||
$lang["module_receivings"] = "Receivings";
|
||||
$lang["module_receivings_desc"] = "Process Purchase Orders";
|
||||
$lang["module_reports"] = "Reports";
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
<?php
|
||||
|
||||
$lang["reports_all"] = "All";
|
||||
$lang["reports_canceled"] = "Canceled";
|
||||
$lang["reports_categories"] = "Categories";
|
||||
$lang["reports_categories_summary_report"] = "Categories Summary Report";
|
||||
$lang["reports_category"] = "Category";
|
||||
$lang["reports_code_canceled"] = "CNL";
|
||||
$lang["reports_code_invoice"] = "INV";
|
||||
$lang["reports_code_quote"] = "Q";
|
||||
$lang["reports_code_return"] = "RET";
|
||||
$lang["reports_code_type"] = "Type";
|
||||
$lang["reports_code_work_order"] = "W/O";
|
||||
$lang["reports_comments"] = "Comments";
|
||||
$lang["reports_cost"] = "Cost";
|
||||
$lang["reports_cost_price"] = "Cost Price";
|
||||
@@ -97,4 +104,5 @@ $lang["reports_total_inventory_value"] = "Total Inventory Value";
|
||||
$lang["reports_type"] = "Type";
|
||||
$lang["reports_unit_price"] = "Sell Price";
|
||||
$lang["reports_used"] = "Points Used";
|
||||
$lang["reports_zero_and_less"] = "Zero and less";
|
||||
$lang["reports_work_orders"] = "Work Orders";
|
||||
$lang["reports_zero_and_less"] = "Zero and Less";
|
||||
|
||||
@@ -8,6 +8,7 @@ $lang["sales_amount_due"] = "Amount Due";
|
||||
$lang["sales_amount_tendered"] = "Amount Tendered";
|
||||
$lang["sales_cancel_sale"] = "Cancel";
|
||||
$lang["sales_cash"] = "Cash";
|
||||
$lang["sales_cash_deposit"] = "Cash Deposit";
|
||||
$lang["sales_cash_filter"] = "Cash";
|
||||
$lang["sales_change_due"] = "Change Due";
|
||||
$lang["sales_check"] = "Check";
|
||||
@@ -19,6 +20,7 @@ $lang["sales_complete_sale"] = "Complete";
|
||||
$lang["sales_confirm_cancel_sale"] = "Are you sure you want to clear this sale? All items will be cleared.";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected Sale(s)?";
|
||||
$lang["sales_credit"] = "Credit Card";
|
||||
$lang["sales_credit_deposit"] = "Credit Deposit";
|
||||
$lang["sales_customer"] = "Name";
|
||||
$lang["sales_customer_address"] = "Address";
|
||||
$lang["sales_customer_discount"] = "Discount";
|
||||
@@ -36,7 +38,7 @@ $lang["sales_delete_entire_sale"] = "Delete Entire Sale";
|
||||
$lang["sales_delete_successful"] = "Sale delete successful";
|
||||
$lang["sales_delete_unsuccessful"] = "Sale delete failed";
|
||||
$lang["sales_description_abbrv"] = "Desc";
|
||||
$lang["sales_discard_quote"] = "Discard";
|
||||
$lang["sales_discard"] = "Discard";
|
||||
$lang["sales_discount"] = "Disc %";
|
||||
$lang["sales_discount_included"] = "% Discount";
|
||||
$lang["sales_discount_short"] = "%";
|
||||
@@ -57,6 +59,7 @@ $lang["sales_giftcard_number"] = "Gift Card Number";
|
||||
$lang["sales_group_by_category"] = "Group by Category";
|
||||
$lang["sales_group_by_type"] = "Group by Type";
|
||||
$lang["sales_id"] = "Sale ID";
|
||||
$lang["sales_include_prices"] = "Include Prices?";
|
||||
$lang["sales_invoice"] = "Invoice";
|
||||
$lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_enable"] = "Create Invoice";
|
||||
@@ -94,6 +97,7 @@ $lang["sales_quantity_less_than_reorder_level"] = "Warning: Desired Quantity is
|
||||
$lang["sales_quantity_less_than_zero"] = "Warning: Desired Quantity is insufficient. You can still process the sale, but audit your inventory";
|
||||
$lang["sales_quote"] = "Quote";
|
||||
$lang["sales_quote_number"] = "Quote Number";
|
||||
$lang["sales_quote_number_duplicate"] = "Quote Number must be unique";
|
||||
$lang["sales_quote_sent"] = "Quote sent to";
|
||||
$lang["sales_quote_unsent"] = "Quote failed to be sent to";
|
||||
$lang["sales_receipt"] = "Sales Receipt";
|
||||
@@ -114,6 +118,7 @@ $lang["sales_select_customer"] = "Select Customer (Optional)";
|
||||
$lang["sales_send_invoice"] = "Send Invoice";
|
||||
$lang["sales_send_quote"] = "Send Quote";
|
||||
$lang["sales_send_receipt"] = "Send Receipt";
|
||||
$lang["sales_send_work_order"] = "Send Work Order";
|
||||
$lang["sales_serial"] = "Serial";
|
||||
$lang["sales_show_invoice"] = "Show Invoice";
|
||||
$lang["sales_show_receipt"] = "Show Receipt";
|
||||
@@ -125,6 +130,7 @@ $lang["sales_successfully_deleted"] = "You have successfully deleted sale";
|
||||
$lang["sales_successfully_suspended_sale"] = "Sale suspend successful";
|
||||
$lang["sales_successfully_updated"] = "Sale update successful";
|
||||
$lang["sales_suspend_sale"] = "Suspend";
|
||||
$lang["sales_suspended_doc_id"] = "Document";
|
||||
$lang["sales_suspended_sale_id"] = "ID";
|
||||
$lang["sales_suspended_sales"] = "Suspended";
|
||||
$lang["sales_table"] = "Table";
|
||||
@@ -141,3 +147,8 @@ $lang["sales_unsuccessfully_updated"] = "Sale update failed";
|
||||
$lang["sales_unsuspend"] = "Unsuspend";
|
||||
$lang["sales_unsuspend_and_delete"] = "Action";
|
||||
$lang["sales_update"] = "Update";
|
||||
$lang["sales_work_order"] = "Work Order";
|
||||
$lang["sales_work_order_number"] = "Work Order Number";
|
||||
$lang["sales_work_order_number_duplicate"] = "Work Order Number must be unique";
|
||||
$lang["sales_work_order_sent"] = "Work Order sent to";
|
||||
$lang["sales_work_order_unsent"] = "Work Order failed to be sent to";
|
||||
|
||||
@@ -142,6 +142,7 @@ $lang["config_jsprintsetup_required"] = "Warning: This functionality will only w
|
||||
$lang["config_language"] = "Language";
|
||||
$lang["config_last_used_invoice_number"] = "Last used Invoice Number";
|
||||
$lang["config_last_used_quote_number"] = "Last used Quote Number";
|
||||
$lang["config_last_used_work_order_number"] = "Last used W/O Number";
|
||||
$lang["config_left"] = "Left";
|
||||
$lang["config_license"] = "License";
|
||||
$lang["config_license_configuration"] = "License Statement";
|
||||
@@ -222,9 +223,11 @@ $lang["config_reward"] = "Reward";
|
||||
$lang["config_reward_configuration"] = "Reward Configuration";
|
||||
$lang["config_right"] = "Right";
|
||||
$lang["config_sales_invoice_format"] = "Sales Invoice Format";
|
||||
$lang["config_work_order_format"] = "Work Order Format";
|
||||
$lang["config_sales_quote_format"] = "Sales Quote Format";
|
||||
$lang["config_saved_successfully"] = "Configuration save successful.";
|
||||
$lang["config_saved_unsuccessfully"] = "Configuration save failed.";
|
||||
$lang["config_show_office_group"] = "Show office icon";
|
||||
$lang["config_statistics"] = "Send Statistics";
|
||||
$lang["config_statistics_tooltip"] = "Send statistics for development and feature improvement purposes.";
|
||||
$lang["config_stock_location"] = "Stock location";
|
||||
@@ -245,3 +248,4 @@ $lang["config_thousands_separator"] = "Thousands Separator";
|
||||
$lang["config_timezone"] = "Timezone";
|
||||
$lang["config_top"] = "Top";
|
||||
$lang["config_website"] = "Website";
|
||||
$lang["config_work_order_enable"] = "Work Order Support";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
$lang["module_both"] = "Both";
|
||||
$lang["module_config"] = "Store Config";
|
||||
$lang["module_config_desc"] = "Change the store's configuration";
|
||||
$lang["module_customers"] = "Customers";
|
||||
@@ -9,6 +10,7 @@ $lang["module_employees_desc"] = "Add, Update, Delete, and Search Employees.";
|
||||
$lang["module_giftcards"] = "Gift Cards";
|
||||
$lang["module_giftcards_desc"] = "Add, Update, Delete and Search Gift Cards.";
|
||||
$lang["module_home"] = "Home";
|
||||
$lang["module_home_desc"] = "List home menu modules.";
|
||||
$lang["module_item_kits"] = "Item Kits";
|
||||
$lang["module_item_kits_desc"] = "Add, Update, Delete and Search Item Kits.";
|
||||
$lang["module_items"] = "Items";
|
||||
@@ -17,6 +19,8 @@ $lang["module_messages"] = "Messages";
|
||||
$lang["module_messages_desc"] = "Send Messages to Customers, Suppliers and Employees.";
|
||||
$lang["module_migrate"] = "Migrate";
|
||||
$lang["module_migrate_desc"] = "Update the OSPOS Database.";
|
||||
$lang["module_office"] = "Office";
|
||||
$lang["module_office_desc"] = "List office menu modules.";
|
||||
$lang["module_receivings"] = "Receivings";
|
||||
$lang["module_receivings_desc"] = "Process Purchase Orders.";
|
||||
$lang["module_reports"] = "Reports";
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
<?php
|
||||
|
||||
$lang["reports_all"] = "All";
|
||||
$lang["reports_canceled"] = "Canceled";
|
||||
$lang["reports_categories"] = "Categories";
|
||||
$lang["reports_categories_summary_report"] = "Categories Summary Report";
|
||||
$lang["reports_category"] = "Category";
|
||||
$lang["reports_code_canceled"] = "CNL";
|
||||
$lang["reports_code_invoice"] = "INV";
|
||||
$lang["reports_code_quote"] = "Q";
|
||||
$lang["reports_code_return"] = "RET";
|
||||
$lang["reports_code_type"] = "Type";
|
||||
$lang["reports_code_work_order"] = "W/O";
|
||||
$lang["reports_comments"] = "Comments";
|
||||
$lang["reports_cost"] = "Wholesale";
|
||||
$lang["reports_cost_price"] = "Wholesale Price";
|
||||
@@ -97,4 +104,5 @@ $lang["reports_total_inventory_value"] = "Total Inventory Value";
|
||||
$lang["reports_type"] = "Type";
|
||||
$lang["reports_unit_price"] = "Retail Price";
|
||||
$lang["reports_used"] = "Points Used";
|
||||
$lang["reports_work_orders"] = "Work Orders";
|
||||
$lang["reports_zero_and_less"] = "Zero and less";
|
||||
|
||||
@@ -8,6 +8,7 @@ $lang["sales_amount_due"] = "Amount Due";
|
||||
$lang["sales_amount_tendered"] = "Amount Tendered";
|
||||
$lang["sales_cancel_sale"] = "Cancel";
|
||||
$lang["sales_cash"] = "Cash";
|
||||
$lang["sales_cash_deposit"] = "Cash Deposit";
|
||||
$lang["sales_cash_filter"] = "Cash";
|
||||
$lang["sales_change_due"] = "Change Due";
|
||||
$lang["sales_check"] = "Check";
|
||||
@@ -19,6 +20,7 @@ $lang["sales_complete_sale"] = "Complete";
|
||||
$lang["sales_confirm_cancel_sale"] = "Are you sure you want to clear this sale? All items will cleared.";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected Sale(s)?";
|
||||
$lang["sales_credit"] = "Credit Card";
|
||||
$lang["sales_credit_deposit"] = "Credit Deposit";
|
||||
$lang["sales_customer"] = "Name";
|
||||
$lang["sales_customer_address"] = "Address";
|
||||
$lang["sales_customer_discount"] = "Discount";
|
||||
@@ -36,7 +38,7 @@ $lang["sales_delete_entire_sale"] = "Delete Entire Sale";
|
||||
$lang["sales_delete_successful"] = "Sale delete successful.";
|
||||
$lang["sales_delete_unsuccessful"] = "Sale delete failed.";
|
||||
$lang["sales_description_abbrv"] = "Desc.";
|
||||
$lang["sales_discard_quote"] = "Discard";
|
||||
$lang["sales_discard"] = "Discard";
|
||||
$lang["sales_discount"] = "Disc %";
|
||||
$lang["sales_discount_included"] = "% Discount";
|
||||
$lang["sales_discount_short"] = "%";
|
||||
@@ -57,6 +59,7 @@ $lang["sales_giftcard_number"] = "Gift Card Number";
|
||||
$lang["sales_group_by_category"] = "Group by Category";
|
||||
$lang["sales_group_by_type"] = "Group by Type";
|
||||
$lang["sales_id"] = "Sale ID";
|
||||
$lang["sales_include_prices"] = "Include Prices?";
|
||||
$lang["sales_invoice"] = "Invoice";
|
||||
$lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_enable"] = "Create Invoice";
|
||||
@@ -94,6 +97,7 @@ $lang["sales_quantity_less_than_reorder_level"] = "Warning: Desired Quantity is
|
||||
$lang["sales_quantity_less_than_zero"] = "Warning: Desired Quantity is insufficient. You can still process the sale, but audit your inventory.";
|
||||
$lang["sales_quote"] = "Quote";
|
||||
$lang["sales_quote_number"] = "Quote Number";
|
||||
$lang["sales_quote_number_duplicate"] = "Quote Number must be unique.";
|
||||
$lang["sales_quote_sent"] = "Quote sent to";
|
||||
$lang["sales_quote_unsent"] = "Quote failed to be sent to";
|
||||
$lang["sales_receipt"] = "Sales Receipt";
|
||||
@@ -114,6 +118,7 @@ $lang["sales_select_customer"] = "Select Customer (Optional)";
|
||||
$lang["sales_send_invoice"] = "Send Invoice";
|
||||
$lang["sales_send_quote"] = "Send Quote";
|
||||
$lang["sales_send_receipt"] = "Send Receipt";
|
||||
$lang["sales_send_work_order"] = "Send Work Order";
|
||||
$lang["sales_serial"] = "Serial";
|
||||
$lang["sales_show_invoice"] = "Show Invoice";
|
||||
$lang["sales_show_receipt"] = "Show Receipt";
|
||||
@@ -125,6 +130,7 @@ $lang["sales_successfully_deleted"] = "You have successfully deleted";
|
||||
$lang["sales_successfully_suspended_sale"] = "Sale suspend successful.";
|
||||
$lang["sales_successfully_updated"] = "Sale update successful.";
|
||||
$lang["sales_suspend_sale"] = "Suspend";
|
||||
$lang["sales_suspended_doc_id"] = "Document";
|
||||
$lang["sales_suspended_sale_id"] = "ID";
|
||||
$lang["sales_suspended_sales"] = "Suspended";
|
||||
$lang["sales_table"] = "Table";
|
||||
@@ -141,3 +147,8 @@ $lang["sales_unsuccessfully_updated"] = "Sale update failed.";
|
||||
$lang["sales_unsuspend"] = "Unsuspend";
|
||||
$lang["sales_unsuspend_and_delete"] = "Action";
|
||||
$lang["sales_update"] = "Update";
|
||||
$lang["sales_work_order"] = "Work Order";
|
||||
$lang["sales_work_order_number"] = "Work Order Number";
|
||||
$lang["sales_work_order_number_duplicate"] = "Work Order Number must be unique.";
|
||||
$lang["sales_work_order_sent"] = "Work Order sent to";
|
||||
$lang["sales_work_order_unsent"] = "Work Order failed to be sent to";
|
||||
|
||||
@@ -28,11 +28,23 @@ class Sale_lib
|
||||
|
||||
public function get_register_mode_options()
|
||||
{
|
||||
return array(
|
||||
'sale' => $this->CI->lang->line('sales_receipt'),
|
||||
'sale_invoice' => $this->CI->lang->line('sales_invoice'),
|
||||
'sale_quote' => $this->CI->lang->line('sales_quote')
|
||||
);
|
||||
$register_modes = array();
|
||||
if($this->CI->config->item('invoice_enable') == '0')
|
||||
{
|
||||
$register_modes['sale'] = $this->CI->lang->line('sales_sale');
|
||||
}
|
||||
else
|
||||
{
|
||||
$register_modes['sale'] = $this->CI->lang->line('sales_receipt');
|
||||
$register_modes['sale_quote'] = $this->CI->lang->line('sales_quote');
|
||||
if($this->CI->config->item('work_order_enable') == '1')
|
||||
{
|
||||
$register_modes['sale_work_order'] = $this->CI->lang->line('sales_work_order');
|
||||
}
|
||||
$register_modes['sale_invoice'] = $this->CI->lang->line('sales_invoice');
|
||||
}
|
||||
$register_modes['return'] = $this->CI->lang->line('sales_return');
|
||||
return $register_modes;
|
||||
}
|
||||
|
||||
public function get_cart()
|
||||
@@ -148,6 +160,16 @@ class Sale_lib
|
||||
return $this->CI->session->userdata('sales_quote_number');
|
||||
}
|
||||
|
||||
public function get_work_order_number()
|
||||
{
|
||||
return $this->CI->session->userdata('sales_work_order_number');
|
||||
}
|
||||
|
||||
public function get_sale_type()
|
||||
{
|
||||
return $this->CI->session->userdata('sale_type');
|
||||
}
|
||||
|
||||
public function set_invoice_number($invoice_number, $keep_custom = FALSE)
|
||||
{
|
||||
$current_invoice_number = $this->CI->session->userdata('sales_invoice_number');
|
||||
@@ -166,6 +188,24 @@ class Sale_lib
|
||||
}
|
||||
}
|
||||
|
||||
public function set_work_order_number($work_order_number, $keep_custom = FALSE)
|
||||
{
|
||||
$current_work_order_number = $this->CI->session->userdata('sales_work_order_number');
|
||||
if(!$keep_custom || empty($current_work_order_number))
|
||||
{
|
||||
$this->CI->session->set_userdata('sales_work_order_number', $work_order_number);
|
||||
}
|
||||
}
|
||||
|
||||
public function set_sale_type($sale_type, $keep_custom = FALSE)
|
||||
{
|
||||
$current_sale_type = $this->CI->session->userdata('sale_type');
|
||||
if(!$keep_custom || empty($current_sale_type))
|
||||
{
|
||||
$this->CI->session->set_userdata('sale_type', $sale_type);
|
||||
}
|
||||
}
|
||||
|
||||
public function clear_invoice_number()
|
||||
{
|
||||
$this->CI->session->unset_userdata('sales_invoice_number');
|
||||
@@ -176,6 +216,11 @@ class Sale_lib
|
||||
$this->CI->session->unset_userdata('sales_quote_number');
|
||||
}
|
||||
|
||||
public function clear_sale_type()
|
||||
{
|
||||
$this->CI->session->unset_userdata('sale_type');
|
||||
}
|
||||
|
||||
public function set_suspended_id($suspended_id)
|
||||
{
|
||||
$this->CI->session->set_userdata('suspended_id', $suspended_id);
|
||||
@@ -204,6 +249,16 @@ class Sale_lib
|
||||
return ($this->CI->session->userdata('sales_mode') == 'sale_quote');
|
||||
}
|
||||
|
||||
public function is_return_mode()
|
||||
{
|
||||
return ($this->CI->session->userdata('sales_mode') == 'return');
|
||||
}
|
||||
|
||||
public function is_work_order_mode()
|
||||
{
|
||||
return ($this->CI->session->userdata('sales_mode') == 'sale_work_order');
|
||||
}
|
||||
|
||||
public function set_invoice_number_enabled($invoice_number_enabled)
|
||||
{
|
||||
return $this->CI->session->set_userdata('sales_invoice_number_enabled', $invoice_number_enabled);
|
||||
@@ -215,11 +270,22 @@ class Sale_lib
|
||||
$this->CI->session->userdata('sales_print_after_sale') == '1');
|
||||
}
|
||||
|
||||
public function is_price_work_orders()
|
||||
{
|
||||
return ($this->CI->session->userdata('sales_price_work_orders') == 'true' ||
|
||||
$this->CI->session->userdata('sales_price_work_orders') == '1');
|
||||
}
|
||||
|
||||
public function set_print_after_sale($print_after_sale)
|
||||
{
|
||||
return $this->CI->session->set_userdata('sales_print_after_sale', $print_after_sale);
|
||||
}
|
||||
|
||||
public function set_price_work_orders($price_work_orders)
|
||||
{
|
||||
return $this->CI->session->set_userdata('sales_price_work_orders', $price_work_orders);
|
||||
}
|
||||
|
||||
public function get_email_receipt()
|
||||
{
|
||||
return $this->CI->session->userdata('sales_email_receipt');
|
||||
@@ -380,7 +446,6 @@ class Sale_lib
|
||||
{
|
||||
$cash_total = $total;
|
||||
$totals['cash_total'] = $cash_total;
|
||||
|
||||
}
|
||||
|
||||
$payment_total = $this->get_payments_total();
|
||||
@@ -862,8 +927,14 @@ class Sale_lib
|
||||
$this->set_customer($this->CI->Sale->get_customer($sale_id)->person_id);
|
||||
$this->set_employee($this->CI->Sale->get_employee($sale_id)->person_id);
|
||||
$this->set_quote_number($this->CI->Sale->get_quote_number($sale_id));
|
||||
$this->set_sale_type($this->CI->Sale->get_sale_type($sale_id));
|
||||
$this->set_comment($this->CI->Sale->get_comment($sale_id));
|
||||
$this->set_dinner_table($this->CI->Sale->get_dinner_table($sale_id));
|
||||
$this->CI->session->set_userdata('sale_id', $sale_id);
|
||||
}
|
||||
|
||||
public function get_sale_id() {
|
||||
return $this->CI->session->userdata('sale_id');
|
||||
}
|
||||
|
||||
public function get_cart_reordered($sale_id)
|
||||
@@ -880,6 +951,7 @@ class Sale_lib
|
||||
|
||||
public function clear_all()
|
||||
{
|
||||
$this->CI->session->set_userdata('sale_id', -1);
|
||||
$this->set_invoice_number_enabled(FALSE);
|
||||
$this->clear_table();
|
||||
$this->empty_cart();
|
||||
@@ -887,6 +959,7 @@ class Sale_lib
|
||||
$this->clear_email_receipt();
|
||||
$this->clear_invoice_number();
|
||||
$this->clear_quote_number();
|
||||
$this->clear_sale_type();
|
||||
$this->clear_giftcard_remainder();
|
||||
$this->empty_payments();
|
||||
$this->remove_customer();
|
||||
|
||||
@@ -5,6 +5,7 @@ require_once(APPPATH . 'libraries/tokens/Token_customer.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_invoice_count.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_invoice_sequence.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_quote_sequence.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_work_order_sequence.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_suspended_invoice_count.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_year_invoice_count.php');
|
||||
|
||||
@@ -27,7 +28,8 @@ abstract class Token
|
||||
static function get_tokens()
|
||||
{
|
||||
return array(new Token_customer(), new Token_invoice_count(), new Token_invoice_sequence(),
|
||||
new Token_quote_sequence(), new Token_suspended_invoice_count(), new Token_quote_sequence(), new Token_year_invoice_count());
|
||||
new Token_quote_sequence(), new Token_suspended_invoice_count(), new Token_quote_sequence(),
|
||||
new Token_work_order_sequence(), new Token_year_invoice_count());
|
||||
}
|
||||
|
||||
abstract public function token_id();
|
||||
|
||||
19
application/libraries/tokens/Token_work_order_sequence.php
Normal file
19
application/libraries/tokens/Token_work_order_sequence.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_work_order_sequence class
|
||||
*/
|
||||
|
||||
class Token_work_order_sequence extends Token
|
||||
{
|
||||
public function token_id()
|
||||
{
|
||||
return 'WSEQ';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Appconfig->acquire_save_next_work_order_sequence();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -93,5 +93,12 @@ class Appconfig extends CI_Model
|
||||
$this->save('last_used_quote_number', $last_used);
|
||||
return $last_used;
|
||||
}
|
||||
|
||||
public function acquire_save_next_work_order_sequence()
|
||||
{
|
||||
$last_used = $this->get('last_used_work_order_number') + 1;
|
||||
$this->save('last_used_work_order_number', $last_used);
|
||||
return $last_used;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -119,9 +119,11 @@ class Employee extends Person
|
||||
//Now insert the new grants
|
||||
if($success)
|
||||
{
|
||||
foreach($grants_data as $permission_id)
|
||||
$count = 0;
|
||||
foreach($grants_data as $grant)
|
||||
{
|
||||
$success = $this->db->insert('grants', array('permission_id' => $permission_id, 'person_id' => $employee_id));
|
||||
$success = $this->db->insert('grants', array('permission_id' => $grant['permission_id'], 'person_id' => $employee_id, 'menu_group' => $grant['menu_group']));
|
||||
$count = $count+ 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,9 +392,9 @@ class Employee extends Person
|
||||
return ($this->db->get()->num_rows() == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Determines whether the employee specified employee has access the specific module.
|
||||
*/
|
||||
/**
|
||||
* Determines whether the employee specified employee has access the specific module.
|
||||
*/
|
||||
public function has_grant($permission_id, $person_id)
|
||||
{
|
||||
//if no module_id is null, allow access
|
||||
@@ -406,9 +408,32 @@ class Employee extends Person
|
||||
return ($query->num_rows() == 1);
|
||||
}
|
||||
|
||||
/*
|
||||
Gets employee permission grants
|
||||
*/
|
||||
/**
|
||||
* Returns the menu group designation that this module is to appear in
|
||||
*/
|
||||
public function get_menu_group($permission_id, $person_id)
|
||||
{
|
||||
$this->db->select('menu_group');
|
||||
$this->db->from('grants');
|
||||
$this->db->where('permission_id', $permission_id);
|
||||
$this->db->where('person_id', $person_id);
|
||||
|
||||
$row = $this->db->get()->row();
|
||||
|
||||
// If no grants are assigned yet then set the default to 'home'
|
||||
if ($row == null)
|
||||
{
|
||||
return "home";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $row->menu_group;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Gets employee permission grants
|
||||
*/
|
||||
public function get_employee_grants($person_id)
|
||||
{
|
||||
$this->db->from('grants');
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
|
||||
class Module extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function get_module_name($module_id)
|
||||
{
|
||||
$query = $this->db->get_where('modules', array('module_id' => $module_id), 1);
|
||||
@@ -55,19 +60,69 @@ class Module extends CI_Model
|
||||
{
|
||||
$this->db->from('modules');
|
||||
$this->db->order_by('sort', 'asc');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function get_allowed_modules($person_id)
|
||||
public function get_allowed_home_modules($person_id)
|
||||
{
|
||||
$menus = array('home', 'both');
|
||||
$this->db->from('modules');
|
||||
$this->db->join('permissions', 'permissions.permission_id = modules.module_id');
|
||||
$this->db->join('grants', 'permissions.permission_id = grants.permission_id');
|
||||
$this->db->where('person_id', $person_id);
|
||||
$this->db->where_in('menu_group', $menus);
|
||||
$this->db->where('sort !=', 0);
|
||||
$this->db->order_by('sort', 'asc');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function get_allowed_office_modules($person_id)
|
||||
{
|
||||
$menus = array('office', 'both');
|
||||
$this->db->from('modules');
|
||||
$this->db->join('permissions', 'permissions.permission_id = modules.module_id');
|
||||
$this->db->join('grants', 'permissions.permission_id = grants.permission_id');
|
||||
$this->db->where('person_id', $person_id);
|
||||
$this->db->where_in('menu_group', $menus);
|
||||
$this->db->where('sort !=', 0);
|
||||
$this->db->order_by('sort', 'asc');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to set the show the office navigation icon on the home page
|
||||
* which happens when the sort value is greater than zero
|
||||
*/
|
||||
public function set_show_office_group($show_office_group)
|
||||
{
|
||||
if($show_office_group)
|
||||
{
|
||||
$sort = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort = 0;
|
||||
}
|
||||
|
||||
$modules_data = array(
|
||||
'sort' => $sort
|
||||
);
|
||||
$this->db->where('module_id', 'office');
|
||||
$this->db->update('modules', $modules_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to show the office navigation icon on the home page
|
||||
* which happens when the sort value is greater than zero
|
||||
*/
|
||||
public function get_show_office_group()
|
||||
{
|
||||
$this->db->select('sort');
|
||||
$this->db->from('grants');
|
||||
$this->db->where('module_id', 'office');
|
||||
$this->db->from('modules');
|
||||
return $this->db->get()->row()->sort;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
define('COMPLETED', 0);
|
||||
define('SUSPENDED', 1);
|
||||
define('QUOTE', 2);
|
||||
define('CANCELED', 2);
|
||||
|
||||
define('SALE_TYPE_POS', 0);
|
||||
define('SALE_TYPE_INVOICE', 1);
|
||||
define('SALE_TYPE_WORK_ORDER', 2);
|
||||
define('SALE_TYPE_QUOTE', 3);
|
||||
define('SALE_TYPE_RETURN', 4);
|
||||
|
||||
/**
|
||||
* Sale class
|
||||
@@ -537,8 +543,13 @@ class Sale extends CI_Model
|
||||
* Save the sale information after the sales is complete but before the final document is printed
|
||||
* The sales_taxes variable needs to be initialized to an empty array before calling
|
||||
*/
|
||||
public function save(&$sale_status, &$items, $customer_id, $employee_id, $comment, $invoice_number, $quote_number, $payments, $dinner_table, &$sales_taxes, $sale_id = FALSE)
|
||||
public function save($sale_id, &$sale_status, &$items, $customer_id, $employee_id, $comment, $invoice_number, $work_order_number, $quote_number, $sale_type, $payments, $dinner_table, &$sales_taxes)
|
||||
{
|
||||
if($sale_id != -1)
|
||||
{
|
||||
$this->clear_suspended_sale_detail($sale_id);
|
||||
}
|
||||
|
||||
$tax_decimals = tax_decimals();
|
||||
|
||||
if(count($items) == 0)
|
||||
@@ -549,22 +560,32 @@ class Sale extends CI_Model
|
||||
$table_status = $this->determine_sale_status($sale_status, $dinner_table);
|
||||
|
||||
$sales_data = array(
|
||||
'sale_time' => date('Y-m-d H:i:s'),
|
||||
'customer_id' => $this->Customer->exists($customer_id) ? $customer_id : null,
|
||||
'employee_id' => $employee_id,
|
||||
'comment' => $comment,
|
||||
'sale_status' => $sale_status,
|
||||
'invoice_number' => $invoice_number,
|
||||
'quote_number' => $quote_number,
|
||||
'dinner_table_id'=> $dinner_table,
|
||||
'sale_status' => $sale_status
|
||||
'sale_time' => date('Y-m-d H:i:s'),
|
||||
'customer_id' => $this->Customer->exists($customer_id) ? $customer_id : null,
|
||||
'employee_id' => $employee_id,
|
||||
'comment' => $comment,
|
||||
'sale_status' => $sale_status,
|
||||
'invoice_number' => $invoice_number,
|
||||
'quote_number' => $quote_number,
|
||||
'work_order_number' => $work_order_number,
|
||||
'dinner_table_id' => $dinner_table,
|
||||
'sale_status' => $sale_status,
|
||||
'sale_type' => $sale_type
|
||||
);
|
||||
|
||||
// Run these queries as a transaction, we want to make sure we do all or nothing
|
||||
$this->db->trans_start();
|
||||
|
||||
$this->db->insert('sales', $sales_data);
|
||||
$sale_id = $this->db->insert_id();
|
||||
if($sale_id == -1)
|
||||
{
|
||||
$this->db->insert('sales', $sales_data);
|
||||
$sale_id = $this->db->insert_id();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->where('sale_id', $sale_id);
|
||||
$this->db->update('sales', $sales_data);
|
||||
}
|
||||
$total_amount = 0;
|
||||
$total_amount_used = 0;
|
||||
foreach($payments as $payment_id=>$payment)
|
||||
@@ -800,19 +821,16 @@ class Sale extends CI_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete sale
|
||||
* Delete sale. Hard deletes are not supported for sales transactions.
|
||||
* When a sale is "deleted" it is simply changed to a status of canceled.
|
||||
* However, if applicable the inventory still needs to be updated
|
||||
*/
|
||||
public function delete($sale_id, $employee_id, $update_inventory = TRUE)
|
||||
{
|
||||
// start a transaction to assure data integrity
|
||||
$this->db->trans_start();
|
||||
|
||||
// first delete all payments
|
||||
$this->db->delete('sales_payments', array('sale_id' => $sale_id));
|
||||
// then delete all taxes on items
|
||||
$this->db->delete('sales_items_taxes', array('sale_id' => $sale_id));
|
||||
|
||||
if($update_inventory)
|
||||
if($update_inventory && $sale_status = $this->get_sale_status($sale_id) == COMPLETED)
|
||||
{
|
||||
// defect, not all item deletions will be undone??
|
||||
// get array with all the items involved in the sale to update the inventory tracking
|
||||
@@ -840,10 +858,8 @@ class Sale extends CI_Model
|
||||
}
|
||||
}
|
||||
|
||||
// delete all items
|
||||
$this->db->delete('sales_items', array('sale_id' => $sale_id));
|
||||
// delete sale itself
|
||||
$this->db->delete('sales', array('sale_id' => $sale_id));
|
||||
// Set the status of the sale to canceled
|
||||
$this->update_sale_status($sale_id, CANCELED);
|
||||
|
||||
// execute transaction
|
||||
$this->db->trans_complete();
|
||||
@@ -965,6 +981,12 @@ class Sale extends CI_Model
|
||||
$payments[$this->lang->line('sales_rewards')] = $this->lang->line('sales_rewards');
|
||||
}
|
||||
|
||||
if($this->sale_lib->get_mode() == 'sale_work_order')
|
||||
{
|
||||
$payments[$this->lang->line('sales_cash_deposit')] = $this->lang->line('sales_cash_deposit');
|
||||
$payments[$this->lang->line('sales_credit_deposit')] = $this->lang->line('sales_credit_deposit');
|
||||
}
|
||||
|
||||
return $payments;
|
||||
}
|
||||
|
||||
@@ -1021,6 +1043,21 @@ class Sale extends CI_Model
|
||||
return ($this->db->get()->num_rows() == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if work order number exists
|
||||
*/
|
||||
public function check_work_order_number_exists($work_order_number, $sale_id = '')
|
||||
{
|
||||
$this->db->from('sales');
|
||||
$this->db->where('invoice_number', $work_order_number);
|
||||
if(!empty($sale_id))
|
||||
{
|
||||
$this->db->where('sale_id !=', $sale_id);
|
||||
}
|
||||
|
||||
return ($this->db->get()->num_rows() == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Giftcard value
|
||||
*/
|
||||
@@ -1117,6 +1154,7 @@ class Sale extends CI_Model
|
||||
MAX(sales.sale_time) AS sale_time,
|
||||
sales.sale_id AS sale_id,
|
||||
MAX(sales.sale_status) AS sale_status,
|
||||
MAX(sales.sale_type) AS sale_type,
|
||||
MAX(sales.comment) AS comment,
|
||||
MAX(sales.invoice_number) AS invoice_number,
|
||||
MAX(sales.quote_number) AS quote_number,
|
||||
@@ -1184,12 +1222,12 @@ class Sale extends CI_Model
|
||||
{
|
||||
if($customer_id == -1)
|
||||
{
|
||||
$query = $this->db->query('select sale_id, sale_id as suspended_sale_id, sale_status, sale_time, dinner_table_id, customer_id, comment from '
|
||||
$query = $this->db->query("select sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' then quote_number when sale_type = '".SALE_TYPE_WORK_ORDER."' then work_order_number else sale_id end as doc_id, sale_id as suspended_sale_id, sale_status, sale_time, dinner_table_id, customer_id, comment from "
|
||||
. $this->db->dbprefix('sales') . ' where sale_status = ' . SUSPENDED);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = $this->db->query('select sale_id, sale_status, sale_time, dinner_table_id, customer_id, comment from '
|
||||
$query = $this->db->query("select sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' then quote_number when sale_type = '".SALE_TYPE_WORK_ORDER."' then work_order_number else sale_id end as doc_id, sale_status, sale_time, dinner_table_id, customer_id, comment from "
|
||||
. $this->db->dbprefix('sales') . ' where sale_status = '. SUSPENDED .' AND customer_id = ' . $customer_id);
|
||||
}
|
||||
|
||||
@@ -1202,12 +1240,45 @@ class Sale extends CI_Model
|
||||
*/
|
||||
public function get_dinner_table($sale_id)
|
||||
{
|
||||
if($sale_id == -1)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
$this->db->from('sales');
|
||||
$this->db->where('sale_id', $sale_id);
|
||||
|
||||
return $this->db->get()->row()->dinner_table_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sale type for the selected sale
|
||||
*/
|
||||
public function get_sale_type($sale_id)
|
||||
{
|
||||
$this->db->from('sales');
|
||||
$this->db->where('sale_id', $sale_id);
|
||||
|
||||
return $this->db->get()->row()->sale_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sale status for the selected sale
|
||||
*/
|
||||
public function get_sale_status($sale_id)
|
||||
{
|
||||
$this->db->from('sales');
|
||||
$this->db->where('sale_id', $sale_id);
|
||||
|
||||
return $this->db->get()->row()->sale_status;
|
||||
}
|
||||
|
||||
public function update_sale_status($sale_id, $sale_status)
|
||||
{
|
||||
$this->db->where('sale_id', $sale_id);
|
||||
$this->db->update('sales', array('sale_status'=>$sale_status));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the quote_number for the selected sale
|
||||
*/
|
||||
@@ -1277,17 +1348,38 @@ class Sale extends CI_Model
|
||||
$this->db->where('dinner_table_id',$dinner_table);
|
||||
$this->db->update('dinner_tables', $dinner_table_data);
|
||||
|
||||
$this->db->delete('sales_payments', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales_items_taxes', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales_items', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales_taxes', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales', array('sale_id' => $sale_id, 'sale_status' => SUSPENDED));
|
||||
$this->update_sale_status($sale_id, CANCELED);
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
return $this->db->trans_status();
|
||||
}
|
||||
|
||||
/**
|
||||
* This clears the sales detail for a given sale_id before the detail is resaved.
|
||||
* This allows us to reuse the same sale_id
|
||||
*/
|
||||
public function clear_suspended_sale_detail($sale_id)
|
||||
{
|
||||
$this->db->trans_start();
|
||||
|
||||
$dinner_table = $this->get_dinner_table($sale_id);
|
||||
$dinner_table_data = array(
|
||||
'status' => 0
|
||||
);
|
||||
|
||||
$this->db->where('dinner_table_id',$dinner_table);
|
||||
$this->db->update('dinner_tables', $dinner_table_data);
|
||||
|
||||
$this->db->delete('sales_payments', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales_items_taxes', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales_items', array('sale_id' => $sale_id));
|
||||
$this->db->delete('sales_taxes', array('sale_id' => $sale_id));
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
return $this->db->trans_status();
|
||||
}
|
||||
/**
|
||||
* Gets suspended sale info
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ class Detailed_sales extends Report
|
||||
return array(
|
||||
'summary' => array(
|
||||
array('id' => $this->lang->line('reports_sale_id')),
|
||||
array('type_code' => $this->lang->line('reports_code_type')),
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('employee_name' => $this->lang->line('reports_sold_by')),
|
||||
@@ -66,7 +67,15 @@ class Detailed_sales extends Report
|
||||
|
||||
public function getData(array $inputs)
|
||||
{
|
||||
$this->db->select('sale_id,
|
||||
$this->db->select('sale_id,
|
||||
MAX(CASE
|
||||
WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_RETURN . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_return') . '\'
|
||||
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
|
||||
ELSE \'\'
|
||||
END) AS type_code,
|
||||
MAX(sale_status) as sale_status,
|
||||
MAX(sale_date) AS sale_date,
|
||||
SUM(quantity_purchased) AS items_purchased,
|
||||
@@ -86,21 +95,41 @@ class Detailed_sales extends Report
|
||||
$this->db->where('item_location', $inputs['location_id']);
|
||||
}
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = '. COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
$this->db->group_by('sale_id');
|
||||
@@ -136,21 +165,41 @@ class Detailed_sales extends Report
|
||||
$this->db->where('item_location', $inputs['location_id']);
|
||||
}
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
return $this->db->get()->row_array();
|
||||
|
||||
@@ -15,6 +15,7 @@ class Specific_customer extends Report
|
||||
return array(
|
||||
'summary' => array(
|
||||
array('id' => $this->lang->line('reports_sale_id')),
|
||||
array('type_code' => $this->lang->line('reports_code_type')),
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('employee_name' => $this->lang->line('reports_sold_by')),
|
||||
@@ -46,6 +47,14 @@ class Specific_customer extends Report
|
||||
public function getData(array $inputs)
|
||||
{
|
||||
$this->db->select('sale_id,
|
||||
MAX(CASE
|
||||
WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_RETURN . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_return') . '\'
|
||||
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
|
||||
ELSE \'\'
|
||||
END) AS type_code,
|
||||
MAX(sale_date) AS sale_date,
|
||||
SUM(quantity_purchased) AS items_purchased,
|
||||
MAX(employee_name) AS employee_name,
|
||||
@@ -59,21 +68,41 @@ class Specific_customer extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('customer_id', $inputs['customer_id']);
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
$this->db->group_by('sale_id');
|
||||
@@ -105,21 +134,41 @@ class Specific_customer extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('customer_id', $inputs['customer_id']);
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
return $this->db->get()->row_array();
|
||||
|
||||
@@ -15,6 +15,7 @@ class Specific_discount extends Report
|
||||
return array(
|
||||
'summary' => array(
|
||||
array('id' => $this->lang->line('reports_sale_id')),
|
||||
array('type_code' => $this->lang->line('reports_code_type')),
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('customer_name' => $this->lang->line('reports_sold_to')),
|
||||
@@ -44,6 +45,14 @@ class Specific_discount extends Report
|
||||
public function getData(array $inputs)
|
||||
{
|
||||
$this->db->select('sale_id,
|
||||
MAX(CASE
|
||||
WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_RETURN . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_return') . '\'
|
||||
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
|
||||
ELSE \'\'
|
||||
END) AS type_code,
|
||||
MAX(sale_date) AS sale_date,
|
||||
SUM(quantity_purchased) AS items_purchased,
|
||||
MAX(customer_name) AS customer_name,
|
||||
@@ -57,21 +66,41 @@ class Specific_discount extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('discount_percent >=', $inputs['discount']);
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
$this->db->group_by('sale_id');
|
||||
@@ -103,21 +132,41 @@ class Specific_discount extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('discount_percent >=', $inputs['discount']);
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
return $this->db->get()->row_array();
|
||||
|
||||
@@ -15,6 +15,7 @@ class Specific_employee extends Report
|
||||
return array(
|
||||
'summary' => array(
|
||||
array('id' => $this->lang->line('reports_sale_id')),
|
||||
array('type_code' => $this->lang->line('reports_code_type')),
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('customer_name' => $this->lang->line('reports_sold_to')),
|
||||
@@ -46,6 +47,14 @@ class Specific_employee extends Report
|
||||
public function getData(array $inputs)
|
||||
{
|
||||
$this->db->select('sale_id,
|
||||
MAX(CASE
|
||||
WHEN sale_type = ' . SALE_TYPE_INVOICE . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_invoice') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_WORK_ORDER . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_work_order') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_QUOTE . ' && sale_status = ' . SUSPENDED . ' THEN \'' . $this->lang->line('reports_code_quote') . '\'
|
||||
WHEN sale_type = ' . SALE_TYPE_RETURN . ' && sale_status = ' . COMPLETED . ' THEN \'' . $this->lang->line('reports_code_return') . '\'
|
||||
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
|
||||
ELSE \'\'
|
||||
END) AS type_code,
|
||||
MAX(sale_date) AS sale_date,
|
||||
SUM(quantity_purchased) AS items_purchased,
|
||||
MAX(customer_name) AS customer_name,
|
||||
@@ -59,21 +68,41 @@ class Specific_employee extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('employee_id', $inputs['employee_id']);
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
$this->db->group_by('sale_id');
|
||||
@@ -105,21 +134,41 @@ class Specific_employee extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('employee_id', $inputs['employee_id']);
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
return $this->db->get()->row_array();
|
||||
|
||||
@@ -90,21 +90,41 @@ abstract class Summary_report extends Report
|
||||
$this->db->where('sales_items.item_location', $inputs['location_id']);
|
||||
}
|
||||
|
||||
if($inputs['sale_type'] == 'sales')
|
||||
if($inputs['sale_type'] == 'complete')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased > 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_RETURN);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'all')
|
||||
elseif($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED);
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->group_start();
|
||||
$this->db->where('sale_type', SALE_TYPE_POS);
|
||||
$this->db->or_where('sale_type', SALE_TYPE_INVOICE);
|
||||
$this->db->group_end();
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'quotes')
|
||||
{
|
||||
$this->db->where('sale_status = ' . SUSPENDED . ' and quote_number IS NOT NULL');
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_QUOTE);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'work_orders')
|
||||
{
|
||||
$this->db->where('sale_status', SUSPENDED);
|
||||
$this->db->where('sale_type', SALE_TYPE_WORK_ORDER);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'canceled')
|
||||
{
|
||||
$this->db->where('sale_status', CANCELED);
|
||||
}
|
||||
elseif($inputs['sale_type'] == 'returns')
|
||||
{
|
||||
$this->db->where('sale_status = ' . COMPLETED . ' and quantity_purchased < 0');
|
||||
$this->db->where('sale_status', COMPLETED);
|
||||
$this->db->where('sale_type', SALE_TYPE_RETURN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_gcaptcha_site_key'), 'config_gcaptcha_site_key', array('class' => 'required control-label col-xs-2')); ?>
|
||||
<?php echo form_label($this->lang->line('config_gcaptcha_site_key'), 'config_gcaptcha_site_key', array('class' => 'required control-label col-xs-2','id' => 'config_gcaptcha_site_key')); ?>
|
||||
<div class='col-xs-4'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'gcaptcha_site_key',
|
||||
@@ -105,7 +105,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_gcaptcha_secret_key'), 'config_gcaptcha_secret_key', array('class' => 'required control-label col-xs-2')); ?>
|
||||
<?php echo form_label($this->lang->line('config_gcaptcha_secret_key'), 'config_gcaptcha_secret_key', array('class' => 'required control-label col-xs-2','id' => 'config_gcaptcha_secret_key')); ?>
|
||||
<div class='col-xs-4'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'gcaptcha_secret_key',
|
||||
@@ -150,6 +150,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_show_office_group'), 'show_office_group', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-1'>
|
||||
<?php echo form_checkbox(array(
|
||||
'name' => 'show_office_group',
|
||||
'id' => 'show_office_group',
|
||||
'value' => 'show_office_group',
|
||||
'checked' => $show_office_group)); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_custom1'), 'config_custom1', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
@@ -284,7 +295,17 @@ $(document).ready(function()
|
||||
{
|
||||
var enable_disable_gcaptcha_enable = (function() {
|
||||
var gcaptcha_enable = $("#gcaptcha_enable").is(":checked");
|
||||
$("#gcaptcha_site_key, #gcaptcha_secret_key").prop("disabled", !gcaptcha_enable);
|
||||
if(gcaptcha_enable)
|
||||
{
|
||||
$("#gcaptcha_site_key, #gcaptcha_secret_key").prop("disabled", !gcaptcha_enable).addClass("required");
|
||||
$("#config_gcaptcha_site_key, #config_gcaptcha_secret_key").addClass("required");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#gcaptcha_site_key, #gcaptcha_secret_key").prop("disabled", gcaptcha_enable).removeClass("required");
|
||||
$("#config_gcaptcha_site_key, #config_gcaptcha_secret_key").removeClass("required");
|
||||
}
|
||||
|
||||
return arguments.callee;
|
||||
})();
|
||||
|
||||
@@ -294,6 +315,7 @@ $(document).ready(function()
|
||||
window.location='<?php echo site_url('config/backup_db') ?>';
|
||||
});
|
||||
|
||||
|
||||
$('#general_config_form').validate($.extend(form_support.handler, {
|
||||
|
||||
errorLabelContainer: "#general_error_message_box",
|
||||
@@ -312,11 +334,11 @@ $(document).ready(function()
|
||||
},
|
||||
gcaptcha_site_key:
|
||||
{
|
||||
required: true
|
||||
required: "#gcaptcha_enable:checked"
|
||||
},
|
||||
gcaptcha_secret_key:
|
||||
{
|
||||
required: true
|
||||
required: "#gcaptcha_enable:checked"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -15,36 +15,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_register_mode_default'), 'default_register_mode', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_dropdown('default_register_mode', $register_mode_options, $this->config->item('default_register_mode'), array('class' => 'form-control input-sm')); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_sales_invoice_format'), 'sales_invoice_format', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'sales_invoice_format',
|
||||
'id' => 'sales_invoice_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $this->config->item('sales_invoice_format'))); ?>
|
||||
<?php echo form_dropdown('default_register_mode', $register_mode_options, $this->config->item('default_register_mode'), array('class' => 'form-control input-sm')); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_sales_quote_format'), 'sales_quote_format', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'sales_quote_format',
|
||||
'id' => 'sales_quote_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $this->config->item('sales_quote_format'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_recv_invoice_format'), 'recv_invoice_format', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
@@ -84,29 +62,85 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_sales_invoice_format'), 'sales_invoice_format', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'sales_invoice_format',
|
||||
'id' => 'sales_invoice_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $this->config->item('sales_invoice_format'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_last_used_invoice_number'), 'last_used_invoice_number', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'type' => 'number',
|
||||
'name' => 'last_used_invoice_number',
|
||||
'id' => 'last_used_invoice_number',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=>$this->config->item('last_used_invoice_number'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_sales_quote_format'), 'sales_quote_format', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'sales_quote_format',
|
||||
'id' => 'sales_quote_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $this->config->item('sales_quote_format'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_last_used_quote_number'), 'last_used_quote_number', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'type' => 'number',
|
||||
'name' => 'last_used_quote_number',
|
||||
'id' => 'last_used_quote_number',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=>$this->config->item('last_used_quote_number'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_work_order_enable'), 'work_order_enable', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-1'>
|
||||
<?php echo form_checkbox(array(
|
||||
'name' => 'work_order_enable',
|
||||
'value' => 'work_order_enable',
|
||||
'id' => 'work_order_enable',
|
||||
'checked' => $this->config->item('work_order_enable')));?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_work_order_format'), 'work_order_format', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'name' => 'work_order_format',
|
||||
'id' => 'work_order_format',
|
||||
'class' => 'form-control input-sm',
|
||||
'value' => $this->config->item('work_order_format'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_last_used_work_order_number'), 'last_used_work_order_number', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<?php echo form_input(array(
|
||||
'type' => 'number',
|
||||
'name' => 'last_used_work_order_number',
|
||||
'id' => 'last_used_work_order_number',
|
||||
'class' => 'form-control input-sm required',
|
||||
'value'=>$this->config->item('last_used_work_order_number'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo form_submit(array(
|
||||
'name' => 'submit_form',
|
||||
@@ -122,13 +156,30 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
var enable_disable_invoice_enable = (function() {
|
||||
var invoice_enable = $("#invoice_enable").is(":checked");
|
||||
$("#sales_invoice_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message, select[name='default_register_mode'], #sales_quote_format, select[name='line_sequence'], #last_used_invoice_number, #last_used_quote_number").prop("disabled", !invoice_enable);
|
||||
var invoice_enabled = $("#invoice_enable").is(":checked");
|
||||
var work_order_enabled = $("#work_order_enable").is(":checked");
|
||||
$("#sales_invoice_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message, select[name='default_register_mode'], #sales_quote_format, select[name='line_sequence'], #last_used_invoice_number, #last_used_quote_number, #work_order_enable, #work_order_format, #last_used_work_order_number").prop("disabled", !invoice_enabled);
|
||||
if(invoice_enabled) {
|
||||
$("#work_order_format, #last_used_work_order_number").prop("disabled", !work_order_enabled);
|
||||
} else {
|
||||
$("#work_order_enable").attr('checked', false);
|
||||
}
|
||||
return arguments.callee;
|
||||
})();
|
||||
|
||||
var enable_disable_work_order_enable = (function() {
|
||||
var work_order_enabled = $("#work_order_enable").is(":checked");
|
||||
var invoice_enabled = $("#invoice_enable").is(":checked");
|
||||
if(invoice_enabled) {
|
||||
$("#work_order_format, #last_used_work_order_number").prop("disabled", !work_order_enabled);
|
||||
}
|
||||
return arguments.callee;
|
||||
})();
|
||||
|
||||
$("#invoice_enable").change(enable_disable_invoice_enable);
|
||||
|
||||
$("#work_order_enable").change(enable_disable_work_order_enable);
|
||||
|
||||
$("#invoice_config_form").validate($.extend(form_support.handler, {
|
||||
|
||||
errorLabelContainer: "#invoice_error_message_box",
|
||||
@@ -136,13 +187,14 @@ $(document).ready(function()
|
||||
submitHandler: function(form) {
|
||||
$(form).ajaxSubmit({
|
||||
beforeSerialize: function(arr, $form, options) {
|
||||
$("#sales_invoice_format, #sales_quote_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message, #last_used_invoice_number, #last_used_quote_number").prop("disabled", false);
|
||||
$("#sales_invoice_format, #sales_quote_format, #recv_invoice_format, #invoice_default_comments, #invoice_email_message, #last_used_invoice_number, #last_used_quote_number, #work_order_enable, #work_order_format, #last_used_work_order_number").prop("disabled", false);
|
||||
return true;
|
||||
},
|
||||
success: function(response) {
|
||||
$.notify(response.message, { type: response.success ? 'success' : 'danger'} );
|
||||
// set back disabled state
|
||||
enable_disable_invoice_enable();
|
||||
enable_disable_work_order_enable();
|
||||
},
|
||||
dataType:'json'
|
||||
});
|
||||
|
||||
@@ -82,6 +82,11 @@
|
||||
?>
|
||||
<li>
|
||||
<?php echo form_checkbox("grants[]", $module->module_id, $module->grant, "class='module'"); ?>
|
||||
<?php echo form_dropdown("menu_groups[]", array(
|
||||
'home' => $this->lang->line('module_home'),
|
||||
'office' => $this->lang->line('module_office'),
|
||||
'both' => $this->lang->line('module_both')
|
||||
), $module->menu_group, "class='module'"); ?>
|
||||
<span class="medium"><?php echo $this->lang->line('module_'.$module->module_id);?>:</span>
|
||||
<span class="small"><?php echo $this->lang->line('module_'.$module->module_id.'_desc');?></span>
|
||||
<?php
|
||||
@@ -99,6 +104,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<?php echo form_checkbox("grants[]", $permission->permission_id, $permission->grant); ?>
|
||||
<?php echo form_hidden("menu_groups[]", "--"); ?>
|
||||
<span class="medium"><?php echo $lang_line ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -139,20 +145,20 @@ $(document).ready(function()
|
||||
|
||||
$("ul#permission_list > li > input[name='grants[]']").each(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
$("ul > li > input", $this.parent()).each(function()
|
||||
{
|
||||
var $that = $(this);
|
||||
var updateCheckboxes = function (checked)
|
||||
{
|
||||
var $this = $(this);
|
||||
$("ul > li > input", $this.parent()).each(function()
|
||||
{
|
||||
var $that = $(this);
|
||||
var updateCheckboxes = function (checked)
|
||||
{
|
||||
$that.prop("disabled", !checked);
|
||||
!checked && $that.prop("checked", false);
|
||||
}
|
||||
$this.change(function() {
|
||||
updateCheckboxes($this.is(":checked"));
|
||||
});
|
||||
!checked && $that.prop("checked", false);
|
||||
}
|
||||
$this.change(function() {
|
||||
updateCheckboxes($this.is(":checked"));
|
||||
});
|
||||
updateCheckboxes($this.is(":checked"));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#employee_form').validate($.extend({
|
||||
@@ -191,20 +197,20 @@ $(document).ready(function()
|
||||
},
|
||||
repeat_password:
|
||||
{
|
||||
equalTo: "#password"
|
||||
equalTo: "#password"
|
||||
},
|
||||
email: "email"
|
||||
},
|
||||
email: "email"
|
||||
},
|
||||
messages:
|
||||
{
|
||||
first_name: "<?php echo $this->lang->line('common_first_name_required'); ?>",
|
||||
last_name: "<?php echo $this->lang->line('common_last_name_required'); ?>",
|
||||
username:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('employees_username_required'); ?>",
|
||||
minlength: "<?php echo $this->lang->line('employees_username_minlength'); ?>"
|
||||
},
|
||||
|
||||
first_name: "<?php echo $this->lang->line('common_first_name_required'); ?>",
|
||||
last_name: "<?php echo $this->lang->line('common_last_name_required'); ?>",
|
||||
username:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('employees_username_required'); ?>",
|
||||
minlength: "<?php echo $this->lang->line('employees_username_minlength'); ?>"
|
||||
},
|
||||
|
||||
password:
|
||||
{
|
||||
<?php
|
||||
@@ -220,8 +226,8 @@ $(document).ready(function()
|
||||
repeat_password:
|
||||
{
|
||||
equalTo: "<?php echo $this->lang->line('employees_password_must_match'); ?>"
|
||||
},
|
||||
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>"
|
||||
},
|
||||
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>"
|
||||
}
|
||||
}, form_support.error));
|
||||
});
|
||||
|
||||
23
application/views/office.php
Normal file
23
application/views/office.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php $this->load->view("partial/header"); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
dialog_support.init("a.modal-dlg");
|
||||
</script>
|
||||
|
||||
<h3 class="text-center"><?php echo $this->lang->line('common_welcome_message'); ?></h3>
|
||||
|
||||
<div id="office_module_list">
|
||||
<?php
|
||||
foreach($allowed_modules->result() as $module)
|
||||
{
|
||||
?>
|
||||
<div class="module_item" title="<?php echo $this->lang->line('module_'.$module->module_id.'_desc');?>">
|
||||
<a href="<?php echo site_url("$module->module_id");?>"><img src="<?php echo base_url().'images/menubar/'.$module->module_id.'.png';?>" border="0" alt="Menubar Image" /></a>
|
||||
<a href="<?php echo site_url("$module->module_id");?>"><?php echo $this->lang->line("module_".$module->module_id) ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view("partial/footer"); ?>
|
||||
@@ -124,13 +124,16 @@
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<?php foreach($allowed_modules->result() as $module): ?>
|
||||
<li class="<?php echo $module->module_id == $this->uri->segment(1)? 'active': ''; ?>">
|
||||
<a href="<?php echo site_url("$module->module_id");?>" title="<?php echo $this->lang->line("module_".$module->module_id);?>" class="menu-icon">
|
||||
<img src="<?php echo base_url().'images/menubar/'.$module->module_id.'.png';?>" border="0" alt="Module Icon" /><br />
|
||||
<?php echo $this->lang->line("module_".$module->module_id) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="<?php echo $module->module_id == $this->uri->segment(1) ? 'active' : ''; ?>">
|
||||
<a href="<?php echo site_url("$module->module_id"); ?>"
|
||||
title="<?php echo $this->lang->line("module_" . $module->module_id); ?>"
|
||||
class="menu-icon">
|
||||
<img src="<?php echo base_url() . 'images/menubar/' . $module->module_id . '.png'; ?>"
|
||||
border="0" alt="Module Icon"/><br/>
|
||||
<?php echo $this->lang->line("module_" . $module->module_id) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,10 +29,7 @@ if(isset($error))
|
||||
?>
|
||||
<?php echo form_label($this->lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required control-label col-xs-2')); ?>
|
||||
<div id='report_sale_type' class="col-xs-3">
|
||||
<?php echo form_dropdown('sale_type', array('all' => $this->lang->line('reports_all'),
|
||||
'sales' => $this->lang->line('reports_sales'),
|
||||
'quotes' => $this->lang->line('reports_quotes'),
|
||||
'returns' => $this->lang->line('reports_returns')), 'all', array('id'=>'input_type', 'class'=>'form-control')); ?>
|
||||
<?php echo form_dropdown('sale_type', $sale_type_options, 'complete', array('id'=>'input_type', 'class'=>'form-control')); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@ if(isset($error))
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required control-label col-xs-2')); ?>
|
||||
<div id='report_sale_type' class="col-xs-3">
|
||||
<?php echo form_dropdown('sale_type', array('all' => $this->lang->line('reports_all'),
|
||||
'sales' => $this->lang->line('reports_sales'),
|
||||
'quotes' => $this->lang->line('reports_quotes'),
|
||||
'returns' => $this->lang->line('reports_returns')), 'all', 'id="input_type" class="form-control"'); ?>
|
||||
<?php echo form_dropdown('sale_type',$sale_type_options, 'complete', 'id="input_type" class="form-control"'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ if (isset($error_message))
|
||||
<a href="javascript:void(0);"><div class="btn btn-info btn-sm", id="show_email_button"><?php echo '<span class="glyphicon glyphicon-envelope"> </span>' . $this->lang->line('sales_send_quote'); ?></div></a>
|
||||
<?php endif; ?>
|
||||
<?php echo anchor("sales", '<span class="glyphicon glyphicon-shopping-cart"> </span>' . $this->lang->line('sales_register'), array('class'=>'btn btn-info btn-sm', 'id'=>'show_sales_button')); ?>
|
||||
<?php echo anchor("sales/discard_quote", '<span class="glyphicon glyphicon-remove"> </span>' . $this->lang->line('sales_discard_quote'), array('class'=>'btn btn-danger btn-sm', 'id'=>'discard_quote_button')); ?>
|
||||
<?php echo anchor("sales/discard_suspended_sale", '<span class="glyphicon glyphicon-remove"> </span>' . $this->lang->line('sales_discard'), array('class'=>'btn btn-danger btn-sm', 'id'=>'discard_quote_button')); ?>
|
||||
</div>
|
||||
|
||||
<div id="page-wrap">
|
||||
|
||||
@@ -411,7 +411,7 @@ if(isset($success))
|
||||
<?php echo form_close(); ?>
|
||||
<?php
|
||||
// Only show this part if the payment cover the total and in sale or return mode
|
||||
if($sales_or_return_mode == '1')
|
||||
if($pos_mode == '1')
|
||||
{
|
||||
?>
|
||||
<div class='btn btn-sm btn-success pull-right' id='finish_sale_button' tabindex='<?php echo ++$tabindex; ?>'><span class="glyphicon glyphicon-ok"> </span><?php echo $this->lang->line('sales_complete_sale'); ?></div>
|
||||
@@ -485,7 +485,7 @@ if(isset($success))
|
||||
<div class='btn btn-sm btn-default pull-left' id='suspend_sale_button'><span class="glyphicon glyphicon-align-justify"> </span><?php echo $this->lang->line('sales_suspend_sale'); ?></div>
|
||||
<?php
|
||||
// Only show this part if the payment cover the total
|
||||
if($quote_or_invoice_mode && isset($customer))
|
||||
if(!$pos_mode && isset($customer))
|
||||
{
|
||||
?>
|
||||
<div class='btn btn-sm btn-success' id='finish_invoice_quote_button'><span class="glyphicon glyphicon-ok"> </span><?php echo $mode_label; ?></div>
|
||||
@@ -500,7 +500,7 @@ if(isset($success))
|
||||
|
||||
<?php
|
||||
// Only show this part if the payment cover the total
|
||||
if($payments_cover_total || $quote_or_invoice_mode)
|
||||
if($payments_cover_total || !$pos_mode)
|
||||
{
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
@@ -535,7 +535,20 @@ if(isset($success))
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if($mode == "sale_work_order")
|
||||
{
|
||||
?>
|
||||
<div class="col-xs-6">
|
||||
<label for="price_work_orders" class="control-label checkbox">
|
||||
<?php echo form_checkbox(array('name'=>'price_work_orders', 'id'=>'price_work_orders', 'value'=>1, 'checked'=>$price_work_orders)); ?>
|
||||
<?php echo $this->lang->line('sales_include_prices');?>
|
||||
</label>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if(($mode == "sale") && $this->config->item('invoice_enable') == TRUE)
|
||||
@@ -678,7 +691,12 @@ $(document).ready(function()
|
||||
{
|
||||
$.post('<?php echo site_url($controller_name."/set_print_after_sale");?>', {sales_print_after_sale: $(this).is(":checked")});
|
||||
});
|
||||
|
||||
|
||||
$("#price_work_orders").change(function()
|
||||
{
|
||||
$.post('<?php echo site_url($controller_name."/set_price_work_orders");?>', {price_work_orders: $(this).is(":checked")});
|
||||
});
|
||||
|
||||
$('#email_receipt').change(function()
|
||||
{
|
||||
$.post('<?php echo site_url($controller_name."/set_email_receipt");?>', {email_receipt: $('#email_receipt').is(':checked') ? '1' : '0'});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<table id="suspended_sales_table" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr bgcolor="#CCC">
|
||||
<th><?php echo $this->lang->line('sales_suspended_sale_id'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_suspended_doc_id'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_date'); ?></th>
|
||||
<?php
|
||||
if($this->config->item('dinner_table_enable') == TRUE)
|
||||
@@ -22,7 +22,7 @@
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $suspended_sale['sale_id'];?></td>
|
||||
<td><?php echo $suspended_sale['doc_id'];?></td>
|
||||
<td><?php echo date($this->config->item('dateformat'), strtotime($suspended_sale['sale_time']));?></td>
|
||||
<?php
|
||||
if($this->config->item('dinner_table_enable') == TRUE)
|
||||
@@ -50,7 +50,7 @@
|
||||
<td><?php echo $suspended_sale['comment'];?></td>
|
||||
<td>
|
||||
<?php echo form_open('sales/unsuspend');
|
||||
echo form_hidden('suspended_sale_id', $suspended_sale['suspended_sale_id']);
|
||||
echo form_hidden('suspended_sale_id', $suspended_sale['sale_id']);
|
||||
?>
|
||||
<input type="submit" name="submit" value="<?php echo $this->lang->line('sales_unsuspend'); ?>" id="submit" class="btn btn-primary btn-xs pull-right">
|
||||
<?php echo form_close(); ?>
|
||||
|
||||
213
application/views/sales/work_order.php
Normal file
213
application/views/sales/work_order.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php $this->load->view("partial/header"); ?>
|
||||
|
||||
<?php
|
||||
if (isset($error_message))
|
||||
{
|
||||
echo "<div class='alert alert-dismissible alert-danger'>".$error_message."</div>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if(!empty($customer_email)): ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
var send_email = function()
|
||||
{
|
||||
$.get('<?php echo site_url() . "/sales/send_pdf/" . $sale_id_num . "/work_order"; ?>',
|
||||
function(response)
|
||||
{
|
||||
$.notify(response.message, { type: response.success ? 'success' : 'danger'} );
|
||||
}, 'json'
|
||||
);
|
||||
};
|
||||
|
||||
$("#show_email_button").click(send_email);
|
||||
|
||||
<?php if(!empty($email_receipt)): ?>
|
||||
send_email();
|
||||
<?php endif; ?>
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $this->load->view('partial/print_receipt', array('print_after_sale'=>$print_after_sale, 'selected_printer'=>'invoice_printer')); ?>
|
||||
|
||||
<div class="print_hide" id="control_buttons" style="text-align:right">
|
||||
<a href="javascript:printdoc();"><div class="btn btn-info btn-sm", id="show_print_button"><?php echo '<span class="glyphicon glyphicon-print"> </span>' . $this->lang->line('common_print'); ?></div></a>
|
||||
<?php /* this line will allow to print and go back to sales automatically.... echo anchor("sales", '<span class="glyphicon glyphicon-print"> </span>' . $this->lang->line('common_print'), array('class'=>'btn btn-info btn-sm', 'id'=>'show_print_button', 'onclick'=>'window.print();')); */ ?>
|
||||
<?php if(isset($customer_email) && !empty($customer_email)): ?>
|
||||
<a href="javascript:void(0);"><div class="btn btn-info btn-sm", id="show_email_button"><?php echo '<span class="glyphicon glyphicon-envelope"> </span>' . $this->lang->line('sales_send_work_order'); ?></div></a>
|
||||
<?php endif; ?>
|
||||
<?php echo anchor("sales", '<span class="glyphicon glyphicon-shopping-cart"> </span>' . $this->lang->line('sales_register'), array('class'=>'btn btn-info btn-sm', 'id'=>'show_sales_button')); ?>
|
||||
<?php echo anchor("sales/discard_suspended_sale", '<span class="glyphicon glyphicon-remove"> </span>' . $this->lang->line('sales_discard'), array('class'=>'btn btn-danger btn-sm', 'id'=>'discard_work_order_button')); ?>
|
||||
</div>
|
||||
|
||||
<div id="page-wrap">
|
||||
<div id="header"><?php echo $sales_work_order; ?></div>
|
||||
<div id="block1">
|
||||
<div id="customer-title">
|
||||
<?php
|
||||
if(isset($customer))
|
||||
{
|
||||
?>
|
||||
<textarea id="customer" rows="5" cols="6"><?php echo $customer_info ?></textarea>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="logo">
|
||||
<?php
|
||||
if($this->Appconfig->get('company_logo') != '')
|
||||
{
|
||||
?>
|
||||
<img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div> </div>
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_company_name'))
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><?php echo $this->config->item('company'); ?></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="block2">
|
||||
<textarea id="company-title" rows="5" cols="35"><?php echo $company_info ?></textarea>
|
||||
<table id="meta">
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $work_order_number_label;?> </td>
|
||||
<td><textarea rows="5" cols="6"><?php echo $work_order_number; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $this->lang->line('common_date'); ?></td>
|
||||
<td><textarea rows="5" cols="6"><?php echo $transaction_date; ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
if($print_price_info) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $this->lang->line('sales_amount_due'); ?></td>
|
||||
<td><textarea rows="5" cols="6"><?php echo to_currency($total); ?></textarea></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<table id="items">
|
||||
<tr>
|
||||
<th><?php echo $this->lang->line('sales_item_number'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_item_name'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_quantity'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_price'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_discount'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_total'); ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($cart as $line=>$item)
|
||||
{
|
||||
?>
|
||||
<tr class="item-row">
|
||||
<td><?php echo $item['item_number']; ?></td>
|
||||
<td class="item-name"><textarea rows="4" cols="6"><?php echo $item['name']; ?></textarea></td>
|
||||
<td style='text-align:center;'><textarea rows="5" cols="6"><?php echo to_quantity_decimals($item['quantity']); ?></textarea></td>
|
||||
<td><textarea rows="4" cols="6"><?php if($print_price_info) echo to_currency($item['price']); ?></textarea></td>
|
||||
<td style='text-align:center;'><textarea rows="4" cols="6"><?php echo $item['discount'] . '%'; ?></textarea></td>
|
||||
<td style='border-right: solid 1px; text-align:right;'><textarea rows="4" cols="6"><?php if($print_price_info) echo to_currency($item['discounted_total']); ?></textarea></td>
|
||||
</tr>
|
||||
|
||||
<?php if($item['is_serialized'] || $item['allow_alt_description'] && !empty($item['description']))
|
||||
{
|
||||
?>
|
||||
<tr class="item-row">
|
||||
<td></td>
|
||||
<td class="item-name" colspan = "4"><div><?php echo $item['description']; ?></div></td>
|
||||
<td style='text-align:center;'><textarea><?php echo $item['serialnumber']; ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="blank" colspan="6" align="center"><?php echo ' '; ?></td>
|
||||
</tr>
|
||||
<?php if($print_price_info) { ?>
|
||||
<tr>
|
||||
<td colspan="3" class="blank-bottom"> </td>
|
||||
<td colspan="2" class="total-line"><textarea rows="5" cols="6"><?php echo $this->lang->line('sales_sub_total'); ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="subtotal"><?php echo to_currency($subtotal); ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($taxes as $tax_group_index=>$sales_tax)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><textarea rows="5" cols="6"><?php echo $sales_tax['tax_group']; ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="taxes"><?php echo to_currency_tax($sales_tax['sale_tax_amount']); ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><textarea rows="5" cols="6"><?php echo $this->lang->line('sales_total'); ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="total"><?php echo to_currency($total); ?></textarea></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$only_sale_check = FALSE;
|
||||
$show_giftcard_remainder = FALSE;
|
||||
foreach($payments as $payment_id=>$payment)
|
||||
{
|
||||
$only_sale_check |= $payment['payment_type'] == $this->lang->line('sales_check');
|
||||
$splitpayment = explode(':', $payment['payment_type']);
|
||||
$show_giftcard_remainder |= $splitpayment[0] == $this->lang->line('sales_giftcard');
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><textarea rows="5" cols="6"><?php echo $splitpayment[0]; ?></textarea></td>
|
||||
<td class="total-value"><textarea rows="5" cols="6" id="paid"><?php echo to_currency( $payment['payment_amount'] ); ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(window).on("load", function()
|
||||
{
|
||||
// install firefox addon in order to use this plugin
|
||||
if (window.jsPrintSetup)
|
||||
{
|
||||
<?php if (!$this->Appconfig->get('print_header'))
|
||||
{
|
||||
?>
|
||||
// set page header
|
||||
jsPrintSetup.setOption('headerStrLeft', '');
|
||||
jsPrintSetup.setOption('headerStrCenter', '');
|
||||
jsPrintSetup.setOption('headerStrRight', '');
|
||||
<?php
|
||||
}
|
||||
if (!$this->Appconfig->get('print_footer'))
|
||||
{
|
||||
?>
|
||||
// set empty page footer
|
||||
jsPrintSetup.setOption('footerStrLeft', '');
|
||||
jsPrintSetup.setOption('footerStrCenter', '');
|
||||
jsPrintSetup.setOption('footerStrRight', '');
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php $this->load->view("partial/footer"); ?>
|
||||
128
application/views/sales/work_order_email.php
Normal file
128
application/views/sales/work_order_email.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'css/invoice_email.css';?>"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
if (isset($error_message))
|
||||
{
|
||||
echo "<div class='alert alert-dismissible alert-danger'>".$error_message."</div>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="page-wrap">
|
||||
<div id="header"><?php echo $this->lang->line('sales_work_order'); ?></div>
|
||||
<table id="info">
|
||||
<tr>
|
||||
<td id="logo">
|
||||
<?php if($this->config->item('company_logo') != '')
|
||||
{
|
||||
?>
|
||||
<img id="image" src="<?php echo 'uploads/' . $this->config->item('company_logo'); ?>" alt="company_logo" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td id="customer-title">
|
||||
<pre><?php if(isset($customer)) { echo $customer_info; } ?></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="company-title">
|
||||
<pre><?php echo $this->config->item('company'); ?></pre>
|
||||
<pre><?php echo $company_info; ?></pre>
|
||||
</td>
|
||||
<td id="meta">
|
||||
<table align="right">
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $this->lang->line('sales_work_order_number');?> </td>
|
||||
<td><div><?php echo $work_order_number; ?></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $this->lang->line('common_date'); ?></td>
|
||||
<td><div><?php echo $transaction_date; ?></div></td>
|
||||
</tr>
|
||||
<?php if ($amount_due > 0)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td class="meta-head"><?php echo $this->lang->line('sales_amount_due'); ?></td>
|
||||
<td><div class="due"><?php echo to_currency($total); ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table id="items">
|
||||
<tr>
|
||||
<th><?php echo $this->lang->line('sales_item_number'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_item_name'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_quantity'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_price'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_discount'); ?></th>
|
||||
<th><?php echo $this->lang->line('sales_total'); ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
foreach($cart as $line=>$item)
|
||||
{
|
||||
?>
|
||||
<tr class="item-row">
|
||||
<td><?php echo $item['item_number']; ?></td>
|
||||
<td class="item-name"><?php echo $item['name']; ?></td>
|
||||
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
|
||||
<td><?php echo to_currency($item['price']); ?></td>
|
||||
<td><?php echo $item['discount'] .'%'; ?></td>
|
||||
<td class="total-line"><?php echo to_currency($item['discounted_total']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="6" align="center"><?php echo ' '; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><?php echo $this->lang->line('sales_sub_total'); ?></td>
|
||||
<td id="subtotal" class="total-value"><?php echo to_currency($tax_exclusive_subtotal); ?></td>
|
||||
</tr>
|
||||
<?php foreach($taxes as $name=>$value) { ?>
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><?php echo $name; ?></td>
|
||||
<td id="taxes" class="total-value"><?php echo to_currency_tax($value); ?></td>
|
||||
</tr>
|
||||
<?php }; ?>
|
||||
<tr>
|
||||
<td colspan="3" class="blank"> </td>
|
||||
<td colspan="2" class="total-line"><?php echo $this->lang->line('sales_total'); ?></td>
|
||||
<td id="total" class="total-value"><?php echo to_currency($total); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="terms">
|
||||
<div id="sale_return_policy">
|
||||
<h5>
|
||||
<div><?php echo nl2br($this->config->item('payment_message')); ?></div>
|
||||
<div><?php echo $this->lang->line('sales_comments'). ': ' . (empty($comments) ? $this->config->item('invoice_default_comments') : $comments); ?></div>
|
||||
</h5>
|
||||
<?php echo nl2br($this->config->item('return_policy')); ?>
|
||||
</div>
|
||||
<div id='barcode'>
|
||||
<img src='data:image/png;base64,<?php echo $barcode; ?>' /><br>
|
||||
<?php echo $sale_id; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "opensourcepos",
|
||||
"description": "Open Source Point of Sale is a web based POS system written in the PHP language. It uses MySQL as backend and has a simple user interface",
|
||||
"version": "3.1.1",
|
||||
"version": "3.2.0",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
"jekkos <jeroen.peelaerts - at - gmail.com>",
|
||||
|
||||
59
database/3.1.1_to_3.2.0.sql
Normal file
59
database/3.1.1_to_3.2.0.sql
Normal file
@@ -0,0 +1,59 @@
|
||||
--
|
||||
-- Add support for office menu group
|
||||
--
|
||||
|
||||
ALTER TABLE `ospos_grants`
|
||||
ADD COLUMN `menu_group` varchar(32) DEFAULT 'home';
|
||||
|
||||
INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_id`) VALUES
|
||||
('module_office', 'module_office_desc', 1, 'office'),
|
||||
('module_home', 'module_home_desc', 1, 'home');
|
||||
|
||||
INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('office', 'office'),
|
||||
('home', 'home');
|
||||
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`, `menu_group`) VALUES
|
||||
('office', 1, 'home'),
|
||||
('home', 1, 'office');
|
||||
|
||||
update `ospos_grants`
|
||||
set menu_group = 'office'
|
||||
where permission_id in ('config', 'home', 'employees', 'taxes', 'migrate')
|
||||
and person_id = 1;
|
||||
|
||||
--
|
||||
-- Add support for Work Orders
|
||||
--
|
||||
|
||||
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
|
||||
('work_order_enable', '0'),
|
||||
('work_order_format', 'W%y{WSEQ:6}'),
|
||||
('last_used_work_order_number', '0');
|
||||
|
||||
ALTER TABLE `ospos_sales`
|
||||
ADD COLUMN `work_order_number` varchar(32) DEFAULT NULL,
|
||||
ADD COLUMN `sale_type` tinyint(2) NOT NULL DEFAULT 0;
|
||||
|
||||
-- sale_type (0=pos, 1=invoice, 2=work order, 3=quote, 4=return)
|
||||
|
||||
UPDATE `ospos_sales`
|
||||
SET `sale_type` = 0;
|
||||
|
||||
UPDATE ospos_sales t1
|
||||
SET sale_type = 4
|
||||
WHERE EXISTS (SELECT t2.sale_id FROM ospos_sales_items t2 WHERE t1.sale_id = t2.sale_id AND t2.quantity_purchased < 0);
|
||||
|
||||
UPDATE `ospos_sales`
|
||||
SET `sale_type` = 3
|
||||
WHERE `quote_number` IS NOT NULL;
|
||||
|
||||
-- The following is needed only if quotes were being treated as work orders.
|
||||
-- UPDATE `ospos_sales`
|
||||
-- SET `sale_type` = 2, `work_order_number` = `quote_number`
|
||||
-- WHERE quote_number IS NOT NULL;
|
||||
|
||||
-- Identify invoices
|
||||
UPDATE `ospos_sales`
|
||||
SET `sale_type` = 1
|
||||
WHERE `invoice_number` IS NOT NULL;
|
||||
@@ -111,7 +111,11 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
|
||||
('gcaptcha_enable', '0'),
|
||||
('gcaptcha_secret_key', ''),
|
||||
('gcaptcha_site_key', ''),
|
||||
('receiving_calculate_average_price', '0');
|
||||
('receiving_calculate_average_price', '0'),
|
||||
('work_order_enable', '0'),
|
||||
('work_order_format', 'W%y{WSEQ:6}'),
|
||||
('last_used_work_order_number', '0');
|
||||
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
@@ -354,10 +358,12 @@ INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_i
|
||||
('module_customers', 'module_customers_desc', 10, 'customers'),
|
||||
('module_employees', 'module_employees_desc', 80, 'employees'),
|
||||
('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'),
|
||||
('module_home', 'module_home_desc', 1, 'home'),
|
||||
('module_items', 'module_items_desc', 20, 'items'),
|
||||
('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'),
|
||||
('module_messages', 'module_messages_desc', 100, 'messages'),
|
||||
('module_migrate', 'module_migrate_desc', 120, 'migrate'),
|
||||
('module_office', 'module_office_desc', 1, 'office'),
|
||||
('module_receivings', 'module_receivings_desc', 60, 'receivings'),
|
||||
('module_reports', 'module_reports_desc', 50, 'reports'),
|
||||
('module_sales', 'module_sales_desc', 70, 'sales'),
|
||||
@@ -428,10 +434,12 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('customers', 'customers'),
|
||||
('employees', 'employees'),
|
||||
('giftcards', 'giftcards'),
|
||||
('home', 'home'),
|
||||
('items', 'items'),
|
||||
('item_kits', 'item_kits'),
|
||||
('messages', 'messages'),
|
||||
('migrate', 'migrate'),
|
||||
('office', 'office'),
|
||||
('receivings', 'receivings'),
|
||||
('reports', 'reports'),
|
||||
('sales', 'sales'),
|
||||
@@ -439,6 +447,8 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('suppliers', 'suppliers'),
|
||||
('taxes', 'taxes');
|
||||
|
||||
|
||||
|
||||
INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VALUES
|
||||
('items_stock', 'items', 1),
|
||||
('sales_stock', 'sales', 1),
|
||||
@@ -453,6 +463,7 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VA
|
||||
CREATE TABLE `ospos_grants` (
|
||||
`permission_id` varchar(255) NOT NULL,
|
||||
`person_id` int(10) NOT NULL,
|
||||
`menu_group` varchar(32) DEFAULT 'home',
|
||||
PRIMARY KEY (`permission_id`,`person_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -461,34 +472,36 @@ CREATE TABLE `ospos_grants` (
|
||||
--
|
||||
-- --------------------------------------------------------
|
||||
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES
|
||||
('reports_customers', 1),
|
||||
('reports_receivings', 1),
|
||||
('reports_items', 1),
|
||||
('reports_inventory', 1),
|
||||
('reports_employees', 1),
|
||||
('reports_suppliers', 1),
|
||||
('reports_sales', 1),
|
||||
('reports_discounts', 1),
|
||||
('reports_taxes', 1),
|
||||
('reports_categories', 1),
|
||||
('reports_payments', 1),
|
||||
('customers', 1),
|
||||
('employees', 1),
|
||||
('giftcards', 1),
|
||||
('items', 1),
|
||||
('item_kits', 1),
|
||||
('messages', 1),
|
||||
('migrate', 1),
|
||||
('receivings', 1),
|
||||
('reports', 1),
|
||||
('sales', 1),
|
||||
('config', 1),
|
||||
('items_stock', 1),
|
||||
('sales_stock', 1),
|
||||
('receivings_stock', 1),
|
||||
('suppliers', 1),
|
||||
('taxes', 1);
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`, `menu_group`) VALUES
|
||||
('reports_customers', 1, 'home'),
|
||||
('reports_receivings', 1, 'home'),
|
||||
('reports_items', 1, 'home'),
|
||||
('reports_inventory', 1, 'home'),
|
||||
('reports_employees', 1, 'home'),
|
||||
('reports_suppliers', 1, 'home'),
|
||||
('reports_sales', 1, 'home'),
|
||||
('reports_discounts', 1, 'home'),
|
||||
('reports_taxes', 1, 'home'),
|
||||
('reports_categories', 1, 'home'),
|
||||
('reports_payments', 1, 'home'),
|
||||
('customers', 1, 'home'),
|
||||
('employees', 1, 'office'),
|
||||
('giftcards', 1, 'home'),
|
||||
('items', 1, 'home'),
|
||||
('item_kits', 1, 'home'),
|
||||
('messages', 1, 'home'),
|
||||
('migrate', 1, 'office'),
|
||||
('receivings', 1, 'home'),
|
||||
('reports', 1, 'home'),
|
||||
('sales', 1, 'home'),
|
||||
('config', 1, 'office'),
|
||||
('items_stock', 1, 'home'),
|
||||
('sales_stock', 1, 'home'),
|
||||
('receivings_stock', 1, 'home'),
|
||||
('suppliers', 1, 'home'),
|
||||
('taxes', 1, 'office'),
|
||||
('office', 1, 'home'),
|
||||
('home', 1, 'office');
|
||||
|
||||
--
|
||||
-- Table structure for table `ospos_receivings`
|
||||
@@ -556,6 +569,8 @@ CREATE TABLE `ospos_sales` (
|
||||
`sale_id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`sale_status` tinyint(2) NOT NULL DEFAULT 0,
|
||||
`dinner_table_id` int(11) NULL,
|
||||
`work_order_number` varchar(32) DEFAULT NULL,
|
||||
`sale_type` tinyint(2) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`sale_id`),
|
||||
KEY `customer_id` (`customer_id`),
|
||||
KEY `employee_id` (`employee_id`),
|
||||
|
||||
@@ -111,7 +111,11 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
|
||||
('gcaptcha_enable', '0'),
|
||||
('gcaptcha_secret_key', ''),
|
||||
('gcaptcha_site_key', ''),
|
||||
('receiving_calculate_average_price', '0');
|
||||
('receiving_calculate_average_price', '0'),
|
||||
('work_order_enable', '0'),
|
||||
('work_order_format', 'W%y{WSEQ:6}'),
|
||||
('last_used_work_order_number', '0');
|
||||
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
@@ -354,10 +358,12 @@ INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_i
|
||||
('module_customers', 'module_customers_desc', 10, 'customers'),
|
||||
('module_employees', 'module_employees_desc', 80, 'employees'),
|
||||
('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'),
|
||||
('module_home', 'module_home_desc', 1, 'home'),
|
||||
('module_items', 'module_items_desc', 20, 'items'),
|
||||
('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'),
|
||||
('module_messages', 'module_messages_desc', 100, 'messages'),
|
||||
('module_migrate', 'module_migrate_desc', 120, 'migrate'),
|
||||
('module_office', 'module_office_desc', 1, 'office'),
|
||||
('module_receivings', 'module_receivings_desc', 60, 'receivings'),
|
||||
('module_reports', 'module_reports_desc', 50, 'reports'),
|
||||
('module_sales', 'module_sales_desc', 70, 'sales'),
|
||||
@@ -428,10 +434,12 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('customers', 'customers'),
|
||||
('employees', 'employees'),
|
||||
('giftcards', 'giftcards'),
|
||||
('home', 'home'),
|
||||
('items', 'items'),
|
||||
('item_kits', 'item_kits'),
|
||||
('messages', 'messages'),
|
||||
('migrate', 'migrate'),
|
||||
('office', 'office'),
|
||||
('receivings', 'receivings'),
|
||||
('reports', 'reports'),
|
||||
('sales', 'sales'),
|
||||
@@ -439,6 +447,8 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('suppliers', 'suppliers'),
|
||||
('taxes', 'taxes');
|
||||
|
||||
|
||||
|
||||
INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VALUES
|
||||
('items_stock', 'items', 1),
|
||||
('sales_stock', 'sales', 1),
|
||||
@@ -453,6 +463,7 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VA
|
||||
CREATE TABLE `ospos_grants` (
|
||||
`permission_id` varchar(255) NOT NULL,
|
||||
`person_id` int(10) NOT NULL,
|
||||
`menu_group` varchar(32) DEFAULT 'home',
|
||||
PRIMARY KEY (`permission_id`,`person_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -461,34 +472,36 @@ CREATE TABLE `ospos_grants` (
|
||||
--
|
||||
-- --------------------------------------------------------
|
||||
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES
|
||||
('reports_customers', 1),
|
||||
('reports_receivings', 1),
|
||||
('reports_items', 1),
|
||||
('reports_inventory', 1),
|
||||
('reports_employees', 1),
|
||||
('reports_suppliers', 1),
|
||||
('reports_sales', 1),
|
||||
('reports_discounts', 1),
|
||||
('reports_taxes', 1),
|
||||
('reports_categories', 1),
|
||||
('reports_payments', 1),
|
||||
('customers', 1),
|
||||
('employees', 1),
|
||||
('giftcards', 1),
|
||||
('items', 1),
|
||||
('item_kits', 1),
|
||||
('messages', 1),
|
||||
('migrate', 1),
|
||||
('receivings', 1),
|
||||
('reports', 1),
|
||||
('sales', 1),
|
||||
('config', 1),
|
||||
('items_stock', 1),
|
||||
('sales_stock', 1),
|
||||
('receivings_stock', 1),
|
||||
('suppliers', 1),
|
||||
('taxes', 1);
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`, `menu_group`) VALUES
|
||||
('reports_customers', 1, 'home'),
|
||||
('reports_receivings', 1, 'home'),
|
||||
('reports_items', 1, 'home'),
|
||||
('reports_inventory', 1, 'home'),
|
||||
('reports_employees', 1, 'home'),
|
||||
('reports_suppliers', 1, 'home'),
|
||||
('reports_sales', 1, 'home'),
|
||||
('reports_discounts', 1, 'home'),
|
||||
('reports_taxes', 1, 'home'),
|
||||
('reports_categories', 1, 'home'),
|
||||
('reports_payments', 1, 'home'),
|
||||
('customers', 1, 'home'),
|
||||
('employees', 1, 'office'),
|
||||
('giftcards', 1, 'home'),
|
||||
('items', 1, 'home'),
|
||||
('item_kits', 1, 'home'),
|
||||
('messages', 1, 'home'),
|
||||
('migrate', 1, 'office'),
|
||||
('receivings', 1, 'home'),
|
||||
('reports', 1, 'home'),
|
||||
('sales', 1, 'home'),
|
||||
('config', 1, 'office'),
|
||||
('items_stock', 1, 'home'),
|
||||
('sales_stock', 1, 'home'),
|
||||
('receivings_stock', 1, 'home'),
|
||||
('suppliers', 1, 'home'),
|
||||
('taxes', 1, 'office'),
|
||||
('office', 1, 'home'),
|
||||
('home', 1, 'office');
|
||||
|
||||
--
|
||||
-- Table structure for table `ospos_receivings`
|
||||
@@ -556,6 +569,8 @@ CREATE TABLE `ospos_sales` (
|
||||
`sale_id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`sale_status` tinyint(2) NOT NULL DEFAULT 0,
|
||||
`dinner_table_id` int(11) NULL,
|
||||
`work_order_number` varchar(32) DEFAULT NULL,
|
||||
`sale_type` tinyint(2) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`sale_id`),
|
||||
KEY `customer_id` (`customer_id`),
|
||||
KEY `employee_id` (`employee_id`),
|
||||
|
||||
@@ -111,7 +111,11 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
|
||||
('gcaptcha_enable', '0'),
|
||||
('gcaptcha_secret_key', ''),
|
||||
('gcaptcha_site_key', ''),
|
||||
('receiving_calculate_average_price', '0');
|
||||
('receiving_calculate_average_price', '0'),
|
||||
('work_order_enable', '0'),
|
||||
('work_order_format', 'W%y{WSEQ:6}'),
|
||||
('last_used_work_order_number', '0');
|
||||
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
@@ -354,10 +358,12 @@ INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_i
|
||||
('module_customers', 'module_customers_desc', 10, 'customers'),
|
||||
('module_employees', 'module_employees_desc', 80, 'employees'),
|
||||
('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'),
|
||||
('module_home', 'module_home_desc', 1, 'home'),
|
||||
('module_items', 'module_items_desc', 20, 'items'),
|
||||
('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'),
|
||||
('module_messages', 'module_messages_desc', 100, 'messages'),
|
||||
('module_migrate', 'module_migrate_desc', 120, 'migrate'),
|
||||
('module_office', 'module_office_desc', 1, 'office'),
|
||||
('module_receivings', 'module_receivings_desc', 60, 'receivings'),
|
||||
('module_reports', 'module_reports_desc', 50, 'reports'),
|
||||
('module_sales', 'module_sales_desc', 70, 'sales'),
|
||||
@@ -428,10 +434,12 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('customers', 'customers'),
|
||||
('employees', 'employees'),
|
||||
('giftcards', 'giftcards'),
|
||||
('home', 'home'),
|
||||
('items', 'items'),
|
||||
('item_kits', 'item_kits'),
|
||||
('messages', 'messages'),
|
||||
('migrate', 'migrate'),
|
||||
('office', 'office'),
|
||||
('receivings', 'receivings'),
|
||||
('reports', 'reports'),
|
||||
('sales', 'sales'),
|
||||
@@ -439,6 +447,8 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
|
||||
('suppliers', 'suppliers'),
|
||||
('taxes', 'taxes');
|
||||
|
||||
|
||||
|
||||
INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VALUES
|
||||
('items_stock', 'items', 1),
|
||||
('sales_stock', 'sales', 1),
|
||||
@@ -453,6 +463,7 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VA
|
||||
CREATE TABLE `ospos_grants` (
|
||||
`permission_id` varchar(255) NOT NULL,
|
||||
`person_id` int(10) NOT NULL,
|
||||
`menu_group` varchar(32) DEFAULT 'home',
|
||||
PRIMARY KEY (`permission_id`,`person_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -461,34 +472,36 @@ CREATE TABLE `ospos_grants` (
|
||||
--
|
||||
-- --------------------------------------------------------
|
||||
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES
|
||||
('reports_customers', 1),
|
||||
('reports_receivings', 1),
|
||||
('reports_items', 1),
|
||||
('reports_inventory', 1),
|
||||
('reports_employees', 1),
|
||||
('reports_suppliers', 1),
|
||||
('reports_sales', 1),
|
||||
('reports_discounts', 1),
|
||||
('reports_taxes', 1),
|
||||
('reports_categories', 1),
|
||||
('reports_payments', 1),
|
||||
('customers', 1),
|
||||
('employees', 1),
|
||||
('giftcards', 1),
|
||||
('items', 1),
|
||||
('item_kits', 1),
|
||||
('messages', 1),
|
||||
('migrate', 1),
|
||||
('receivings', 1),
|
||||
('reports', 1),
|
||||
('sales', 1),
|
||||
('config', 1),
|
||||
('items_stock', 1),
|
||||
('sales_stock', 1),
|
||||
('receivings_stock', 1),
|
||||
('suppliers', 1),
|
||||
('taxes', 1);
|
||||
INSERT INTO `ospos_grants` (`permission_id`, `person_id`, `menu_group`) VALUES
|
||||
('reports_customers', 1, 'home'),
|
||||
('reports_receivings', 1, 'home'),
|
||||
('reports_items', 1, 'home'),
|
||||
('reports_inventory', 1, 'home'),
|
||||
('reports_employees', 1, 'home'),
|
||||
('reports_suppliers', 1, 'home'),
|
||||
('reports_sales', 1, 'home'),
|
||||
('reports_discounts', 1, 'home'),
|
||||
('reports_taxes', 1, 'home'),
|
||||
('reports_categories', 1, 'home'),
|
||||
('reports_payments', 1, 'home'),
|
||||
('customers', 1, 'home'),
|
||||
('employees', 1, 'office'),
|
||||
('giftcards', 1, 'home'),
|
||||
('items', 1, 'home'),
|
||||
('item_kits', 1, 'home'),
|
||||
('messages', 1, 'home'),
|
||||
('migrate', 1, 'office'),
|
||||
('receivings', 1, 'home'),
|
||||
('reports', 1, 'home'),
|
||||
('sales', 1, 'home'),
|
||||
('config', 1, 'office'),
|
||||
('items_stock', 1, 'home'),
|
||||
('sales_stock', 1, 'home'),
|
||||
('receivings_stock', 1, 'home'),
|
||||
('suppliers', 1, 'home'),
|
||||
('taxes', 1, 'office'),
|
||||
('office', 1, 'home'),
|
||||
('home', 1, 'office');
|
||||
|
||||
--
|
||||
-- Table structure for table `ospos_receivings`
|
||||
@@ -556,6 +569,8 @@ CREATE TABLE `ospos_sales` (
|
||||
`sale_id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`sale_status` tinyint(2) NOT NULL DEFAULT 0,
|
||||
`dinner_table_id` int(11) NULL,
|
||||
`work_order_number` varchar(32) DEFAULT NULL,
|
||||
`sale_type` tinyint(2) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`sale_id`),
|
||||
KEY `customer_id` (`customer_id`),
|
||||
KEY `employee_id` (`employee_id`),
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"public_stats": true
|
||||
},
|
||||
"version": {
|
||||
"name": "3.1.1"
|
||||
"name": "3.2.0"
|
||||
},
|
||||
"files":
|
||||
[
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "opensourcepos",
|
||||
"version": "3.1.1",
|
||||
"version": "3.2.0",
|
||||
"description": "Open Source Point of Sale is a web based point of sale system written in the PHP language. It uses MySQL as the data storage back-end and has a simple user interface.",
|
||||
"main": "index.php",
|
||||
"license": "MIT",
|
||||
|
||||
BIN
public/images/menubar/home.png
Normal file
BIN
public/images/menubar/home.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/images/menubar/office.png
Normal file
BIN
public/images/menubar/office.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user