diff --git a/application/controllers/MRIRcontroller.php b/application/controllers/MRIRcontroller.php index 02038880..e6712bae 100755 --- a/application/controllers/MRIRcontroller.php +++ b/application/controllers/MRIRcontroller.php @@ -24,14 +24,15 @@ class MRIRcontroller extends BaseController $this->isLoggedIn(); } + /* For Entry MRIR Screen*/ function materialinspectionreport($mrir='',$IGRNO='') { $this->global['pageTitle'] = 'Siddharth : Material Inspection Report'; $this->load->model('mrir_model'); - $data['IGRNOonly'] = $this->mrir_model->getIGRNOonly(); - + $data['IGRNOonly'] = $this->mrir_model->getIGRNOonly(); + $this->loadViews("materialinspectionreport", $this->global,$data,NULL); } @@ -42,35 +43,47 @@ class MRIRcontroller extends BaseController $this->loadViews("viewmrirforbilling", $this->global, NULL , NULL); } + + - /*FOR Displaying IGR Values in Materialinspectionreport.php(view file) */ + /*FOR Displaying IGR Values (view folder- IGR view page (button link)) */ function igrdatavalues() { $IgrNo= $_GET['IGRNO']; - //print_r($IgrNo); - - $data['IGRDetails'] = $this->mrir_model->get_IGRs($IgrNo); + $data['IGRDetails'] = $this->mrir_model->get_IGR($IgrNo); $this->global['pageTitle'] = 'Siddharth : IGR Details '; $this->loadViews("materialinspectionreport", $this->global, $data,NULL); - } - /* FOR Edit MRIR Screen */ + /* For View MRIR Screen (view folder - view page)*/ + function viewmaterialinspectionreport() + + { + + $this->load->model('mrir_model'); + + $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 Edit MRIR Screen (View folder - edit page)*/ function editmaterialinspectionreport() { - - $this->load->model('mrir_model'); + $this->load->model('mrir_model'); $MrirNo = $_GET['MRIRNO']; - // print_r($MrirNo); - $data['MRIRDetails'] = $this->mrir_model->get_MRIR_Values($MrirNo); + $data['MRIRDetails'] = $this->mrir_model->edit_mrir($MrirNo);//get_MRIR_Values($MrirNo); $this->global['pageTitle'] = 'Siddharth : Edit Material Inspection Report'; @@ -79,35 +92,19 @@ class MRIRcontroller extends BaseController } - /* For View MRIR Screen*/ - function viewmaterialinspectionreport() - - { - - $this->load->model('mrir_model'); - - $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); - - } - /* NEW Values TO Stored in DB (for insert operation) */ - function displaying_values() + function stored_db()//old name : displaying_values() { $this->load->model('mrir_model'); $RowCount = $this->input->post('RowCount'); - //echo $RowCount; - // get form variable $igrno = $this->input->post('IGRNO'); $PONO = $this->input->post('PONO'); + $CreatedBy = $this->session->userdata('userId'); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); - $Remark = $this->input->post('Remarks'); + $Remark = $this->input->post('Remark'); //this array to store the value in master table.. @@ -129,41 +126,34 @@ class MRIRcontroller extends BaseController for ($i = 1; $i <= $RowCount; $i++) - { + { + $MaterialCode = $this->input->post('MaterialCode'.$i); $ActualQuantityReceived = $this->input->post('ActualQuantity'.$i); - echo $ActualQuantityReceived; - $QuantityAsPerInvoice = $this->input->post('ReceivedQuantity'.$i); - $Remarked = $this->input->post('Remarks'.$i); + $Remarked = $this->input->post('Remark'.$i); $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); + //this array to store the value in child table.. + $mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$ActualQuantityReceived,'StoreInchargeID'=>$StoreIncharge,'Remarks'=>$Remarked); + + $mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues); } echo "successfully created : ".$MRIRNO; + // redirect(MRIRcontroller/); } - /* Values To Stored in DB (for update operation) */ - function updated_values() - { - //print_r("this is controller which is present in updated_value function "); - // die(); + /* Values To Stored in DB (for update operation) */ + function updated_db() + { + $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')); @@ -173,25 +163,15 @@ class MRIRcontroller extends BaseController $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"; + + //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(); + $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'); @@ -200,21 +180,14 @@ class MRIRcontroller extends BaseController $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")); + echo "successfully updated :".$mrir_no; } - - - - - - /*in view screen we display values for modal (viewmaterialinspectionreport.php)*/ function displaying_MRIRvalues() { @@ -231,7 +204,6 @@ class MRIRcontroller extends BaseController $igr= $this->input->post("igrno"); $result=$this->mrir_model->get_IGRs($igr); - $obj = json_encode($result); echo $obj; } @@ -240,7 +212,6 @@ class MRIRcontroller extends BaseController function pageNotFound() { $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found'; - $this->loadViews("404", $this->global, NULL, NULL); } } diff --git a/application/controllers/employeedetails.php b/application/controllers/employeedetails.php index 4f21e960..0b7ee897 100755 --- a/application/controllers/employeedetails.php +++ b/application/controllers/employeedetails.php @@ -564,38 +564,40 @@ echo ""; $this->excel->getActiveSheet()->setCellValue('B5', 'FirstName-LastName'); $this->excel->getActiveSheet()->setCellValue('c5', 'FatherName'); $this->excel->getActiveSheet()->setCellValue('d5', 'Gender'); - $this->excel->getActiveSheet()->setCellValue('E5', 'ContactNumber'); - $this->excel->getActiveSheet()->setCellValue('F5', 'EmailId'); - $this->excel->getActiveSheet()->setCellValue('G5', 'BloodGroup'); - $this->excel->getActiveSheet()->setCellValue('H5', 'MartialStatus'); - $this->excel->getActiveSheet()->setCellValue('I5', 'DateofJoining'); - $this->excel->getActiveSheet()->setCellValue('J5', 'PreviousYearsOfExp'); - $this->excel->getActiveSheet()->setCellValue('K5', 'Designation'); - $this->excel->getActiveSheet()->setCellValue('L5', 'Departmentcode'); - $this->excel->getActiveSheet()->setCellValue('M5', 'PresentAddress'); - $this->excel->getActiveSheet()->setCellValue('N5', 'PermanentAddress'); - $this->excel->getActiveSheet()->setCellValue('O5', 'EmergencyContactName'); - $this->excel->getActiveSheet()->setCellValue('P5', 'EmergencyContactNumber'); - $this->excel->getActiveSheet()->setCellValue('Q5', 'Edu_Qualification'); - $this->excel->getActiveSheet()->setCellValue('R5', 'Additional_Qualification'); - $this->excel->getActiveSheet()->setCellValue('S5', 'AadharNo'); - $this->excel->getActiveSheet()->setCellValue('T5', 'PANNo'); - $this->excel->getActiveSheet()->setCellValue('U5', 'BankStatemant'); - $this->excel->getActiveSheet()->setCellValue('V5', 'PassportNo'); - $this->excel->getActiveSheet()->setCellValue('W5', 'Passport_Valid_till'); - $this->excel->getActiveSheet()->setCellValue('X5', 'IsActive'); - $this->excel->getActiveSheet()->setCellValue('Y5', 'Reference_Name'); - $this->excel->getActiveSheet()->setCellValue('Z5', 'Reference_ContactNumber'); - $this->excel->getActiveSheet()->setCellValue('AA5', 'PFNO'); - $this->excel->getActiveSheet()->setCellValue('AB5', 'ESI'); - $this->excel->getActiveSheet()->setCellValue('AC5', 'UANO'); - $this->excel->getActiveSheet()->setCellValue('AD5', 'Remarks'); - $this->excel->getActiveSheet()->setCellValue('AE5', 'Reference_Name'); + $this->excel->getActiveSheet()->setCellValue('E5', 'Date of Birth'); + $this->excel->getActiveSheet()->setCellValue('F5', 'ContactNumber'); + $this->excel->getActiveSheet()->setCellValue('G5', 'EmailId'); + $this->excel->getActiveSheet()->setCellValue('H5', 'BloodGroup'); + $this->excel->getActiveSheet()->setCellValue('I5', 'MartialStatus'); + $this->excel->getActiveSheet()->setCellValue('J5', 'DateofJoining'); + $this->excel->getActiveSheet()->setCellValue('K5', 'PreviousYearsOfExp'); + $this->excel->getActiveSheet()->setCellValue('L5', 'Designation'); + $this->excel->getActiveSheet()->setCellValue('M5', 'DepartmentName'); + $this->excel->getActiveSheet()->setCellValue('N5', 'PresentAddress'); + $this->excel->getActiveSheet()->setCellValue('O5', 'PermanentAddress'); + $this->excel->getActiveSheet()->setCellValue('P5', 'EmergencyContactName'); + $this->excel->getActiveSheet()->setCellValue('Q5', 'EmergencyContactNumber'); + $this->excel->getActiveSheet()->setCellValue('R5', 'Edu_Qualification'); + $this->excel->getActiveSheet()->setCellValue('S5', 'Additional_Qualification'); + $this->excel->getActiveSheet()->setCellValue('T5', 'AadharNo'); + $this->excel->getActiveSheet()->setCellValue('U5', 'PANNo'); + $this->excel->getActiveSheet()->setCellValue('V5', 'BankStatemant'); + $this->excel->getActiveSheet()->setCellValue('W5', 'PassportNo'); + $this->excel->getActiveSheet()->setCellValue('X5', 'Passport_Valid_till'); + $this->excel->getActiveSheet()->setCellValue('Y5', 'IsActive'); + $this->excel->getActiveSheet()->setCellValue('Z5', 'Reference_Name'); + $this->excel->getActiveSheet()->setCellValue('AA5', 'Reference_ContactNumber'); + $this->excel->getActiveSheet()->setCellValue('AB5', 'PFNO'); + $this->excel->getActiveSheet()->setCellValue('AC5', 'ESI'); + $this->excel->getActiveSheet()->setCellValue('AD5', 'UANO'); + $this->excel->getActiveSheet()->setCellValue('AE5', 'Remarks'); $this->excel->getActiveSheet()->setCellValue('AF5', 'Reference_Name'); - $this->excel->getActiveSheet()->setCellValue('AG5', 'CreatedBy'); - $this->excel->getActiveSheet()->setCellValue('AH5', 'UpdatedBY'); - $this->excel->getActiveSheet()->setCellValue('AI5', 'PF_Balance'); - $this->excel->getActiveSheet()->setCellValue('AJ5', 'PF_Bal_On'); + $this->excel->getActiveSheet()->setCellValue('AG5', 'Reference_Name'); + $this->excel->getActiveSheet()->setCellValue('AH5', 'CreatedBy'); + $this->excel->getActiveSheet()->setCellValue('AI5', 'UpdatedBY'); + $this->excel->getActiveSheet()->setCellValue('AJ5', 'PF_Balance'); + $this->excel->getActiveSheet()->setCellValue('AK5', 'PF_Bal_On'); + //$this->excel->getActiveSheet()->setCellValue('AK5', 'Date OF Birth'); @@ -681,6 +683,8 @@ echo ""; $this->excel->getActiveSheet()->getStyle('AI5')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('AJ5')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('AJ5')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('AK5')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('AK5')->getFont()->setBold(true); @@ -697,38 +701,39 @@ echo ""; $this->excel->getActiveSheet()->setCellValue('B'. $i,$data['FirstName'].'-'.$data['LastName']); $this->excel->getActiveSheet()->setCellValue('C'. $i,$data['FatherName']); $this->excel->getActiveSheet()->setCellValue('D'. $i,$data['Gender']); - $this->excel->getActiveSheet()->setCellValue('E'. $i,$data['ContactNumber']); - $this->excel->getActiveSheet()->setCellValue('F'. $i,$data['EmailId']); - $this->excel->getActiveSheet()->setCellValue('G'. $i,$data['BloodGroup']); - $this->excel->getActiveSheet()->setCellValue('H'. $i,$data['MartialStatus']); - $this->excel->getActiveSheet()->setCellValue('I'. $i,$data['DateofJoining']); - $this->excel->getActiveSheet()->setCellValue('J'. $i,$data['PreviousYearsOfExp']); - $this->excel->getActiveSheet()->setCellValue('K'. $i,$data['Designation']); - $this->excel->getActiveSheet()->setCellValue('L'. $i,$data['Departmentcode']); - $this->excel->getActiveSheet()->setCellValue('M'. $i,$data['PresentAddress']); - $this->excel->getActiveSheet()->setCellValue('N'. $i,$data['PermanentAddress']); - $this->excel->getActiveSheet()->setCellValue('O'. $i,$data['EmergencyContactName']); - $this->excel->getActiveSheet()->setCellValue('P'. $i,$data['EmergencyContactNumber']); - $this->excel->getActiveSheet()->setCellValue('Q'. $i,$data['Edu_Qualification']); - $this->excel->getActiveSheet()->setCellValue('R'. $i,$data['Additional_Qualification']); - $this->excel->getActiveSheet()->setCellValue('S'. $i,$data['AadharNo']); - $this->excel->getActiveSheet()->setCellValue('T'. $i,$data['PANNo']); - $this->excel->getActiveSheet()->setCellValue('U'. $i,$data['BankAccountNo'].'-'.$data['IFSCCode'].'-'.$data['BankBranchName'].$data['BankAddress']); - $this->excel->getActiveSheet()->setCellValue('V'. $i,$data['PassportNo']); - $this->excel->getActiveSheet()->setCellValue('W'. $i,$data['Passport_Valid_till']); - $this->excel->getActiveSheet()->setCellValue('X'. $i,$data['IsActive']); - $this->excel->getActiveSheet()->setCellValue('Y'. $i,$data['Reference_Name']); - $this->excel->getActiveSheet()->setCellValue('Z'. $i,$data['Reference_ContactNumber']); - $this->excel->getActiveSheet()->setCellValue('AA'. $i,$data['PFNO']); - $this->excel->getActiveSheet()->setCellValue('AB'. $i,$data['ESI']); - $this->excel->getActiveSheet()->setCellValue('AC'. $i,$data['UANO']); - $this->excel->getActiveSheet()->setCellValue('AD'. $i,$data['Remarks']); - $this->excel->getActiveSheet()->setCellValue('AE'. $i,$data['Reference_Name']); + $this->excel->getActiveSheet()->setCellValue('E'. $i,$data['DateofBirth']); + $this->excel->getActiveSheet()->setCellValue('F'. $i,$data['ContactNumber']); + $this->excel->getActiveSheet()->setCellValue('G'. $i,$data['EmailId']); + $this->excel->getActiveSheet()->setCellValue('H'. $i,$data['BloodGroup']); + $this->excel->getActiveSheet()->setCellValue('I'. $i,$data['MartialStatus']); + $this->excel->getActiveSheet()->setCellValue('J'. $i,$data['DateofJoining']); + $this->excel->getActiveSheet()->setCellValue('K'. $i,$data['PreviousYearsOfExp']); + $this->excel->getActiveSheet()->setCellValue('L'. $i,$data['Designation']); + $this->excel->getActiveSheet()->setCellValue('M'. $i,$data['DepartmentName']); + $this->excel->getActiveSheet()->setCellValue('N'. $i,$data['PresentAddress']); + $this->excel->getActiveSheet()->setCellValue('O'. $i,$data['PermanentAddress']); + $this->excel->getActiveSheet()->setCellValue('P'. $i,$data['EmergencyContactName']); + $this->excel->getActiveSheet()->setCellValue('Q'. $i,$data['EmergencyContactNumber']); + $this->excel->getActiveSheet()->setCellValue('R'. $i,$data['Edu_Qualification']); + $this->excel->getActiveSheet()->setCellValue('S'. $i,$data['Additional_Qualification']); + $this->excel->getActiveSheet()->setCellValue('T'. $i,$data['AadharNo']); + $this->excel->getActiveSheet()->setCellValue('U'. $i,$data['PANNo']); + $this->excel->getActiveSheet()->setCellValue('V'. $i,$data['BankAccountNo'].'-'.$data['IFSCCode'].'-'.$data['BankBranchName'].$data['BankAddress']); + $this->excel->getActiveSheet()->setCellValue('W'. $i,$data['PassportNo']); + $this->excel->getActiveSheet()->setCellValue('X'. $i,$data['Passport_Valid_till']); + $this->excel->getActiveSheet()->setCellValue('Y'. $i,$data['IsActive']); + $this->excel->getActiveSheet()->setCellValue('Z'. $i,$data['Reference_Name']); + $this->excel->getActiveSheet()->setCellValue('AA'. $i,$data['Reference_ContactNumber']); + $this->excel->getActiveSheet()->setCellValue('AB'. $i,$data['PFNO']); + $this->excel->getActiveSheet()->setCellValue('AC'. $i,$data['ESI']); + $this->excel->getActiveSheet()->setCellValue('AD'. $i,$data['UANO']); + $this->excel->getActiveSheet()->setCellValue('AE'. $i,$data['Remarks']); $this->excel->getActiveSheet()->setCellValue('AF'. $i,$data['Reference_Name']); - $this->excel->getActiveSheet()->setCellValue('AG'. $i,$data['firstname']); - $this->excel->getActiveSheet()->setCellValue('AH'. $i,$data['UpdatedBY']); - $this->excel->getActiveSheet()->setCellValue('AI'. $i,$data['PF_Balance']); - $this->excel->getActiveSheet()->setCellValue('AJ'. $i,$data['PF_Bal_On']); + $this->excel->getActiveSheet()->setCellValue('AG'. $i,$data['Reference_Name']); + $this->excel->getActiveSheet()->setCellValue('AH'. $i,$data['firstname']); + $this->excel->getActiveSheet()->setCellValue('AI'. $i,$data['UpdatedBY']); + $this->excel->getActiveSheet()->setCellValue('AJ'. $i,$data['PF_Balance']); + $this->excel->getActiveSheet()->setCellValue('AK'. $i,$data['PF_Bal_On']); diff --git a/application/models/mrir_model.php b/application/models/mrir_model.php index 40409428..d6d4f0c2 100755 --- a/application/models/mrir_model.php +++ b/application/models/mrir_model.php @@ -2,75 +2,141 @@ class mrir_model extends CI_Model { - /** - * This function is used to get the user listing count - * @param string $searchText : This is optional search text - * @return number $count : This is row count - */ - - function mrirListingCount() + /* This function is used to get the user listing count*/ + + /* This function is used to display the IGR in dropdown box*/ + 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(); + + } + + /* This function is used to get the igr value (button link)*/ + function get_IGR($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_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID'); + $this->db->join('T_MaterialMaster MM',' MM.MaterialCode=IGRD.MaterialCode'); + $this->db->join('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO and IGRD.MaterialCode = POLT.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(); + //print_r($this->db->last_query()); + return $result; + + } + + /* This function is used to list the MRIR value*/ + 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,TMD.UpdateBY,POM.PODate,POM.POType,POM.ReleasedBy,ED.FirstName as UpdatedbyName,ED1.FirstName as ReleasedbyName'); + $this->db->from ('T_MRIR_Master TMM'); + $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 user1','user1.userid = POM.ReleasedBy','left'); + $this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left'); + $this->db->order_by ('TMM.MRIRNO','asc'); + $query = $this->db->get(); + return $query->result(); + + } + + /* This function is used to get the MRIR value for edit*/ + function edit_mrir($MrirNo) { + $this->db->distinct(); + $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 as PORasiedbyName,ED1.FirstName as MRIRRasiedbyName, ED2.FirstName as IGRRasiedbyName'); + $this->db->from ('T_MRIR_Master TMM'); + $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO','left');//to get IGRNO,PONO,MRIRNO,mrirdate, + $this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO = TMM.IGRNO','left');//to get actualquantity,deliverydate,Invoicedate,vechileno,courierno,igrdate, + $this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO = POMR.PONO','left');//to get podate,deliverydate,servicedescription + $this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO','left');//to get receivedquantity,quantity + $this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO = IGRM.IGRNO','left');//to get invoicequantity + $this->db->join ('T_MaterialMaster MM','IGRD.MaterialCode = MM.MaterialCode','left'); + $this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID = SUPP.SupplierID','left');//to get suppliername,supplieraddress + $this->db->join ('tbl_users user','user.userid = POMR.CreatedBy','left');//to get poraisedby + $this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left'); + $this->db->join ('tbl_users user1','user1.userid=TMM.CreatedBy','left');//to get mrirraisedby + $this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left'); + $this->db->join ('tbl_users user2','user2.userid=IGRM.CreatedBy','left');//to get igrraisedby + $this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID','left'); + $this->db->where('TMM.MRIRNO',$MrirNo); + $query = $this->db->get(); + $result = $query->result(); + return $result; + + } + + /* This function is used to store the MRIR value in master table*/ + function master_mrir($mrirmastervalues) + { + - - $this->db->select('TMM.PONO,TMM.IGRNO,TMD.*,IGRM.DeliveryChellanOrInvoiceNo,IGRM.VehicleNo,IGRD.*,SUPP.SupplierName,SUPP.Address,POMR.DeliveryDate,MM.MaterialCode,MM.MaterialName,MM.UOM,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_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'); - $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_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID','left'); - $this->db->group_by('TMD.MRIRNO'); - $query = $this->db->get(); - - return $query->result(); - - } - - - - function mrirListing($mrir) - { - - $this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,TMD.*,IGRM.DeliveryChellanOrInvoiceNo,IGRM.VehicleNo,IGRD.*,SUPP.SupplierName,SUPP.Address,POMR.DeliveryDate,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_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'); - $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_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID','left'); - $this->db->group_by('TMD.MRIRNO',$mrir); + $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(); + } - $query = $this->db->get(); - $result=$query->result(); - return $result; - } + } - function get_IGRdatas() + /* This function is used to store the MRIR value in detail table*/ + function detail_mrir($mrirdetailvalues) + { + + $this->db->insert('T_MRIR_Details',$mrirdetailvalues); + $insert_id = $this->db->affected_rows(); + + return $insert_id; + + } + + + /* This function is used to update the value in MRIR master table*/ + function update_mrirmaster($updatemastervalues,$mrir_no) { - $this->db->select('IGRM.*,IGRD.*,SUPP.SupplierName,SUPP.Address,TMM.PONO,TMD.*,MM.MaterialCode,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity'); - $this->db->from ('T_IGR_Master IGRM'); - $this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO','left'); - $this->db->join ('T_MRIR_Master TMM' ,'TMM.IGRNO=IGRM.IGRNO'); - $this->db->join ('T_MRIR_Details TMD','TMD.MRIRNO=TMM.MRIRNO'); - //$this->db->join ('T_MRIRNO'); - $this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO= IGRM.IGRNO','left'); - $this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO','left'); - $this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID','left'); - $this->db->join ('T_MaterialMaster MM',' MM.MaterialCode=TMD.MaterialCode','left'); - //$this->db->where('IGRM.IGRNO '); - $query = $this->db->get(); - $result = $query->result(); - //print_r($result); - - return $result; + $this->db->where('MRIRNO', $mrir_no); + $this->db->update('T_MRIR_Master', $updatemastervalues); + $affectedRows = $this->db->affected_rows(); - } + return $affectedRows; + + } - /* to get the value for modal in MRIR we using this function */ + + /* This function is used to update the value in MRIR detail table*/ + function update_mrirdetail($updatedetailvalues,$mrir_no) + { + $this->db->where('MRIRNO',$mrir_no); + $this->db->update('T_MRIR_Details',$updatedetailvalues); + $affectedRows = $this->db->affected_rows(); + + return $affectedRows; + } + + + /* This function is used to get the value for modal in view MRIR page */ 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'); @@ -94,166 +160,28 @@ class mrir_model extends CI_Model //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,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'); - $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; - } - - - function master_mrir($mrirmastervalues) - { - - - $this->db->insert('T_MRIR_Master', $mrirmastervalues); - $insert_id = $this->db->affected_rows(); - - if($insert_id>0) + function get_IGRdatas() { - $subQuery = 'select max(MRIRNO) as MRIRNo from T_MRIR_Master'; - $query = $this->db->query($subQuery); - return $query->result();//_array(); - } + $this->db->select('IGRM.*,IGRD.*,SUPP.SupplierName,SUPP.Address,TMM.PONO,TMD.*,MM.MaterialCode,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity'); + $this->db->from ('T_IGR_Master IGRM'); + $this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO','left'); + $this->db->join ('T_MRIR_Master TMM' ,'TMM.IGRNO=IGRM.IGRNO'); + $this->db->join ('T_MRIR_Details TMD','TMD.MRIRNO=TMM.MRIRNO'); + //$this->db->join ('T_MRIRNO'); + $this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO= IGRM.IGRNO','left'); + $this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO','left'); + $this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID','left'); + $this->db->join ('T_MaterialMaster MM',' MM.MaterialCode=TMD.MaterialCode','left'); + //$this->db->where('IGRM.IGRNO '); + $query = $this->db->get(); + $result = $query->result(); + //print_r($result); + + return $result; - } - - function detail_mrir($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); - $this->db->insert('T_MRIR_Details', $mrirvalue2); - $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); - return $insert_id; - - } + } + } - - 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 index f014eecf..a034caaa 100755 --- a/application/views/Editmaterialinspectionreport.php +++ b/application/views/Editmaterialinspectionreport.php @@ -1,8 +1,10 @@ CreatedDate; $mrir_date = strtotime( $MRIRDate ); $mrirdate = date( 'd/m/Y', $mrir_date ); + $MRIRRasiedbyName=$MRIR->MRIRRasiedbyName; $IGRNO = $MRIR->IGRNO; $IGRDate = $MRIR->Createdon; $igr_date = strtotime( $IGRDate ); $igrdate = date( 'd/m/Y', $igr_date ); + $IGRRasiedbyName=$MRIR->IGRRasiedbyName; $PONO = $MRIR->PONO; $PODate=$MRIR->PODate; - $PORasiedbyName=$MRIR->FirstName; + $PORasiedbyName=$MRIR->PORasiedbyName; $po_date = strtotime( $PODate ); $podate = date( 'd/m/Y', $po_date ); $VehicleNo = $MRIR->VehicleNo; @@ -87,12 +91,13 @@ if(!empty($MRIRDetails)) $attributes = array('class' => 'form-label-left MRIR ','name' => 'MRIR','id' => 'MRIR'); echo form_open($this->config->base_url().'/MRIRcontroller/generateMRIR/',$attributes); ?> -

+

+
- +
'MRIRNO','value' => set_value('MRIRNO',$MRIRNO),'id'=>'MRIRNO', 'class' => 'form-control' ,'readonly' => 'true'); @@ -102,7 +107,7 @@ if(!empty($MRIRDetails))
- +
'MRIRDate','value' => set_value('MRIRDate',$mrirdate),'id'=>'MRIRDate', 'class' => 'form-control' ,'readonly' => 'true'); @@ -111,10 +116,20 @@ if(!empty($MRIRDetails))
+
+ +
+ 'MRIRRaisedby','value' => set_value('MRIRRaisedby',$MRIRRasiedbyName),'id'=>'MRIRDate', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> + +
+
- +
'IGRNO','value' => set_value('IGRNO',$IGRNO),'id'=>'IGRNO', 'class' => 'form-control' ,'readonly' => 'true'); @@ -124,7 +139,7 @@ if(!empty($MRIRDetails))
- +
'IGRDate','value' => set_value('IGRDate',$igrdate),'id'=>'IGRDate', 'class' => 'form-control' ,'readonly' => 'true'); @@ -133,6 +148,17 @@ if(!empty($MRIRDetails))
+ +
+ +
+ 'IGRRaisedBy','value' => set_value('IGRRaisedBy',$PORasiedbyName),'id'=>'IGRRaisedBy', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> + +
+
@@ -156,7 +182,7 @@ if(!empty($MRIRDetails))
- +
'PORasiedbyName','value' => set_value('PORasiedbyName',$PORasiedbyName),'id'=>'PORasiedbyName', 'class' => 'form-control' ,'readonly' => 'true'); @@ -239,11 +265,11 @@ if(!empty($MRIRDetails))
- +
'Address','value' => set_value('Address',$Address),'id'=>'Address', 'class' => 'form-control' ,'readonly' => 'true' , 'rows'=>'4' ,'columns'=> '3'); + $data = array('name' => 'ServiceDescription','value' => set_value('ServiceDescription',$ServiceDescription),'id'=>'ServiceDescription', 'class' => 'form-control' ,'readonly' => 'true' , 'rows'=>'4' ,'columns'=> '3'); echo Form_textarea($data); ?>
@@ -291,14 +317,14 @@ if(!empty($MRIRDetails)) QuantityAsPerInvoice?> ActualQuantityReceived ?> - - - - - - + + + + + + - + function updatemrir() { + //$('#content').loader('show'); //alert("update function worked "); $.ajax({ data:$('.MRIR').serialize(), type:"POST", - url:"MRIRcontroller/updated_values", + url:"MRIRcontroller/updated_db", + success:function(data){ //alert("success function worked "); if(data){ + //$('#content').loader('hide'); //alert("if function") //alert(data); - alert("value updated"); + alert(data); } else { diff --git a/application/views/materialinspectionreport.php b/application/views/materialinspectionreport.php index 804844df..29402cf2 100755 --- a/application/views/materialinspectionreport.php +++ b/application/views/materialinspectionreport.php @@ -80,9 +80,10 @@ if(!empty($IGRDetails)) 'form-label-left MRIR ','name' => 'MRIR','id' => 'MRIR'); - echo form_open($this->config->base_url().'/MRIRscreen/generateMRIR/',$attributes); ?> + echo form_open($this->config->base_url().'/MRIRcontroller/generateMRIR/',$attributes); ?>
-

+

+
@@ -316,7 +317,7 @@ function setactual(rowId) function setremark(rowId) { var remark = ($('#Remark'+rowId).val()); - alert(remark); + //alert(remark); } @@ -324,20 +325,21 @@ function setremark(rowId) -Add Comment \ No newline at end of file + \ No newline at end of file diff --git a/application/views/viewmaterialinspectionreport.php b/application/views/viewmaterialinspectionreport.php index ed8429c1..ef2b67c2 100755 --- a/application/views/viewmaterialinspectionreport.php +++ b/application/views/viewmaterialinspectionreport.php @@ -1,12 +1,4 @@ -MRIRNO; -?> - - -