Merge branch 'feature/multistore_support' into feature/invoice_numbering

This commit is contained in:
jekkos-t520
2014-10-03 08:03:59 +02:00
40 changed files with 386 additions and 134 deletions

1
.gitignore vendored
View File

@@ -11,3 +11,4 @@ git-svn-diff.py
*.swp
*.rej
*.orig
*~

View File

@@ -9,7 +9,7 @@
|
|
*/
$config['application_version'] = '2.3';
$config['application_version'] = '2.3.1';
/*
|--------------------------------------------------------------------------

View File

@@ -36,6 +36,10 @@ define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
| Precision for calculations performed on decimals
*/
define("PRECISION", 3);
/* End of file constants.php */
/* Location: ./application/config/constants.php */

View File

@@ -6,6 +6,7 @@ class Items extends Secure_area implements iData_controller
function __construct()
{
parent::__construct('items');
$this->load->library('item_lib');
}
function index()
@@ -16,9 +17,14 @@ class Items extends Secure_area implements iData_controller
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$stock_location=$this->item_lib->get_item_location();
$stock_locations=$this->Stock_locations->get_allowed_locations();
$data['stock_location']=$this->item_lib->get_item_location();
$data['stock_locations']=$stock_locations;
$data['controller_name']=strtolower(get_class());
$data['form_width']=$this->get_form_width();
$data['manage_table']=get_items_manage_table( $this->Item->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
$data['manage_table']=get_items_manage_table( $this->Item->get_all( $stock_location, $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
$this->load->view('items/manage',$data);
}
@@ -27,7 +33,13 @@ class Items extends Secure_area implements iData_controller
$is_serialized=$this->input->post('is_serialized');
$no_description=$this->input->post('no_description');
$search_custom=$this->input->post('search_custom');//GARRISON ADDED 4/13/2013
$is_deleted=$this->input->post('is_deleted'); // Parq 131215
$is_deleted=$this->input->post('is_deleted'); // Parq 131215
$this->item_lib->set_item_location($this->input->post('stock_location'));
$stock_location=$this->input->post('stock_location');
$stock_locations=$this->Stock_locations->get_allowed_locations();
$data['stock_location']=$this->item_lib->get_item_location();
$data['stock_locations']=$stock_locations;
$data['search_section_state']=$this->input->post('search_section_state');
$data['is_serialized']=$this->input->post('is_serialized');
@@ -36,7 +48,7 @@ class Items extends Secure_area implements iData_controller
$data['is_deleted']=$this->input->post('is_deleted'); // Parq 131215
$data['controller_name']=strtolower(get_class());
$data['form_width']=$this->get_form_width();
$data['manage_table']=get_items_manage_table($this->Item->get_all_filtered($is_serialized,$no_description,$search_custom,$is_deleted),$this);//GARRISON MODIFIED 4/13/2013, Parq 131215
$data['manage_table']=get_items_manage_table($this->Item->get_all_filtered($stock_location,$is_serialized,$no_description,$search_custom,$is_deleted),$this);//GARRISON MODIFIED 4/13/2013, Parq 131215
$this->load->view('items/manage',$data);
}
@@ -182,13 +194,15 @@ class Items extends Secure_area implements iData_controller
function get_row()
{
$item_id = $this->input->post('row_id');
$data_row=get_item_data_row($this->Item->get_info($item_id),$this);
$stock_location_id=$this->item_lib->get_item_location();
$data_row=get_item_data_row($this->Item->get_info($item_id,$stock_location_id),$this);
echo $data_row;
}
function view($item_id=-1)
{
$data['item_info']=$this->Item->get_info($item_id);
$stock_location_id=$this->item_lib->get_item_location();
$data['item_info']=$this->Item->get_info($item_id,$stock_location_id);
$data['item_tax_info']=$this->Item_taxes->get_info($item_id);
$suppliers = array('' => $this->lang->line('items_none'));
foreach($this->Supplier->get_all()->result_array() as $row)
@@ -197,20 +211,19 @@ class Items extends Secure_area implements iData_controller
}
$data['suppliers']=$suppliers;
$data['selected_supplier'] = $this->Item->get_info($item_id)->supplier_id;
$data['selected_supplier'] = $this->Item->get_info($item_id,$stock_location_id)->supplier_id;
$data['default_tax_1_rate']=($item_id==-1) ? $this->Appconfig->get('default_tax_1_rate') : '';
$data['default_tax_2_rate']=($item_id==-1) ? $this->Appconfig->get('default_tax_2_rate') : '';
$locations_data = $this->Stock_locations->get_undeleted_all()->result_array();
$location_array;
foreach($locations_data as $location)
{
$quantity = $this->Item_quantities->get_item_quantity($item_id, $location['location_id'])->quantity;
$quantity = ($item_id == -1) ? null: $quantity;
$location_array[$location['location_id']] = array('location_name'=>$location['location_name'],
'quantity'=>$quantity);
$data['stock_locations']= $location_array;
}
$data['stock_locations']= $location_array;
$this->load->view("items/form",$data);
}

View File

@@ -6,7 +6,7 @@ class No_Access extends CI_Controller
parent::__construct();
}
function index($module_id='')
function index($module_id='',$submodule_id='')
{
$data['module_name']=$this->Module->get_module_name($module_id);
$this->load->view('no_access',$data);

View File

@@ -4,7 +4,7 @@ class Receivings extends Secure_area
{
function __construct()
{
parent::__construct('receivings');
parent::__construct('receivings','items');
$this->load->library('receiving_lib');
}

View File

@@ -6,9 +6,19 @@ define("FORM_WIDTH", "400");
class Reports extends Secure_area
{
function __construct()
{
parent::__construct('reports');
$method_name = $this->uri->segment(2);
$exploder = explode('_', $method_name);
$submodule_id = preg_match("/([^_.]*)(?:_graph)?$/", $method_name, $matches);
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
// check access to report submodule
/* if (sizeof($exploder) > 1 && !$this->Employee->has_permission('reports_'.$matches[1],$employee_id))
{
redirect('no_access/'.$submodule_id);
} */
$this->load->helper('report');
}
@@ -927,7 +937,7 @@ class Reports extends Secure_area
}
$data = array(
"title" => $this->lang->line('reports_low_inventory_report'),
"title" => $this->lang->line('reports_inventory_low_report'),
"subtitle" => '',
"headers" => $model->getDataColumns(),
"data" => $tabular_data,

View File

@@ -4,7 +4,7 @@ class Sales extends Secure_area
{
function __construct()
{
parent::__construct('sales');
parent::__construct('sales','items');
$this->load->library('sale_lib');
}
@@ -361,17 +361,8 @@ class Sales extends Secure_area
$data['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return'));
$data['mode']=$this->sale_lib->get_mode();
$data['stock_locations'] = array();
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
$show_stock_locations = count($stock_locations) > 1;
if ($show_stock_locations) {
foreach($stock_locations as $location_data)
{
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
}
$data['stock_location']=$this->sale_lib->get_sale_location();
}
$data['show_stock_locations'] = $show_stock_locations;
$data['stock_locations']=$this->Stock_locations->get_allowed_locations();
$data['stock_location']=$this->sale_lib->get_sale_location();
$data['subtotal']=$this->sale_lib->get_subtotal();
$data['taxes']=$this->sale_lib->get_taxes();

View File

@@ -5,7 +5,7 @@ class Secure_area extends CI_Controller
Controllers that are considered secure extend Secure_area, optionally a $module_id can
be set to also check if a user can access a particular module in the system.
*/
function __construct($module_id=null)
function __construct($module_id=null,$submodule_id=null)
{
parent::__construct();
$this->load->model('Employee');
@@ -13,8 +13,9 @@ class Secure_area extends CI_Controller
{
redirect('login');
}
if(!$this->Employee->has_permission($module_id,$this->Employee->get_logged_in_employee_info()->person_id))
$submodule_id = empty($submodule_id) ? $module_id : $submodule_id;
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
if(!$this->Employee->has_permission($module_id,$employee_id) || !$this->Employee->has_subpermission($submodule_id,$employee_id))
{
redirect('no_access/'.$module_id);
}

View File

@@ -84,4 +84,26 @@ function random_color()
$c .= sprintf("%02X", mt_rand(0, 255));
}
return $c;
}
function show_report_if_allowed($allowed_modules, $report_prefix, $report_name, $permission='')
{
$CI =& get_instance();
$lang_line = 'reports_' .$report_name;
$report_label = $CI->lang->line($lang_line);
$permission = empty($permission) ? $report_name : $permission;
$report_prefix = empty($report_prefix) ? '' : $report_prefix . '_';
// no summary nor detailed reports for receivings
if (!empty($report_label) && !(preg_match('/.*summary_?$/', $report_prefix) && $report_name === "receivings"))
{
foreach($allowed_modules->result() as $module)
{
if ($module->module_id == 'reports_'. $permission)
{
?>
<li><a href="<?php echo site_url('reports/' . $report_prefix . $report_name);?>"><?php echo $report_label; ?></a></li>
<?php
}
}
}
}

View File

@@ -211,7 +211,7 @@ function get_item_data_row($item,$controller)
$width = $controller->get_form_width();
$item_quantity='';
$locations_data = $CI->Stock_locations->get_undeleted_all()->result_array();
/* $locations_data = $CI->Stock_locations->get_allowed_locations()->result_array();
foreach($locations_data as $location)
{
if (count($locations_data) > 1)
@@ -219,7 +219,7 @@ function get_item_data_row($item,$controller)
$item_quantity .= $location['location_name'].': ';
}
$item_quantity .= $CI->Item_quantities->get_item_quantity($item->item_id, $location['location_id'])->quantity . '<br/>';
}
} */
$table_data_row='<tr>';
$table_data_row.="<td width='3%'><input type='checkbox' id='item_$item->item_id' value='".$item->item_id."'/></td>";
@@ -228,7 +228,7 @@ function get_item_data_row($item,$controller)
$table_data_row.='<td width="14%">'.$item->category.'</td>';
$table_data_row.='<td width="14%">'.to_currency($item->cost_price).'</td>';
$table_data_row.='<td width="14%">'.to_currency($item->unit_price).'</td>';
$table_data_row.='<td width="14%">'.$item_quantity.'</td>';
$table_data_row.='<td width="14%">'.$item->quantity.'</td>';
$table_data_row.='<td width="14%">'.$tax_percents.'</td>';
$table_data_row.='<td width="5%">'.anchor($controller_name."/view/$item->item_id/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update'))).'</td>';

View File

@@ -77,10 +77,6 @@ $lang['items_manually_editing_of_quantity'] = 'Manual Edit of Quantity';
$lang['items_inventory'] = 'Inventory';
$lang['items_location'] = 'Location';
$lang['items_is_deleted'] = 'Deleted';// Parq 131215
$lang['items_stock_type_sale'] = 'Sale stock';
$lang['items_stock_type_warehouse'] = 'Warehouse stock';
$lang['items_unit_quantity'] = 'Unit quantity';
$lang['items_related_number'] = 'Related item number';
$lang['items_stock_location']='Stock location';
?>

View File

@@ -68,11 +68,11 @@ $lang['reports_summary_reports'] = 'Summary Reports';
$lang['reports_graphical_reports'] = 'Graphical Reports';
$lang['reports_detailed_reports'] = 'Detailed Reports';
$lang['reports_inventory_reports'] = 'Inventory Reports';
$lang['reports_low_inventory'] = 'Low Inventory';
$lang['reports_inventory_low'] = 'Low Inventory';
$lang['reports_inventory_summary'] = ' Inventory Summary';
$lang['reports_item_number'] = 'Item Number';
$lang['reports_reorder_level'] = 'Reorder Level';
$lang['reports_low_inventory_report'] = 'Low Inventory Report';
$lang['reports_inventory_low_report'] = 'Low Inventory Report';
$lang['reports_item_name'] = 'Item Name';
$lang['reports_inventory_summary_report'] = 'Inventory Summary Report';
$lang['reports_payment_type'] = 'Payment Type';
@@ -92,4 +92,5 @@ $lang['reports_sales'] = 'Sales';
$lang['reports_requisitions'] = 'Requisitions';
$lang['reports_receiving_id'] = 'Receiving ID';
$lang['reports_stock_location'] = 'Stock location';
$lang['reports_inventory'] = 'Inventory';
?>

View File

@@ -66,11 +66,11 @@ $lang['reports_summary_reports'] = 'Reportes Resumidos';
$lang['reports_graphical_reports'] = 'Reportes Gráficos';
$lang['reports_detailed_reports'] = 'Reportes Detallados';
$lang['reports_inventory_reports'] = 'Reportes de Inventario';
$lang['reports_low_inventory'] = 'Inventario Bajo';
$lang['reports_inventory_low'] = 'Inventario Bajo';
$lang['reports_inventory_summary'] = 'Resumen de Inventario';
$lang['reports_item_number'] = 'Número de Artículo';
$lang['reports_reorder_level'] = 'Cantidad Mínima';
$lang['reports_low_inventory_report'] = 'Reporte de Inventario Bajo';
$lang['reports_inventory_low_report'] = 'Reporte de Inventario Bajo';
$lang['reports_item_name'] = 'Nombre del Artículo';
$lang['reports_inventory_summary_report'] = 'Reporte de Resumen de Inventario';
$lang['reports_payment_type'] = 'Tipo de Pago';

View File

@@ -68,11 +68,11 @@ $lang['reports_summary_reports'] = 'Rapports de Résumés';
$lang['reports_graphical_reports'] = 'Rapports Graphiques';
$lang['reports_detailed_reports'] = 'Rapports Détaillés';
$lang['reports_inventory_reports'] = 'Rapports d\'Inventaire';
$lang['reports_low_inventory'] = 'Niveau d\'Inventaire Bas';
$lang['reports_inventory_low'] = 'Niveau d\'Inventaire Bas';
$lang['reports_inventory_summary'] = ' Résumé d\'Inventaire';
$lang['reports_item_number'] = 'Numéro d\'Item';
$lang['reports_reorder_level'] = 'Seuil de Réapprovisionnement';
$lang['reports_low_inventory_report'] = 'Rapport de Niveau d\'Inventaire Bas';
$lang['reports_inventory_low_report'] = 'Rapport de Niveau d\'Inventaire Bas';
$lang['reports_item_name'] = 'Nom d\'Item';
$lang['reports_inventory_summary_report'] = 'Rapport: Résumé d\'Inventaire';
$lang['reports_payment_type'] = 'Type Paiement';

View File

@@ -66,11 +66,11 @@ $lang['reports_summary_reports'] = 'Ringkasan Laporan';
$lang['reports_graphical_reports'] = 'Laporan Dalam Bentuk Grafis';
$lang['reports_detailed_reports'] = 'Perincian Laporan';
$lang['reports_inventory_reports'] = 'Laporan Inventori';
$lang['reports_low_inventory'] = 'Laporan Inventori Rendah';
$lang['reports_inventory_low'] = 'Laporan Inventori Rendah';
$lang['reports_inventory_summary'] = 'Laporan Ringkasan Inventori';
$lang['reports_item_number'] = 'Nomor Barang';
$lang['reports_reorder_level'] = 'Level Pesan Ulang';
$lang['reports_low_inventory_report'] = 'Laporan Inventori Rendah';
$lang['reports_inventory_low_report'] = 'Laporan Inventori Rendah';
$lang['reports_item_name'] = 'Nama Barang';
$lang['reports_inventory_summary_report'] = 'Laporan Ringkasan Inventori';
$lang['reports_payment_type'] = 'Jenis Pembayaran';

View File

@@ -66,11 +66,11 @@ $lang['reports_summary_reports'] = 'Overzicht Rapporten';
$lang['reports_graphical_reports'] = 'Grafische Rapporten';
$lang['reports_detailed_reports'] = 'Gedetailleerde Rapporten';
$lang['reports_inventory_reports'] = 'Rapporten Bevoorrading';
$lang['reports_low_inventory'] = 'Herbevoorrading';
$lang['reports_inventory_low'] = 'Herbevoorrading';
$lang['reports_inventory_summary'] = 'Overzicht Vooraad';
$lang['reports_item_number'] = 'Productnummer';
$lang['reports_reorder_level'] = 'Reorder Level';
$lang['reports_low_inventory_report'] = 'Rapport Herbevoorrading';
$lang['reports_inventory_low_report'] = 'Rapport Herbevoorrading';
$lang['reports_item_name'] = 'Product Naam';
$lang['reports_inventory_summary_report'] = 'Rapport Overzicht Vooraad';
$lang['reports_payment_type'] = 'Payment Type';

View File

@@ -66,11 +66,11 @@ $lang['reports_summary_reports'] = 'Сводные отчеты';
$lang['reports_graphical_reports'] = 'графических отчетов';
$lang['reports_detailed_reports'] = 'Подробные отчеты';
$lang['reports_inventory_reports'] = 'Инвентаризация Отчеты';
$lang['reports_low_inventory'] = 'Низкий инвентаризации';
$lang['reports_inventory_low'] = 'Низкий инвентаризации';
$lang['reports_inventory_summary'] = ' Сводка инвентаризации';
$lang['reports_item_number'] = 'Номер Товара';
$lang['reports_reorder_level'] = 'минимальный уровень';
$lang['reports_low_inventory_report'] = 'отчет Низкии инвентаризации';
$lang['reports_inventory_low_report'] = 'отчет Низкии инвентаризации';
$lang['reports_item_name'] = 'Название товара';
$lang['reports_inventory_summary_report'] = 'Отчет Сводка инвентаризации';
$lang['reports_payment_type'] = 'Вид оплаты';

View File

@@ -77,9 +77,6 @@ $lang['items_use_inventory_menu'] = 'ใช้สินค้าคงเหล
$lang['items_manually_editing_of_quantity'] = 'แก้ไขจำนวน';
$lang['items_inventory'] = 'สินค้าคงเหลือ';
$lang['items_location'] = 'ที่ตั้ง';
$lang['items_unit_quantity'] = 'จำนวนหน่วย';
$lang['items_related_number'] = 'สินค้าที่เกี่ยวข้อง';
$lang['items_stock_type_warehouse'] = 'สินค้าหลังร้าน';
$lang['items_stock_type'] = 'ชนิดของสินค้า';
?>

View File

@@ -66,11 +66,11 @@ $lang['reports_summary_reports'] = 'สรุปรายงาน';
$lang['reports_graphical_reports'] = 'รายงายแบบกราฟ';
$lang['reports_detailed_reports'] = 'รายละเอียดรายงาน';
$lang['reports_inventory_reports'] = 'รายงานสินค้าคงเหลือ';
$lang['reports_low_inventory'] = 'สินค้าเหลือน้อย';
$lang['reports_inventory_low'] = 'สินค้าเหลือน้อย';
$lang['reports_inventory_summary'] = ' รายงานสินค้าคงเหลือ';
$lang['reports_item_number'] = 'เลขสินค้า';
$lang['reports_reorder_level'] = 'ระดับการสั่งใหม่';
$lang['reports_low_inventory_report'] = 'รายงานสินค้าที่เหลือน้อย';
$lang['reports_inventory_low_report'] = 'รายงานสินค้าที่เหลือน้อย';
$lang['reports_item_name'] = 'ชื่อสินค้า';
$lang['reports_inventory_summary_report'] = 'รายงานสรุปสินค้าคงเหลือ';
$lang['reports_payment_type'] = 'ชนิดการจ่าย';
@@ -166,11 +166,11 @@ $lang['reports_summary_reports'] = 'สรุปรายงาน';
$lang['reports_graphical_reports'] = 'รายงายแบบกราฟ';
$lang['reports_detailed_reports'] = 'รายละเอียดรายงาน';
$lang['reports_inventory_reports'] = 'รายงานสินค้าคงเหลือ';
$lang['reports_low_inventory'] = 'สินค้าเหลือน้อย';
$lang['reports_inventory_low'] = 'สินค้าเหลือน้อย';
$lang['reports_inventory_summary'] = ' รายงานสินค้าคงเหลือ';
$lang['reports_item_number'] = 'เลขสินค้า';
$lang['reports_reorder_level'] = 'ระดับการสั่งใหม่';
$lang['reports_low_inventory_report'] = 'รายงานสินค้าที่เหลือน้อย';
$lang['reports_inventory_low_report'] = 'รายงานสินค้าที่เหลือน้อย';
$lang['reports_item_name'] = 'ชื่อสินค้า';
$lang['reports_inventory_summary_report'] = 'รายงานสรุปสินค้าคงเหลือ';
$lang['reports_payment_type'] = 'ชนิดการจ่าย';

View File

@@ -66,11 +66,11 @@ $lang['reports_summary_reports'] = '摘要報表';
$lang['reports_graphical_reports'] = '圖表';
$lang['reports_detailed_reports'] = '詳細報表';
$lang['reports_inventory_reports'] = '庫存報告';
$lang['reports_low_inventory'] = '低庫存';
$lang['reports_inventory_low'] = '低庫存';
$lang['reports_inventory_summary'] = ' 庫存摘要';
$lang['reports_item_number'] = '產品數量';
$lang['reports_reorder_level'] = '補貨點';
$lang['reports_low_inventory_report'] = '低庫存報告';
$lang['reports_inventory_low_report'] = '低庫存報告';
$lang['reports_item_name'] = '產品名稱';
$lang['reports_inventory_summary_report'] = '庫存報告摘要';
$lang['reports_payment_type'] = '付款模式';

View File

@@ -0,0 +1,34 @@
<?php
class Item_lib
{
var $CI;
function __construct()
{
$this->CI =& get_instance();
}
function get_item_location()
{
if(!$this->CI->session->userdata('item_location'))
{
$stock_locations = $this->CI->Stock_locations->get_undeleted_all()->result_array();
$location_name = $stock_locations[0]['location_id'];
$this->set_item_location($location_name);
}
return $this->CI->session->userdata('item_location');
}
function set_item_location($location)
{
$this->CI->session->set_userdata('item_location',$location);
}
function clear_item_location()
{
$this->CI->session->unset_userdata('item_location');
}
}
?>

View File

@@ -135,7 +135,7 @@ class Receiving_lib
}
$insertkey=$maxkey+1;
$item_info=$this->CI->Item->get_info($item_id);
$item_info=$this->CI->Item->get_info($item_id,$item_location);
//array records are identified by $insertkey and item_id is just another field.
$item = array(($insertkey)=>
array(

View File

@@ -1,5 +1,4 @@
<?php
define("PRECISION", 3);
class Sale_lib
{
@@ -231,7 +230,7 @@ class Sale_lib
}
$insertkey=$maxkey+1;
$item_info=$this->CI->Item->get_info($item_id);
$item_info=$this->CI->Item->get_info($item_id,$item_location);
//array/cart records are identified by $insertkey and item_id is just another field.
$item = array(($insertkey)=>
array(

View File

@@ -303,6 +303,26 @@ class Employee extends Person
return false;
}
/*
* Determines whether the employee has access to at least one submodule
*/
function has_subpermission($submodule_id,$person_id)
{
$this->db->from('modules');
$this->db->where('module_id like "' . $submodule_id . '_%"');
// has no submodules
$result = $this->db->get();
if ($result->num_rows() > 0)
{
$this->db->from('permissions');
$this->db->where('permissions.module_id like "' . $submodule_id . '_%"');
$this->db->where("permissions.person_id",$person_id);
$result = $this->db->get();
return $result->num_rows() > 0;
}
return true;
}
/*
Determins whether the employee specified employee has access the specific module.
*/
@@ -315,10 +335,7 @@ class Employee extends Person
}
$query = $this->db->get_where('permissions', array('person_id' => $person_id,'module_id'=>$module_id), 1);
return $query->num_rows() == 1;
return false;
return ($query->num_rows() == 1);
}
}

View File

@@ -16,11 +16,13 @@ class Item extends CI_Model
/*
Returns all the items
*/
function get_all($limit=10000, $offset=0)
function get_all($stock_location_id,$limit=10000,$offset=0)
{
$this->db->from('items');
$this->db->join('item_quantities','item_quantities.item_id=items.item_id');
$this->db->where('deleted',0);
$this->db->order_by("name", "asc");
$this->db->where('location_id',$stock_location_id);
$this->db->order_by("name","asc");
$this->db->limit($limit);
$this->db->offset($offset);
return $this->db->get();
@@ -33,9 +35,11 @@ class Item extends CI_Model
return $this->db->count_all_results();
}
function get_all_filtered($is_serialized=0,$no_description,$search_custom,$is_deleted)/**GARRISON MODIFIED 4/21/2013, Parq 131215 **/
function get_all_filtered($stock_location_id,$is_serialized=0,$no_description,$search_custom,$is_deleted)/**GARRISON MODIFIED 4/21/2013, Parq 131215 **/
{
$this->db->from('items');
$this->db->join('item_quantities','item_quantities.item_id=items.item_id');
$this->db->where('location_id',$stock_location_id);
if ($is_serialized !=0 )
{
$this->db->where('is_serialized',1);
@@ -62,14 +66,7 @@ class Item extends CI_Model
$this->db->or_like('custom10',$search);
}
**/
/* Parq 131215 start*/
if ($is_deleted !=0 )
{
$this->db->where('deleted',1);
} else {
$this->db->where('deleted',0);
}
/* Parq 131215 end*/
$this->db->where('deleted',$is_deleted);
$this->db->order_by("name", "asc");
return $this->db->get();
}
@@ -77,10 +74,15 @@ class Item extends CI_Model
/*
Gets information about a particular item
*/
function get_info($item_id)
function get_info($item_id,$stock_location_id=0)
{
$this->db->from('items');
$this->db->where('item_id',$item_id);
$this->db->join('item_quantities','item_quantities.item_id=items.item_id');
if ($stock_location_id > 0)
{
$this->db->where('location_id',$stock_location_id);
}
$this->db->where('items.item_id',$item_id);
$query = $this->db->get();

View File

@@ -46,5 +46,6 @@ class Module extends CI_Model
$this->db->order_by("sort", "asc");
return $this->db->get();
}
}
?>

View File

@@ -13,6 +13,9 @@ class Stock_locations extends CI_Model
function get_all($limit=10000, $offset=0)
{
$this->db->from('stock_locations');
$this->db->join('modules', 'modules.module_id=concat(\'items_stock\', location_id)');
$this->db->join('permissions', 'permissions.module_id=modules.module_id');
$this->db->where('person_id', $this->session->userdata('person_id'));
$this->db->limit($limit);
$this->db->offset($offset);
return $this->db->get();
@@ -22,6 +25,9 @@ class Stock_locations extends CI_Model
{
$this->db->select('location_name');
$this->db->from('stock_locations');
$this->db->join('modules', 'modules.module_id=concat(\'items_stock\', location_id)');
$this->db->join('permissions', 'permissions.module_id=modules.module_id');
$this->db->where('person_id', $this->session->userdata('person_id'));
$this->db->where('deleted', 0);
return $this->db->get();
}
@@ -34,27 +40,30 @@ class Stock_locations extends CI_Model
return $this->db->get()->row();
}
function get_undeleted_all($limit=10000, $offset=0)
function get_undeleted_all()
{
$this->db->from('stock_locations');
$this->db->join('modules', 'modules.module_id=concat(\'items_stock\', location_id)');
$this->db->join('permissions', 'permissions.module_id=modules.module_id');
$this->db->where('person_id', $this->session->userdata('person_id'));
$this->db->where('deleted',0);
$this->db->limit($limit);
$this->db->offset($offset);
return $this->db->get();
}
function get_location_id($location_name)
function get_allowed_locations()
{
$this->db->from('stock_locations');
$this->db->where('deleted',0);
$this->db->where('location_name',$location_name);
return $this->db->get()->row()->location_id;
$stock = $this->get_undeleted_all()->result_array();
$stock_locations = array();
foreach($stock as $location_data)
{
$stock_locations[$location_data['location_id']] = $location_data['location_name'];
}
return $stock_locations;
}
function get_location_name($location_id)
{
$this->db->from('stock_locations');
$this->db->where('deleted',0);
$this->db->where('location_id',$location_id);
return $this->db->get()->row()->location_name;
}
@@ -91,6 +100,8 @@ class Stock_locations extends CI_Model
$this->db->where('location_id', $db['location_id']);
$this->db->update('stock_locations',array('location_name'=>$db['location_name'],'deleted'=>0));
// remmove module (and permissions) for stock location
$this->db->delete('modules', array('module_id' => 'items_stock'.$db['location_id']));
}
$to_create = false;
break;
@@ -101,6 +112,18 @@ class Stock_locations extends CI_Model
{
$location_data = array('location_name'=>$location,'deleted'=>0);
$this->db->insert('stock_locations',$location_data);
// insert new module for stock location
$module_id = 'items_stock'.$this->db->insert_id();
$module_name = 'module_'.$module_id;
$module_data = array('name_lang_key' => $module_name, 'desc_lang_key' => $module_name.'_desc', 'module_id' => $module_id);
$this->db->insert('modules', $module_data);
// insert permissions for stock location
$employees = $this->Employee->get_all();
foreach ($employees->result_array() as $employee)
{
$permission_data = array('module_id' => $module_id, 'person_id' => $employee['person_id']);
$this->db->insert('permissions', $permission_data);
}
}
}
$this->db->trans_complete();

View File

@@ -54,15 +54,35 @@ $password_label_attributes = $person_info->person_id == "" ? array('class'=>'req
<?php
foreach($all_modules->result() as $module)
{
if (sizeof(explode('_', $module->module_id)) == 1)
{
?>
<li>
<?php echo form_checkbox("permissions[]",$module->module_id,$this->Employee->has_permission($module->module_id,$person_info->person_id)); ?>
<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>
</li>
<?php
foreach($all_modules->result() as $submodule)
{
$exploded_submodule_id = explode('_', $submodule->module_id);
if (sizeof($exploded_submodule_id) > 1 && $exploded_submodule_id[0] == $module->module_id)
{
$lang_line = $this->lang->line('reports_'.$exploded_submodule_id[1]);
$lang_line = empty($lang_line) ? $this->Stock_locations->get_location_name(substr($exploded_submodule_id[1], -1)) : $lang_line;
?>
<ul>
<li>
<?php echo form_checkbox("permissions[]",$submodule->module_id,$this->Employee->has_permission($submodule->module_id,$person_info->person_id)); ?>
<span class="medium"><?php echo $lang_line ?></span>
</li>
</ul>
<?php
}
}
}
}
?>
</li>
</ul>
<?php
echo form_submit(array(
@@ -82,6 +102,27 @@ echo form_close();
//validation and submit handling
$(document).ready(function()
{
$("ul#permission_list > li > input[name='permissions[]']").each(function()
{
var $this = $(this);
$("ul > li > input", $this.parent()).each(function()
{
var $that = $(this);
var updateCheckboxes = function (checked)
{
if (checked) {
$that.removeAttr("disabled");
} else {
$that.attr("disabled", "disabled");
$that.removeAttr("checked", "");
}
}
$this.change(function() {
updateCheckboxes($this.is(":checked"));
});
});
});
$('#employee_form').validate({
submitHandler:function(form)
{
@@ -123,7 +164,30 @@ $(document).ready(function()
{
equalTo: "#password"
},
email: "email"
email: "email", "permissions[]" : {
required : function(element) {
var checked = false;
$("ul#permission_list > li > input:checkbox").each(function()
{
if ($(this).is(":checked")) {
var has_children = false;
$("ul > li > input:checkbox", $(this).parent()).each(function()
{
has_children = true;
checked |= $(this).is(":checked");
console.log("checking.. " + $(this).val() + " required " + checked);
});
if (has_children && !checked)
{
return false;
}
}
});
console.log("returning " + !checked);
return !checked;
},
minlength: 1
}
},
messages:
{
@@ -151,7 +215,8 @@ $(document).ready(function()
{
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'); ?>",
"permissions[]": "fill in correctly!!"
}
});
});

View File

@@ -5,6 +5,8 @@
<?php
foreach($allowed_modules->result() as $module)
{
if (sizeof(explode('_', $module->module_id)) == 1)
{
?>
<div class="module_item">
<a href="<?php echo site_url("$module->module_id");?>">
@@ -13,6 +15,7 @@
- <?php echo $this->lang->line('module_'.$module->module_id.'_desc');?>
</div>
<?php
}
}
?>
</div>

View File

@@ -152,6 +152,12 @@ function show_hide_search_filter(search_filter_section, switchImgTag) {
<li class="float_left"><span><?php echo anchor("$controller_name/delete",$this->lang->line("common_delete"),array('id'=>'delete')); ?></span></li>
<li class="float_left"><span><?php echo anchor("$controller_name/bulk_edit/width:$form_width",$this->lang->line("items_bulk_edit"),array('id'=>'bulk_edit','title'=>$this->lang->line('items_edit_multiple_items'))); ?></span></li>
<li class="float_left"><span><?php echo anchor("$controller_name/generate_barcodes",$this->lang->line("items_generate_barcodes"),array('id'=>'generate_barcodes', 'target' =>'_blank','title'=>$this->lang->line('items_generate_barcodes'))); ?></span></li>
<?php if (count($stock_locations) > 1): ?>
<li class="float_left"><span>
<?php echo form_open("$controller_name/refresh",array('id'=>'stock_filter_form')); ?>
<?php echo form_dropdown('stock_location',$stock_locations,$stock_location,'id="stock_location" onchange="$(\'#stock_filter_form\').submit();"'); ?>
</form></span></li>
<?php endif; ?>
<li class="float_right">
<img src='<?php echo base_url()?>images/spinner_small.gif' alt='spinner' id='spinner' />
<?php echo form_open("$controller_name/search",array('id'=>'search_form')); ?>

View File

@@ -44,13 +44,16 @@ html {
<?php
foreach($allowed_modules->result() as $module)
{
?>
if (sizeof(explode('_', $module->module_id)) == 1)
{
?>
<div class="menu_item">
<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><br />
<a href="<?php echo site_url("$module->module_id");?>"><?php echo $this->lang->line("module_".$module->module_id) ?></a>
</div>
<?php
<?php
}
}
?>
</div>

View File

@@ -4,7 +4,6 @@ $this->load->view("partial/header");
<div id="page_title" style="margin-bottom:8px;"><?php echo $title ?></div>
<div id="page_subtitle" style="margin-bottom:8px;"><?php echo $subtitle ?></div>
<div style="text-align: center;">
<script type="text/javascript">
swfobject.embedSWF(
"<?php echo base_url(); ?>open-flash-chart.swf", "chart",

View File

@@ -5,49 +5,60 @@
<ul id="report_list">
<li><h3><?php echo $this->lang->line('reports_graphical_reports'); ?></h3>
<ul>
<li><a href="<?php echo site_url('reports/graphical_summary_sales');?>"><?php echo $this->lang->line('reports_sales'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_categories');?>"><?php echo $this->lang->line('reports_categories'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_customers');?>"><?php echo $this->lang->line('reports_customers'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_suppliers');?>"><?php echo $this->lang->line('reports_suppliers'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_items');?>"><?php echo $this->lang->line('reports_items'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_employees');?>"><?php echo $this->lang->line('reports_employees'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_taxes');?>"><?php echo $this->lang->line('reports_taxes'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_discounts');?>"><?php echo $this->lang->line('reports_discounts'); ?></a></li>
<li><a href="<?php echo site_url('reports/graphical_summary_payments');?>"><?php echo $this->lang->line('reports_payments'); ?></a></li>
<?php
foreach($allowed_modules->result() as $module)
{
show_report_if_allowed($allowed_modules, 'graphical_summary', $module->module_id);
}
foreach(array('categories', 'taxes', 'discounts', 'payments') as $sales_category)
{
show_report_if_allowed($allowed_modules, 'graphical_summary', $sales_category, 'sales');
}
?>
</ul>
</li>
<li><h3><?php echo $this->lang->line('reports_summary_reports'); ?></h3>
<ul>
<li><a href="<?php echo site_url('reports/summary_sales');?>"><?php echo $this->lang->line('reports_sales'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_categories');?>"><?php echo $this->lang->line('reports_categories'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_customers');?>"><?php echo $this->lang->line('reports_customers'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_suppliers');?>"><?php echo $this->lang->line('reports_suppliers'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_items');?>"><?php echo $this->lang->line('reports_items'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_employees');?>"><?php echo $this->lang->line('reports_employees'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_taxes');?>"><?php echo $this->lang->line('reports_taxes'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_discounts');?>"><?php echo $this->lang->line('reports_discounts'); ?></a></li>
<li><a href="<?php echo site_url('reports/summary_payments');?>"><?php echo $this->lang->line('reports_payments'); ?></a></li>
<?php
foreach($allowed_modules->result() as $module)
{
show_report_if_allowed($allowed_modules, 'summary', $module->module_id);
}
foreach(array('categories', 'taxes', 'discounts', 'payments') as $sales_category)
{
show_report_if_allowed($allowed_modules, 'summary', $sales_category, 'sales');
}
?>
</ul>
</li>
<li><h3><?php echo $this->lang->line('reports_detailed_reports'); ?></h3>
<ul>
<li><a href="<?php echo site_url('reports/detailed_sales');?>"><?php echo $this->lang->line('reports_sales'); ?></a></li>
<li><a href="<?php echo site_url('reports/detailed_receivings');?>"><?php echo $this->lang->line('reports_receivings'); ?></a></li>
<li><a href="<?php echo site_url('reports/specific_customer');?>"><?php echo $this->lang->line('reports_customer'); ?></a></li>
<li><a href="<?php echo site_url('reports/specific_discount');?>"><?php echo $this->lang->line('reports_discount'); ?></a></li>
<li><a href="<?php echo site_url('reports/specific_employee');?>"><?php echo $this->lang->line('reports_employee'); ?></a></li>
<?php
show_report_if_allowed($allowed_modules, 'detailed', 'sales');
show_report_if_allowed($allowed_modules, 'detailed', 'receivings');
show_report_if_allowed($allowed_modules, 'specific', 'customer', 'customers');
show_report_if_allowed($allowed_modules, 'specific', 'discount', 'sales');
show_report_if_allowed($allowed_modules, 'specific', 'employee', 'employees');
?>
</ul>
</li>
<?php
if ($this->Employee->has_permission('reports_inventory', $this->session->userdata('person_id')))
{
?>
<li><h3><?php echo $this->lang->line('reports_inventory_reports'); ?></h3>
<ul>
<li><a href="<?php echo site_url('reports/inventory_low');?>"><?php echo $this->lang->line('reports_low_inventory'); ?></a></li>
<li><a href="<?php echo site_url('reports/inventory_summary');?>"><?php echo $this->lang->line('reports_inventory_summary'); ?></a></li>
<?php
show_report_if_allowed($allowed_modules, '', 'inventory_low', 'inventory');
show_report_if_allowed($allowed_modules, '', 'inventory_summary', 'inventory');
?>
</ul>
</li>
<?php
}
?>
</ul>
<?php
if(isset($error))
@@ -55,10 +66,4 @@ if(isset($error))
echo "<div class='error_message'>".$error."</div>";
}
?>
<?php $this->load->view("partial/footer"); ?>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
});
</script>
<?php $this->load->view("partial/footer"); ?>

View File

@@ -20,7 +20,7 @@ if (isset($success))
<?php echo form_open("sales/change_mode",array('id'=>'mode_form')); ?>
<span><?php echo $this->lang->line('sales_mode') ?></span>
<?php echo form_dropdown('mode',$modes,$mode,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php if ($show_stock_locations): ?>
<?php if (count($stock_locations) > 0): ?>
<span><?php echo $this->lang->line('sales_stock_location') ?></span>
<?php echo form_dropdown('stock_location',$stock_locations,$stock_location,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php endif; ?>

View File

@@ -145,6 +145,11 @@ input#search
padding: 0px;
}
select#stock_location
{
border: none;
}
#select_customer_form input, #select_supplier_form input
{
width: 95%;

View File

@@ -49,6 +49,13 @@
padding:5px;
}
#permission_list ul li
{
padding-left:20px;
padding-bottom: 0px;
list-style:none;
}
#permission_list input
{
top:3px;

View File

@@ -26,7 +26,7 @@
}
#table_action_header ul li span
#table_action_header ul li span a
{
background-color:#0a6184;
border:2px solid #DDDDDD;

33
database/2.3_to_2.3.1.sql Normal file
View File

@@ -0,0 +1,33 @@
-- add granular report permissions
INSERT INTO ospos_modules (name_lang_key, desc_lang_key, sort, module_id) VALUES
('module_reports_sales', 'module_reports_sales_desc', 51, 'reports_sales'),
('module_reports_receivings', 'module_reports_receivings_desc', 52, 'reports_receivings'),
('module_reports_items', 'module_reports_items_desc', 54, 'reports_items'),
('module_reports_inventory', 'module_reports_inventory_desc', 55, 'reports_inventory'),
('module_reports_customers', 'module_reports_customers_desc', 56, 'reports_customers'),
('module_reports_employees', 'module_reports_employees_desc', 57, 'reports_employees'),
('module_reports_suppliers', 'module_reports_suppliers_desc', 57, 'reports_suppliers');
-- add modules for existing stock locations
INSERT INTO ospos_modules (name_lang_key, desc_lang_key, sort, module_id) (SELECT CONCAT('module_items_stock', location_id), CONCAT('module_items_stock', location_id, '_desc'), (SELECT MAX(sort)+1 FROM ospos_modules WHERE module_id LIKE 'items_stock%' OR module_id = 'items'), CONCAT('items_stock', location_id) from ospos_stock_locations);
-- add permissions for all employees
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_customers', person_id from ospos_employees;
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_receivings', person_id from ospos_employees;
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_items', person_id from ospos_employees;
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_inventory', person_id from ospos_employees;
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_employees', person_id from ospos_employees;
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_suppliers', person_id from ospos_employees;
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_sales', person_id from ospos_employees;
-- add config options for tax inclusive sales
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('tax_included', '0');
-- add cascading deletes on modules
ALTER TABLE `ospos_permissions` DROP FOREIGN KEY `ospos_permissions_ibfk_1`;
ALTER TABLE `ospos_permissions` ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos`.`ospos_employee`(`person_id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `ospos_permissions` DROP FOREIGN KEY `ospos_permissions_ibfk_2`;
ALTER TABLE `ospos_permissions` ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos`.`ospos_modules`(`module_id`) ON DELETE CASCADE ON UPDATE RESTRICT;

View File

@@ -36,7 +36,8 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('phone', '555-555-5555'),
('return_policy', 'Test'),
('timezone', 'America/New_York'),
('website', '');
('website', ''),
('tax_included', '0');
-- --------------------------------------------------------
@@ -94,7 +95,7 @@ CREATE TABLE `ospos_giftcards` (
`person_id` INT NOT NULL,
PRIMARY KEY (`giftcard_id`),
UNIQUE KEY `giftcard_number` (`giftcard_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=48 ;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
--
-- Dumping data for table `ospos_giftcards`
@@ -142,7 +143,6 @@ CREATE TABLE `ospos_items` (
`unit_price` decimal(15,2) NOT NULL,
`quantity` decimal(15,2) NOT NULL DEFAULT '0.00',
`reorder_level` decimal(15,2) NOT NULL DEFAULT '0.00',
`location` varchar(255) NOT NULL,
`item_id` int(10) NOT NULL AUTO_INCREMENT,
`allow_alt_description` tinyint(1) NOT NULL,
`is_serialized` tinyint(1) NOT NULL,
@@ -262,9 +262,17 @@ INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_i
('module_employees', 'module_employees_desc', 80, 'employees'),
('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'),
('module_items', 'module_items_desc', 20, 'items'),
('module_items_stock0', 'module_items_stock0_desc', 20, 'items_stock0'),
('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'),
('module_receivings', 'module_receivings_desc', 60, 'receivings'),
('module_reports', 'module_reports_desc', 50, 'reports'),
('module_reports_sales', 'module_reports_sales_desc', 51, 'reports_sales'),
('module_reports_receivings', 'module_reports_receivings_desc', 52, 'reports_receivings'),
('module_reports_items', 'module_reports_items_desc', 54, 'reports_items'),
('module_reports_inventory', 'module_reports_inventory_desc', 55, 'reports_inventory'),
('module_reports_customers', 'module_reports_customers_desc', 56, 'reports_customers'),
('module_reports_employees', 'module_reports_employees_desc', 57, 'reports_employees'),
('module_reports_suppliers', 'module_reports_suppliers_desc', 57, 'reports_suppliers'),
('module_sales', 'module_sales_desc', 70, 'sales'),
('module_suppliers', 'module_suppliers_desc', 40, 'suppliers');
@@ -315,7 +323,14 @@ CREATE TABLE `ospos_permissions` (
--
INSERT INTO `ospos_permissions` (`module_id`, `person_id`) VALUES
('config', 1),
('reports_customers', 1),
('reports_receivings', 1),
('reports_items', 1),
('reports_inventory', 1),
('reports_employees', 1),
('reports_suppliers', 1),
('reports_sales', 1),
('items_stock0', 1),
('customers', 1),
('employees', 1),
('giftcards', 1),
@@ -586,8 +601,7 @@ CREATE TABLE `ospos_stock_locations` (
`location_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`deleted` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;
--
-- Dumping data for table `ospos_stock_locations`
@@ -661,8 +675,8 @@ ALTER TABLE `ospos_item_kit_items`
-- Constraints for table `ospos_permissions`
--
ALTER TABLE `ospos_permissions`
ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_employees` (`person_id`),
ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos_modules` (`module_id`);
ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_employees` (`person_id`) ON DELETE CASCADE,
ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos_modules` (`module_id`) ON DELETE CASCADE;
--
-- Constraints for table `ospos_receivings`