diff --git a/application/controllers/MRIRcontroller.php b/application/controllers/MRIRcontroller.php index e6712bae..eacb85c2 100755 --- a/application/controllers/MRIRcontroller.php +++ b/application/controllers/MRIRcontroller.php @@ -40,8 +40,10 @@ class MRIRcontroller extends BaseController public function viewmrirforbilling() { $this->global['pageTitle'] = 'Siddharth : Billing '; + $data['Billing'] = $this->mrir_model->view_mrir_Billing(); + - $this->loadViews("viewmrirforbilling", $this->global, NULL , NULL); + $this->loadViews("viewmrirforbilling", $this->global,$data , NULL); } @@ -59,7 +61,16 @@ class MRIRcontroller extends BaseController $this->loadViews("materialinspectionreport", $this->global, $data,NULL); } - + function viewinwardgateregister() + { + + $this->global['pageTitle'] = 'Siddharth : View Inward Gate Register'; + + $data['IGR']= $this->mrir_model->ViewigrListing(); + + $this->loadViews("viewinwardgateregister",$this->global,$data,NULL); + } + /* For View MRIR Screen (view folder - view page)*/ function viewmaterialinspectionreport() @@ -111,7 +122,10 @@ class MRIRcontroller extends BaseController $mrirmastervalues = array('IGRNO'=>$igrno,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt); $mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues); - + $IGRDetails = array('IGRStatus'=>MRIR_CREATED,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt); + + $this->mrir_model->UpdateIGRStatus($IGRDetails,$igrno); + $MRIRNO = ''; @@ -141,7 +155,7 @@ class MRIRcontroller extends BaseController } echo "successfully created : ".$MRIRNO; - // redirect(MRIRcontroller/); + } @@ -154,33 +168,50 @@ class MRIRcontroller extends BaseController $mrir_no = $this->input->post('MRIRNO'); $RowCount = $this->input->post('RowCount'); - + $Status = $this->input->post('status'); $UPdateby=$this->session->userdata('userId'); $date = new DateTime('now',new DateTimeZone('Asia/Kolkata')); $UPdateon = $date->format('Y-m-d H:i:s'); //this array to store the updated value in master table.. - $updatemastervalues = array('UpdateBY'=>$UPdateby,'UpdatedOn'=>$UPdateon); + $updatemastervalues = array('MRIRStatus'=>$Status,'UpdateBY'=>$UPdateby,'UpdatedOn'=>$UPdateon); $updatemaster = $this->mrir_model->update_mrirmaster($updatemastervalues,$mrir_no); - + $strStatus = ''; //echo "outside for loop"; for ($i = 1; $i <= $RowCount; $i++) { - - - $acceptquantity=$this->input->post('AcceptQuantity'.$i); - $rejectquantity=$this->input->post('RejectQuantity'.$i); + $acceptquantity=$this->input->post('AcceptQuantity'.$i); + $rejectquantity=$this->input->post('RejectQuantity'.$i); + $MaterialCode = $this->input->post('MaterialCode'.$i); + if(strlen($acceptquantity)>0) + { + $strStatus = MRIR_APPROVED; + $avlQty = 0; + $getAvailableqty = $this->mrir_model->getItemQuantityFromStock($MaterialCode); + if(count($getAvailableqty)>0) + { + $avlQty = $getAvailableqty[0]['Quantity']; + } + $updatStock = array('Quantity'=>($acceptquantity+$avlQty),'Status'=>'1','UpdatedOn'=>$UPdateon,'UpdatedBy'=>$UPdateby); + // print_r($updatStock); + } + elseif(strlen($acceptquantity)==0 && strlen($rejectquantity)>0) + { + $strStatus = MRIR_REJECTED; + } + $remark=$this->input->post('Remark'.$i); $updateby=$this->session->userdata('userId'); $date = new DateTime('now',new DateTimeZone('Asia/Kolkata')); $updateon = $date->format('Y-m-d H:i:s'); - + //this array to store the update value in child table.. - $updatedetailvalues = array('UpdateBy'=>$updateby,'UpdatedOn'=>$updateon,'QuantityAccepted'=>$acceptquantity,'QuantityRejected'=>$rejectquantity,'Remarks'=>$remark); + $updatedetailvalues = array('UpdateBy'=>$updateby,'UpdatedOn'=>$updateon,'QuantityAccepted'=>$acceptquantity,'QuantityRejected'=>$rejectquantity,'Remarks'=>$remark,'MRIRStatus'=>$strStatus); - $updatedetails = $this->mrir_model->update_mrirdetail($updatedetailvalues,$mrir_no); - + $updatedetails = $this->mrir_model->update_mrirdetail($updatedetailvalues,$mrir_no); + + } echo "successfully updated :".$mrir_no; diff --git a/application/controllers/inwardgateregister.php b/application/controllers/inwardgateregister.php index 37635529..a37c204d 100755 --- a/application/controllers/inwardgateregister.php +++ b/application/controllers/inwardgateregister.php @@ -34,14 +34,7 @@ class inwardgateregister extends BaseController $this->loadViews("viewinwardgateregister", $this->global,NULL , NULL); } - function viewinwardgateregister() - { - $this->load->model('inwardgateregister_model'); - $this->global['pageTitle'] = 'Siddharth : Inward Gate Register'; - $data['IGR']= $this->inwardgateregister_model->igrListing(); - - $this->loadViews("viewinwardgateregister",$this->global,$data,NULL); - } + function viewIGRDetails() { $this->load->model('inwardgateregister_model'); diff --git a/application/controllers/storestatus.php b/application/controllers/storestatus.php index 6ba65f1f..e0ba7545 100755 --- a/application/controllers/storestatus.php +++ b/application/controllers/storestatus.php @@ -47,10 +47,67 @@ class storestatus extends BaseController $this->global['pageTitle'] = 'Siddharth Industries : Store Status'; //viewStock $data['Stock'] = $this->store_model->viewStock(); + $data['MaterialList'] = $this->store_model->GetAllMaterialList(); + $data['StockStatus'] = $this->store_model->GetConfigValue('C021'); $this->loadViews("storestatus", $this->global, $data,null); } + /** + * This function is used to load the Supplier list + */ + function AddStock() + { + + $MaterialCode = $this->input->post('MaterialCode'); + $AvailableQty = $this->input->post('AddAvailableStock'); + $AvailbilityStatus = $this->input->post('StockAvail'); + $Remarks = $this->input->post('Remarks'); + $CreatedBy = $this->session->userdata('EmpID'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $Status = 1; + if(trim($AvailbilityStatus) == 'YES') + { + $Status = 0; + } + + + //this array to store the value in master table.. + $Stockdetails = array('MaterialCode'=>$MaterialCode,'Quantity'=>$AvailableQty,'Status'=>$Status,'Remarks'=>$Remarks, 'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt); + + $data['Stock'] = $this->store_model->addStock($Stockdetails); + echo 'Stock Added successfully'; + + + } + + function UpdateStock() + { + + $MaterialCode = $this->input->post('EditMaterialCode'); + $AvailableQty = $this->input->post('EditAvailableStock'); + $AvailbilityStatus = $this->input->post('EditStockAvail'); + $Remarks = $this->input->post('EditRemarks'); + $CreatedBy = $this->session->userdata('EmpID'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $Status = 1; + if(trim($AvailbilityStatus) == 'YES') + { + $Status = 0; + } + + + //this array to store the value in master table.. + $Stockdetails = array('Quantity'=>$AvailableQty,'Status'=>$Status,'Remarks'=>$Remarks, 'UpdatedBy'=>$CreatedBy,'updatedOn'=>$createddt); + + $data['Stock'] = $this->store_model->UpdateStock($Stockdetails,$MaterialCode); + echo 'Stock updated successfully'; + + + } + function pageNotFound()