diff --git a/application/config/autoload.php b/application/config/autoload.php index 3a5b7cd9d..051567985 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -109,7 +109,7 @@ $autoload['language'] = array(); | */ -$autoload['model'] = array('Appconfig','Person','Customer','Employee','Module','Item', 'Item_taxes', 'Sale', 'Sale_suspended', 'Supplier','Inventory','Receiving','Giftcard', 'Item_kit', 'Item_kit_items','Item_unit','Stock_locations','Item_quantitys'); +$autoload['model'] = array('Appconfig','Person','Customer','Employee','Module','Item', 'Item_taxes', 'Sale', 'Sale_suspended', 'Supplier','Inventory','Receiving','Giftcard', 'Item_kit', 'Item_kit_items','Item_unit','Stock_locations','Item_quantities'); /* End of file autoload.php */ diff --git a/application/controllers/config.php b/application/controllers/config.php index 78d278427..04bbba351 100644 --- a/application/controllers/config.php +++ b/application/controllers/config.php @@ -9,7 +9,14 @@ class Config extends Secure_area function index() { - $this->load->view("config"); + $location_names = array(); + $locations = $this->Stock_locations->get_location_names(); + foreach($locations->result_array() as $array) + { + array_push($location_names, $array['location_name']); + } + $data['location_names'] = implode(',', $location_names); + $this->load->view("config", $data); } function save() @@ -30,7 +37,6 @@ class Config extends Secure_area 'return_policy'=>$this->input->post('return_policy'), 'language'=>$this->input->post('language'), 'timezone'=>$this->input->post('timezone'), - 'stock_location'=>$this->input->post('stock_location'), 'print_after_sale'=>$this->input->post('print_after_sale'), 'custom1_name'=>$this->input->post('custom1_name'),/**GARRISON ADDED 4/20/2013**/ 'custom2_name'=>$this->input->post('custom2_name'),/**GARRISON ADDED 4/20/2013**/ diff --git a/application/controllers/items.php b/application/controllers/items.php index 57d6d1852..a48078b47 100644 --- a/application/controllers/items.php +++ b/application/controllers/items.php @@ -200,18 +200,17 @@ class Items extends Secure_area implements iData_controller $data['selected_supplier'] = $this->Item->get_info($item_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') : ''; - $data['stock_type'] = $data['item_info']->stock_type; $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['stock_'.$location['location_id']] = array('location_name'=>$location['location_name'], - 'quantity'=>($item_id == -1)?null:$this->Item_quantitys->get_item_quantity($item_id, $location['location_id'])->quantity); + 'quantity'=>$quantity); } $data['stock_locations']= $location_array; - - $data['item_unit_info']=$this->Item_unit->get_info($item_id); $this->load->view("items/form",$data); } @@ -226,7 +225,7 @@ class Items extends Secure_area implements iData_controller foreach($stock_locations as $location_data) { $data['stock_locations']['stock_'.$location_data['location_id']] = $location_data['location_name']; - $data['item_quantitys']['stock_'.$location_data['location_id']] = $this->Item_quantitys->get_item_quantity($item_id,$location_data['location_id'])->quantity; + $data['item_quantities']['stock_'.$location_data['location_id']] = $this->Item_quantities->get_item_quantity($item_id,$location_data['location_id'])->quantity; } $this->load->view("items/inventory",$data); @@ -241,7 +240,7 @@ class Items extends Secure_area implements iData_controller foreach($stock_locations as $location_data) { $data['stock_locations']['stock_'.$location_data['location_id']] = $location_data['location_name']; - $data['item_quantitys']['stock_'.$location_data['location_id']] = $this->Item_quantitys->get_item_quantity($item_id,$location_data['location_id'])->quantity; + $data['item_quantities']['stock_'.$location_data['location_id']] = $this->Item_quantities->get_item_quantity($item_id,$location_data['location_id'])->quantity; } $this->load->view("items/count_details",$data); @@ -296,7 +295,6 @@ class Items extends Secure_area implements iData_controller 'cost_price'=>$this->input->post('cost_price'), 'unit_price'=>$this->input->post('unit_price'), 'reorder_level'=>$this->input->post('reorder_level'), - 'location'=>$this->input->post('location'), 'allow_alt_description'=>$this->input->post('allow_alt_description'), 'is_serialized'=>$this->input->post('is_serialized'), 'deleted'=>$this->input->post('is_deleted'), /** Parq 131215 **/ @@ -354,15 +352,15 @@ class Items extends Secure_area implements iData_controller 'location_id'=>$location_data['location_id'], 'quantity'=>$updated_quantity); - $item_quantity = $this->Item_quantitys->get_item_quantity($item_id, $location_data['location_id']); - $this->Item_quantitys->save($location_detail, $item_quantity->item_quantity_id); + $item_quantity = $this->Item_quantities->get_item_quantity($item_id, $location_data['location_id']); + $this->Item_quantities->save($location_detail, $item_quantity->item_quantity_id); $inv_data = array ( 'trans_date'=>date('Y-m-d H:i:s'), 'trans_items'=>$item_id, 'trans_user'=>$employee_id, - 'location_id'=>$location_data['location_id'], + 'trans_location'=>$location_data['location_id'], 'trans_comment'=>$this->lang->line('items_manually_editing_of_quantity'), 'trans_inventory'=>$item_quantity->item_quantity_id ? $updated_quantity - $item_quantity->quantity : $updated_quantity ); @@ -388,7 +386,7 @@ class Items extends Secure_area implements iData_controller 'trans_date'=>date('Y-m-d H:i:s'), 'trans_items'=>$item_id, 'trans_user'=>$employee_id, - 'location_id'=>$location_id, + 'trans_location'=>$location_id, 'trans_comment'=>$this->input->post('trans_comment'), 'trans_inventory'=>$this->input->post('newquantity') ); @@ -396,13 +394,13 @@ class Items extends Secure_area implements iData_controller //Update stock quantity - $item_quantity= $this->Item_quantitys->get_item_quantity($item_id,$location_id); + $item_quantity= $this->Item_quantities->get_item_quantity($item_id,$location_id); $item_quantity_data = array( 'item_id'=>$item_id, 'location_id'=>$location_id, 'quantity'=>$item_quantity->quantity + $this->input->post('newquantity') ); - if($this->Item_quantitys->save($item_quantity_data,$item_quantity->item_quantity_id)) + if($this->Item_quantities->save($item_quantity_data,$item_quantity->item_quantity_id)) { echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '. $cur_item_info->name,'item_id'=>$item_id)); diff --git a/application/controllers/receivings.php b/application/controllers/receivings.php index e339e559f..f0c4634ac 100644 --- a/application/controllers/receivings.php +++ b/application/controllers/receivings.php @@ -245,20 +245,27 @@ class Receivings extends Secure_area function _reload($data=array()) { + $data['stock_locations'] = array(); + $stock_locations = $this->Stock_locations->get_undeleted_all()->result_array(); + $show_stock_locations = count($stock_locations) > 1; + $person_info = $this->Employee->get_logged_in_employee_info(); $data['cart']=$this->receiving_lib->get_cart(); - $data['modes']=array('receive'=>$this->lang->line('recvs_receiving'),'return'=>$this->lang->line('recvs_return'), 'requisition'=>$this->lang->line('recvs_requisition')); + $data['modes']=array('receive'=>$this->lang->line('recvs_receiving'),'return'=>$this->lang->line('recvs_return')); + $data['mode']=$this->receiving_lib->get_mode(); - $data['stock_locations'] = array(); - $stock_locations = $this->Stock_locations->get_undeleted_all()->result_array(); - foreach($stock_locations as $location_data) - { - $data['stock_locations']['stock_'.$location_data['location_id']] = $location_data['location_name']; - } - - $data['stock_source']=$this->receiving_lib->get_stock_source(); - $data['stock_destination']=$this->receiving_lib->get_stock_destination(); + if ($show_stock_locations) { + $data['modes']['requisition'] = $this->lang->line('recvs_requisition'); + foreach($stock_locations as $location_data) + { + $data['stock_locations']['stock_'.$location_data['location_id']] = $location_data['location_name']; + } + + $data['stock_source']=$this->receiving_lib->get_stock_source(); + $data['stock_destination']=$this->receiving_lib->get_stock_destination(); + } + $data['show_stock_locations'] = $show_stock_locations; $data['total']=$this->receiving_lib->get_total(); $data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id); diff --git a/application/controllers/sales.php b/application/controllers/sales.php index 3efdb4b12..8d88094c9 100644 --- a/application/controllers/sales.php +++ b/application/controllers/sales.php @@ -351,12 +351,16 @@ class Sales extends Secure_area $data['mode']=$this->sale_lib->get_mode(); $data['stock_locations'] = array(); - $stock_locations = $this->Stock_locations->get_undeleted_all()->result_array(); - foreach($stock_locations as $location_data) - { - $data['stock_locations']['stock_'.$location_data['location_id']] = $location_data['location_name']; - } - $data['stock_location']=$this->sale_lib->get_sale_location(); + $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']['stock_'.$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['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return')); $data['mode']=$this->sale_lib->get_mode(); diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index 8c4c61907..dd1f5751e 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -214,7 +214,11 @@ function get_item_data_row($item,$controller) $locations_data = $CI->Stock_locations->get_undeleted_all()->result_array(); foreach($locations_data as $location) { - $item_quantity .= $location['location_name'].': '.$CI->Item_quantitys->get_item_quantity($item->item_id, $location['location_id'])->quantity . '
'; + if (count($locations_data) > 1) + { + $item_quantity .= $location['location_name'].': '; + } + $item_quantity .= $CI->Item_quantities->get_item_quantity($item->item_id, $location['location_id'])->quantity . '
'; } $table_data_row=''; diff --git a/application/libraries/Sale_lib.php b/application/libraries/Sale_lib.php index 4474410d0..c26567d78 100644 --- a/application/libraries/Sale_lib.php +++ b/application/libraries/Sale_lib.php @@ -274,7 +274,7 @@ class Sale_lib //$item = $this->CI->Item->get_info($item_id); $location_id = $this->get_location_id_from_stock_location($this->get_sale_location()); - $item_quantity = $this->CI->Item_quantitys->get_item_quantity($item_id, $location_id)->quantity; + $item_quantity = $this->CI->Item_quantities->get_item_quantity($item_id, $location_id)->quantity; $quanity_added = $this->get_quantity_already_added($item_id); if ($item_quantity - $quanity_added < 0) diff --git a/application/models/item_quantitys.php b/application/models/item_quantities.php similarity index 69% rename from application/models/item_quantitys.php rename to application/models/item_quantities.php index 78a1d31a9..8ea7eb569 100644 --- a/application/models/item_quantitys.php +++ b/application/models/item_quantities.php @@ -1,9 +1,9 @@ db->from('item_quantitys'); + $this->db->from('item_quantities'); $this->db->where('item_quantity_id',$item_quantity_id); $query = $this->db->get(); @@ -14,7 +14,7 @@ class Item_quantitys extends CI_Model { if (!$item_quantity_id or !$this->exists($item_quantity_id)) { - if($this->db->insert('item_quantitys',$location_detail)) + if($this->db->insert('item_quantities',$location_detail)) { $location_detail['item_quantity_id']=$this->db->insert_id(); return true; @@ -23,12 +23,12 @@ class Item_quantitys extends CI_Model } $this->db->where('item_quantity_id', $item_quantity_id); - return $this->db->update('item_quantitys',$location_detail); + return $this->db->update('item_quantities',$location_detail); } function get_item_quantity($item_id, $location_id) { - $this->db->from('item_quantitys'); + $this->db->from('item_quantities'); $this->db->where('item_id',$item_id); $this->db->where('location_id',$location_id); $result = $this->db->get()->row(); @@ -36,12 +36,13 @@ class Item_quantitys extends CI_Model { //Get empty base parent object, as $item_id is NOT an item $result=new stdClass(); - //Get all the fields from items table - $fields = $this->db->list_fields('item_quantitys'); + //Get all the fields from items table (TODO to be reviewed) + $fields = $this->db->list_fields('item_quantities'); foreach ($fields as $field) { $result->$field=''; - } + } + $result->quantity = 0; } return $result; } diff --git a/application/models/receiving.php b/application/models/receiving.php index aa26c85db..778a09d27 100644 --- a/application/models/receiving.php +++ b/application/models/receiving.php @@ -63,8 +63,8 @@ class Receiving extends CI_Model $this->db->insert('receivings_items',$receivings_items_data); //Update stock quantity - $item_quantity = $this->Item_quantitys->get_item_quantity($item['item_id'], $this->receiving_lib->get_location_id_from_stock_location($stock_location)); - $this->Item_quantitys->save(array('quantity'=>$item_quantity->quantity + $item['quantity'], + $item_quantity = $this->Item_quantities->get_item_quantity($item['item_id'], $this->receiving_lib->get_location_id_from_stock_location($stock_location)); + $this->Item_quantities->save(array('quantity'=>$item_quantity->quantity + $item['quantity'], 'item_id'=>$item['item_id'], 'location_id'=>$this->receiving_lib->get_location_id_from_stock_location($stock_location)), $item_quantity->item_quantity_id); diff --git a/application/models/reports/inventory_low.php b/application/models/reports/inventory_low.php index 17ded4608..3c460a7b8 100644 --- a/application/models/reports/inventory_low.php +++ b/application/models/reports/inventory_low.php @@ -15,12 +15,12 @@ class Inventory_low extends Report public function getData(array $inputs) { $this->db->from('items'); - $this->db->join('item_quantitys','items.item_id=item_quantitys.item_id'); - $this->db->join('stock_locations','item_quantitys.location_id=stock_locations.location_id'); + $this->db->join('item_quantities','items.item_id=item_quantities.item_id'); + $this->db->join('stock_locations','item_quantities.location_id=stock_locations.location_id'); - $this->db->select('name, item_number, reorder_level, item_quantitys.quantity,description,location_name'); + $this->db->select('name, item_number, reorder_level, item_quantities.quantity,description,location_name'); - $this->db->where('item_quantitys.quantity <= reorder_level'); + $this->db->where('item_quantities.quantity <= reorder_level'); $this->db->where('items.deleted = 0'); $this->db->order_by('name'); diff --git a/application/models/reports/inventory_summary.php b/application/models/reports/inventory_summary.php index a10180bb5..4525f1255 100644 --- a/application/models/reports/inventory_summary.php +++ b/application/models/reports/inventory_summary.php @@ -15,10 +15,10 @@ class Inventory_summary extends Report public function getData(array $inputs) { $this->db->from('items'); - $this->db->join('item_quantitys','items.item_id=item_quantitys.item_id'); - $this->db->join('stock_locations','item_quantitys.location_id=stock_locations.location_id'); + $this->db->join('item_quantities','items.item_id=item_quantities.item_id'); + $this->db->join('stock_locations','item_quantities.location_id=stock_locations.location_id'); - $this->db->select('name, item_number, reorder_level, item_quantitys.quantity, description,location_name'); + $this->db->select('name, item_number, reorder_level, item_quantities.quantity, description,location_name'); $this->db->where('items.deleted', 0); $this->db->order_by('items.name'); diff --git a/application/models/sale.php b/application/models/sale.php index b5d4be07d..2c5abdf68 100644 --- a/application/models/sale.php +++ b/application/models/sale.php @@ -94,8 +94,8 @@ class Sale extends CI_Model $this->db->insert('sales_items',$sales_items_data); //Update stock quantity - $item_quantity = $this->Item_quantitys->get_item_quantity($item['item_id'], $this->sale_lib->get_location_id_from_stock_location($this->sale_lib->get_sale_location())); - $this->Item_quantitys->save(array('quantity'=>$item_quantity->quantity - $item['quantity'], + $item_quantity = $this->Item_quantities->get_item_quantity($item['item_id'], $this->sale_lib->get_location_id_from_stock_location($this->sale_lib->get_sale_location())); + $this->Item_quantities->save(array('quantity'=>$item_quantity->quantity - $item['quantity'], 'item_id'=>$item['item_id'], 'location_id'=>$this->sale_lib->get_location_id_from_stock_location($stock_location)), $item_quantity->item_quantity_id); diff --git a/application/models/stock_locations.php b/application/models/stock_locations.php index 4df2d8058..42619bddf 100644 --- a/application/models/stock_locations.php +++ b/application/models/stock_locations.php @@ -1,7 +1,7 @@ db->from('stock_locations'); $this->db->where('location_name',$location_name); @@ -18,6 +18,14 @@ class Stock_locations extends CI_Model return $this->db->get(); } + function get_location_names() + { + $this->db->select('location_name'); + $this->db->from('stock_locations'); + $this->db->where('deleted', 0); + return $this->db->get(); + } + function get_undeleted_all($limit=10000, $offset=0) { $this->db->from('stock_locations'); diff --git a/application/views/config.php b/application/views/config.php index 264f5ced8..83637776f 100644 --- a/application/views/config.php +++ b/application/views/config.php @@ -264,7 +264,7 @@ echo form_open('config/save/',array('id'=>'config_form')); 'stock_location', 'id'=>'stock_location', - 'value'=>$this->config->item('stock_location')));?> + 'value'=>$location_names)); ?> diff --git a/application/views/items/count_details.php b/application/views/items/count_details.php index bb27e3e0e..746ad3bdd 100644 --- a/application/views/items/count_details.php +++ b/application/views/items/count_details.php @@ -76,7 +76,7 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for 'name'=>'quantity', 'id'=>'quantity', - 'value'=>current($item_quantitys), + 'value'=>current($item_quantities), 'style' => 'border:none', 'readonly' => 'readonly' ); @@ -122,8 +122,8 @@ $(document).ready(function() function display_stock(stock) { - var item_quantitys= ; - document.getElementById("quantity").value = item_quantitys[stock]; + var item_quantities= ; + document.getElementById("quantity").value = item_quantities[stock]; var location_id = stock.substring(6); var inventory_data = ; diff --git a/application/views/items/form.php b/application/views/items/form.php index 212470860..5a00385a2 100644 --- a/application/views/items/form.php +++ b/application/views/items/form.php @@ -143,17 +143,6 @@ foreach($stock_locations as $key=>$location_detail) -
-lang->line('items_location').':', 'location',array('class'=>'wide')); ?> -
- 'location', - 'id'=>'location', - 'value'=>$item_info->location) - );?> -
-
-
lang->line('items_description').':', 'description',array('class'=>'wide')); ?>
@@ -167,37 +156,8 @@ foreach($stock_locations as $key=>$location_detail)
-
-lang->line('items_unit_quantity').':', 'unit_quantity',array('class'=>'wide')); ?> -
- 'unit_quantity', - 'id'=>'unit_quantity', - 'value'=>($item_unit_info->unit_quantity) ? $item_unit_info->unit_quantity : 1) - );?> -
-
- -
-lang->line('items_related_number').':', 'related_number',array('class'=>'wide')); ?> -
- 'related_number', - 'id'=>'related_number', - 'value'=>$item_unit_info->related_number) - );?> -
-
- -
- -
- -
-lang->line('items_allow_alt_desciption').':', 'allow_alt_description',array('class'=>'wide')); ?> +lang->line('items_allow_alt_description').':', 'allow_alt_description',array('class'=>'wide')); ?>
'allow_alt_description', @@ -440,28 +400,6 @@ $(document).ready(function() $("#custom10").search(); /** END GARRISON ADDED **/ - //custom function. I leave this function as an example for creating JS custom function - //Please note that this function is not used - $.validator.addMethod( - "relatedItemNumber", - function(value) - { - var site_url = ""; - var ajax_return_result; - jQuery.ajax({ - mode: "abort", - url: site_url+"/"+value, - type: "get", - success: function(result) { - ajax_return_result = result; - }, - async: false - }); - - return ajax_return_result; - }, - "relatedItemNumber failed"); - $('#item_form').validate({ submitHandler:function(form) { diff --git a/application/views/items/inventory.php b/application/views/items/inventory.php index 0d4192b0c..9cb5be9f7 100644 --- a/application/views/items/inventory.php +++ b/application/views/items/inventory.php @@ -79,7 +79,7 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for 'name'=>'quantity', 'id'=>'quantity', - 'value'=>current($item_quantitys), + 'value'=>current($item_quantities), 'style' => 'border:none', 'readonly' => 'readonly' ); @@ -168,7 +168,7 @@ $(document).ready(function() function fill_quantity(val) { - var item_quantitys= ; - document.getElementById("quantity").value = item_quantitys[val]; + var item_quantities= ; + document.getElementById("quantity").value = item_quantities[val]; } \ No newline at end of file diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index 1d65d6b2c..97d865799 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -16,7 +16,7 @@ if(isset($error)) lang->line('recvs_mode') ?> - + lang->line('recvs_stock_source') ?> > lang->line('recvs_stock_destination') ?> - + 'add_item_form')); ?>
- + 'add_item_form')); ?>
--> - - - - - - - - - - - - - - - + +
lang->line('common_delete'); ?>lang->line('sales_item_number'); ?>lang->line('sales_item_name'); ?>lang->line('sales_price'); ?>lang->line('sales_quantity'); ?>lang->line('sales_discount'); ?>lang->line('sales_total'); ?>lang->line('sales_edit'); ?>
+ + + + + + + + + + + + + - + + + - - - + + @@ -124,13 +129,13 @@ else ?> - - - - - - - + + + + + + - - + - - - - + + + + + -
lang->line('common_delete'); ?>lang->line('sales_item_number'); ?>lang->line('sales_item_name'); ?>lang->line('sales_price'); ?>lang->line('sales_quantity'); ?>lang->line('sales_discount'); ?>lang->line('sales_total'); ?>lang->line('sales_edit'); ?>
-
lang->line('sales_no_items_in_cart'); ?>
-
+
lang->line('sales_no_items_in_cart'); ?>
+ +
lang->line('common_delete').']');?>
[Item_quantitys->get_item_quantity($item['item_id'], $this->sale_lib->get_location_id_from_stock_location($stock_location)); +
lang->line('common_delete').']');?>
[Item_quantities->get_item_quantity($item['item_id'], $this->sale_lib->get_location_id_from_stock_location($stock_location)); echo $item_quantity->quantity; ?> in stock]
'discount','value'=>$item['discount'],'size'=>'3'));?>lang->line('sales_edit_item'));?>
lang->line('sales_description_abbrv').':';?> + 'discount','value'=>$item['discount'],'size'=>'3'));?>lang->line('sales_edit_item'));?>
lang->line('sales_description_abbrv').':';?>   +   + -
+ @@ -201,29 +207,29 @@ else 'customer','id'=>'customer','size'=>'30','value'=>$this->lang->line('sales_start_typing_customer_name')));?> -
+

lang->line('common_or'); ?>

".$this->lang->line('sales_new_customer')."
", array('class'=>'thickbox none','title'=>$this->lang->line('sales_new_customer'))); ?>
-
 
+
 
-
lang->line('sales_sub_total'); ?>:
-
+
lang->line('sales_sub_total'); ?>:
+
$value) { ?> -
:
-
+
:
+
-
lang->line('sales_total'); ?>:
-
+
lang->line('sales_total'); ?>:
+
@@ -237,12 +243,13 @@ else
'cancel_sale_form')); ?> -
+
lang->line('sales_cancel_sale'); ?>
- -
-
 
+ +
+
 
0) @@ -252,7 +259,8 @@ else 'finish_sale_form')); ?> 'comment', 'id' => 'comment', 'value'=>$comment,'rows'=>'4','cols'=>'23'));?> -

+
+
".$this->lang->line('sales_suspend_sale').""; ?> - + - - - - - - - -
lang->line('sales_payments_total').':';?>
lang->line('sales_amount_due').':';?>
+ + + + + + + + + +
lang->line('sales_payments_total').':';?>
lang->line('sales_amount_due').':';?>
-
+
-
+
'add_payment_form')); ?> - - + - - - - - + + + - -
+
lang->line('sales_payment').': ';?> +
- lang->line( 'sales_amount_tendered' ).': '; ?> - +
lang->line( 'sales_amount_tendered' ).': '; ?> + 'amount_tendered', 'id'=>'amount_tendered', 'value'=>to_currency_no_money($amount_due), 'size'=>'10' ) ); ?>
-
+ + +
lang->line('sales_add_payment'); ?>
@@ -324,14 +336,14 @@ else { ?> - - - - - + + + + + - + 'edit_payment_form'.$payment_id)); ?> - + - - + + @@ -352,8 +364,8 @@ else } ?> -
lang->line('common_delete'); ?>lang->line('sales_payment_type'); ?>lang->line('sales_payment_amount'); ?>
lang->line('common_delete'); ?>lang->line('sales_payment_type'); ?>lang->line('sales_payment_amount'); ?>
lang->line('common_delete').']' ); ?>lang->line('common_delete').']' ); ?>
-
+ +
@@ -366,7 +378,7 @@ else } ?>
-
 
+
 
load->view("partial/footer"); ?> diff --git a/database/database.sql b/database/database.sql index 99248ca77..172279d9d 100644 --- a/database/database.sql +++ b/database/database.sql @@ -35,7 +35,6 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('fax', ''), ('phone', '555-555-5555'), ('return_policy', 'Test'), -('stock_location', 'stockD,stockE,stockA'), ('timezone', 'America/New_York'), ('website', ''); @@ -114,10 +113,12 @@ CREATE TABLE `ospos_inventory` ( `trans_user` int(11) NOT NULL DEFAULT '0', `trans_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `trans_comment` text NOT NULL, + `trans_location` int(11) NOT NULL, `trans_inventory` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`trans_id`), - KEY `ospos_inventory_ibfk_1` (`trans_items`), - KEY `ospos_inventory_ibfk_2` (`trans_user`) + KEY `trans_items` (`trans_items`), + KEY `trans_user` (`trans_user`), + KEY `trans_location` (`trans_location`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- @@ -141,7 +142,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, @@ -224,16 +224,18 @@ CREATE TABLE `ospos_item_kit_items` ( -- -------------------------------------------------------- -- --- Table structure for table `ospos_item_quantitys` +-- Table structure for table `ospos_item_quantities` -- -CREATE TABLE IF NOT EXISTS `ospos_item_quantitys` ( +CREATE TABLE IF NOT EXISTS `ospos_item_quantities` ( `item_quantity_id` int(11) NOT NULL AUTO_INCREMENT, `item_id` int(11) NOT NULL, `location_id` int(11) NOT NULL, `quantity` int(11) NOT NULL, - PRIMARY KEY (`item_quantity_id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=69 ; + PRIMARY KEY (`item_quantity_id`), + KEY `item_id` (`item_id`), + KEY `location_id` (`location_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; -- -------------------------------------------------------- @@ -579,6 +581,13 @@ CREATE TABLE `ospos_stock_locations` ( PRIMARY KEY (`location_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8; + +-- +-- Dumping data for table `ospos_stock_locations` +-- + +INSERT INTO `ospos_stock_locations` ( `deleted` ) VALUES ('0'); + -- -------------------------------------------------------- -- @@ -716,6 +725,13 @@ ALTER TABLE `ospos_sales_suspended_items_taxes` ALTER TABLE `ospos_sales_suspended_payments` ADD CONSTRAINT `ospos_sales_suspended_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`); +-- +-- Constraints for table `ospos_item_quantities` +-- +ALTER TABLE `ospos_item_quantities` + ADD CONSTRAINT `ospos_item_quantities_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), + ADD CONSTRAINT `ospos_item_quantities_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `ospos_stock_locations` (`location_id`); + -- -- Constraints for table `ospos_suppliers` --