diff --git a/application/controllers/MRIRcontroller.php b/application/controllers/MRIRcontroller.php
old mode 100755
new mode 100644
index 000b6880..629d1200
--- a/application/controllers/MRIRcontroller.php
+++ b/application/controllers/MRIRcontroller.php
@@ -47,13 +47,14 @@ class MRIRcontroller extends BaseController
$this->loadViews("materialinspectionreport", $this->global,$data,NULL);
}
- /*FOR Displaying IGR Values in Materialinspection.php(view file) */
+
+ /*FOR Displaying IGR Values in Materialinspectionreport.php(view file) */
function igrdatavalues()
{
$IgrNo= $_GET['IGRNO'];
- print_r($IgrNo);
+ //print_r($IgrNo);
$data['IGRDetails'] = $this->mrir_model->get_IGRs($IgrNo);
@@ -67,11 +68,16 @@ class MRIRcontroller extends BaseController
/* FOR Edit MRIR Screen */
function editmaterialinspectionreport()
{
- $this->global['pageTitle'] = 'Siddharth : Edit Material Inspection Report';
+
- $this->load->model('mrir_model');
+ $this->load->model('mrir_model');
+
+ $MrirNo = $_GET['MRIRNO'];
+ // print_r($MrirNo);
- $data['IGRNOonly'] = $this->mrir_model->getIGRNOonly();
+ $data['MRIRDetails'] = $this->mrir_model->get_MRIR_Values($MrirNo);
+
+ $this->global['pageTitle'] = 'Siddharth : Edit Material Inspection Report';
$this->loadViews("Editmaterialinspectionreport", $this->global,$data,NULL);
@@ -85,15 +91,15 @@ class MRIRcontroller extends BaseController
$this->load->model('mrir_model');
- $data['mrirdatas2'] = $this->mrir_model-> view_MRIR();
-
+ $data['viewmrirdatas'] = $this->mrir_model-> view_MRIR();
+ //old name:mrirdatas2
$this->global['pageTitle'] = 'Siddharth : View Material Inspection Report';
//print_r( $data);
$this->loadViews("viewmaterialinspectionreport", $this->global,$data,NULL);
}
- /* For Values are Stored in DB */
+ /* NEW Values TO Stored in DB (for insert operation) */
function displaying_values()
{
$this->load->model('mrir_model');
@@ -135,11 +141,10 @@ class MRIRcontroller extends BaseController
$QuantityAsPerInvoice = $this->input->post('ReceivedQuantity'.$i);
$Remarked = $this->input->post('Remarks'.$i);
- $StoreIncharge = $this->session->userdata('name');
- $UpdatedBy = $this->session->userdata('userId');
-
- //this array to store the value in master table..
- $mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$ActualQuantityReceived,'StoreInchargeID'=>$StoreIncharge,'Remarks'=>$Remarked,'UpdateBy'=>$UpdatedBy);
+ $StoreIncharge = $this->session->userdata('userId');
+
+ //this array to store the value in child table..
+ $mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$ActualQuantityReceived,'StoreInchargeID'=>$StoreIncharge,'Remarks'=>$Remarked);
//print_r($mrirvalues2);
//die();
$mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues);
@@ -149,8 +154,73 @@ class MRIRcontroller extends BaseController
}
+ /* Values To Stored in DB (for update operation) */
+ function updated_values()
+ {
+ //print_r("this is controller which is present in updated_value function ");
+ // die();
+ $this->load->model('mrir_model');
+
+ $mrir_no = $this->input->post('MRIRNO');
+ //print_r($mrir_no);
+ //die(
+
+ $RowCount = $this->input->post('RowCount');
+ //echo $RowCount;
+
+
+ $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);
+
+ $updatemaster = $this->mrir_model->update_mrirmaster($updatemastervalues,$mrir_no);
+ //echo "Master affected rows";
+ // print_r($updatemaster);
+ //die();
+
+
+ echo "outside for loop";
+ for ($i = 1; $i <= $RowCount; $i++)
+ {
+ echo "inside for loop";
+
+ $acceptquantity=$this->input->post('AcceptQuantity'.$i);
+ echo $acceptquantity;
+ $rejectquantity=$this->input->post('RejectQuantity'.$i);
+ echo $rejectquantity;
+ $remark=$this->input->post('Remarks'.$i);
+ echo "hi before remark";
+ echo $remark;
+
+ //die();
+ $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);
+
+ $updatedetails = $this->mrir_model->update_mrirdetail($updatedetailvalues,$mrir_no);
+ echo "Child affected rows";
+ // print_r($updatemaster);
+
+ }
+ //print_r(alert($mrir_no.": successfully updated"));
+
+
+ }
+
+
+
+
+
+
+
+ /*in view screen we display values for modal (viewmaterialinspectionreport.php)*/
function displaying_MRIRvalues()
{
$mrir = $this->input->post("mrirno");
diff --git a/application/models/mrir_model.php b/application/models/mrir_model.php
old mode 100755
new mode 100644
index da9c0a9c..40409428
--- a/application/models/mrir_model.php
+++ b/application/models/mrir_model.php
@@ -70,12 +70,12 @@ class mrir_model extends CI_Model
}
-
+ /* to get the value for modal in MRIR we using this function */
function get_MRIRs($mrir)
{
$this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,TMD.*,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRD.*,SUPP.SupplierName,SUPP.Address,POMR.DeliveryDate,POMR.ServiceDescription,MM.MaterialCode,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity');
$this->db->from ('T_MRIR_Master TMM');
- $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO','left');;
+ $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO','left');
$this->db->join ('T_MaterialMaster MM','TMD.MaterialCode = MM.MaterialCode','left');
$this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO=TMM.IGRNO','left');
$this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO','left');
@@ -86,29 +86,121 @@ class mrir_model extends CI_Model
//$this->db->order_by('TMD.MRIRNO','asc');
- // $this->db->from ('T_MRIR_Master TMM');
- $query = $this->db->get();
+ // $this->db->from ('T_MRIR_Master TMM');
+ $query = $this->db->get();
//print_r($this->db->last_query());
- $result=$query->result();
- //print_r($result);
- return $result;
+ $result=$query->result();
+ //print_r($result);
+ return $result;
}
-
+
+ function get_MRIR_Values($MrirNo)
+ {
+ $this->db->distinct();
+ //$this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,SUPP.SupplierName,SUPP.Address,POMR.DeliveryDate,POMR.ServiceDescription,MM.MaterialCode,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity');
+ $this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,TMM.Createdon,TMD.ActualQuantityReceived,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,IGRM.CreatedDate,IGRD.QuantityAsPerInvoice,SUPP.SupplierName,SUPP.Address,POMR.PODate,POMR.DeliveryDate,POMR.ServiceDescription,TMD.MaterialCode,MM.MaterialName,MM.UOM,POLT.Quantity,POLT.ReceivedQuantity,ED.FirstName');
+ $this->db->from ('T_MRIR_Master TMM');
+ $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO','left');
+ $this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO=TMM.IGRNO','left');
+ $this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO','left');
+ $this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO','left');
+ $this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO= IGRM.IGRNO','left');
+ $this->db->join ('T_MaterialMaster MM','IGRD.MaterialCode = MM.MaterialCode','left');
+ $this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID','left');
+ $this->db->join ('tbl_users user','user.userid=POMR.CreatedBy','left');
+ $this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
+ $this->db->where('TMM.MRIRNO',$MrirNo);
+ $query = $this->db->get();
+ $result = $query->result();
+ return $result;
+
+ }
+
+ function get_IGRs($IgrNo)
+ {
+ $this->db->distinct();
+ $this->db->select('IGRM.DeliveryChellanDate,IGRM.CreatedDate,IGRM.IGRNO,IGRM.VehicleNo,IGRM.DeliveryChellanOrInvoiceNo,IGRM.CourierNo,IGRM.PONO,IGRD.MaterialCode,IGRD.QuantityAsPerInvoice,POMR.ServiceDescription,POMR.PODate,POMR.DeliveryDate,POMR.CreatedBy,SUPP.SupplierName,SUPP.Address,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity,ED.FirstName');
+ //$this->db->select("DATE_FORMAT(IGRM.DeliveryChellanDate, '%d %m %Y') as DCdate");
+ $this->db->from('T_IGR_Master IGRM');
+ $this->db->join('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO');
+ $this->db->join('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
+ $this->db->join('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO and IGRD.MaterialCode = POLT.MaterialCode');
+ $this->db->join('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID');
+ $this->db->join('T_MaterialMaster MM',' MM.MaterialCode=IGRD.MaterialCode');
+ $this->db->join ('tbl_users user','user.userid=POMR.CreatedBy','left');
+ $this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
+ $this->db->where('IGRM.IGRNO',$IgrNo);
+
+ $query = $this->db->get();
+ $result = $query->result();
+ return $result;
+
+ }
+
+
+
+
+
+ /* to display the value for view page in MRIR we using this function*/
function view_MRIR()
{
- $this->db->distinct();
- $this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,TMD.StoreInchargeID,TMD.QualityInchargeID,TMD.PlantInchargeID');
+ $this->db->distinct();
+ $this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,TMD.StoreInchargeID,TMD.QualityInchargeID,TMD.PlantInchargeID,TMD.UpdateBY,POM.PODate,POM.POType,POM.ReleasedBy,,ED1.FirstName as ReleasedbyName,
+ED.FirstName as UpdatedbyName');
$this->db->from ('T_MRIR_Master TMM');
- $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO','left');
- $this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO','left');
- $this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO','left');
- $this->db->order_by ('TMM.MRIRNO','asc');
- $query = $this->db->get();
- return $query->result();
+ $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO=TMD.MRIRNO');
+ $this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO');
+ $this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
+ $this->db->join ('T_PurchaseOrder_Master POM','TMM.PONO=POM.PONO');
+ $this->db->join ('tbl_users user','user.userid=TMD.UpdateBY','left');
+ $this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
+ $this->db->join ('tbl_users user2','user2.userid = POM.ReleasedBy','left');
+ $this->db->join ('T_Employee_Details ED1','ED1.EmpID = user2.EmpID','left');
+ $this->db->order_by ('TMM.MRIRNO','asc');
+ $query = $this->db->get();
+ return $query->result();
+
+ }
+
+
+
+ function update_mrirmaster($updatemastervalues,$mrir_no)
+ {
+ // print_r($updatemastervalues);
+ // echo $mrir_no;
+ // die();
+ $this->db->where('MRIRNO', $mrir_no);
+ $this->db->update('T_MRIR_Master', $updatemastervalues);
+ $affectedRows = $this->db->affected_rows();
+ // if(count($affectedRows>0))
+ // {
+ // $subquery = "select max(MRIRNO) from T_MRIR_Master";
+ // $result = $this->db->query($subquery);
+ // //print_r($result->result());
+ // //die();
+ // return $result->result();
+ // }
+ return $affectedRows;
+
+ }
+
+ //return $afftectedRows;
+
+
+
+ function update_mrirdetail($updatedetailvalues,$mrir_no)
+ {
+ // print_r($updatedetailvalues);
+ // echo $mrir_no;
+ // die();
+ $this->db->where('MRIRNO',$mrir_no);
+ $this->db->update('T_MRIR_Details',$updatedetailvalues);
+ $affectedRows = $this->db->affected_rows();
+ return $affectedRows;
}
@@ -117,30 +209,28 @@ class mrir_model extends CI_Model
$this->db->insert('T_MRIR_Master', $mrirmastervalues);
-
$insert_id = $this->db->affected_rows();
if($insert_id>0)
{
$subQuery = 'select max(MRIRNO) as MRIRNo from T_MRIR_Master';
-
$query = $this->db->query($subQuery);
-
return $query->result();//_array();
}
- }
- function detail_mrir($mrirdetailvalues)
- {
+ }
- $this->db->insert('T_MRIR_Details',$mrirdetailvalues);
- $insert_id = $this->db->affected_rows();
- return $insert_id;
+ function detail_mrir($mrirdetailvalues)
+ {
-
- }
- function mrir_detailtable($mrirdetailvalues)
- {
+ $this->db->insert('T_MRIR_Details',$mrirdetailvalues);
+ $insert_id = $this->db->affected_rows();
+ return $insert_id;
+
+ }
+
+ function mrir_detailtable($mrirdetailvalues)
+ {
$this->db->trans_start();
//print_r($mrirvalue2);
@@ -149,37 +239,21 @@ class mrir_model extends CI_Model
$this->db->trans_complete();
return $insert_id;
- }
+ }
- function get_IGRs($IgrNo)
- {
- $this->db->distinct();
- $this->db->select('IGRM.DeliveryChellanDate,IGRM.CreatedDate,IGRM.IGRNO,IGRM.VehicleNo,IGRM.DeliveryChellanOrInvoiceNo,IGRM.CourierNo,IGRM.PONO,IGRD.MaterialCode,IGRD.QuantityAsPerInvoice,POMR.ServiceDescription,POMR.PODate,POMR.DeliveryDate,POMR.CreatedBy,SUPP.SupplierName,SUPP.Address,MM.MaterialCode,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity');
- //$this->db->select("DATE_FORMAT(IGRM.DeliveryChellanDate, '%d %m %Y') as DCdate");
- $this->db->from('T_IGR_Master IGRM');
- $this->db->join('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO');
- $this->db->join('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
- $this->db->join('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO and IGRD.MaterialCode = POLT.MaterialCode');
- $this->db->join('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID');
- $this->db->join('T_MaterialMaster MM',' MM.MaterialCode=IGRD.MaterialCode');
- $this->db->where('IGRM.IGRNO',$IgrNo);
+
- $query = $this->db->get();
- $result = $query->result();
- return $result;
-
- }
-
-
- function getIGRNOonly(){
+ function getIGRNOonly()
+ {
$this->db->select('IGRNO');
$this->db->from('T_IGR_Master');
$this->db->order_by('IGRNO', 'asc');
$res=$this->db->get();
return $res->result();
- }
+ }}
+
+
-}
?>
\ No newline at end of file
diff --git a/application/views/Editmaterialinspectionreport.php b/application/views/Editmaterialinspectionreport.php
old mode 100755
new mode 100644
index 0db033db..f014eecf
--- a/application/views/Editmaterialinspectionreport.php
+++ b/application/views/Editmaterialinspectionreport.php
@@ -1,34 +1,49 @@
-IGRNO;
- $PONO = $IGR->PONO;
- $VehicleNo = $IGR->VehicleNo;
- $CourierNo= $IGR->CourierNo;
- $DeliveryChellanOrInvoiceNo=$IGR->DeliveryChellanOrInvoiceNo;
- $SupplierName=$IGR->SupplierName;
- $DeliveryChellanDate=$IGR->DeliveryChellanDate;
- $Address=$IGR->Address;
- $CreatedBy=$IGR->CreatedBy;
- $PODate=$IGR->PODate;
- $ServiceDescription=$IGR->ServiceDescription;
-
-
+ $MRIRNO = $MRIR->MRIRNO;
+ $MRIRDate=$MRIR->CreatedDate;
+ $mrir_date = strtotime( $MRIRDate );
+ $mrirdate = date( 'd/m/Y', $mrir_date );
+ $IGRNO = $MRIR->IGRNO;
+ $IGRDate = $MRIR->Createdon;
+ $igr_date = strtotime( $IGRDate );
+ $igrdate = date( 'd/m/Y', $igr_date );
+ $PONO = $MRIR->PONO;
+ $PODate=$MRIR->PODate;
+ $PORasiedbyName=$MRIR->FirstName;
+ $po_date = strtotime( $PODate );
+ $podate = date( 'd/m/Y', $po_date );
+ $VehicleNo = $MRIR->VehicleNo;
+ $CourierNo= $MRIR->CourierNo;
+ $DeliveryChellanOrInvoiceNo=$MRIR->DeliveryChellanOrInvoiceNo;
+ $SupplierName=$MRIR->SupplierName;
+ $DeliveryChellanDate=$MRIR->DeliveryChellanDate;
+ $dc_date = strtotime( $DeliveryChellanDate );
+ $dcdate = date( 'd/m/Y', $dc_date );
+ $Address=$MRIR->Address;
+ //$CreatedBy=$MRIR->CreatedBy;
+ $ServiceDescription=$MRIR->ServiceDescription;
}
}
@@ -43,9 +58,6 @@ if(!empty($IGRDetails))
});//ready closed.
-
-
-