mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Merge branch 'feature/multistore_support' into feature/invoice_numbering
This commit is contained in:
@@ -19,7 +19,7 @@ class Items extends Secure_area implements iData_controller
|
||||
|
||||
$stock_location=$this->item_lib->get_item_location();
|
||||
$stock_locations=$this->Stock_locations->get_allowed_locations();
|
||||
$data['stock_location']=$this->item_lib->get_item_location();
|
||||
$data['stock_location']=$stock_location;
|
||||
$data['stock_locations']=$stock_locations;
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
|
||||
@@ -51,6 +51,11 @@ class Receivings extends Secure_area
|
||||
}
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function set_comment()
|
||||
{
|
||||
$this->receiving_lib->set_comment($this->input->post('comment'));
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
@@ -226,6 +231,7 @@ class Receivings extends Secure_area
|
||||
|
||||
$data['total']=$this->receiving_lib->get_total();
|
||||
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
|
||||
$data['comment']=$this->receiving_lib->get_comment();
|
||||
$data['payment_options']=array(
|
||||
$this->lang->line('sales_cash') => $this->lang->line('sales_cash'),
|
||||
$this->lang->line('sales_check') => $this->lang->line('sales_check'),
|
||||
|
||||
@@ -13,8 +13,7 @@ class Item_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('item_location'))
|
||||
{
|
||||
$stock_locations = $this->CI->Stock_locations->get_undeleted_all()->result_array();
|
||||
$location_name = $stock_locations[0]['location_id'];
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_item_location($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('item_location');
|
||||
|
||||
@@ -52,12 +52,26 @@ class Receiving_lib
|
||||
{
|
||||
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'];
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_stock_source($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('recv_stock_source');
|
||||
}
|
||||
|
||||
function get_comment()
|
||||
{
|
||||
return $this->CI->session->userdata('comment');
|
||||
}
|
||||
|
||||
function set_comment($comment)
|
||||
{
|
||||
$this->CI->session->set_userdata('comment', $comment);
|
||||
}
|
||||
|
||||
function clear_comment()
|
||||
{
|
||||
$this->CI->session->unset_userdata('comment');
|
||||
}
|
||||
|
||||
function set_stock_source($stock_source)
|
||||
{
|
||||
@@ -73,9 +87,8 @@ class Receiving_lib
|
||||
{
|
||||
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);
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_stock_destination($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('recv_stock_destination');
|
||||
}
|
||||
@@ -294,6 +307,7 @@ class Receiving_lib
|
||||
$this->clear_mode();
|
||||
$this->empty_cart();
|
||||
$this->delete_supplier();
|
||||
$this->clear_comment();
|
||||
}
|
||||
|
||||
function get_item_total($quantity, $price, $discount_percentage)
|
||||
|
||||
@@ -172,8 +172,7 @@ class Sale_lib
|
||||
{
|
||||
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'];
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_sale_location($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('sale_location');
|
||||
|
||||
@@ -61,6 +61,18 @@ class Stock_locations extends CI_Model
|
||||
return $stock_locations;
|
||||
}
|
||||
|
||||
function get_default_location_id()
|
||||
{
|
||||
$this->db->from('stock_locations');
|
||||
// TODO replace with extra join on ospos_grants
|
||||
$this->db->join('modules', 'modules.module_id=concat(\'items_stock\', location_id)');
|
||||
$this->db->join('permissions', 'permissions.module_id=modules.module_id');
|
||||
$this->db->where('person_id', $this->session->userdata('person_id'));
|
||||
$this->db->where('deleted',0);
|
||||
$this->db->limit(1);
|
||||
return $this->db->get()->row()->location_id;
|
||||
}
|
||||
|
||||
function get_location_name($location_id)
|
||||
{
|
||||
$this->db->from('stock_locations');
|
||||
|
||||
@@ -196,7 +196,7 @@ else
|
||||
<?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'));?>
|
||||
<?php echo form_textarea(array('name'=>'comment','id'=>'comment','value'=>$comment,'rows'=>'4','cols'=>'23'));?>
|
||||
<br /><br />
|
||||
|
||||
<div class='small_button' id='finish_sale_button' style='float:right;margin-top:5px;'>
|
||||
@@ -218,7 +218,7 @@ else
|
||||
<?php echo form_open("receivings/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'));?>
|
||||
<?php echo form_textarea(array('name'=>'comment','id'=>'comment','value'=>$comment,'rows'=>'4','cols'=>'23'));?>
|
||||
<br /><br />
|
||||
<table width="100%">
|
||||
<tr>
|
||||
@@ -326,6 +326,11 @@ $(document).ready(function()
|
||||
$(this).attr('value',"<?php echo $this->lang->line('recvs_start_typing_supplier_name'); ?>");
|
||||
});
|
||||
|
||||
$('#comment').change(function()
|
||||
{
|
||||
$.post('<?php echo site_url("receivings/set_comment");?>', {comment: $('#comment').val()});
|
||||
});
|
||||
|
||||
$("#finish_sale_button").click(function()
|
||||
{
|
||||
if (confirm('<?php echo $this->lang->line("recvs_confirm_finish_receiving"); ?>'))
|
||||
|
||||
Reference in New Issue
Block a user