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='
| 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('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('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] |
@@ -124,13 +129,13 @@ else
?>
- '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').':';?> | +- | - | + | + | - | + | - | |||||
| - | ||||||||||||
| + | ||||||||||||
lang->line('sales_payments_total').':';?> |
- - |
lang->line('sales_amount_due').':';?> |
- - |
lang->line('sales_payments_total').':';?> |
+ + |
lang->line('sales_amount_due').':';?> |
+ + |
| + | ||
| 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('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').']' ); ?> | -- | + | + |