Added invoice_number field to receivings table

Save comments field in receivings as in sales
Add translations for cancel button in receivings
Add cascading deletes for ospos_permissions
This commit is contained in:
jekkos-t520
2014-10-03 10:24:08 +02:00
parent d486202c4f
commit bac80e3a92
6 changed files with 39 additions and 27 deletions

View File

@@ -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(

View File

@@ -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 #';
?>

View File

@@ -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

View File

@@ -199,13 +199,13 @@ else
<?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 class='small_button' id='finish_sale_button' style='float:right;margin-top:5px;'>
<span><?php echo $this->lang->line('recvs_complete_receiving') ?></span>
</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>
<span><?php echo $this->lang->line('recvs_cancel_receving')?></span>
</div>
</form>
</div>
@@ -220,12 +220,21 @@ else
<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 />
<table width="100%"><tr><td>
<?php
echo $this->lang->line('sales_payment').': ';?>
</td><td>
<?php
echo form_dropdown('payment_type',$payment_options);?>
<table width="100%">
<tr>
<td>
<?php echo $this->lang->line('recvs_invoice_number').': ';?>
</td>
<td>
<?php echo form_input(array('name'=>'invoice_number','value'=>$invoice_number,'size'=>10));?>
</td>
</tr>
<tr>
<td>
<?php echo $this->lang->line('sales_payment').': ';?>
</td>
<td>
<?php echo form_dropdown('payment_type',$payment_options);?>
</td>
</tr>
@@ -242,15 +251,15 @@ else
</table>
<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 class='small_button' id='finish_sale_button' style='float:right;margin-top:5px;'>
<span><?php echo $this->lang->line('recvs_complete_receiving') ?></span>
</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>
<span><?php echo $this->lang->line('recvs_cancel_receiving')?></span>
</div>
</form>
</div>

View File

@@ -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;

View File

@@ -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`)