diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index a8a2600f..8aebb7d7 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -1043,9 +1043,9 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; function getEditMaterialAdjustments($AdjustmentId) { - $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity'); + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity,Ref_Type,Transaction_type'); $this->db->from('T_Material_Adjustment'); - $this->db->join('T_Material_stock_history', 'T_Material_Adjustment.AdjustmentId = T_Material_stock_history.Ref_No'); + $this->db->join('T_Material_stock_history', 'T_Material_Adjustment.AdjustmentId = T_Material_stock_history.Ref_No and T_Material_stock_history.Ref_Type="Adjust"'); $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID'); $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode'); $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId); diff --git a/application/views/editmaterialadjustment.php b/application/views/editmaterialadjustment.php index c036d0b7..d9445d4b 100644 --- a/application/views/editmaterialadjustment.php +++ b/application/views/editmaterialadjustment.php @@ -8,6 +8,7 @@ $edit_Description=''; $editquantity=''; $editid=''; $latestupdate=''; +$type= ''; if(!empty($materailAdjustmentlist)) { @@ -25,9 +26,28 @@ if(!empty($materailAdjustmentlist)) // $edit_Adjustable_qty= ''; $edit_Description= $mat->Description; $edit_reason= $mat->Reason; + $type = $mat->Transaction_type; } } +$as_per_system = ''; +$value_to_display= ''; +if($type == "Add") +{ + // $as_per_system = $editquantity - $edit_Actual_Qty; + + $as_per_system = $edit_Actual_Qty-$editquantity; + $value_to_display = $editquantity; +} + +else if($type == "Reduce") +{ + // $as_per_system = $editquantity + $edit_Actual_Qty; + + $as_per_system=$edit_Actual_Qty+$editquantity; + $value_to_display = "-".$editquantity; +} + //$latestupdate=parseFloat($Addqty)-parseFloat($reduceqty); //print_r($latestupdate); @@ -179,7 +199,7 @@ $(function() { } $latestupdate=$Addqty-$reduceqty; - $data = array('name' => 'Qty_aspersystem','value' => set_value('Qty_aspersystem', $latestupdate),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);'); + $data = array('name' => 'Qty_aspersystem','value' => set_value('Qty_aspersystem', $as_per_system),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);'); echo form_input($data); ?> @@ -198,7 +218,7 @@ $(function() {
'ActualQty','value' => set_value('ActualQty',$editquantity),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()'); + $data = array('name' => 'ActualQty','value' => set_value('ActualQty',$edit_Actual_Qty),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()'); echo form_input($data); ?> @@ -216,7 +236,7 @@ $(function() {
'AdjustableQty','value' => set_value('AdjustableQty',0),'id'=>'AdjustableQty', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true'); + $data = array('name' => 'AdjustableQty','value' => set_value('AdjustableQty',$value_to_display),'id'=>'AdjustableQty', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true'); echo form_input($data); ?> @@ -284,9 +304,14 @@ $(function() {
-
-   Save -
+
+ + + OK +
+ + +