diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index abecdede..0aa0ca09 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -1352,6 +1352,7 @@ class batchcard extends BaseController $status = $this->input->post('transtatus'); $CreatedBy = $this->session->userdata('userId'); $absaluteQty = abs($Qty); + $Isactive=1; // echo $Qty; // echo "abs"; @@ -1366,7 +1367,8 @@ class batchcard extends BaseController // echo $createddt; // die(); - $adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt,'CreatedBy'=>$CreatedBy); + $adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt, + 'CreatedBy'=>$CreatedBy,'Isactive'=>$Isactive); $materialadjust = $this->batchcard_model->AddmaterialAdjustment($adjustmentaarray); @@ -1381,7 +1383,7 @@ class batchcard extends BaseController } - $historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId); + $historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId,'Isactive'=>$Isactive); $historyadd = $this->batchcard_model->AddMaterialHistory($historytable); @@ -1710,25 +1712,6 @@ class batchcard extends BaseController } } - - - - - - - - - - - - - - - - - - echo "Updated"; - @@ -1740,18 +1723,56 @@ class batchcard extends BaseController { $AdjustmentId = $_GET['AdjustmentId']; + $Supplier = $_GET['sn']; + $date =$_GET['date']; + $MaterialCode =$_GET['mc']; + $this->global['pageTitle'] = 'Siddharth : Material Adjustment'; + $data['netQuantityarray'] = $this->batchcard_model->GetNetQty($MaterialCode,$date,$Supplier); + //print_r($data['netQuantityarray']); $data['materailAdjustmentlist'] = $this->batchcard_model->getEditMaterialAdjustments($AdjustmentId); $data['materiallist'] = $this->batchcard_model->getMaterial(); $data['getSupplierlist'] = $this->batchcard_model->getSupplierlist(); - // print_r($data['materailAdjustmentlist']); - - - - $this->global['pageTitle'] = 'Siddharth : Material Adjustment'; - $this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + $this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + + //return true; + } + function UpdateQuantity() + { + $adjquantity =$this->input->post('adjquantity'); + $reason =$this->input->post('reason'); + $id = $this->input->post('adid'); + //echo $id; + $adjustquantity = $this->input->post('editquantity'); + $description = $this->input->post('desc'); + $updatequantitydes = array('Quantity'=>$adjustquantity,'Description'=>$description,'Reason'=>$reason,'ActualQuantity'=>$adjquantity); + //print_r($updatequantitydes); + $updatequantity=array('Quantity'=>$adjustquantity); + $UpdateQuantityHistory = $this->batchcard_model->updateQuantityStockHistory($updatequantity,$id); + $UpdateQuantityAdj = $this->batchcard_model->updateQuantityAdjusment($updatequantitydes,$id); + + // print_r($updatequantityadj); + + if((count($updatequantityadj)>0) &&(count($updatequantityhistory))) + { + echo "Details Added Successfully"; + } + else + { + echo "Something Went Wrong,Please Try Again"; + } + //$this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + } + function Deletequantity() + { + $AdjustmentId = $_GET['AdjustmentId']; + $Isactive=0; + $Updateactive =array('Isactive'=>$Isactive); + $this->batchcard_model->updateisactiveadjusment($Updateactive,$AdjustmentId); + $this->batchcard_model->updateisactiveastockhistory($Updateactive,$AdjustmentId); + $this->loadViews("editmaterialadjustment", $this->global,$data,NULL); } diff --git a/application/logs/log-2018-05-31.php b/application/logs/log-2018-05-31.php new file mode 100644 index 00000000..ec234979 --- /dev/null +++ b/application/logs/log-2018-05-31.php @@ -0,0 +1,4 @@ + + +ERROR - 2018-05-31 11:30:40 --> Severity: Notice --> Use of undefined constant Adjust - assumed 'Adjust' C:\xampp\htdocs\siddharth_application\application\models\batchcard_model.php 781 +ERROR - 2018-05-31 11:30:41 --> Severity: Notice --> Undefined variable: updatequantityadj C:\xampp\htdocs\siddharth_application\application\controllers\batchcard.php 1507 diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index 4aadbd31..ec464140 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -758,18 +758,7 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; } - function getEditMaterialAdjustments($AdjustmentId) - { - - $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName'); - $this->db->from('T_Material_Adjustment'); - $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); - $res = $this->db->get(); - return $res->result(); - } - + function save_rawmaterialto_materialHistory($materialhistory) { @@ -971,6 +960,65 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; $this->db->update('T_FinalProduct_CoProduct_Materials', $coparray); return TRUE; } + function getEditMaterialAdjustments($AdjustmentId) + { + + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity'); + $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_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); + $res = $this->db->get(); + return $res->result(); + } + //created by TamilBala + //for update quantity stockhistory + function updateQuantityStockHistory($updatequantity,$id) + { + + $this->db->where('Ref_No',$id); + $this->db->where('Ref_Type',Adjust); + $this->db->update('T_Material_stock_history',$updatequantity); + $r = $this->db->affected_rows(); + //return $r->result(); + //echo "HIS"; + + } + + //created by TamilBala + //for update quantity T_Material_Adjustment + + function updateQuantityAdjusment($updatequantitydes,$id) + { + $this->db->where('AdjustmentId',$id); + $this->db->update('T_Material_Adjustment',$updatequantitydes); + $r = $this->db->affected_rows(); + return $r; + + } + //created by TamilBala + //for update isactive T_Material_Adjustment + function updateisactiveadjusment($Updateactive,$AdjustmentId) + { + $this->db->where('AdjustmentId',$AdjustmentId); + $this->db->update('T_Material_Adjustment',$Updateactive); + $r = $this->db->affected_rows(); + return $r; + + } + + //created by TamilBala + //for update isactive stockhistory + function updateisactiveastockhistory($Updateactive,$AdjustmentId) + { + $this->db->where('Ref_No',$AdjustmentId); + $this->db->where('Ref_Type',Adjust); + $this->db->update('T_Material_stock_history',$Updateactive); + $r = $this->db->affected_rows(); + return $r; + } + } diff --git a/application/views/editmaterialadjustment.php b/application/views/editmaterialadjustment.php index c3c48540..2287315e 100644 --- a/application/views/editmaterialadjustment.php +++ b/application/views/editmaterialadjustment.php @@ -5,24 +5,31 @@ $edit_Qty_aspersystem=''; $edit_Actual_Qty= ''; $edit_Adjustable_qty= ''; $edit_Description=''; +$editquantity=''; +$editid=''; +$latestupdate=''; if(!empty($materailAdjustmentlist)) { +//print_r($materailAdjustmentlist); foreach($materailAdjustmentlist as $mat) { - + $editid = $mat->AdjustmentId; $supplier = $mat->SupplierID; + $suppliername=$mat->SupplierName; $materialcode = $mat->MaterialCode; $date = $mat->CreatedOn; - // $edit_Qty_aspersystem= $mat->; + $editquantity= $mat->Quantity; $edit_Actual_Qty= $mat->ActualQuantity; - $edit_Adjustable_qty= ''; - $edit_Description=''; + + // $edit_Adjustable_qty= ''; + $edit_Description= $mat->Description; } } - +//$latestupdate=parseFloat($Addqty)-parseFloat($reduceqty); +//print_r($latestupdate); ?> @@ -78,7 +85,7 @@ $(function() {