diff --git a/application/controllers/receivings.php b/application/controllers/receivings.php
index 39de5c527..33823c658 100644
--- a/application/controllers/receivings.php
+++ b/application/controllers/receivings.php
@@ -129,6 +129,7 @@ class Receivings extends Secure_area
$emp_info=$this->Employee->get_info($employee_id);
$payment_type = $this->input->post('payment_type');
$data['payment_type']=$this->input->post('payment_type');
+ $data['invoice_number']=$this->input->post('invoice_number');
$data['stock_location']=$this->receiving_lib->get_stock_source();
if ($this->input->post('amount_tendered'))
@@ -145,7 +146,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['stock_location']);
+ $data['receiving_id']='RECV '.$this->Receiving->save($data['cart'], $supplier_id,$employee_id,$comment,$payment_type,$data['stock_location'],$invoice_number);
if ($data['receiving_id'] == 'RECV -1')
{
@@ -207,28 +208,22 @@ 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['stock_locations']=$this->Stock_locations->get_allowed_locations();
+ $show_stock_locations = count($data['stock_locations']);
+ if ($show_stock_locations > 0) {
$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['invoice_number']=$this->CI->config->config['invoice_number_format'];
+
$data['total']=$this->receiving_lib->get_total();
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
$data['payment_options']=array(
diff --git a/application/language/en/receivings_lang.php b/application/language/en/receivings_lang.php
index e3546689e..cbbf80c57 100644
--- a/application/language/en/receivings_lang.php
+++ b/application/language/en/receivings_lang.php
@@ -16,6 +16,7 @@ $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_cancel_receiving']='Cancel';
$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';
@@ -37,4 +38,5 @@ $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';
+$lang['recvs_invoice_number']='Invoice #';
?>
diff --git a/application/models/receiving.php b/application/models/receiving.php
index 94273115d..9ec0e0de1 100644
--- a/application/models/receiving.php
+++ b/application/models/receiving.php
@@ -17,7 +17,7 @@ class Receiving extends CI_Model
return ($query->num_rows()==1);
}
- function save ($items,$supplier_id,$employee_id,$comment,$payment_type,$receiving_id=false)
+ function save ($items,$supplier_id,$employee_id,$comment,$payment_type,$receiving_id=false,$invoice_number=null)
{
if(count($items)==0)
return -1;
@@ -26,7 +26,8 @@ class Receiving extends CI_Model
'supplier_id'=> $this->Supplier->exists($supplier_id) ? $supplier_id : null,
'employee_id'=>$employee_id,
'payment_type'=>$payment_type,
- 'comment'=>$comment
+ 'comment'=>$comment,
+ 'invoice_number'=>$invoice_number
);
//Run these queries as a transaction, we want to make sure we do all or nothing
diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php
index 578fe5268..8f377d8a7 100644
--- a/application/views/receivings/receiving.php
+++ b/application/views/receivings/receiving.php
@@ -199,13 +199,13 @@ else
'comment','value'=>'','rows'=>'4','cols'=>'23'));?>
- ".$this->lang->line('recvs_complete_receiving')."";
- ?>
+
| - lang->line('sales_payment').': ';?> - |
-
+
- ".$this->lang->line('recvs_complete_receiving').""; - ?> + 'cancel_sale_form')); ?> diff --git a/database/2.3_to_2.3.1.sql b/database/2.3_to_2.3.1.sql index c76c87580..2d886b434 100644 --- a/database/2.3_to_2.3.1.sql +++ b/database/2.3_to_2.3.1.sql @@ -30,4 +30,8 @@ ALTER TABLE `ospos_permissions` ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIG ALTER TABLE `ospos_permissions` DROP FOREIGN KEY `ospos_permissions_ibfk_2`; ALTER TABLE `ospos_permissions` ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos`.`ospos_modules`(`module_id`) ON DELETE CASCADE ON UPDATE RESTRICT; +-- add invoice_number column to receivings table +ALTER TABLE `ospos_receivings` ADD COLUMN `invoice_number` varchar(32) DEFAULT NULL; + + diff --git a/database/database.sql b/database/database.sql index 025d542cc..5391df368 100644 --- a/database/database.sql +++ b/database/database.sql @@ -354,6 +354,7 @@ CREATE TABLE `ospos_receivings` ( `comment` text NOT NULL, `receiving_id` int(10) NOT NULL AUTO_INCREMENT, `payment_type` varchar(20) DEFAULT NULL, + `invoice_number` varchar(32) DEFAULT NULL, PRIMARY KEY (`receiving_id`), KEY `supplier_id` (`supplier_id`), KEY `employee_id` (`employee_id`) |