Merge branch 'merge/padungsak'

Conflicts:
	database/database.sql
This commit is contained in:
jekkos-t520
2014-08-17 01:22:12 +02:00
59 changed files with 1699 additions and 897 deletions

3
.gitignore vendored
View File

@@ -8,3 +8,6 @@ git-svn-diff.py
.buildpath
.project
.settings/*
*.swp
*.rej
*.orig

View File

@@ -66,6 +66,7 @@ $autoload['libraries'] = array('database','form_validation','session','user_agen
$autoload['helper'] = array('form','url','table','text','currency', 'html', 'download', 'directory');
/*
| -------------------------------------------------------------------
| Auto-load Config files
@@ -108,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');
$autoload['model'] = array('Appconfig','Person','Customer','Employee','Module','Item', 'Item_taxes', 'Sale', 'Sale_suspended', 'Supplier','Inventory','Receiving','Giftcard', 'Item_kit', 'Item_kit_items','Stock_locations','Item_quantities');
/* End of file autoload.php */

View File

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

View File

@@ -50,7 +50,7 @@ $route['reports/inventory_:any'] = "reports/excel_export";
$route['reports/(detailed_sales)/(:any)/(:any)'] = "reports/$1/$2/$3";
$route['reports/detailed_sales'] = "reports/date_input";
$route['reports/(detailed_receivings)/(:any)/(:any)'] = "reports/$1/$2/$3";
$route['reports/detailed_receivings'] = "reports/date_input";
$route['reports/detailed_receivings'] = "reports/date_input_recv";
$route['reports/(specific_:any)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3/$4";
$route['reports/specific_customer'] = "reports/specific_customer_input";
$route['reports/specific_employee'] = "reports/specific_employee_input";

View File

@@ -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()
@@ -43,7 +50,25 @@ class Config extends Secure_area
'custom10_name'=>$this->input->post('custom10_name')/**GARRISON ADDED 4/20/2013**/
);
if( $this->Appconfig->batch_save( $batch_save_data ) )
$stock_locations = explode( ',', $this->input->post('stock_location'));
$stock_locations_trimmed=array();
foreach($stock_locations as $location)
{
array_push($stock_locations_trimmed, trim($location, ' '));
}
$current_locations = $this->Stock_locations->concat_location_names()->location_names;
if ($this->input->post('stock_locations') != $current_locations)
{
$this->load->library('sale_lib');
$this->sale_lib->clear_sale_location();
$this->sale_lib->clear_all();
$this->load->library('receiving_lib');
$this->receiving_lib->clear_stock_source();
$this->receiving_lib->clear_stock_destination();
$this->receiving_lib->clear_all();
}
if( $this->Appconfig->batch_save( $batch_save_data ) && $this->Stock_locations->array_save($stock_locations_trimmed))
{
echo json_encode(array('success'=>true,'message'=>$this->lang->line('config_saved_successfully')));
}

View File

@@ -24,21 +24,19 @@ class Items extends Secure_area implements iData_controller
function refresh()
{
$low_inventory=$this->input->post('low_inventory');
$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
$search_custom=$this->input->post('search_custom');//GARRISON ADDED 4/13/2013
$is_deleted=$this->input->post('is_deleted'); // Parq 131215
$data['search_section_state']=$this->input->post('search_section_state');
$data['low_inventory']=$this->input->post('low_inventory');
$data['is_serialized']=$this->input->post('is_serialized');
$data['no_description']=$this->input->post('no_description');
$data['search_custom']=$this->input->post('search_custom');//GARRISON ADDED 4/13/2013
$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($low_inventory,$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($is_serialized,$no_description,$search_custom,$is_deleted),$this);//GARRISON MODIFIED 4/13/2013, Parq 131215
$this->load->view('items/manage',$data);
}
@@ -66,7 +64,7 @@ class Items extends Secure_area implements iData_controller
function item_search()
{
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'));
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'),'warehouse');
echo implode("\n",$suggestions);
}
@@ -80,104 +78,104 @@ class Items extends Secure_area implements iData_controller
}
/**GARRISON ADDED 5/18/2013**/
/*
Gives search suggestions based on what is being searched for
*/
function suggest_location()
{
$suggestions = $this->Item->get_location_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_location()
{
$suggestions = $this->Item->get_location_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom1()
{
$suggestions = $this->Item->get_custom1_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom1()
{
$suggestions = $this->Item->get_custom1_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom2()
{
$suggestions = $this->Item->get_custom2_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom2()
{
$suggestions = $this->Item->get_custom2_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom3()
{
$suggestions = $this->Item->get_custom3_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom3()
{
$suggestions = $this->Item->get_custom3_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom4()
{
$suggestions = $this->Item->get_custom4_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom4()
{
$suggestions = $this->Item->get_custom4_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom5()
{
$suggestions = $this->Item->get_custom5_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom5()
{
$suggestions = $this->Item->get_custom5_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom6()
{
$suggestions = $this->Item->get_custom6_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom6()
{
$suggestions = $this->Item->get_custom6_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom7()
{
$suggestions = $this->Item->get_custom7_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom7()
{
$suggestions = $this->Item->get_custom7_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom8()
{
$suggestions = $this->Item->get_custom8_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom8()
{
$suggestions = $this->Item->get_custom8_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom9()
{
$suggestions = $this->Item->get_custom9_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom9()
{
$suggestions = $this->Item->get_custom9_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom10()
{
$suggestions = $this->Item->get_custom10_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/*
Gives search suggestions based on what is being searched for
*/
function suggest_custom10()
{
$suggestions = $this->Item->get_custom10_suggestions($this->input->post('q'));
echo implode("\n",$suggestions);
}
/**END GARRISON ADDED**/
@@ -202,19 +200,49 @@ 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') : '';
$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;
$this->load->view("items/form",$data);
}
//Ramel Inventory Tracking
function inventory($item_id=-1)
{
$data['item_info']=$this->Item->get_info($item_id);
$data['stock_locations'] = array();
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
foreach($stock_locations as $location_data)
{
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
$data['item_quantities'][$location_data['location_id']] = $this->Item_quantities->get_item_quantity($item_id,$location_data['location_id'])->quantity;
}
$this->load->view("items/inventory",$data);
}
function count_details($item_id=-1)
{
$data['item_info']=$this->Item->get_info($item_id);
$data['stock_locations'] = array();
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
foreach($stock_locations as $location_data)
{
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
$data['item_quantities'][$location_data['location_id']] = $this->Item_quantities->get_item_quantity($item_id,$location_data['location_id'])->quantity;
}
$this->load->view("items/count_details",$data);
} //------------------------------------------- Ramel
@@ -257,6 +285,7 @@ class Items extends Secure_area implements iData_controller
function save($item_id=-1)
{
//Save item data
$item_data = array(
'name'=>$this->input->post('name'),
'description'=>$this->input->post('description'),
@@ -265,13 +294,10 @@ class Items extends Secure_area implements iData_controller
'item_number'=>$this->input->post('item_number')=='' ? null:$this->input->post('item_number'),
'cost_price'=>$this->input->post('cost_price'),
'unit_price'=>$this->input->post('unit_price'),
'quantity'=>$this->input->post('quantity'),
'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 **/
'custom1'=>$this->input->post('custom1'), /**GARRISON ADDED 4/21/2013**/
'custom2'=>$this->input->post('custom2'),/**GARRISON ADDED 4/21/2013**/
'custom3'=>$this->input->post('custom3'),/**GARRISON ADDED 4/21/2013**/
@@ -303,15 +329,6 @@ class Items extends Secure_area implements iData_controller
$item_data['name'],'item_id'=>$item_id));
}
$inv_data = array
(
'trans_date'=>date('Y-m-d H:i:s'),
'trans_items'=>$item_id,
'trans_user'=>$employee_id,
'trans_comment'=>$this->lang->line('items_manually_editing_of_quantity'),
'trans_inventory'=>$cur_item_info ? $this->input->post('quantity') - $cur_item_info->quantity : $this->input->post('quantity')
);
$this->Inventory->insert($inv_data);
$items_taxes_data = array();
$tax_names = $this->input->post('tax_names');
$tax_percents = $this->input->post('tax_percents');
@@ -323,6 +340,33 @@ class Items extends Secure_area implements iData_controller
}
}
$this->Item_taxes->save($items_taxes_data, $item_id);
//Save item quantity
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
foreach($stock_locations as $location_data)
{
$updated_quantity = $this->input->post($location_data['location_id'].'_quantity');
$location_detail = array('item_id'=>$item_id,
'location_id'=>$location_data['location_id'],
'quantity'=>$updated_quantity);
$item_quantity = $this->Item_quantities->get_item_quantity($item_id, $location_data['location_id']);
if ($item_quantity->quantity != $updated_quantity)
{
$this->Item_quantities->save($location_detail, $item_id, $location_data['location_id']);
$inv_data = array
(
'trans_date'=>date('Y-m-d H:i:s'),
'trans_items'=>$item_id,
'trans_user'=>$employee_id,
'trans_location'=>$location_data['location_id'],
'trans_comment'=>$this->lang->line('items_manually_editing_of_quantity'),
'trans_inventory'=>$updated_quantity - $item_quantity->quantity
);
$this->Inventory->insert($inv_data);
}
}
}
else//failure
{
@@ -337,21 +381,27 @@ class Items extends Secure_area implements iData_controller
{
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$cur_item_info = $this->Item->get_info($item_id);
$location_id = $this->input->post('stock_location');
$inv_data = array
(
'trans_date'=>date('Y-m-d H:i:s'),
'trans_items'=>$item_id,
'trans_user'=>$employee_id,
'trans_location'=>$location_id,
'trans_comment'=>$this->input->post('trans_comment'),
'trans_inventory'=>$this->input->post('newquantity')
);
$this->Inventory->insert($inv_data);
//Update stock quantity
$item_data = array(
'quantity'=>$cur_item_info->quantity + $this->input->post('newquantity')
$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->save($item_data,$item_id))
if($this->Item_quantities->save($item_quantity_data,$item_id,$location_id))
{
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '.
$cur_item_info->name,'item_id'=>$item_id));
@@ -455,7 +505,6 @@ class Items extends Secure_area implements iData_controller
$item_data = array(
'name' => $data[1],
'description' => $data[13],
'location' => $data[12],
'category' => $data[2],
'cost_price' => $data[4],
'unit_price' => $data[5],
@@ -552,5 +601,11 @@ class Items extends Secure_area implements iData_controller
{
return 360;
}
function is_sale_store_item($item_number)
{
echo $this->Item->is_sale_store_item_exist($item_number);
}
}
?>

View File

@@ -35,8 +35,20 @@ class Receivings extends Secure_area
function change_mode()
{
$mode = $this->input->post("mode");
$this->receiving_lib->set_mode($mode);
$stock_destination = $this->input->post('stock_destination');
$stock_source = $this->input->post("stock_source");
if ((!$stock_source || $stock_source == $this->receiving_lib->get_stock_source()) &&
(!$stock_destination || $stock_destination == $this->receiving_lib->get_stock_destination()))
{
$this->receiving_lib->empty_cart();
$mode = $this->input->post("mode");
$this->receiving_lib->set_mode($mode);
}
else
{
$this->receiving_lib->set_stock_source($stock_source);
$this->receiving_lib->set_stock_destination($stock_destination);
}
$this->_reload();
}
@@ -45,19 +57,20 @@ class Receivings extends Secure_area
$data=array();
$mode = $this->receiving_lib->get_mode();
$item_id_or_number_or_item_kit_or_receipt = $this->input->post("item");
$quantity = $mode=="receive" ? 1:-1;
$quantity = ($mode=="receive" or $mode=="requisition") ? 1:-1;
$item_location = $this->receiving_lib->get_stock_source();
if($this->receiving_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt) && $mode=='return')
{
$this->receiving_lib->return_entire_receiving($item_id_or_number_or_item_kit_or_receipt);
$this->receiving_lib->return_entire_receiving($item_id_or_number_or_item_kit_or_receipt,$item_location);
}
elseif($this->receiving_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
{
$this->receiving_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt);
$this->receiving_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt,$item_location);
}
elseif(!$this->receiving_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity))
else
{
$data['error']=$this->lang->line('recvs_unable_to_add_item');
if(!$this->receiving_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity,$item_location))
$data['error']=$this->lang->line('recvs_unable_to_add_item');
}
$this->_reload($data);
}
@@ -75,6 +88,7 @@ class Receivings extends Secure_area
$price = $this->input->post("price");
$quantity = $this->input->post("quantity");
$discount = $this->input->post("discount");
$item_location = $this->input->post("location");
if ($this->form_validation->run() != FALSE)
{
@@ -88,6 +102,26 @@ class Receivings extends Secure_area
$this->_reload($data);
}
function edit_item_unit($item_id)
{
$data= array();
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|integer');
$quantity = $this->input->post("quantity");
if ($this->form_validation->run() != FALSE)
{
$this->receiving_lib->edit_item_unit($item_id,$description,$quantity,0,0);
}
else
{
$data['error']=$this->lang->line('recvs_error_editing_item');
}
$this->_reload($data);
}
function delete_item($item_number)
{
$this->receiving_lib->delete_item($item_number);
@@ -106,12 +140,16 @@ class Receivings extends Secure_area
$data['total']=$this->receiving_lib->get_total();
$data['receipt_title']=$this->lang->line('recvs_receipt');
$data['transaction_time']= date('m/d/Y h:i:s a');
$data['mode']=$this->receiving_lib->get_mode();
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
$data['show_stock_locations'] = count($stock_locations) > 1;
$supplier_id=$this->receiving_lib->get_supplier();
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$comment = $this->input->post('comment');
$emp_info=$this->Employee->get_info($employee_id);
$payment_type = $this->input->post('payment_type');
$data['payment_type']=$this->input->post('payment_type');
$data['stock_location']=$this->receiving_lib->get_stock_source();
if ($this->input->post('amount_tendered'))
{
@@ -127,7 +165,7 @@ class Receivings extends Secure_area
}
//SAVE receiving to database
$data['receiving_id']='RECV '.$this->Receiving->save($data['cart'], $supplier_id,$employee_id,$comment,$payment_type);
$data['receiving_id']='RECV '.$this->Receiving->save($data['cart'], $supplier_id,$employee_id,$comment,$payment_type,$data['stock_location']);
if ($data['receiving_id'] == 'RECV -1')
{
@@ -139,14 +177,37 @@ class Receivings extends Secure_area
$this->_remove_duplicate_cookies();
}
function requisition_complete()
{
if ($this->receiving_lib->get_stock_source() != $this->receiving_lib->get_stock_destination())
{
foreach($this->receiving_lib->get_cart() as $item)
{
$this->receiving_lib->delete_item($item['line']);
$this->receiving_lib->add_item($item['item_id'],$item['quantity'],$this->receiving_lib->get_stock_destination());
$this->receiving_lib->add_item($item['item_id'],-$item['quantity'],$this->receiving_lib->get_stock_source());
}
$this->complete();
}
else
{
$data['error']=$this->lang->line('recvs_error_requisition');
$this->_reload($data);
}
}
function receipt($receiving_id)
{
$receiving_info = $this->Receiving->get_info($receiving_id)->row_array();
$this->receiving_lib->copy_entire_receiving($receiving_id);
$data['cart']=$this->receiving_lib->get_cart();
$data['total']=$this->receiving_lib->get_total();
$data['mode']=$this->receiving_lib->get_mode();
$data['receipt_title']=$this->lang->line('recvs_receipt');
$data['transaction_time']= date('m/d/Y h:i:s a', strtotime($receiving_info['receiving_time']));
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
$data['show_stock_locations'] = count($stock_locations) > 1;
$supplier_id=$this->receiving_lib->get_supplier();
$emp_info=$this->Employee->get_info($receiving_info['employee_id']);
$data['payment_type']=$receiving_info['payment_type'];
@@ -166,10 +227,28 @@ 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'));
$data['mode']=$this->receiving_lib->get_mode();
if ($show_stock_locations) {
$data['modes']['requisition'] = $this->lang->line('recvs_requisition');
foreach($stock_locations as $location_data)
{
$data['stock_locations'][$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);
$data['payment_options']=array(

View File

@@ -302,9 +302,24 @@ class Reports extends Secure_area
function date_input()
{
$data = $this->_get_common_report_data();
$data['mode'] = 'sale';
$this->load->view("reports/date_input",$data);
}
function date_input_recv()
{
$data = $this->_get_common_report_data();
$data['mode'] = 'receiving';
$this->load->view("reports/date_input",$data);
}
function date_input_reqs()
{
$data = $this->_get_common_report_data();
$data['mode'] = 'requisition';
$this->load->view("reports/date_input",$data);
}
//Graphical summary sales report
function graphical_summary_sales($start_date, $end_date, $sale_type)
{
@@ -827,14 +842,14 @@ class Reports extends Secure_area
$this->load->view("reports/tabular_details",$data);
}
function detailed_receivings($start_date, $end_date, $sale_type, $export_excel=0)
function detailed_receivings($start_date, $end_date, $receiving_type, $export_excel=0)
{
$this->load->model('reports/Detailed_receivings');
$model = $this->Detailed_receivings;
$headers = $model->getDataColumns();
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'receiving_type' => $receiving_type));
$summary_data = array();
$details_data = array();
@@ -855,13 +870,46 @@ class Reports extends Secure_area
"headers" => $model->getDataColumns(),
"summary_data" => $summary_data,
"details_data" => $details_data,
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'receiving_type' => $receiving_type)),
"export_excel" => $export_excel
);
$this->load->view("reports/tabular_details",$data);
}
function detailed_requisition($start_date, $end_date , $export_excel=0)
{
$this->load->model('reports/Detailed_requisition');
$model = $this->Detailed_requisition;
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date));
$summary_data = array();
$details_data = array();
foreach($report_data['summary'] as $key=>$row)
{
$summary_data[] = array(anchor('receivings/requisition_receipt/'.$row['requisition_id'], 'REQS '.$row['requisition_id'], array('target' => '_blank')), $row['requisition_date'], $row['employee_name'], $row['comment']);
foreach($report_data['details'][$key] as $drow)
{
$details_data[$key][] = array($drow['name'], $drow['requisition_quantity'],
$drow['related_item_id'], $drow['related_item_quantity'],
$drow['related_item_total_quantity']);
}
}
$data = array(
"title" =>$this->lang->line('reports_detailed_requisition_report'),
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
"headers" => $model->getDataColumns(),
"summary_data" => $summary_data,
"details_data" => $details_data,
"overall_summary_data" => '',
"export_excel" => $export_excel
);
$this->load->view("reports/tabular_details",$data);
}
function excel_export()
{
$this->load->view("reports/excel_export",array());
@@ -875,7 +923,7 @@ class Reports extends Secure_area
$report_data = $model->getData(array());
foreach($report_data as $row)
{
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level']);
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level'], $row['location_name']);
}
$data = array(
@@ -898,7 +946,7 @@ class Reports extends Secure_area
$report_data = $model->getData(array());
foreach($report_data as $row)
{
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level']);
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level'],$row['location_name']);
}
$data = array(

View File

@@ -35,8 +35,17 @@ class Sales extends Secure_area
function change_mode()
{
$mode = $this->input->post("mode");
$this->sale_lib->set_mode($mode);
$stock_location = $this->input->post("stock_location");
if (!$stock_location || $stock_location == $this->sale_lib->get_sale_location())
{
$this->sale_lib->clear_all();
$mode = $this->input->post("mode");
$this->sale_lib->set_mode($mode);
}
else
{
$this->sale_lib->set_sale_location($stock_location);
}
$this->_reload();
}
@@ -112,7 +121,8 @@ class Sales extends Secure_area
$data=array();
$mode = $this->sale_lib->get_mode();
$item_id_or_number_or_item_kit_or_receipt = $this->input->post("item");
$quantity = $mode=="sale" ? 1:-1;
$quantity = ($mode=="return")? -1:1;
$item_location = $this->sale_lib->get_sale_location();
if($this->sale_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt) && $mode=='return')
{
@@ -120,14 +130,14 @@ class Sales extends Secure_area
}
elseif($this->sale_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
{
$this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt);
$this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt,$item_location);
}
elseif(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity))
elseif(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity,$item_location))
{
$data['error']=$this->lang->line('sales_unable_to_add_item');
}
if($this->sale_lib->out_of_stock($item_id_or_number_or_item_kit_or_receipt))
if($this->sale_lib->out_of_stock($item_id_or_number_or_item_kit_or_receipt,$item_location))
{
$data['warning'] = $this->lang->line('sales_quantity_less_than_zero');
}
@@ -146,6 +156,7 @@ class Sales extends Secure_area
$price = $this->input->post("price");
$quantity = $this->input->post("quantity");
$discount = $this->input->post("discount");
$item_location = $this->input->post("location");
if ($this->form_validation->run() != FALSE)
@@ -157,7 +168,7 @@ class Sales extends Secure_area
$data['error']=$this->lang->line('sales_error_editing_item');
}
if($this->sale_lib->out_of_stock($this->sale_lib->get_item_id($line)))
if($this->sale_lib->out_of_stock($this->sale_lib->get_item_id($line),$item_location))
{
$data['warning'] = $this->lang->line('sales_quantity_less_than_zero');
}
@@ -186,6 +197,8 @@ class Sales extends Secure_area
$data['total']=$this->sale_lib->get_total();
$data['receipt_title']=$this->lang->line('sales_receipt');
$data['transaction_time']= date('m/d/Y h:i:s a');
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
$data['show_stock_locations'] = count($stock_locations) > 1;
$customer_id=$this->sale_lib->get_customer();
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$comment = $this->sale_lib->get_comment();
@@ -193,7 +206,7 @@ class Sales extends Secure_area
$data['payments']=$this->sale_lib->get_payments();
$data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1);
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
if($customer_id!=-1)
{
$cust_info=$this->Customer->get_info($customer_id);
@@ -230,6 +243,8 @@ class Sales extends Secure_area
{
$sale_info = $this->Sale->get_info($sale_id)->row_array();
$this->sale_lib->copy_entire_sale($sale_id);
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
$data['show_stock_locations'] = count($stock_locations) > 1;
$data['cart']=$this->sale_lib->get_cart();
$data['payments']=$this->sale_lib->get_payments();
$data['subtotal']=$this->sale_lib->get_subtotal();
@@ -330,7 +345,8 @@ class Sales extends Secure_area
}
/* Changed the conditional to account for floating point rounding */
if ( ( $this->sale_lib->get_mode() == 'sale' ) && ( ( to_currency_no_money( $this->sale_lib->get_total() ) - $total_payments ) > 1e-6 ) )
if ( ($this->sale_lib->get_mode() == 'sale') &&
( ( to_currency_no_money( $this->sale_lib->get_total() ) - $total_payments ) > 1e-6 ) )
{
return false;
}
@@ -341,9 +357,22 @@ class Sales extends Secure_area
function _reload($data=array())
{
$person_info = $this->Employee->get_logged_in_employee_info();
$data['cart']=$this->sale_lib->get_cart();
$data['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return'));
$data['mode']=$this->sale_lib->get_mode();
$data['cart']=$this->sale_lib->get_cart();
$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['subtotal']=$this->sale_lib->get_subtotal();
$data['taxes']=$this->sale_lib->get_taxes();
$data['total']=$this->sale_lib->get_total();

View File

@@ -159,8 +159,8 @@ function get_items_manage_table($items,$controller)
$CI->lang->line('items_category'),
$CI->lang->line('items_cost_price'),
$CI->lang->line('items_unit_price'),
$CI->lang->line('items_tax_percents'),
$CI->lang->line('items_quantity'),
$CI->lang->line('items_tax_percents'),
' ',
$CI->lang->line('items_inventory')
);
@@ -210,6 +210,17 @@ function get_item_data_row($item,$controller)
$controller_name=strtolower(get_class($CI));
$width = $controller->get_form_width();
$item_quantity='';
$locations_data = $CI->Stock_locations->get_undeleted_all()->result_array();
foreach($locations_data as $location)
{
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 . '<br/>';
}
$table_data_row='<tr>';
$table_data_row.="<td width='3%'><input type='checkbox' id='item_$item->item_id' value='".$item->item_id."'/></td>";
$table_data_row.='<td width="15%">'.$item->item_number.'</td>';
@@ -217,8 +228,8 @@ 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%">'.$tax_percents.'</td>';
$table_data_row.='<td width="14%">'.$item->quantity.'</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>';
//Ramel Inventory Tracking

View File

@@ -32,4 +32,7 @@ $lang['config_custom7'] = 'Custom Field 7'; //GARRISON ADDED 4/21/2013
$lang['config_custom8'] = 'Custom Field 8'; //GARRISON ADDED 4/21/2013
$lang['config_custom9'] = 'Custom Field 9'; //GARRISON ADDED 4/21/2013
$lang['config_custom10'] = 'Custom Field 10'; //GARRISON ADDED 4/21/2013
$lang['config_stock_location'] = 'Stock location';
$lang['config_stock_location_required'] = 'Stock location number is a required field';
?>

View File

@@ -23,4 +23,5 @@ $lang['employees_login_info'] = 'Employee Login Info';
$lang['employees_permission_info'] = 'Employee Permissions and Access';
$lang['employees_permission_desc'] = 'Check the boxes below to grant access to modules';
$lang['employees_error_updating_demo_admin'] = 'You can not change the demo admin user';
$lang['employees_error_deleting_demo_admin'] = 'You can not delete the demo admin user';
?>

View File

@@ -1,56 +1,56 @@
<?php
$lang['items_item_number'] = 'UPC/EAN/ISBN';
$lang['items_retrive_item_info'] = 'Retrive Item Info';
$lang['items_description'] = 'Description';
$lang['items_amazon'] = 'Amazon';
$lang['items_upc_database'] = 'UPC Database';
$lang['items_cannot_find_item'] = 'Cannot find any information about item';
$lang['items_info_provided_by'] = 'Info provided by';
$lang['items_basic_information'] = 'Item Information';
$lang['items_number_information'] = 'Item Number';
$lang['items_new'] = 'New Item';
$lang['items_update'] = 'Update Item';
$lang['items_item'] = 'Item';
$lang['items_edit_multiple_items'] = 'Editing Multiple Items';
$lang['items_name'] = 'Item Name';
$lang['items_category'] = 'Category';
$lang['items_cost_price'] = 'Wholesale Price';//GARRISON ADDED 4/21/2013
$lang['items_unit_price'] = 'Retail Price';//GARRISON ADDED 4/21/2013
$lang['items_tax_1'] = 'Tax 1';
$lang['items_tax_2'] = 'Tax 2';
$lang['items_item_number']='UPC/EAN/ISBN';
$lang['items_retrive_item_info']='Retrive Item Info';
$lang['items_description']='Description';
$lang['items_amazon']='Amazon';
$lang['items_upc_database']='UPC Database';
$lang['items_cannot_find_item']='Cannot find any information about item';
$lang['items_info_provided_by']='Info provided by';
$lang['items_basic_information']='Item Information';
$lang['items_number_information']='Item Number';
$lang['items_new']='New Item';
$lang['items_update']='Update Item';
$lang['items_item']='Item';
$lang['items_edit_multiple_items']='Editing Multiple Items';
$lang['items_name']='Item Name';
$lang['items_category']='Category';
$lang['items_cost_price']='Cost Price';//GARRISON ADDED 4/21/2013
$lang['items_unit_price']='Retail Price';//GARRISON ADDED 4/21/2013
$lang['items_tax_1']='Tax 1';
$lang['items_tax_2']='Tax 2';
$lang['items_sales_tax_1'] = 'Sales Tax';
$lang['items_sales_tax_2'] = 'Sales Tax 2';
$lang['items_tax_percent'] = 'Tax Percent';
$lang['items_tax_percents'] = 'Tax Percent(s)';
$lang['items_reorder_level'] = 'Reorder Level';
$lang['items_quantity'] = 'Quantity';
$lang['items_reorder_level'] = 'Reorder Level';
$lang['items_no_items_to_display'] = 'No Items to display';
$lang['items_bulk_edit'] = 'Bulk Edit';
$lang['items_confirm_delete'] = 'Are you sure you want to delete the selected items?';
$lang['items_none_selected'] = 'You have not selected any items to edit';
$lang['items_confirm_bulk_edit'] = 'Are you sure you want to edit all the items selected?';
$lang['items_successful_bulk_edit'] = 'You have successfully updated the selected items';
$lang['items_error_updating_multiple'] = 'Error updating items';
$lang['items_edit_fields_you_want_to_update'] = 'Edit the fields you want to edit for ALL selected items';
$lang['items_tax_percent']='Tax Percent';
$lang['items_tax_percents']='Tax Percent(s)';
$lang['items_reorder_level']='Reorder Level';
$lang['items_quantity']='Quantity';
$lang['items_reorder_level']='Reorder Level';
$lang['items_no_items_to_display']='No Items to display';
$lang['items_bulk_edit']='Bulk Edit';
$lang['items_confirm_delete']='Are you sure you want to delete the selected items?';
$lang['items_none_selected']='You have not selected any items to edit';
$lang['items_confirm_bulk_edit']='Are you sure you want to edit all the items selected?';
$lang['items_successful_bulk_edit']='You have successfully updated the selected items';
$lang['items_error_updating_multiple']='Error updating items';
$lang['items_edit_fields_you_want_to_update']='Edit the fields you want to edit for ALL selected items';
$lang['items_error_adding_updating'] = 'Error adding/updating item';
$lang['items_successful_adding'] = 'You have successfully added item';
$lang['items_successful_updating'] = 'You have successfully updated item';
$lang['items_successful_deleted'] = 'You have successfully deleted';
$lang['items_one_or_multiple'] = 'item(s)';
$lang['items_cannot_be_deleted'] = 'Could not deleted selected items, one or more of the selected items has sales.';
$lang['items_name_required'] = 'Item Name is a required field';
$lang['items_category_required'] = 'Category is a required field';
$lang['items_buy_price_required'] = 'Purchase price is a required field'; //GARRISON UPDATED 6/3/2013
$lang['items_unit_price_required'] = 'Retail Price is a required field'; //GARRISON UPDATED 6/3/2013
$lang['items_cost_price_required'] = 'Wholesale Price is a required field'; //GARRISON UPDATED 6/3/2013
$lang['items_tax_percent_required'] = 'Tax Percent is a required field';
$lang['items_quantity_required'] = 'Quantity is a required field';
$lang['items_reorder_level_required'] = 'Reorder level is a required field';
$lang['items_unit_price_number'] = 'Unit price must be a number';
$lang['items_cost_price_number'] = 'Cost price must be a number';
$lang['items_quantity_number'] = 'Quantity must be a number';
$lang['items_reorder_level_number'] = 'Reorder level must be a number';
$lang['items_successful_adding']='You have successfully added item';
$lang['items_successful_updating']='You have successfully updated item';
$lang['items_successful_deleted']='You have successfully deleted';
$lang['items_one_or_multiple']='item(s)';
$lang['items_cannot_be_deleted']='Could not deleted selected items, one or more of the selected items has sales.';
$lang['items_name_required']='Item Name is a required field';
$lang['items_category_required']='Category is a required field';
$lang['items_buy_price_required']='Purchase price is a required field'; //GARRISON UPDATED 6/3/2013
$lang['items_unit_price_required']='Retail Price is a required field'; //GARRISON UPDATED 6/3/2013
$lang['items_cost_price_required']='Cost Price is a required field'; //GARRISON UPDATED 6/3/2013
$lang['items_tax_percent_required']='Tax Percent is a required field';
$lang['items_quantity_required']='Quantity is a required field';
$lang['items_reorder_level_required']='Reorder level is a required field';
$lang['items_unit_price_number']='Unit price must be a number';
$lang['items_cost_price_number']='Cost price must be a number';
$lang['items_quantity_number']='Quantity must be a number';
$lang['items_reorder_level_number']='Reorder level must be a number';
$lang['items_none'] = 'None';
$lang['items_supplier'] = 'Supplier';
$lang['items_generate_barcodes'] = 'Generate Barcodes';
@@ -58,16 +58,15 @@ $lang['items_must_select_item_for_barcode'] = 'You must select at least 1 item t
$lang['items_excel_import_failed'] = 'Excel import failed';
$lang['items_allow_alt_description'] = 'Allow Alt Description';
$lang['items_is_serialized'] = 'Item has Serial Number';
$lang['items_low_inventory_items'] = 'Low Inventory Items';
$lang['items_serialized_items'] = 'Serialized Items';
$lang['items_no_description_items'] = 'No Description Items';
$lang['items_search_custom_items'] = 'Search Custom Fields';//GARRISON ADDED
$lang['items_inventory_comments'] = 'Comments';
$lang['items_count'] = 'Update Inventory';
$lang['items_details_count'] = 'Inventory Count Details';
$lang['items_add_minus'] = 'Inventory to add/subtract';
$lang['items_current_quantity'] = 'Current Quantity';
$lang['items_quantity_required'] = 'Quantity is a required field. Please Close ( X ) to cancel';
$lang['items_inventory_comments']='Comments';
$lang['items_count']='Update Inventory';
$lang['items_details_count']='Inventory Count Details';
$lang['items_add_minus']='Inventory to add/subtract';
$lang['items_current_quantity']='Current Quantity';
$lang['items_quantity_required']='Quantity is a required field. Please Close ( X ) to cancel';
$lang['items_do_nothing'] = 'Do Nothing';
$lang['items_change_all_to_serialized'] = 'Change All To Serialized';
$lang['items_change_all_to_unserialized'] = 'Change All To Unserialized';
@@ -78,4 +77,10 @@ $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

@@ -1,26 +1,40 @@
<?php
$lang['recvs_register'] = 'Items Receiving';
$lang['recvs_mode'] = 'Receiving Mode';
$lang['recvs_receiving'] = 'Receive';
$lang['recvs_return'] = 'Return';
$lang['recvs_total'] = 'Total';
$lang['recvs_cost'] = 'Cost';
$lang['recvs_quantity'] = 'Qty.';
$lang['recvs_discount'] = 'Disc %';
$lang['recvs_edit'] = 'Edit';
$lang['recvs_register']='Items Receiving';
$lang['recvs_mode']='Receiving Mode';
$lang['recvs_receiving']='Receive';
$lang['recvs_return']='Return';
$lang['recvs_total']='Total';
$lang['recvs_cost']='Cost';
$lang['recvs_quantity']='Qty.';
$lang['recvs_discount']='Disc %';
$lang['recvs_edit']='Edit';
$lang['recvs_new_supplier'] = 'New Supplier';
$lang['recvs_supplier'] = 'Supplier';
$lang['recvs_select_supplier'] = 'Select Supplier (Optional)';
$lang['recvs_start_typing_supplier_name'] = 'Start Typing supplier\'s name...';
$lang['recvs_unable_to_add_item'] = 'Unable to add item to receiving';
$lang['recvs_error_editing_item'] = 'Error editing item';
$lang['recvs_receipt'] = 'Receivings Receipt';
$lang['recvs_complete_receiving'] = 'Finish';
$lang['recvs_select_supplier']='Select Supplier (Optional)';
$lang['recvs_start_typing_supplier_name']='Start Typing supplier\'s name...';
$lang['recvs_unable_to_add_item']='Unable to add item to receiving';
$lang['recvs_error_editing_item']='Error editing item';
$lang['recvs_receipt']='Receivings Receipt';
$lang['recvs_complete_receiving']='Finish';
$lang['recvs_confirm_finish_receiving'] = 'Are you sure you want to submit this receiving? This cannot be undone.';
$lang['recvs_confirm_cancel_receiving'] = 'Are you sure you want to clear this receiving? All items will cleared.';
$lang['recvs_find_or_scan_item'] = 'Find/Scan Item';
$lang['recvs_find_or_scan_item_or_receipt'] = 'Find/Scan Item OR Receipt';
$lang['recvs_id'] = 'Receiving ID';
$lang['recvs_find_or_scan_item']='Find/Scan Item';
$lang['recvs_find_or_scan_item_or_receipt']='Find/Scan Item OR Receipt';
$lang['recvs_id']='Receiving ID';
$lang['recvs_item_name'] = 'Item Name';
$lang['receivings_transaction_failed'] = 'Receivings Transactions Failed';
$lang['recvs_requisition']='Requisition';
$lang['reqs_quantity'] ='Qty.';
$lang['reqs_related_item']='Related item';
$lang['reqs_unit_quantity']='Unit qty.';
$lang['reqs_unit_quantity_total']='Total qty.';
$lang['reqs_related_item_quantity']='Related item qty.';
$lang['reqs_receipt']='Requisition Receipt';
$lang['reqs_transaction_failed'] = 'Requisition Transactions Failed';
$lang['reqs_unable_to_add_item']='Unable to add item to requisition';
$lang['recvs_stock_source']='Stock source';
$lang['recvs_stock_destination']='Stock destination';
$lang['recvs_stock_locaiton']='Stock location';
$lang['recvs_error_requisition']='Unable to move inventory from and to the same stock location';
?>

View File

@@ -43,8 +43,8 @@ $lang['reports_all_time'] = 'All Time';
$lang['reports_detailed_sales_report'] = 'Detailed Sales Report';
$lang['reports_comments'] = 'Comments';
$lang['reports_discount'] = 'Discount';
$lang['reports_sales']= 'Sale';
$lang['reports_payment_type'] = 'Payment Type';
$lang['reports_sales'] = 'Sales';
$lang['reports_categories'] = 'Categories';
$lang['reports_customers'] = 'Customers';
$lang['reports_suppliers'] = 'Suppliers';
@@ -84,7 +84,12 @@ $lang['reports_supplied_by'] = 'Supplied by';
$lang['reports_items_received'] = 'Items Received';
$lang['reports_detailed_receivings_report'] = 'Detailed Receivings Report';
$lang['reports_sale_type'] = 'Sale Type';
$lang['reports_receiving_type'] = 'Receiving Type';
$lang['reports_all'] = 'All';
$lang['reports_returns'] = 'Returns';
$lang['reports_discount'] = 'Discounts';
$lang['reports_sales'] = 'Sales';
$lang['reports_requisitions'] = 'Requisitions';
$lang['reports_receiving_id'] = 'Receiving ID';
$lang['reports_stock_location'] = 'Stock location';
?>

View File

@@ -1,42 +1,40 @@
<?php
$lang['sales_giftcard_number'] = 'Gift Card Number';
$lang['sales_giftcard'] = 'Gift Card';
$lang['sales_register'] = 'Sales Register';
$lang['sales_mode'] = 'Register Mode';
$lang['sales_giftcard_number']='Gift Card Number';
$lang['sales_giftcard']='Gift Card';
$lang['sales_register']='Sales Register';
$lang['sales_mode']='Register Mode';
$lang['sales_new_item'] = 'New Item';
$lang['sales_item_name'] = 'Item Name';
$lang['sales_item_number'] = 'Item #';
$lang['sales_new_customer'] = 'New Customer';
$lang['sales_customer'] = 'Customer';
$lang['sales_no_items_in_cart'] = 'There are no items in the cart';
$lang['sales_total'] = 'Total';
$lang['sales_tax_percent'] = 'Tax %';
$lang['sales_price'] = 'Price';
$lang['sales_quantity'] = 'Qty.';
$lang['sales_discount'] = 'Disc %';
$lang['sales_edit'] = 'Edit';
$lang['sales_payment'] = 'Payment Type';
$lang['sales_edit_item'] = 'Edit Item';
$lang['sales_find_or_scan_item'] = 'Find/Scan Item';
$lang['sales_find_or_scan_item_or_receipt'] = 'Find/Scan Item OR Receipt';
$lang['sales_select_customer'] = 'Select Customer (Optional)';
$lang['sales_start_typing_item_name'] = 'Start Typing item\'s name or scan barcode...';
$lang['sales_start_typing_customer_name'] = 'Start Typing customer\'s name...';
$lang['sales_sub_total'] = 'Sub Total';
$lang['sales_tax'] = 'Tax';
$lang['sales_comment'] = 'Comment';
$lang['sales_unable_to_add_item'] = 'Unable to add item to sale';
$lang['sales_sale_for_customer'] = 'Customer:';
$lang['sales_remove_customer'] = 'Remove Customer';
$lang['sales_error_editing_item'] = 'Error editing item';
$lang['sales_complete_sale'] = 'Complete Sale';
$lang['sales_cancel_sale'] = 'Cancel Sale';
$lang['sales_add_payment'] = 'Add Payment';
$lang['sales_receipt'] = 'Sales Receipt';
$lang['sales_receipt_number']='POS #';
$lang['sales_id'] = 'Sale ID';
$lang['sales_sale'] = 'Sale';
$lang['sales_return'] = 'Return';
$lang['sales_no_items_in_cart']='There are no items in the cart';
$lang['sales_total']='Total';
$lang['sales_tax_percent']='Tax %';
$lang['sales_price']='Price';
$lang['sales_quantity']='Qty.';
$lang['sales_discount']='Disc %';
$lang['sales_edit']='Edit';
$lang['sales_payment']='Payment Type';
$lang['sales_edit_item']='Edit Item';
$lang['sales_find_or_scan_item']='Find/Scan Item';
$lang['sales_find_or_scan_item_or_receipt']='Find/Scan Item OR Receipt';
$lang['sales_select_customer']='Select Customer (Optional)';
$lang['sales_start_typing_item_name']='Start Typing item\'s name or scan barcode...';
$lang['sales_start_typing_customer_name']='Start Typing customer\'s name...';
$lang['sales_sub_total']='Sub Total';
$lang['sales_tax']='Tax';
$lang['sales_comment']='Comment';
$lang['sales_unable_to_add_item']='Unable to add item to sale';
$lang['sales_sale_for_customer']='Customer:';
$lang['sales_remove_customer']='Remove Customer';
$lang['sales_error_editing_item']='Error editing item';
$lang['sales_complete_sale']='Complete Sale';
$lang['sales_cancel_sale']='Cancel Sale';
$lang['sales_add_payment']='Add Payment';
$lang['sales_receipt']='Sales Receipt';
$lang['sales_id']='Sale ID';
$lang['sales_return']='Return';
$lang['sales_confirm_finish_sale'] = 'Are you sure you want to submit this sale? This cannot be undone.';
$lang['sales_confirm_cancel_sale'] = 'Are you sure you want to clear this sale? All items will cleared.';
$lang['sales_cash'] = 'Cash';
@@ -71,6 +69,7 @@ $lang['sales_confirm_suspend_sale'] = 'Are you sure you want to suspend this sal
$lang['sales_suspended_sales'] = 'Suspended Sales';
$lang['sales_suspended_sale_id'] = 'ID';
$lang['sales_date'] = 'Date';
$lang['sales_customer'] = 'Customer';
$lang['sales_comments'] = 'Comments';
$lang['sales_unsuspend_and_delete'] = '';
$lang['sales_unsuspend'] = 'Unsuspend';
@@ -84,4 +83,7 @@ $lang['sales_amount_due'] = 'Amount Due';
$lang['sales_payment_type'] = "Type";
$lang['sales_payment_amount'] = "Amount";
$lang['sales_basic_information']='Sale information';
$lang['sales_stock_location']='Stock location';
$lang['sales_sale']='Sale';
?>

View File

@@ -79,92 +79,7 @@ $lang['items_inventory'] = 'สินค้าคงเหลือ';
$lang['items_location'] = 'ที่ตั้ง';
$lang['items_unit_quantity'] = 'จำนวนหน่วย';
$lang['items_related_number'] = 'สินค้าที่เกี่ยวข้อง';
$lang['items_stock_type_sale'] = 'สินค้าหน้าร้าน';
$lang['items_stock_type_warehouse'] = 'สินค้าหลังร้าน';
$lang['items_stock_type'] = 'ชนิดของสินค้า';
?>
<?php
$lang['items_item_number']='โค๊ด';
$lang['items_retrive_item_info']='รับข้อมูลสินค้า';
$lang['items_description']='รายละเอียด';
$lang['items_amazon']='Amazon';
$lang['items_upc_database']='UPC ฐานข้อมูล';
$lang['items_cannot_find_item']='ไม่พบข้อมูลของสินค้า';
$lang['items_info_provided_by']='จัดเตรียมข้อมูลโดย';
$lang['items_basic_information']='ข้อมูลสินค้ส';
$lang['items_number_information']='หมายเลขสินค้า';
$lang['items_new']='สินค้าใหม่';
$lang['items_update']='ปรับแต่งสินค้า';
$lang['items_item']='สินค้า';
$lang['items_edit_multiple_items']='แก้ใขสินค้าต่างๆ';
$lang['items_name']='ชื่อสินค้า';
$lang['items_category']='หมวดหมู่';
$lang['items_cost_price']='ราคาทุน';//GARRISON ADDED 4/21/2013
$lang['items_unit_price']='ราคาขาย';//GARRISON ADDED 4/21/2013
$lang['items_tax_1']='ภาษี 1';
$lang['items_tax_2']='ภาษี 2';
$lang['items_sales_tax_1'] = 'ถาษีขาย';
$lang['items_sales_tax_2'] = 'ภาษีขาย 2';
$lang['items_tax_percent']='ภาษี(%)';
$lang['items_tax_percents']='ภาษี(%)';
$lang['items_reorder_level']='ระดับการสั่งใหม่';
$lang['items_quantity']='จำนวน';
$lang['items_reorder_level']='ระดับการสั่งใหม่';
$lang['items_no_items_to_display']='ไม่มีสินค้าแสดง';
$lang['items_bulk_edit']='แก้ไขความจุ';
$lang['items_confirm_delete']='แน่ใจหรือไม่ที่จะลบสินค้าที่ถูกเลือก?';
$lang['items_none_selected']='กรุณาเลือสินค้าที่ต้องการแก้ไข';
$lang['items_confirm_bulk_edit']='แน่ใจหรือไม่ที่จะแก้ใขสินค้าทั้งหมดที่คุณเลือก?';
$lang['items_successful_bulk_edit']='ปรับแต่งสินค้าสำเร็จ';
$lang['items_error_updating_multiple']='ปรับแต่งสินค้าล้มเหลว';
$lang['items_edit_fields_you_want_to_update']='แก้ไขสินค้าทุกชนิดที่คุณเลือก';
$lang['items_error_adding_updating'] = 'เพิ่ม/ปรับแต่ง สินค้าล้มเหลว';
$lang['items_successful_adding']='เพิ่มสินค้าสำเร็จ';
$lang['items_successful_updating']='ปรับแต่งสินค้าสำเร็จ';
$lang['items_successful_deleted']='ลบสินค้าสำเร็จ';
$lang['items_one_or_multiple']='สินค้า(s)';
$lang['items_cannot_be_deleted']='ไมม่สามารถลบสินค้าที่เลือก, สินค้าที่เลือกถูกขายไปแล้ว.';
$lang['items_name_required']='ชื่อสินค้าต้องกรอก';
$lang['items_category_required']='หมวดหมู่สินค้าต้องกรอก';
$lang['items_buy_price_required']='ราคาซื้อขายต้องกรอก'; //GARRISON UPDATED 6/3/2013
$lang['items_unit_price_required']='ราคาต่อหน่วยต้องกรอก'; //GARRISON UPDATED 6/3/2013
$lang['items_cost_price_required']='ราคาทุนต้องกรอก'; //GARRISON UPDATED 6/3/2013
$lang['items_tax_percent_required']='เปอร์เซ็นต์ต้องกรอก';
$lang['items_quantity_required']='จำนวนต้องกรอก';
$lang['items_reorder_level_required']='ระดับการสั่งไหม่ต้องกรอก';
$lang['items_unit_price_number']='ราคาต่อหน่วยต้องเป็นตัวเลข';
$lang['items_cost_price_number']='ราคาทุนต้องเป็นตัวเลข';
$lang['items_quantity_number']='จำนวนต้องเป็นตัวเลข';
$lang['items_reorder_level_number']='ระดับการสั่งใหม่ต้องเป็นตัวเลข';
$lang['items_none'] = 'ว่างเปล่า';
$lang['items_supplier'] = 'ผู้ผลิต';
$lang['items_generate_barcodes'] = 'สร้างบาร์โค๊ด';
$lang['items_must_select_item_for_barcode'] = 'คุต้องเลือกสินค้าอย่างน้อยหนึ่งอย่างเพื่อจะสร้างบาร์โค๊ด';
$lang['items_excel_import_failed'] = 'นำเข้าข้อมูล Excel ล้มเหลว';
$lang['items_allow_alt_desciption'] = 'Allow Alt Description';
$lang['items_is_serialized'] = 'สินค้ามีซีเรียวนัมเบอร์';
$lang['items_low_inventory_items'] = 'สินค้าคงเหลือน้อย';
$lang['items_serialized_items'] = 'รหัสสินค้า';
$lang['items_no_description_items'] = 'สินค้าที่ไม่มีคำอธิบายหรือวิธีการใช้';
$lang['items_search_custom_items'] = 'Search Custom Fields';//GARRISON ADDED
$lang['items_inventory_comments']='คำอธิบาย';
$lang['items_count']='แก้ไขจำนวนสินค้าคงคลัง';
$lang['items_details_count']='รายละเอียดจำนวนสินค้าคงคลัง';
$lang['items_add_minus']='เพิ่ม/ลบ จำนวนสินค้าคงคลัง';
$lang['items_current_quantity']='ปริมาณสินค้าคงคลัง';
$lang['items_quantity_required']='จำนวนต้องกรอก. กรุณาปิดเพื่อยกเลิก';
$lang['items_do_nothing'] = 'ไม่ต้องทำอะไร';
$lang['items_change_all_to_serialized'] = 'เปลี่ยนแปลงรหัสสินค้าทั้งหมด';
$lang['items_change_all_to_unserialized'] = 'ลบรหัสสินค้าทั้งหมด';
$lang['items_change_all_to_allow_alt_desc'] = ' Allow Alt Desc For All';
$lang['items_change_all_to_not_allow_allow_desc'] = 'Not Allow Alt Desc For All';
$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_sale'] = 'สินค้าหน้าร้าน';
$lang['items_stock_type_warehouse'] = 'สินค้าหลังร้าน';
$lang['items_stock_type'] = 'ชนิดของสินค้า';
?>

View File

@@ -43,8 +43,6 @@ $lang['reports_comments'] = 'หมายเหตุ';
$lang['reports_discount'] = 'ส่วนลด';
$lang['reports_payment_type'] = 'ชนิดของการจ่าย';
$lang['reports_sales'] = 'ขาย';
$lang['reports_sales_retail'] = 'ขายปลีก';
$lang['reports_sales_wholesale'] = 'ขายส่ง';
$lang['reports_categories'] = 'หมวดหมู่';
$lang['reports_customers'] = 'ลูกค้า';
$lang['reports_suppliers'] = 'ผู้ผลิต';
@@ -145,8 +143,6 @@ $lang['reports_comments'] = 'หมายเหตุ';
$lang['reports_discount'] = 'ส่วนลด';
$lang['reports_payment_type'] = 'ชนิดของการจ่าย';
$lang['reports_sales'] = 'ขาย';
$lang['reports_sales_retail'] = 'ขายปลีก';
$lang['reports_sales_wholesale'] = 'ขายส่ง';
$lang['reports_categories'] = 'หมวดหมู่';
$lang['reports_customers'] = 'ลูกค้า';
$lang['reports_suppliers'] = 'ผู้ผลิต';

View File

@@ -34,8 +34,6 @@ $lang['sales_cancel_sale']='ยกเลิกการขาย';
$lang['sales_add_payment']='เพิ่มบิล';
$lang['sales_receipt']='บิลขาย';
$lang['sales_id']='เลขที่ขาย';
$lang['sales_sale_retail']='ขายปลีก';
$lang['sales_wholesale']='ขายส่ง';
$lang['sales_return']='คืน';
$lang['sales_confirm_finish_sale'] = 'แน่ใจหรือไม่ที่จะสำเร็จการขาย? ไม่สามารถย้อนกลับได้.';
$lang['sales_confirm_cancel_sale'] = 'แน่ใจหรือไม่ที่จะล้างรายการขาย? สินค้าทุกอย่างจะถูกลบจากบอร์ด.';
@@ -114,8 +112,6 @@ $lang['sales_cancel_sale']='ยกเลิกการขาย';
$lang['sales_add_payment']='เพิ่มบิล';
$lang['sales_receipt']='บิลขาย';
$lang['sales_id']='เลขที่ขาย';
$lang['sales_sale_retail']='ขายปลีก';
$lang['sales_wholesale']='ขายส่ง';
$lang['sales_return']='คืน';
$lang['sales_confirm_finish_sale'] = 'แน่ใจหรือไม่ที่จะสำเร็จการขาย? ไม่สามารถย้อนกลับได้.';
$lang['sales_confirm_cancel_sale'] = 'แน่ใจหรือไม่ที่จะล้างรายการขาย? สินค้าทุกอย่างจะถูกลบจากบอร์ด.';

View File

@@ -46,8 +46,50 @@ class Receiving_lib
{
$this->CI->session->set_userdata('recv_mode',$mode);
}
function get_stock_source()
{
if(!$this->CI->session->userdata('recv_stock_source'))
{
$stock_locations = $this->CI->Stock_locations->get_undeleted_all()->result_array();
$location_name = $stock_locations[0]['location_id'];
$this->set_stock_source($location_name);
}
return $this->CI->session->userdata('recv_stock_source');
}
function add_item($item_id,$quantity=1,$discount=0,$price=null,$description=null,$serialnumber=null)
function set_stock_source($stock_source)
{
$this->CI->session->set_userdata('recv_stock_source',$stock_source);
}
function clear_stock_source()
{
$this->CI->session->unset_userdata('recv_stock_source');
}
function get_stock_destination()
{
if(!$this->CI->session->userdata('recv_stock_destination'))
{
$stock_locations = $this->CI->Stock_locations->get_undeleted_all()->result_array();
$location_name = $stock_locations[0]['location_id'];
$this->set_stock_destination($location_name);
}
return $this->CI->session->userdata('recv_stock_destination');
}
function set_stock_destination($stock_destination)
{
$this->CI->session->set_userdata('recv_stock_destination',$stock_destination);
}
function clear_stock_destination()
{
$this->CI->session->unset_userdata('recv_stock_destination');
}
function add_item($item_id,$quantity=1,$item_location,$discount=0,$price=null,$description=null,$serialnumber=null)
{
//make sure item exists in database.
if(!$this->CI->Item->exists($item_id))
@@ -84,7 +126,7 @@ class Receiving_lib
$maxkey = $item['line'];
}
if($item['item_id']==$item_id)
if($item['item_id']==$item_id && $item['item_location']==$item_location)
{
$itemalreadyinsale=TRUE;
$updatekey=$item['line'];
@@ -92,20 +134,23 @@ class Receiving_lib
}
$insertkey=$maxkey+1;
$item_info=$this->CI->Item->get_info($item_id);
//array records are identified by $insertkey and item_id is just another field.
$item = array(($insertkey)=>
array(
'item_id'=>$item_id,
'item_location'=>$item_location,
'stock_name'=>$this->CI->Stock_locations->get_location_name($item_location),
'line'=>$insertkey,
'name'=>$this->CI->Item->get_info($item_id)->name,
'description'=>$description!=null ? $description: $this->CI->Item->get_info($item_id)->description,
'name'=>$item_info->name,
'description'=>$description!=null ? $description: $item_info->description,
'serialnumber'=>$serialnumber!=null ? $serialnumber: '',
'allow_alt_description'=>$this->CI->Item->get_info($item_id)->allow_alt_description,
'is_serialized'=>$this->CI->Item->get_info($item_id)->is_serialized,
'allow_alt_description'=>$item_info->allow_alt_description,
'is_serialized'=>$item_info->is_serialized,
'quantity'=>$quantity,
'discount'=>$discount,
'price'=>$price!=null ? $price: $this->CI->Item->get_info($item_id)->cost_price
'in_stock'=>$this->CI->Item_quantities->get_item_quantity($item_id, $item_location)->quantity,
'price'=>$price!=null ? $price: $item_info->cost_price
)
);
@@ -140,7 +185,7 @@ class Receiving_lib
return false;
}
function is_valid_receipt($receipt_receiving_id)
{
//RECV #
@@ -178,12 +223,12 @@ class Receiving_lib
foreach($this->CI->Receiving->get_receiving_items($receiving_id)->result() as $row)
{
$this->add_item($row->item_id,-$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
$this->add_item($row->item_id,-$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
$this->set_supplier($this->CI->Receiving->get_supplier($receiving_id)->person_id);
}
function add_item_kit($external_item_kit_id)
function add_item_kit($external_item_kit_id,$item_location)
{
//KIT #
$pieces = explode(' ',$external_item_kit_id);
@@ -191,7 +236,7 @@ class Receiving_lib
foreach ($this->CI->Item_kit_items->get_info($item_kit_id) as $item_kit_item)
{
$this->add_item($item_kit_item['item_id'], $item_kit_item['quantity']);
$this->add_item($item_kit_item['item_id'],$item_kit_item['quantity'],$item_location);
}
}
@@ -202,11 +247,24 @@ class Receiving_lib
foreach($this->CI->Receiving->get_receiving_items($receiving_id)->result() as $row)
{
$this->add_item($row->item_id,$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
$this->add_item($row->item_id,$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
$this->set_supplier($this->CI->Receiving->get_supplier($receiving_id)->person_id);
}
function copy_entire_requisition($requisition_id,$item_location)
{
$this->empty_cart();
$this->delete_supplier();
foreach($this->CI->Receiving->get_requisition_items($requisition_id)->result() as $row)
{
$this->add_item_unit($row->item_id,$row->requisition_quantity,$item_location,$row->description);
}
$this->set_supplier($this->CI->Receiving->get_supplier($requisition_id)->person_id);
}
function delete_item($line)
{

View File

@@ -167,18 +167,34 @@ class Sale_lib
$this->CI->session->set_userdata('sale_mode',$mode);
}
function add_item($item_id,$quantity=1,$discount=0,$price=null,$description=null,$serialnumber=null)
function get_sale_location()
{
if(!$this->CI->session->userdata('sale_location'))
{
$stock_locations = $this->CI->Stock_locations->get_undeleted_all()->result_array();
$location_name = $stock_locations[0]['location_id'];
$this->set_sale_location($location_name);
}
return $this->CI->session->userdata('sale_location');
}
function set_sale_location($location)
{
$this->CI->session->set_userdata('sale_location',$location);
}
function clear_sale_location()
{
$this->CI->session->unset_userdata('sale_location');
}
function add_item($item_id,$quantity=1,$item_location,$discount=0,$price=null,$description=null,$serialnumber=null)
{
//make sure item exists
if(!$this->CI->Item->exists($item_id))
{
//try to get item id given an item_number
$item_id = $this->CI->Item->get_item_id($item_id);
if(!$item_id)
return false;
}
//make sure item exists
if($this->validate_item($item_id) == false)
{
return false;
}
//Alain Serialization and Description
@@ -205,7 +221,7 @@ class Sale_lib
$maxkey = $item['line'];
}
if($item['item_id']==$item_id)
if($item['item_id']==$item_id && $item['item_location']==$item_location)
{
$itemalreadyinsale=TRUE;
$updatekey=$item['line'];
@@ -213,26 +229,29 @@ class Sale_lib
}
$insertkey=$maxkey+1;
$item_info=$this->CI->Item->get_info($item_id);
//array/cart records are identified by $insertkey and item_id is just another field.
$item = array(($insertkey)=>
array(
'item_id'=>$item_id,
'item_location'=>$item_location,
'stock_name'=>$this->CI->Stock_locations->get_location_name($item_location),
'line'=>$insertkey,
'name'=>$this->CI->Item->get_info($item_id)->name,
'item_number'=>$this->CI->Item->get_info($item_id)->item_number,
'description'=>$description!=null ? $description: $this->CI->Item->get_info($item_id)->description,
'name'=>$item_info->name,
'item_number'=>$item_info->item_number,
'description'=>$description!=null ? $description: $item_info->description,
'serialnumber'=>$serialnumber!=null ? $serialnumber: '',
'allow_alt_description'=>$this->CI->Item->get_info($item_id)->allow_alt_description,
'is_serialized'=>$this->CI->Item->get_info($item_id)->is_serialized,
'allow_alt_description'=>$item_info->allow_alt_description,
'is_serialized'=>$item_info->is_serialized,
'quantity'=>$quantity,
'discount'=>$discount,
'price'=>$price!=null ? $price: $this->CI->Item->get_info($item_id)->unit_price
'in_stock'=>$this->CI->Item_quantities->get_item_quantity($item_id, $item_location)->quantity,
'price'=>$price!=null ? $price: $item_info->unit_price
)
);
//Item already exists and is not serialized, add to quantity
if($itemalreadyinsale && ($this->CI->Item->get_info($item_id)->is_serialized ==0) )
if($itemalreadyinsale && ($item_info->is_serialized ==0) )
{
$items[$updatekey]['quantity']+=$quantity;
}
@@ -247,22 +266,20 @@ class Sale_lib
}
function out_of_stock($item_id)
function out_of_stock($item_id,$item_location)
{
//make sure item exists
if(!$this->CI->Item->exists($item_id))
{
//try to get item id given an item_number
$item_id = $this->CI->Item->get_item_id($item_id);
if($this->validate_item($item_id) == false)
{
return false;
}
if(!$item_id)
return false;
}
$item = $this->CI->Item->get_info($item_id);
$quanity_added = $this->get_quantity_already_added($item_id);
//$item = $this->CI->Item->get_info($item_id);
$item_quantity = $this->CI->Item_quantities->get_item_quantity($item_id,$item_location)->quantity;
$quanity_added = $this->get_quantity_already_added($item_id,$item_location);
if ($item->quantity - $quanity_added < 0)
if ($item_quantity - $quanity_added < 0)
{
return true;
}
@@ -270,13 +287,13 @@ class Sale_lib
return false;
}
function get_quantity_already_added($item_id)
function get_quantity_already_added($item_id,$item_location)
{
$items = $this->get_cart();
$quanity_already_added = 0;
foreach ($items as $item)
{
if($item['item_id']==$item_id)
if($item['item_id']==$item_id && $item['item_location']==$item_location)
{
$quanity_already_added+=$item['quantity'];
}
@@ -353,12 +370,12 @@ class Sale_lib
foreach($this->CI->Sale->get_sale_items($sale_id)->result() as $row)
{
$this->add_item($row->item_id,-$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
$this->add_item($row->item_id,-$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
$this->set_customer($this->CI->Sale->get_customer($sale_id)->person_id);
}
function add_item_kit($external_item_kit_id)
function add_item_kit($external_item_kit_id,$item_location)
{
//KIT #
$pieces = explode(' ',$external_item_kit_id);
@@ -366,7 +383,7 @@ class Sale_lib
foreach ($this->CI->Item_kit_items->get_info($item_kit_id) as $item_kit_item)
{
$this->add_item($item_kit_item['item_id'], $item_kit_item['quantity']);
$this->add_item($item_kit_item['item_id'],$item_kit_item['quantity'],$item_location);
}
}
@@ -377,7 +394,7 @@ class Sale_lib
foreach($this->CI->Sale->get_sale_items($sale_id)->result() as $row)
{
$this->add_item($row->item_id,$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
$this->add_item($row->item_id,$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
foreach($this->CI->Sale->get_sale_payments($sale_id)->result() as $row)
{
@@ -394,7 +411,7 @@ class Sale_lib
foreach($this->CI->Sale_suspended->get_sale_items($sale_id)->result() as $row)
{
$this->add_item($row->item_id,$row->quantity_purchased,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
$this->add_item($row->item_id,$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
foreach($this->CI->Sale_suspended->get_sale_payments($sale_id)->result() as $row)
{
@@ -494,5 +511,20 @@ class Sale_lib
return to_currency_no_money($total);
}
function validate_item(&$item_id)
{
//make sure item exists
if(!$this->CI->Item->exists($item_id))
{
//try to get item id given an item_number
$mode = $this->get_mode();
$item_id = $this->CI->Item->get_item_id($item_id);
if(!$item_id)
return false;
}
return true;
}
}
?>

View File

@@ -6,10 +6,14 @@ class Inventory extends CI_Model
return $this->db->insert('inventory',$inventory_data);
}
function get_inventory_data_for_item($item_id)
function get_inventory_data_for_item($item_id, $location_id=false)
{
$this->db->from('inventory');
$this->db->where('trans_items',$item_id);
if($location_id != false)
{
$this->db->where('trans_location',$location_id);
}
$this->db->order_by("trans_date", "desc");
return $this->db->get();
}

View File

@@ -33,13 +33,9 @@ class Item extends CI_Model
return $this->db->count_all_results();
}
function get_all_filtered($low_inventory=0,$is_serialized=0,$no_description,$search_custom,$is_deleted)/**GARRISON MODIFIED 4/21/2013, Parq 131215 **/
function get_all_filtered($is_serialized=0,$no_description,$search_custom,$is_deleted)/**GARRISON MODIFIED 4/21/2013, Parq 131215 **/
{
$this->db->from('items');
if ($low_inventory !=0 )
{
$this->db->where('quantity <=','reorder_level', false);
}
if ($is_serialized !=0 )
{
$this->db->where('is_serialized',1);
@@ -47,11 +43,13 @@ class Item extends CI_Model
if ($no_description!=0 )
{
$this->db->where('description','');
}
}
/**GARRISON SECTION ADDED 4/21/2013**/
/**
if ($search_custom!=0 )
{
if ($search_custom!=0 )
{
$this->db->like('custom1',$search);
$this->db->or_like('custom2',$search);
$this->db->or_like('custom3',$search);
@@ -63,7 +61,7 @@ class Item extends CI_Model
$this->db->or_like('custom9',$search);
$this->db->or_like('custom10',$search);
}
**/
**/
/* Parq 131215 start*/
if ($is_deleted !=0 )
{
@@ -114,8 +112,8 @@ class Item extends CI_Model
{
$this->db->from('items');
$this->db->where('item_number',$item_number);
$this->db->where('deleted',0); // Parq 131226
$this->db->where('deleted',0); // Parq 131226
$query = $this->db->get();
if($query->num_rows()==1)
@@ -223,19 +221,19 @@ class Item extends CI_Model
}
/** GARRISON ADDED 4/21/2013 **/
//Search by description
$this->db->from('items');
$this->db->like('description', $search);
$this->db->where('deleted',0);
$this->db->order_by("description", "asc");
$by_name = $this->db->get();
foreach($by_name->result() as $row)
{
$suggestions[]=$row->name;
}
$this->db->from('items');
$this->db->like('description', $search);
$this->db->where('deleted',0);
$this->db->order_by("description", "asc");
$by_name = $this->db->get();
foreach($by_name->result() as $row)
{
$suggestions[]=$row->name;
}
/** END GARRISON ADDED **/
/** GARRISON ADDED 4/22/2013 **/
//Search by custom fields
//Search by custom fields
$this->db->from('items');
$this->db->like('custom1', $search);
$this->db->or_like('custom2', $search);
@@ -246,13 +244,13 @@ class Item extends CI_Model
$this->db->or_like('custom7', $search);
$this->db->or_like('custom8', $search);
$this->db->or_like('custom9', $search);
$this->db->or_like('custom10', $search);
$this->db->where('deleted',0);
$this->db->order_by("name", "asc");
$by_name = $this->db->get();
foreach($by_name->result() as $row)
{
$suggestions[]=$row->name;
$this->db->or_like('custom10', $search);
$this->db->where('deleted',0);
$this->db->order_by("name", "asc");
$by_name = $this->db->get();
foreach($by_name->result() as $row)
{
$suggestions[]=$row->name;
}
/** END GARRISON ADDED **/
@@ -290,20 +288,21 @@ class Item extends CI_Model
}
/** GARRISON ADDED 4/21/2013 **/
//Search by description
$this->db->from('items');
$this->db->where('deleted',0);
$this->db->like('description', $search);
$this->db->order_by("description", "asc");
$by_description = $this->db->get();
foreach($by_description->result() as $row)
{
$suggestions[]=$row->item_id.'|'.$row->name;
}
$this->db->from('items');
$this->db->where('deleted',0);
$this->db->like('description', $search);
$this->db->order_by("description", "asc");
$by_description = $this->db->get();
foreach($by_description->result() as $row)
{
$suggestions[]=$row->item_id.'|'.$row->name;
}
/** END GARRISON ADDED **/
/** GARRISON ADDED 4/22/2013 **/
//Search by custom fields
$this->db->from('items');
//Search by custom fields
/*$this->db->from('items');
$this->db->where('deleted',0);
$this->db->where('stock_type',$stock_type);
$this->db->like('custom1', $search);
$this->db->or_like('custom2', $search);
$this->db->or_like('custom3', $search);
@@ -313,13 +312,13 @@ class Item extends CI_Model
$this->db->or_like('custom7', $search);
$this->db->or_like('custom8', $search);
$this->db->or_like('custom9', $search);
$this->db->or_like('custom10', $search);
$this->db->order_by("name", "asc");
$by_description = $this->db->get();
foreach($by_description->result() as $row)
{
$suggestions[]=$row->item_id.'|'.$row->name;
}
$this->db->or_like('custom10', $search);
$this->db->order_by("name", "asc");
$by_description = $this->db->get();
foreach($by_description->result() as $row)
{
$suggestions[]=$row->item_id.'|'.$row->name;
}*/
/** END GARRISON ADDED **/
//only return $limit suggestions
@@ -349,40 +348,40 @@ class Item extends CI_Model
}
/** GARRISON ADDED 5/18/2013 **/
function get_location_suggestions($search)
{
$suggestions = array();
$this->db->distinct();
$this->db->select('location');
$this->db->from('items');
$this->db->like('location', $search);
$this->db->where('deleted', 0);
$this->db->order_by("location", "asc");
$by_category = $this->db->get();
foreach($by_category->result() as $row)
{
$suggestions[]=$row->location;
}
return $suggestions;
}
function get_location_suggestions($search)
{
$suggestions = array();
$this->db->distinct();
$this->db->select('location');
$this->db->from('items');
$this->db->like('location', $search);
$this->db->where('deleted', 0);
$this->db->order_by("location", "asc");
$by_category = $this->db->get();
foreach($by_category->result() as $row)
{
$suggestions[]=$row->location;
}
return $suggestions;
}
function get_custom1_suggestions($search)
{
$suggestions = array();
$this->db->distinct();
$this->db->select('custom1');
$this->db->from('items');
$this->db->like('custom1', $search);
$this->db->where('deleted', 0);
$this->db->order_by("custom1", "asc");
$by_category = $this->db->get();
foreach($by_category->result() as $row)
{
$suggestions[]=$row->custom1;
}
return $suggestions;
function get_custom1_suggestions($search)
{
$suggestions = array();
$this->db->distinct();
$this->db->select('custom1');
$this->db->from('items');
$this->db->like('custom1', $search);
$this->db->where('deleted', 0);
$this->db->order_by("custom1", "asc");
$by_category = $this->db->get();
foreach($by_category->result() as $row)
{
$suggestions[]=$row->custom1;
}
return $suggestions;
}
function get_custom2_suggestions($search)
@@ -583,5 +582,27 @@ class Item extends CI_Model
return $this->db->get();
}
function is_sale_store_item_exist($item_number)
{
$this->db->from('items');
$this->db->where('item_number',$item_number);
$this->db->where('stock_type','sale_stock');
$this->db->where('deleted',0);
$query = $this->db->get();
return ($query->num_rows()==1);
}
function is_warehouse_item_exist($item_number)
{
$this->db->from('items');
$this->db->where('item_number',$item_number);
$this->db->where('stock_type','warehouse');
$this->db->where('deleted',0);
$query = $this->db->get();
return ($query->num_rows()==1);
}
}
?>
?>

View File

@@ -0,0 +1,51 @@
<?php
class Item_quantities extends CI_Model
{
function exists($item_id,$location_id)
{
$this->db->from('item_quantities');
$this->db->where('item_id',$item_id);
$this->db->where('location_id',$location_id);
$query = $this->db->get();
return ($query->num_rows()==1);
}
function save($location_detail, $item_id, $location_id)
{
if (!($item_id && $location_id) or !$this->exists($item_id,$location_id))
{
if($this->db->insert('item_quantities',$location_detail))
{
return true;
}
return false;
}
$this->db->where('item_id', $item_id);
$this->db->where('location_id', $location_id);
return $this->db->update('item_quantities',$location_detail);
}
function get_item_quantity($item_id, $location_id)
{
$this->db->from('item_quantities');
$this->db->where('item_id',$item_id);
$this->db->where('location_id',$location_id);
$result = $this->db->get()->row();
if(empty($result) == true)
{
//Get empty base parent object, as $item_id is NOT an item
$result=new stdClass();
//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;
}
}
?>

View File

@@ -1,13 +1,13 @@
<?php
class Receiving extends CI_Model
{
public function get_info($receiving_id)
function get_info($receiving_id)
{
$this->db->from('receivings');
$this->db->where('receiving_id',$receiving_id);
return $this->db->get();
}
function exists($receiving_id)
{
$this->db->from('receivings');
@@ -50,14 +50,18 @@ class Receiving extends CI_Model
'quantity_purchased'=>$item['quantity'],
'discount_percent'=>$item['discount'],
'item_cost_price' => $cur_item_info->cost_price,
'item_unit_price'=>$item['price']
'item_unit_price'=>$item['price'],
'item_location'=>$item['item_location']
);
$this->db->insert('receivings_items',$receivings_items_data);
//Update stock quantity
$item_data = array('quantity'=>$cur_item_info->quantity + $item['quantity']);
$this->Item->save($item_data,$item['item_id']);
$item_quantity = $this->Item_quantities->get_item_quantity($item['item_id'], $item['item_location']);
$this->Item_quantities->save(array('quantity'=>$item_quantity->quantity + $item['quantity'],
'item_id'=>$item['item_id'],
'location_id'=>$item['item_location']), $item['item_id'], $item['item_location']);
$qty_recv = $item['quantity'];
$recv_remarks ='RECV '.$receiving_id;
@@ -66,6 +70,7 @@ class Receiving extends CI_Model
'trans_date'=>date('Y-m-d H:i:s'),
'trans_items'=>$item['item_id'],
'trans_user'=>$employee_id,
'trans_location'=>$item['item_location'],
'trans_comment'=>$recv_remarks,
'trans_inventory'=>$qty_recv
);
@@ -89,7 +94,7 @@ class Receiving extends CI_Model
$this->db->where('receiving_id',$receiving_id);
return $this->db->get();
}
function get_supplier($receiving_id)
{
$this->db->from('receivings');
@@ -112,7 +117,6 @@ class Receiving extends CI_Model
INNER JOIN ".$this->db->dbprefix('items')." ON ".$this->db->dbprefix('receivings_items').'.item_id='.$this->db->dbprefix('items').'.item_id'."
GROUP BY receiving_id, item_id, line)");
}
}
?>

View File

@@ -21,14 +21,18 @@ class Detailed_receivings extends Report
$this->db->join('people as employee', 'receivings_items_temp.employee_id = employee.person_id');
$this->db->join('people as supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left');
$this->db->where('receiving_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
if ($inputs['receiving_type'] == 'receiving')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
elseif ($inputs['receiving_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
elseif ($inputs['receiving_type'] == 'requisitions')
{
$this->db->having('items_purchased = 0');
}
$this->db->group_by('receiving_id');
$this->db->order_by('receiving_date');
@@ -53,14 +57,18 @@ class Detailed_receivings extends Report
$this->db->select('sum(total) as total');
$this->db->from('receivings_items_temp');
$this->db->where('receiving_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
if ($inputs['receiving_type'] == 'receiving')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
elseif ($inputs['receiving_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
elseif ($inputs['receiving_type'] == 'requisitions')
{
$this->db->where('quantity_purchased = 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -40,13 +40,14 @@ class Detailed_sales extends Report
$this->db->join('people as customer', 'sales_items_temp.customer_id = customer.person_id', 'left');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
$this->db->where('sale_type', 'sale_stock');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('sale_id');
$this->db->order_by('sale_date');
@@ -72,13 +73,13 @@ class Detailed_sales extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}

View File

@@ -9,19 +9,25 @@ class Inventory_low extends Report
public function getDataColumns()
{
return array($this->lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level'));
return array($this->lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level'), $this->lang->line('reports_stock_location'));
}
public function getData(array $inputs)
{
$this->db->select('name, item_number, quantity, reorder_level, description');
$this->db->from('items');
$this->db->where('quantity <= reorder_level and deleted=0');
$this->db->order_by('name');
return $this->db->get()->result_array();
public function getData(array $inputs)
{
$this->db->from('items');
$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_quantities.quantity,description,location_name');
}
$this->db->where('item_quantities.quantity <= reorder_level');
$this->db->where('items.deleted = 0');
$this->db->order_by('name');
return $this->db->get()->result_array();
}
public function getSummaryData(array $inputs)
{

View File

@@ -9,15 +9,18 @@ class Inventory_summary extends Report
public function getDataColumns()
{
return array($this->lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level'));
return array($this->lang->line('reports_item_name'), $this->lang->line('reports_item_number'), $this->lang->line('reports_description'), $this->lang->line('reports_count'), $this->lang->line('reports_reorder_level'),$this->lang->line('reports_stock_location'));
}
public function getData(array $inputs)
{
$this->db->select('name, item_number, quantity, reorder_level, description');
$this->db->from('items');
$this->db->where('deleted', 0);
$this->db->order_by('name');
$this->db->from('items');
$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_quantities.quantity, description,location_name');
$this->db->where('items.deleted', 0);
$this->db->order_by('items.name');
return $this->db->get()->result_array();

View File

@@ -21,13 +21,13 @@ class Specific_customer extends Report
$this->db->join('people', 'sales_items_temp.employee_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and customer_id='.$inputs['customer_id']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('sale_id');
$this->db->order_by('sale_date');
@@ -53,13 +53,13 @@ class Specific_customer extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and customer_id='.$inputs['customer_id']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -22,13 +22,13 @@ class Specific_employee extends Report
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and employee_id='.$inputs['employee_id']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('sale_id');
$this->db->order_by('sale_date');
@@ -55,13 +55,13 @@ class Specific_employee extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and employee_id='.$inputs['employee_id']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -19,13 +19,13 @@ class Summary_categories extends Report
$this->db->join('items', 'sales_items_temp.item_id = items.item_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('category');
$this->db->order_by('category');
@@ -39,13 +39,13 @@ class Summary_categories extends Report
$this->db->join('items', 'sales_items_temp.item_id = items.item_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}

View File

@@ -20,13 +20,13 @@ class Summary_customers extends Report
$this->db->join('people', 'customers.person_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('customer_id');
$this->db->order_by('last_name');
@@ -41,13 +41,13 @@ class Summary_customers extends Report
$this->db->join('people', 'customers.person_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -18,13 +18,13 @@ class Summary_discounts extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'" and discount_percent > 0');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('sales_items_temp.discount_percent');
$this->db->order_by('discount_percent');
return $this->db->get()->result_array();
@@ -36,13 +36,13 @@ class Summary_discounts extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -20,13 +20,13 @@ class Summary_employees extends Report
$this->db->join('people', 'employees.person_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('employee_id');
$this->db->order_by('last_name');
@@ -41,13 +41,13 @@ class Summary_employees extends Report
$this->db->join('people', 'employees.person_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}

View File

@@ -19,13 +19,13 @@ class Summary_items extends Report
$this->db->join('items', 'sales_items_temp.item_id = items.item_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('items.item_id');
$this->db->order_by('name');
@@ -39,13 +39,13 @@ class Summary_items extends Report
$this->db->join('items', 'sales_items_temp.item_id = items.item_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -19,13 +19,13 @@ class Summary_payments extends Report
$this->db->join('sales', 'sales.sale_id=sales_payments.sale_id');
$this->db->where('date(sale_time) BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('payment_amount > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('payment_amount < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by("payment_type");
return $this->db->get()->result_array();
}
@@ -37,13 +37,13 @@ class Summary_payments extends Report
$this->db->join('items', 'sales_items_temp.item_id = items.item_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -17,14 +17,14 @@ class Summary_sales extends Report
$this->db->select('sale_date, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit');
$this->db->from('sales_items_temp');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('sale_date');
$this->db->having('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
$this->db->order_by('sale_date');
@@ -37,13 +37,13 @@ class Summary_sales extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}

View File

@@ -20,13 +20,13 @@ class Summary_suppliers extends Report
$this->db->join('people', 'suppliers.person_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
$this->db->group_by('supplier_id');
$this->db->order_by('last_name');
@@ -41,14 +41,13 @@ class Summary_suppliers extends Report
$this->db->join('people', 'suppliers.person_id = people.person_id');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}
}

View File

@@ -52,13 +52,14 @@ class Summary_taxes extends Report
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}

View File

@@ -88,14 +88,18 @@ class Sale extends CI_Model
'quantity_purchased'=>$item['quantity'],
'discount_percent'=>$item['discount'],
'item_cost_price' => $cur_item_info->cost_price,
'item_unit_price'=>$item['price']
'item_unit_price'=>$item['price'],
'item_location'=>$item['item_location']
);
$this->db->insert('sales_items',$sales_items_data);
//Update stock quantity
$item_data = array('quantity'=>$cur_item_info->quantity - $item['quantity']);
$this->Item->save($item_data,$item['item_id']);
$item_quantity = $this->Item_quantities->get_item_quantity($item['item_id'], $item['item_location']);
$this->Item_quantities->save(array('quantity'=>$item_quantity->quantity - $item['quantity'],
'item_id'=>$item['item_id'],
'location_id'=>$item['item_location']), $item['item_id'], $item['item_location']);
//Ramel Inventory Tracking
//Inventory Count Details
@@ -106,6 +110,7 @@ class Sale extends CI_Model
'trans_date'=>date('Y-m-d H:i:s'),
'trans_items'=>$item['item_id'],
'trans_user'=>$employee_id,
'trans_location'=>$item['item_location'],
'trans_comment'=>$sale_remarks,
'trans_inventory'=>$qty_buy
);

View File

@@ -84,7 +84,8 @@ class Sale_suspended extends CI_Model
'quantity_purchased'=>$item['quantity'],
'discount_percent'=>$item['discount'],
'item_cost_price' => $cur_item_info->cost_price,
'item_unit_price'=>$item['price']
'item_unit_price'=>$item['price'],
'item_location'=>$item['item_location']
);
$this->db->insert('sales_suspended_items',$sales_items_data);

View File

@@ -0,0 +1,110 @@
<?php
class Stock_locations extends CI_Model
{
function exists($location_name='')
{
$this->db->from('stock_locations');
$this->db->where('location_name',$location_name);
$query = $this->db->get();
return ($query->num_rows()==1);
}
function get_all($limit=10000, $offset=0)
{
$this->db->from('stock_locations');
$this->db->limit($limit);
$this->db->offset($offset);
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 concat_location_names()
{
$this->db->select('GROUP_CONCAT(location_name SEPARATOR\',\') AS location_names', FALSE);
$this->db->from('stock_locations');
$this->db->where('deleted', 0);
return $this->db->get()->row();
}
function get_undeleted_all($limit=10000, $offset=0)
{
$this->db->from('stock_locations');
$this->db->where('deleted',0);
$this->db->limit($limit);
$this->db->offset($offset);
return $this->db->get();
}
function get_location_id($location_name)
{
$this->db->from('stock_locations');
$this->db->where('deleted',0);
$this->db->where('location_name',$location_name);
return $this->db->get()->row()->location_id;
}
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;
}
function array_save($stock_locations)
{
$location_db = $this->get_all()->result_array();
//Delete all in db
$this->db->trans_start();
$location_ids=array();
foreach($location_db as $db)
{
array_push($location_ids,$db['location_id']);
}
if (sizeof($location_ids) > 0)
{
$this->db->where_in('location_id', $location_ids);
$this->db->update('stock_locations',array('deleted'=>1));
$this->db->trans_complete();
}
$location_db = $this->get_all()->result_array();
//Update the stock location
$this->db->trans_start();
foreach ($stock_locations as $location)
{
$to_create = true;
foreach($location_db as $db)
{
if($db['location_name'] == $location)
{
if($db['deleted'] == 1)
{
$this->db->where('location_id', $db['location_id']);
$this->db->update('stock_locations',array('location_name'=>$db['location_name'],'deleted'=>0));
}
$to_create = false;
break;
}
}
if($to_create)
{
$location_data = array('location_name'=>$location,'deleted'=>0);
$this->db->insert('stock_locations',$location_data);
}
}
$this->db->trans_complete();
return true;
}
}
?>

View File

@@ -258,6 +258,16 @@ echo form_open('config/save/',array('id'=>'config_form'));
</div>
</div>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('config_stock_location').':', 'stock_location',array('class'=>'required wide')); ?>
<div class='form_field'>
<?php echo form_input(array(
'name'=>'stock_location',
'id'=>'stock_location',
'value'=>$location_names)); ?>
</div>
</div>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('config_print_after_sale').':', 'print_after_sale',array('class'=>'wide')); ?>
<div class='form_field'>
@@ -420,7 +430,9 @@ $(document).ready(function()
number:true
},
email:"email",
return_policy: "required"
return_policy: "required",
stock_location:"required"
},
messages:
{
@@ -433,7 +445,8 @@ $(document).ready(function()
number:"<?php echo $this->lang->line('config_default_tax_rate_number'); ?>"
},
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>",
return_policy:"<?php echo $this->lang->line('config_return_policy_required'); ?>"
return_policy:"<?php echo $this->lang->line('config_return_policy_required'); ?>",
stock_location:"<?php echo $this->lang->line('config_stock_location_required'); ?>"
}
});

View File

@@ -59,6 +59,16 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_stock_location').':', 'stock_location',array('class'=>'wide')); ?>
</td>
<td>
<?php
echo form_dropdown('stock_location',$stock_locations,current($stock_locations),'onchange="display_stock(this.value)"');
?>
</td>
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_current_quantity').':', 'quantity',array('class'=>'wide')); ?>
</td>
<td>
@@ -66,7 +76,7 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for
'name'=>'quantity',
'id'=>'quantity',
'value'=>$item_info->quantity,
'value'=>current($item_quantities),
'style' => 'border:none',
'readonly' => 'readonly'
);
@@ -89,26 +99,73 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for
<?php
echo form_close();
?>
<table border="0" align="center">
<tr bgcolor="#FF0033" align="center" style="font-weight:bold"><td colspan="4">Inventory Data Tracking</td></tr>
<tr align="center" style="font-weight:bold"><td width="15%">Date</td><td width="25%">Employee</td><td width="15%">In/Out Qty</td><td width="45%">Remarks</td></tr>
<?php
foreach($this->Inventory->get_inventory_data_for_item($item_info->item_id)->result_array() as $row)
$inventory_array = $this->Inventory->get_inventory_data_for_item($item_info->item_id)->result_array();
$employee_name = array();
foreach( $inventory_array as $row)
{
?>
<tr bgcolor="#CCCCCC" align="center">
<td><?php echo $row['trans_date'];?></td>
<td><?php
$person_id = $row['trans_user'];
$employee = $this->Employee->get_info($person_id);
echo $employee->first_name." ".$employee->last_name;
?>
</td>
<td align="right"><?php echo $row['trans_inventory'];?></td>
<td><?php echo $row['trans_comment'];?></td>
</tr>
<?php
$person_id = $row['trans_user'];
$employee = $this->Employee->get_info($person_id);
array_push($employee_name, $employee->first_name." ".$employee->last_name);
}
?>
</table>
<table id="inventory_result" border="0" align="center">
<tr bgcolor="#FF0033" align="center" style="font-weight:bold"><td colspan="4">Inventory Data Tracking</td></tr>
<tr align="center" style="font-weight:bold"><td width="15%">Date</td><td width="25%">Employee</td><td width="15%">In/Out Qty</td><td width="45%">Remarks</td></tr>
</table>
<script type='text/javascript'>
$(document).ready(function()
{
display_stock(<?php echo json_encode(key($stock_locations)); ?>);
});
function display_stock(location_id)
{
var item_quantities= <?php echo json_encode($item_quantities ); ?>;
document.getElementById("quantity").value = item_quantities[location_id];
var inventory_data = <?php echo json_encode($inventory_array); ?>;
var employee_data = <?php echo json_encode($employee_name); ?>;
var table = document.getElementById("inventory_result");
//Remove old query
var rowCount = table.rows.length;
for (var index = rowCount; index > 2; index--)
{
table.deleteRow(index-1);
}
//Add new query
for (var index = 0; index < inventory_data.length; index++)
{
var data = inventory_data[index];
if(data['trans_location'] == location_id)
{
var tr = document.createElement('TR');
tr.setAttribute("bgColor","#CCCCCC");
tr.setAttribute("align","#center");
var td = document.createElement('TD');
td.appendChild(document.createTextNode(data['trans_date']));
tr.appendChild(td);
td = document.createElement('TD');
td.appendChild(document.createTextNode(employee_data[index]));
tr.appendChild(td);
td = document.createElement('TD');
td.setAttribute("align","right");
td.appendChild(document.createTextNode(data['trans_inventory']));
tr.appendChild(td);
td = document.createElement('TD');
td.appendChild(document.createTextNode(data['trans_comment']));
tr.appendChild(td);
table.appendChild(tr);
}
}
}
</script>

View File

@@ -112,17 +112,25 @@ echo form_open('items/save/'.$item_info->item_id,array('id'=>'item_form'));
</div>
</div>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('items_quantity').':', 'quantity',array('class'=>'required wide')); ?>
<div class='form_field'>
<?php echo form_input(array(
'name'=>'quantity',
'id'=>'quantity',
'value'=>$item_info->quantity)
);?>
</div>
</div>
<?php
foreach($stock_locations as $key=>$location_detail)
{
?>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('items_quantity').' '.$location_detail['location_name'] .':',
$key.'_quantity',
array('class'=>'required wide')); ?>
<div class='form_field'>
<?php echo form_input(array(
'name'=>$key.'_quantity',
'id'=>$key.'_quantity',
'value'=>$location_detail['quantity'])
);?>
</div>
</div>
<?php
}
?>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('items_reorder_level').':', 'reorder_level',array('class'=>'required wide')); ?>
@@ -135,17 +143,6 @@ echo form_open('items/save/'.$item_info->item_id,array('id'=>'item_form'));
</div>
</div>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('items_location').':', 'location',array('class'=>'wide')); ?>
<div class='form_field'>
<?php echo form_input(array(
'name'=>'location',
'id'=>'location',
'value'=>$item_info->location)
);?>
</div>
</div>
<div class="field_row clearfix">
<?php echo form_label($this->lang->line('items_description').':', 'description',array('class'=>'wide')); ?>
<div class='form_field'>
@@ -373,11 +370,6 @@ $(document).ready(function()
$("#category").result(function(event, data, formatted){});
$("#category").search();
/** GARRISON ADDED 5/18/2013 **/
$("#location").autocomplete("<?php echo site_url('items/suggest_location');?>",{max:100,minChars:0,delay:10});
$("#location").result(function(event, data, formatted){});
$("#location").search();
$("#custom1").autocomplete("<?php echo site_url('items/suggest_custom1');?>",{max:100,minChars:0,delay:10});
$("#custom1").result(function(event, data, formatted){});
$("#custom1").search();
@@ -419,7 +411,6 @@ $(document).ready(function()
$("#custom10").search();
/** END GARRISON ADDED **/
$('#item_form').validate({
submitHandler:function(form)
{
@@ -460,16 +451,12 @@ $(document).ready(function()
required:true,
number:true
},
quantity:
{
required:true,
number:true
},
reorder_level:
{
required:true,
number:true
}
},
messages:
{
@@ -490,11 +477,6 @@ $(document).ready(function()
required:"<?php echo $this->lang->line('items_tax_percent_required'); ?>",
number:"<?php echo $this->lang->line('items_tax_percent_number'); ?>"
},
quantity:
{
required:"<?php echo $this->lang->line('items_quantity_required'); ?>",
number:"<?php echo $this->lang->line('items_quantity_number'); ?>"
},
reorder_level:
{
required:"<?php echo $this->lang->line('items_reorder_level_required'); ?>",

View File

@@ -62,6 +62,16 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_stock_location').':', 'stock_location',array('class'=>'wide')); ?>
</td>
<td>
<?php
echo form_dropdown('stock_location',$stock_locations,current($stock_locations),'onchange="fill_quantity(this.value)"');
?>
</td>
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_current_quantity').':', 'quantity',array('class'=>'wide')); ?>
</td>
<td>
@@ -69,7 +79,7 @@ echo form_open('items/save_inventory/'.$item_info->item_id,array('id'=>'item_for
'name'=>'quantity',
'id'=>'quantity',
'value'=>$item_info->quantity,
'value'=>current($item_quantities),
'style' => 'border:none',
'readonly' => 'readonly'
);
@@ -154,4 +164,11 @@ $(document).ready(function()
}
});
});
function fill_quantity(val)
{
var item_quantities= <?php echo json_encode($item_quantities ); ?>;
document.getElementById("quantity").value = item_quantities[val];
}
</script>

View File

@@ -22,7 +22,7 @@ $(document).ready(function()
$(this).attr('href','index.php/items/generate_barcodes/'+selected.join(':'));
});
$("#low_inventory, #is_serialized, #no_description, #search_custom, #is_deleted").click(function()
$("#is_serialized, #no_description, #search_custom, #is_deleted").click(function()
{
$('#items_filter_form').submit();
});
@@ -135,16 +135,12 @@ function show_hide_search_filter(search_filter_section, switchImgTag) {
<div id="search_filter_section" style="display: <?php echo isset($search_section_state)? ( ($search_section_state)? 'block' : 'none') : 'none';?>;background-color:#EEEEEE;">
<?php echo form_open("$controller_name/refresh",array('id'=>'items_filter_form')); ?>
<?php echo form_label($this->lang->line('items_low_inventory_items').' '.':', 'low_inventory');?>
<?php echo form_checkbox(array('name'=>'low_inventory','id'=>'low_inventory','value'=>1,'checked'=> isset($low_inventory)? ( ($low_inventory)? 1 : 0) : 0)).' | ';?>
<?php echo form_label($this->lang->line('items_serialized_items').' '.':', 'is_serialized');?>
<?php echo form_checkbox(array('name'=>'is_serialized','id'=>'is_serialized','value'=>1,'checked'=> isset($is_serialized)? ( ($is_serialized)? 1 : 0) : 0)).' | ';?>
<?php echo form_label($this->lang->line('items_no_description_items').' '.':', 'no_description');?>
<?php echo form_checkbox(array('name'=>'no_description','id'=>'no_description','value'=>1,'checked'=> isset($no_description)? ( ($no_description)? 1 : 0) : 0)).' | ';?>
<?php echo form_label($this->lang->line('items_search_custom_items').' '.':', 'search_custom');//GARRISON ADDED 4/21/2013?>
<?php echo form_checkbox(array('name'=>'search_custom','id'=>'search_custom','value'=>1,'checked'=> isset($search_custom)? ( ($search_custom)? 1 : 0) : 0)).' | ';//GARRISON ADDED 4/21/2013?>
<?php echo form_label($this->lang->line('items_is_deleted').' '.':', 'is_deleted');// Parq 131215?>
<?php echo form_checkbox(array('name'=>'is_deleted','id'=>'is_deleted','value'=>1,'checked'=> isset($is_deleted)? ( ($is_deleted)? 1 : 0) : 0)).' | ';// Parq 131215?>
<?php echo form_checkbox(array('name'=>'search_custom','id'=>'search_custom','value'=>1,'checked'=> isset($search_custom)? ( ($search_custom)? 1 : 0) : 0));//GARRISON ADDED 4/21/2013?>
<input type="hidden" name="search_section_state" id="search_section_state" value="<?php echo isset($search_section_state)? ( ($search_section_state)? 'block' : 'none') : 'none';?>" />
</form>
</div>
@@ -163,8 +159,8 @@ function show_hide_search_filter(search_filter_section, switchImgTag) {
</ul>
</div>
<div id="table_holder">
<div id="table_holder" style="font-size:14px">
<?php echo $manage_table; ?>
</div>
<div id="feedback_bar"></div>
<?php $this->load->view("partial/footer"); ?>
<?php $this->load->view("partial/footer"); ?>

View File

@@ -41,7 +41,9 @@ if (isset($error_message))
<tr>
<td><span class='long_name'><?php echo $item['name']; ?></span><span class='short_name'><?php echo character_limiter($item['name'],10); ?></span></td>
<td><?php echo to_currency($item['price']); ?></td>
<td style='text-align:center;'><?php echo $item['quantity']; ?></td>
<td style='text-align:center;'><?php
echo $item['quantity'] . " " . ($show_stock_locations ? " [" . $item['stock_name'] . "]" : "");
?></td>
<td style='text-align:center;'><?php echo $item['discount']; ?></td>
<td style='text-align:right;'><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
</tr>
@@ -58,11 +60,15 @@ if (isset($error_message))
<td colspan="3" style='text-align:right;'><?php echo $this->lang->line('sales_total'); ?></td>
<td colspan="2" style='text-align:right'><?php echo to_currency($total); ?></td>
</tr>
<?php
if($mode!='requisition')
{
?>
<tr>
<td colspan="3" style='text-align:right;'><?php echo $this->lang->line('sales_payment'); ?></td>
<td colspan="2" style='text-align:right'><?php echo $payment_type; ?></td>
</tr>
<?php if(isset($amount_change))
{
@@ -79,6 +85,9 @@ if (isset($error_message))
<?php
}
?>
<?php
}
?>
</table>
<div id="sale_return_policy">

View File

@@ -13,14 +13,30 @@ if(isset($error))
<div id="register_wrapper">
<?php echo form_open("receivings/change_mode",array('id'=>'mode_form')); ?>
<span><?php echo $this->lang->line('recvs_mode') ?></span>
<span><?php echo $this->lang->line('recvs_mode') ?></span>
<?php echo form_dropdown('mode',$modes,$mode,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php
if ($show_stock_locations)
{
?>
<span><?php echo $this->lang->line('recvs_stock_source') ?></span>
<?php echo form_dropdown('stock_source',$stock_locations,$stock_source,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php
if($mode=='requisition')
{
?>
<span><?php echo $this->lang->line('recvs_stock_destination') ?></span>
<?php echo form_dropdown('stock_destination',$stock_locations,$stock_destination,'onchange="$(\'#mode_form\').submit();"');
}
}
?>
</form>
<?php echo form_open("receivings/add",array('id'=>'add_item_form')); ?>
<label id="item_label" for="item">
<?php
if($mode=='receive')
if($mode=='receive' or $mode=='requisition')
{
echo $this->lang->line('recvs_find_or_scan_item');
}
@@ -45,14 +61,13 @@ if(isset($error))
<table id="register">
<thead>
<tr>
<th style="width:11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width:30%;"><?php echo $this->lang->line('recvs_item_name'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_cost'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_quantity'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_discount'); ?></th>
<th style="width:15%;"><?php echo $this->lang->line('recvs_total'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_edit'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width:30%;"><?php echo $this->lang->line('recvs_item_name'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_cost'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_quantity'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_discount'); ?></th>
<th style="width:15%;"><?php echo $this->lang->line('recvs_total'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('recvs_edit'); ?></th>
</tr>
</thead>
<tbody id="cart_contents">
@@ -69,48 +84,59 @@ else
{
foreach(array_reverse($cart, true) as $line=>$item)
{
echo form_open("receivings/edit_item/$line");
?>
<tr>
<td><?php echo anchor("receivings/delete_item/$line",'['.$this->lang->line('common_delete').']');?></td>
echo form_open("receivings/edit_item/$line");
?>
<tr>
<td><?php echo anchor("receivings/delete_item/$line",'['.$this->lang->line('common_delete').']');?></td>
<td style="align:center;"><?php echo $item['name']; ?><br /> [<?php echo $item['in_stock']; ?> in <?php echo $item['stock_name']; ?>]</td>
<?php echo form_hidden('location', $item['item_location']); ?>
<td style="align:center;"><?php echo $item['name']; ?><br />
<?php
<?php
echo $item['description'];
echo form_hidden('description',$item['description']);
?>
<br />
?>
<?php if ($items_module_allowed)
{
?>
<td><?php echo form_input(array('name'=>'price','value'=>$item['price'],'size'=>'6'));?></td>
<?php
}
else
{
?>
<td><?php echo $item['price']; ?></td>
<?php echo form_hidden('price',$item['price']); ?>
<?php
}
?>
<td>
<?php
echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));
?>
</td>
<td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><?php echo form_submit("edit_item", $this->lang->line('sales_edit_item'));?></td>
</tr>
</form>
<?php
}
<?php if ($items_module_allowed && !$mode=='requisition')
{
?>
<td><?php echo form_input(array('name'=>'price','value'=>$item['price'],'size'=>'6'));?></td>
<?php
}
else
{
?>
<td><?php echo $item['price']; ?></td>
<?php echo form_hidden('price',$item['price']); ?>
<?php
}
?>
<td>
<?php
echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));
?>
</td>
<?php if ($items_module_allowed && !$mode=='requisition')
{
?>
<td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td>
<?php
}
else
{
?>
<td><?php echo $item['discount']; ?></td>
<?php echo form_hidden('discount',$item['discount']); ?>
<?php
}
?>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><?php echo form_submit("edit_item", $this->lang->line('sales_edit_item'));?></td>
</tr>
</form>
<?php
}
}
?>
</tbody>
@@ -144,13 +170,49 @@ else
}
?>
<?php
if($mode != 'requisition')
{
?>
<div id='sale_details'>
<div class="float_left" style='width:55%;'><?php echo $this->lang->line('sales_total'); ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($total); ?></div>
</div>
<?php
}
?>
<?php
if(count($cart) > 0)
{
if($mode == 'requisition')
{
?>
<div style='border-top:2px solid #000;' />
<div id="finish_sale">
<?php echo form_open("receivings/requisition_complete",array('id'=>'finish_sale_form')); ?>
<br />
<label id="comment_label" for="comment"><?php echo $this->lang->line('common_comments'); ?>:</label>
<?php echo form_textarea(array('name'=>'comment','value'=>'','rows'=>'4','cols'=>'23'));?>
<br /><br />
<?php echo "<div class='small_button' id='finish_sale_button' style='float:right;margin-top:5px;'><span>".$this->lang->line('recvs_complete_receiving')."</span></div>";
?>
</div>
</form>
<?php echo form_open("receivings/cancel_receiving",array('id'=>'cancel_sale_form')); ?>
<div class='small_button' id='cancel_sale_button' style='float:left;margin-top:5px;'>
<span>Cancel </span>
</div>
</form>
</div>
<?php
}
else
{
?>
<div id="finish_sale">
<?php echo form_open("receivings/complete",array('id'=>'finish_sale_form')); ?>
@@ -194,6 +256,7 @@ else
</div>
<?php
}
}
?>
</div>

View File

@@ -39,6 +39,36 @@ if(isset($error))
}
?>
</div>
<?php
if($mode == 'sale')
{
?>
<?php echo form_label($this->lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?>
<div id='report_sale_type'>
<?php echo form_dropdown('sale_type',array('all' => $this->lang->line('reports_all'),
'sales' => $this->lang->line('reports_sales'),
'returns' => $this->lang->line('reports_returns')), 'all', 'id="input_type"'); ?>
</div>
<?php
}
elseif($mode == 'receiving')
{
?>
<?php echo form_label($this->lang->line('reports_receiving_type'), 'reports_receiving_type_label', array('class'=>'required')); ?>
<div id='report_receiving_type'>
<?php echo form_dropdown('receiving_type',array('all' => $this->lang->line('reports_all'),
'receiving' => $this->lang->line('reports_receivings'),
'returns' => $this->lang->line('reports_returns'),
'requisitions' => $this->lang->line('reports_requisitions')), 'all', 'id="input_type"'); ?>
</div>
<?php
}
elseif($mode == 'requisition')
{
//Do nothing
}
?>
<?php
echo form_button(array(
'name'=>'generate_report',
@@ -55,18 +85,24 @@ $(document).ready(function()
{
$("#generate_report").click(function()
{
var sale_type = $("#sale_type").val();
var input_type = $("#input_type").val();
if ($("#simple_radio").attr('checked'))
{
window.location = window.location+'/'+$("#report_date_range_simple option:selected").val() + '/' + sale_type;
window.location = window.location+'/'+$("#report_date_range_simple option:selected").val() + '/' + input_type;
}
else
{
var start_date = $("#start_year").val()+'-'+$("#start_month").val()+'-'+$('#start_day').val();
var end_date = $("#end_year").val()+'-'+$("#end_month").val()+'-'+$('#end_day').val();
window.location = window.location+'/'+start_date + '/'+ end_date+ '/' + sale_type;
if(input_type == null)
{
window.location = window.location+'/'+start_date + '/'+ end_date;
}
else
{
window.location = window.location+'/'+start_date + '/'+ end_date+ '/' + input_type;
}
}
});

View File

@@ -25,7 +25,9 @@ if(isset($error))
<?php echo form_label($this->lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?>
<div id='report_sale_type'>
<?php echo form_dropdown('sale_type',array('all' => $this->lang->line('reports_all'), 'sales' => $this->lang->line('reports_sales'), 'returns' => $this->lang->line('reports_returns')), 'all', 'id="sale_type"'); ?>
<?php echo form_dropdown('sale_type',array('all' => $this->lang->line('reports_all'),
'sales' => $this->lang->line('reports_sales'),
'returns' => $this->lang->line('reports_returns')), 'all', 'id="sale_type"'); ?>
</div>
<div>

View File

@@ -57,3 +57,8 @@ if(isset($error))
?>
<?php $this->load->view("partial/footer"); ?>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
});
</script>

View File

@@ -31,7 +31,9 @@ if(isset($error))
<?php echo form_label($this->lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?>
<div id='report_sale_type'>
<?php echo form_dropdown('sale_type',array('all' => $this->lang->line('reports_all'), 'sales' => $this->lang->line('reports_sales'), 'returns' => $this->lang->line('reports_returns')), 'all', 'id="sale_type"'); ?>
<?php echo form_dropdown('sale_type',array('all' => $this->lang->line('reports_all'),
'sales' => $this->lang->line('reports_sales'),
'returns' => $this->lang->line('reports_returns')) , 'all', 'id="sale_type"'); ?>
</div>
<div>

View File

@@ -43,7 +43,9 @@ if (isset($error_message))
<td><?php echo $item['item_number']; ?></td>
<td><span class='long_name'><?php echo $item['name']; ?></span><span class='short_name'><?php echo character_limiter($item['name'],10); ?></span></td>
<td><?php echo to_currency($item['price']); ?></td>
<td style='text-align:center;'><?php echo $item['quantity']; ?></td>
<td style='text-align:center;'><?php
echo $item['quantity'] . " " . ($show_stock_locations ? " [" . $item['stock_name'] . "]" : "");
?></td>
<td style='text-align:center;'><?php echo $item['discount']; ?></td>
<td style='text-align:right;'><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
</tr>

View File

@@ -1,5 +1,5 @@
<?php $this->load->view("partial/header"); ?>
<div id="page_title" style="margin-bottom:8px;"><?php echo $this->lang->line('sales_register'); ?></div>
<div id="page_title" style="margin-bottom: 8px;"><?php echo $this->lang->line('sales_register'); ?></div>
<?php
if(isset($error))
{
@@ -20,18 +20,22 @@ 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): ?>
<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; ?>
<div id="show_suspended_sales_button">
<?php echo anchor("sales/suspended/width:425",
"<div class='small_button'><span style='font-size:73%;'>".$this->lang->line('sales_suspended_sales')."</span></div>",
array('class'=>'thickbox none','title'=>$this->lang->line('sales_suspended_sales')));
?>
</div>
</form>
</form>
<?php echo form_open("sales/add",array('id'=>'add_item_form')); ?>
<label id="item_label" for="item">
<?php
if($mode=='sale')
if($mode=='sale_retail' or $mode=='sale_wholesale')
{
echo $this->lang->line('sales_find_or_scan_item');
}
@@ -41,36 +45,41 @@ else
}
?>
</label>
<?php echo form_input(array('name'=>'item','id'=>'item','size'=>'40'));?>
<!-- no need the new item button in sale page
<div id="new_item_button_register" >
<?php echo anchor("items/view/-1/width:360",
"<div class='small_button'><span>".$this->lang->line('sales_new_item')."</span></div>",
array('class'=>'thickbox none','title'=>$this->lang->line('sales_new_item')));
?>
</div>
</form>
<table id="register">
<thead>
<tr>
<th style="width:11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width:30%;"><?php echo $this->lang->line('sales_item_number'); ?></th>
<th style="width:30%;"><?php echo $this->lang->line('sales_item_name'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('sales_price'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('sales_quantity'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('sales_discount'); ?></th>
<th style="width:15%;"><?php echo $this->lang->line('sales_total'); ?></th>
<th style="width:11%;"><?php echo $this->lang->line('sales_edit'); ?></th>
</tr>
</thead>
<tbody id="cart_contents">
-->
</form>
<table id="register">
<thead>
<tr>
<th style="width: 11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width: 30%;"><?php echo $this->lang->line('sales_item_number'); ?></th>
<th style="width: 30%;"><?php echo $this->lang->line('sales_item_name'); ?></th>
<th style="width: 11%;"><?php echo $this->lang->line('sales_price'); ?></th>
<th style="width: 11%;"><?php echo $this->lang->line('sales_quantity'); ?></th>
<th style="width: 11%;"><?php echo $this->lang->line('sales_discount'); ?></th>
<th style="width: 15%;"><?php echo $this->lang->line('sales_total'); ?></th>
<th style="width: 11%;"><?php echo $this->lang->line('sales_edit'); ?></th>
</tr>
</thead>
<tbody id="cart_contents">
<?php
if(count($cart)==0)
{
?>
<tr><td colspan='8'>
<div class='warning_message' style='padding:7px;'><?php echo $this->lang->line('sales_no_items_in_cart'); ?></div>
</tr></tr>
<tr>
<td colspan='8'>
<div class='warning_message' style='padding: 7px;'><?php echo $this->lang->line('sales_no_items_in_cart'); ?></div>
</tr>
</tr>
<?php
}
else
@@ -81,16 +90,18 @@ else
echo form_open("sales/edit_item/$line");
?>
<tr>
<td><?php echo anchor("sales/delete_item/$line",'['.$this->lang->line('common_delete').']');?></td>
<td><?php echo $item['item_number']; ?></td>
<td style="align:center;"><?php echo $item['name']; ?><br /> [<?php echo $cur_item_info->quantity; ?> in stock]</td>
<td><?php echo anchor("sales/delete_item/$line",'['.$this->lang->line('common_delete').']');?></td>
<td><?php echo $item['item_number']; ?></td>
<td style="align: center;"><?php echo $item['name']; ?><br /> [<?php echo $item['in_stock'] ?> in <?php echo $item['stock_name']; ?>]
<?php echo form_hidden('location', $item['item_location']); ?>
</td>
<?php if ($items_module_allowed)
{
?>
<td><?php echo form_input(array('name'=>'price','value'=>$item['price'],'size'=>'6'));?></td>
<?php
}
else
@@ -116,13 +127,13 @@ else
?>
</td>
<td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><?php echo form_submit("edit_item", $this->lang->line('sales_edit_item'));?></td>
</tr>
<tr>
<td style="color:#2F4F4F";><?php echo $this->lang->line('sales_description_abbrv').':';?></td>
<td colspan=2 style="text-align:left;">
<td><?php echo form_input(array('name'=>'discount','value'=>$item['discount'],'size'=>'3'));?></td>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><?php echo form_submit("edit_item", $this->lang->line('sales_edit_item'));?></td>
</tr>
<tr>
<td style="color: #2F4F4F";><?php echo $this->lang->line('sales_description_abbrv').':';?></td>
<td colspan=2 style="text-align: left;">
<?php
if($item['allow_alt_description']==1)
@@ -144,8 +155,8 @@ else
}
?>
</td>
<td>&nbsp;</td>
<td style="color:#2F4F4F";>
<td>&nbsp;</td>
<td style="color: #2F4F4F";>
<?php
if($item['is_serialized']==1)
{
@@ -153,7 +164,7 @@ else
}
?>
</td>
<td colspan=3 style="text-align:left;">
<td colspan=3 style="text-align: left;">
<?php
if($item['is_serialized']==1)
{
@@ -167,16 +178,17 @@ else
</td>
</tr>
<tr style="height:3px">
<td colspan=8 style="background-color:white"> </td>
</tr> </form>
</tr>
<tr style="height: 3px">
<td colspan=8 style="background-color: white"></td>
</tr>
</form>
<?php
}
}
?>
</tbody>
</table>
</table>
</div>
@@ -193,29 +205,29 @@ else
<label id="customer_label" for="customer"><?php echo $this->lang->line('sales_select_customer'); ?></label>
<?php echo form_input(array('name'=>'customer','id'=>'customer','size'=>'30','value'=>$this->lang->line('sales_start_typing_customer_name')));?>
</form>
<div style="margin-top:5px;text-align:center;">
<div style="margin-top: 5px; text-align: center;">
<h3 style="margin: 5px 0 5px 0"><?php echo $this->lang->line('common_or'); ?></h3>
<?php echo anchor("customers/view/-1/width:350",
"<div class='small_button' style='margin:0 auto;'><span>".$this->lang->line('sales_new_customer')."</span></div>",
array('class'=>'thickbox none','title'=>$this->lang->line('sales_new_customer')));
?>
</div>
<div class="clearfix">&nbsp;</div>
<div class="clearfix">&nbsp;</div>
<?php
}
?>
<div id='sale_details'>
<div class="float_left" style="width:55%;"><?php echo $this->lang->line('sales_sub_total'); ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($subtotal); ?></div>
<div class="float_left" style="width: 55%;"><?php echo $this->lang->line('sales_sub_total'); ?>:</div>
<div class="float_left" style="width: 45%; font-weight: bold;"><?php echo to_currency($subtotal); ?></div>
<?php foreach($taxes as $name=>$value) { ?>
<div class="float_left" style='width:55%;'><?php echo $name; ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($value); ?></div>
<div class="float_left" style='width: 55%;'><?php echo $name; ?>:</div>
<div class="float_left" style="width: 45%; font-weight: bold;"><?php echo to_currency($value); ?></div>
<?php }; ?>
<div class="float_left" style='width:55%;'><?php echo $this->lang->line('sales_total'); ?>:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php echo to_currency($total); ?></div>
<div class="float_left" style='width: 55%;'><?php echo $this->lang->line('sales_total'); ?>:</div>
<div class="float_left" style="width: 45%; font-weight: bold;"><?php echo to_currency($total); ?></div>
</div>
@@ -229,12 +241,13 @@ else
<div id="Cancel_sale">
<?php echo form_open("sales/cancel_sale",array('id'=>'cancel_sale_form')); ?>
<div class='small_button' id='cancel_sale_button' style='margin-top:5px;'>
<div class='small_button' id='cancel_sale_button'
style='margin-top: 5px;'>
<span><?php echo $this->lang->line('sales_cancel_sale'); ?></span>
</div>
</form>
</div>
<div class="clearfix" style="margin-bottom:1px;">&nbsp;</div>
</form>
</div>
<div class="clearfix" style="margin-bottom: 1px;">&nbsp;</div>
<?php
// Only show this part if there is at least one payment entered.
if(count($payments) > 0)
@@ -244,7 +257,8 @@ else
<?php echo form_open("sales/complete",array('id'=>'finish_sale_form')); ?>
<label id="comment_label" for="comment"><?php echo $this->lang->line('common_comments'); ?>:</label>
<?php echo form_textarea(array('name'=>'comment', 'id' => 'comment', 'value'=>$comment,'rows'=>'4','cols'=>'23'));?>
<br /><br />
<br />
<br />
<?php
@@ -265,46 +279,50 @@ else
echo "<div class='small_button' id='suspend_sale_button' style='float:right;margin-top:5px;'><span>".$this->lang->line('sales_suspend_sale')."</span></div>";
?>
</div>
</form>
</form>
<?php
}
?>
<table width="100%"><tr>
<td style="width:55%; "><div class="float_left"><?php echo $this->lang->line('sales_payments_total').':';?></div></td>
<td style="width:45%; text-align:right;"><div class="float_left" style="text-align:right;font-weight:bold;"><?php echo to_currency($payments_total); ?></div></td>
</tr>
<tr>
<td style="width:55%; "><div class="float_left" ><?php echo $this->lang->line('sales_amount_due').':';?></div></td>
<td style="width:45%; text-align:right; "><div class="float_left" style="text-align:right;font-weight:bold;"><?php echo to_currency($amount_due); ?></div></td>
</tr></table>
<table width="100%">
<tr>
<td style="width: 55%;"><div class="float_left"><?php echo $this->lang->line('sales_payments_total').':';?></div></td>
<td style="width: 45%; text-align: right;"><div class="float_left"
style="text-align: right; font-weight: bold;"><?php echo to_currency($payments_total); ?></div></td>
</tr>
<tr>
<td style="width: 55%;"><div class="float_left"><?php echo $this->lang->line('sales_amount_due').':';?></div></td>
<td style="width: 45%; text-align: right;"><div class="float_left"
style="text-align: right; font-weight: bold;"><?php echo to_currency($amount_due); ?></div></td>
</tr>
</table>
<div id="Payment_Types" >
<div id="Payment_Types">
<div style="height:100px;">
<div style="height: 100px;">
<?php echo form_open("sales/add_payment",array('id'=>'add_payment_form')); ?>
<table width="100%">
<tr>
<td>
<tr>
<td>
<?php echo $this->lang->line('sales_payment').': ';?>
</td>
<td>
<td>
<?php echo form_dropdown( 'payment_type', $payment_options, array(), 'id="payment_types"' ); ?>
</td>
</tr>
<tr>
<td>
<span id="amount_tendered_label"><?php echo $this->lang->line( 'sales_amount_tendered' ).': '; ?></span>
</td>
<td>
</tr>
<tr>
<td><span id="amount_tendered_label"><?php echo $this->lang->line( 'sales_amount_tendered' ).': '; ?></span>
</td>
<td>
<?php echo form_input( array( 'name'=>'amount_tendered', 'id'=>'amount_tendered', 'value'=>to_currency_no_money($amount_due), 'size'=>'10' ) ); ?>
</td>
</tr>
</table>
<div class='small_button' id='add_payment_button' style='float:left;margin-top:5px;'>
</tr>
</table>
<div class='small_button' id='add_payment_button'
style='float: left; margin-top: 5px;'>
<span><?php echo $this->lang->line('sales_add_payment'); ?></span>
</div>
</div>
@@ -316,14 +334,14 @@ else
{
?>
<table id="register">
<thead>
<tr>
<th style="width:11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width:60%;"><?php echo $this->lang->line('sales_payment_type'); ?></th>
<th style="width:18%;"><?php echo $this->lang->line('sales_payment_amount'); ?></th>
<thead>
<tr>
<th style="width: 11%;"><?php echo $this->lang->line('common_delete'); ?></th>
<th style="width: 60%;"><?php echo $this->lang->line('sales_payment_type'); ?></th>
<th style="width: 18%;"><?php echo $this->lang->line('sales_payment_amount'); ?></th>
</tr>
</tr>
</thead>
<tbody id="payment_contents">
<?php
@@ -332,10 +350,10 @@ else
echo form_open("sales/edit_payment/$payment_id",array('id'=>'edit_payment_form'.$payment_id));
?>
<tr>
<td><?php echo anchor( "sales/delete_payment/$payment_id", '['.$this->lang->line('common_delete').']' ); ?></td>
<td><?php echo anchor( "sales/delete_payment/$payment_id", '['.$this->lang->line('common_delete').']' ); ?></td>
<td><?php echo $payment['payment_type']; ?></td>
<td style="text-align:right;"><?php echo to_currency( $payment['payment_amount'] ); ?></td>
<td><?php echo $payment['payment_type']; ?></td>
<td style="text-align: right;"><?php echo to_currency( $payment['payment_amount'] ); ?></td>
</tr>
@@ -344,8 +362,8 @@ else
}
?>
</tbody>
</table>
<br />
</table>
<br />
<?php
}
?>
@@ -358,7 +376,7 @@ else
}
?>
</div>
<div class="clearfix" style="margin-bottom:30px;">&nbsp;</div>
<div class="clearfix" style="margin-bottom: 30px;">&nbsp;</div>
<?php $this->load->view("partial/footer"); ?>
@@ -462,7 +480,8 @@ function post_item_form_submit(response)
{
if(response.success)
{
$("#item").attr("value",response.item_id);
var $stock_location = $("select[name='stock_location']").val();
$("#item_location").val($stock_location);
$("#add_item_form").submit();
}
}

53
database/2.2.2_to_2.3.sql Normal file
View File

@@ -0,0 +1,53 @@
CREATE TABLE IF NOT EXISTS `ospos_stock_locations` (
`location_id` int(11) NOT NULL AUTO_INCREMENT,
`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=0;
CREATE TABLE IF NOT EXISTS `ospos_item_quantities` (
`item_id` int(11) NOT NULL,
`location_id` int(11) NOT NULL,
`quantity` int(11) NOT NULL,
PRIMARY KEY (`item_id`,`location_id`),
KEY `item_id` (`item_id`),
KEY `location_id` (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
ALTER TABLE ospos_inventory
ADD COLUMN trans_location int(11) NOT NULL,
ADD KEY `trans_location` (`trans_location`),
ADD CONSTRAINT `ospos_inventory_ibfk_3` FOREIGN KEY (`trans_location`) REFERENCES `ospos_stock_locations` (`location_id`);
-- ALTER TABLE ospos_items DROP COLUMN location;
INSERT INTO `ospos_stock_locations` ( `deleted`, `location_name` ) VALUES ('0', 'stock');
ALTER TABLE ospos_receivings_items
ADD COLUMN item_location int(11) NOT NULL,
ADD KEY `item_location` (`item_location`),
ADD CONSTRAINT `ospos_receivings_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
ALTER TABLE ospos_sales_items
ADD COLUMN item_location int(11) NOT NULL,
ADD KEY `item_location` (`item_location`),
ADD KEY `sale_id` (`sale_id`),
ADD CONSTRAINT `ospos_sales_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
ALTER TABLE ospos_sales_items_taxes
ADD KEY `sale_id` (`sale_id`);
ALTER TABLE ospos_sales_payments
ADD KEY `sale_id` (`sale_id`);
ALTER TABLE ospos_sales_suspended_items
ADD COLUMN item_location int(11) NOT NULL,
ADD KEY `item_location` (`item_location`),
ADD KEY `sale_id` (`sale_id`),
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
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`);

View File

@@ -0,0 +1,2 @@
INSERT INTO ospos_stock_locations (location_name) (SELECT location FROM ospos_items WHERE NOT EXISTS (select location from ospos_stock_locations where location_name = location));
INSERT INTO ospos_item_quantities (item_id, location_id, quantity) (SELECT item_id, location_id, quantity FROM ospos_items, ospos_stock_locations where ospos_items.location = ospos_stock_locations.location_name);

View File

@@ -113,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 ;
--
@@ -219,6 +221,20 @@ CREATE TABLE `ospos_item_kit_items` (
-- Dumping data for table `ospos_item_kit_items`
--
-- --------------------------------------------------------
--
-- Table structure for table `ospos_item_quantities`
--
CREATE TABLE IF NOT EXISTS `ospos_item_quantities` (
`item_id` int(11) NOT NULL,
`location_id` int(11) NOT NULL,
`quantity` int(11) NOT NULL,
PRIMARY KEY (`item_id`,`location_id`),
KEY `item_id` (`item_id`),
KEY `location_id` (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
-- --------------------------------------------------------
@@ -349,6 +365,7 @@ CREATE TABLE `ospos_receivings_items` (
`item_cost_price` decimal(15,2) NOT NULL,
`item_unit_price` decimal(15,2) NOT NULL,
`discount_percent` decimal(15,2) NOT NULL DEFAULT '0',
`item_location` int(11) NOT NULL,
PRIMARY KEY (`receiving_id`,`item_id`,`line`),
KEY `item_id` (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -397,8 +414,11 @@ CREATE TABLE `ospos_sales_items` (
`item_cost_price` decimal(15,2) NOT NULL,
`item_unit_price` decimal(15,2) NOT NULL,
`discount_percent` decimal(15,2) NOT NULL DEFAULT '0',
`item_location` int(11) NOT NULL,
PRIMARY KEY (`sale_id`,`item_id`,`line`),
KEY `item_id` (`item_id`)
KEY `sale_id` (`sale_id`),
KEY `item_id` (`item_id`),
KEY `item_location` (`item_location`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
@@ -419,6 +439,7 @@ CREATE TABLE `ospos_sales_items_taxes` (
`name` varchar(255) NOT NULL,
`percent` decimal(15,2) NOT NULL,
PRIMARY KEY (`sale_id`,`item_id`,`line`,`name`,`percent`),
KEY `sale_id` (`sale_id`),
KEY `item_id` (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -437,7 +458,8 @@ CREATE TABLE `ospos_sales_payments` (
`sale_id` int(10) NOT NULL,
`payment_type` varchar(40) NOT NULL,
`payment_amount` decimal(15,2) NOT NULL,
PRIMARY KEY (`sale_id`,`payment_type`)
PRIMARY KEY (`sale_id`,`payment_type`),
KEY `sale_id` (`sale_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
@@ -484,7 +506,9 @@ CREATE TABLE `ospos_sales_suspended_items` (
`item_cost_price` decimal(15,2) NOT NULL,
`item_unit_price` decimal(15,2) NOT NULL,
`discount_percent` decimal(15,2) NOT NULL DEFAULT '0',
`item_location` int(11) NOT NULL,
PRIMARY KEY (`sale_id`,`item_id`,`line`),
KEY `sale_id` (`sale_id`),
KEY `item_id` (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -551,6 +575,25 @@ CREATE TABLE `ospos_sessions` (
-- Dumping data for table `ospos_sessions`
--
-- --------------------------------------------------------
--
-- Table structure for table `ospos_stock_locations`
--
CREATE TABLE `ospos_stock_locations` (
`location_id` int(11) NOT NULL AUTO_INCREMENT,
`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;
--
-- Dumping data for table `ospos_stock_locations`
--
INSERT INTO `ospos_stock_locations` ( `deleted` ) VALUES ('0');
-- --------------------------------------------------------
@@ -647,7 +690,8 @@ ALTER TABLE `ospos_sales`
--
ALTER TABLE `ospos_sales_items`
ADD CONSTRAINT `ospos_sales_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`),
ADD CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`);
ADD CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`),
ADD CONSTRAINT `ospos_sales_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
--
-- Constraints for table `ospos_sales_items_taxes`
@@ -674,7 +718,8 @@ ALTER TABLE `ospos_sales_suspended`
--
ALTER TABLE `ospos_sales_suspended_items`
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`),
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`);
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`),
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
--
-- Constraints for table `ospos_sales_suspended_items_taxes`
@@ -689,6 +734,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`
--