Add quantity column in item page

Fix bug about validating stock location config

PS
This commit is contained in:
Padungsak
2014-07-11 22:32:47 +07:00
parent 9607300514
commit a1e1883ddc
5 changed files with 35 additions and 30 deletions

View File

@@ -159,6 +159,7 @@ 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_quantity'),
$CI->lang->line('items_tax_percents'),
' ',
$CI->lang->line('items_inventory')
@@ -209,6 +210,13 @@ 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)
{
$item_quantity .= $location['location_name'].': '.$CI->Item_quantitys->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>';
@@ -216,6 +224,7 @@ 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="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>';

View File

@@ -31,7 +31,19 @@ class Item_quantitys extends CI_Model
$this->db->from('item_quantitys');
$this->db->where('item_id',$item_id);
$this->db->where('location_id',$location_id);
return $this->db->get()->row();
$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
$fields = $this->db->list_fields('item_quantitys');
foreach ($fields as $field)
{
$result->$field='';
}
}
return $result;
}
}
?>

View File

@@ -431,7 +431,7 @@ $(document).ready(function()
},
email:"email",
return_policy: "required",
stock_location_number:"required"
stock_location:"required"
},
messages:
@@ -446,7 +446,7 @@ $(document).ready(function()
},
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>",
return_policy:"<?php echo $this->lang->line('config_return_policy_required'); ?>",
stock_location_number:"<?php echo $this->lang->line('config_stock_location_required'); ?>"
stock_location:"<?php echo $this->lang->line('config_stock_location_required'); ?>"
}
});

View File

@@ -502,11 +502,6 @@ $(document).ready(function()
required:true,
number:true
},
quantity:
{
required:true,
number:true
},
reorder_level:
{
required:true,
@@ -533,11 +528,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

@@ -16,24 +16,18 @@ if(isset($error))
<span><?php echo $this->lang->line('recvs_mode') ?></span>
<?php echo form_dropdown('mode',$modes,$mode,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php
if($mode == 'requisition')
{
?>
<span><?php echo $this->lang->line('recvs_stock_source') ?></span>
<?php echo form_dropdown('stock_source',$stock_locations,$stock_source,'onchange="$(\'#mode_form\').submit();"'); ?>
<span><?php echo $this->lang->line('recvs_stock_destination') ?></span>
<?php echo form_dropdown('stock_destination',$stock_locations,$stock_destination,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php
}
else
{
?>
<span><?php echo $this->lang->line('recvs_stock_locaiton') ?></span>
<?php echo form_dropdown('stock_source',$stock_locations,$stock_source,'onchange="$(\'#mode_form\').submit();"'); ?>
<?php
}
<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
$opacity_style='';
if($mode!='requisition')
{
$opacity_style = 'style="opacity:0.0;"';
}
?>
<span <?php echo $opacity_style; ?> > <?php echo $this->lang->line('recvs_stock_destination') ?></span>
<?php echo form_dropdown('stock_deatination',$stock_locations,$stock_destination,'onchange="$(\'#mode_form\').submit();" '.$opacity_style); ?>
</form>
<?php echo form_open("receivings/add",array('id'=>'add_item_form')); ?>