From f7023852d4912b49b30c574b37d867a262fcbe7c Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Wed, 5 Jul 2017 18:27:10 +0530 Subject: [PATCH] I Update MIMR add screen --- application/controllers/MRIRcontroller.php | 183 +++++ application/models/mrir_model.php | 185 +++++ application/views/includes/header.php | 4 +- .../views/materialinspectionreport.php | 704 +++++++++--------- .../views/viewmaterialinspectionreport.php | 401 ++++++++++ 5 files changed, 1122 insertions(+), 355 deletions(-) create mode 100644 application/controllers/MRIRcontroller.php create mode 100644 application/models/mrir_model.php mode change 100755 => 100644 application/views/materialinspectionreport.php create mode 100644 application/views/viewmaterialinspectionreport.php diff --git a/application/controllers/MRIRcontroller.php b/application/controllers/MRIRcontroller.php new file mode 100644 index 00000000..000b6880 --- /dev/null +++ b/application/controllers/MRIRcontroller.php @@ -0,0 +1,183 @@ +load->model('mrir_model'); + $this->load->library('session'); + $this->load->library('form_validation'); + $this->isLoggedIn(); + } + /** + * This function used to load the first screen of the user + */ + // public function index() + // { + // $this->global['pageTitle'] = 'Siddharth : Material Inspetion Report'; + // + // $this->loadViews("materialinspectionreport", $this->global, NULL , NULL); + // } + + + + + function materialinspectionreport($mrir='',$IGRNO='') + { + $this->global['pageTitle'] = 'Siddharth : Material Inspection Report'; + + $this->load->model('mrir_model'); + + $data['IGRNOonly'] = $this->mrir_model->getIGRNOonly(); + + $this->loadViews("materialinspectionreport", $this->global,$data,NULL); + + } + /*FOR Displaying IGR Values in Materialinspection.php(view file) */ + function igrdatavalues() + { + + $IgrNo= $_GET['IGRNO']; + + print_r($IgrNo); + + $data['IGRDetails'] = $this->mrir_model->get_IGRs($IgrNo); + + $this->global['pageTitle'] = 'Siddharth : IGR Details '; + + $this->loadViews("materialinspectionreport", $this->global, $data,NULL); + + + } + + /* FOR Edit MRIR Screen */ + function editmaterialinspectionreport() + { + $this->global['pageTitle'] = 'Siddharth : Edit Material Inspection Report'; + + $this->load->model('mrir_model'); + + $data['IGRNOonly'] = $this->mrir_model->getIGRNOonly(); + + $this->loadViews("Editmaterialinspectionreport", $this->global,$data,NULL); + + } + + + /* For View MRIR Screen*/ + function viewmaterialinspectionreport() + + { + + $this->load->model('mrir_model'); + + $data['mrirdatas2'] = $this->mrir_model-> view_MRIR(); + + $this->global['pageTitle'] = 'Siddharth : View Material Inspection Report'; + //print_r( $data); + $this->loadViews("viewmaterialinspectionreport", $this->global,$data,NULL); + + } + + /* For Values are Stored in DB */ + function 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'); + + + //this array to store the value in master table.. + $mrirmastervalues = array('IGRNO'=>$igrno,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt); + + $mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues); + + + $MRIRNO = ''; + + + if(count($mrirmaster)>0) + + { + foreach ($mrirmaster as $key ) { + + $MRIRNO=$key->MRIRNo; } + } + + + 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); + $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); + //print_r($mrirvalues2); + //die(); + $mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues); + + } + echo "successfully created : ".$MRIRNO; + + + } + + + function displaying_MRIRvalues() + { + $mrir = $this->input->post("mrirno"); + $result=$this->mrir_model->get_MRIRs($mrir); + $obj=json_encode($result); + echo $obj; + + } + + + function displaying_IGRvalues() + { + + $igr= $this->input->post("igrno"); + $result=$this->mrir_model->get_IGRs($igr); + + $obj = json_encode($result); + echo $obj; + } + + + function pageNotFound() + { + $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found'; + + $this->loadViews("404", $this->global, NULL, NULL); + } +} + +?> \ No newline at end of file diff --git a/application/models/mrir_model.php b/application/models/mrir_model.php new file mode 100644 index 00000000..da9c0a9c --- /dev/null +++ b/application/models/mrir_model.php @@ -0,0 +1,185 @@ +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); + + $query = $this->db->get(); + $result=$query->result(); + return $result; + } + + function get_IGRdatas() + { + $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 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_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->where('TMD.MRIRNO',$mrir); + //$this->db->order_by('TMD.MRIRNO','asc'); + + + // $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; + + + } + + 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->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(); + + } + + + function master_mrir($mrirmastervalues) + { + + + $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 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 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(){ + $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/includes/header.php b/application/views/includes/header.php index 4e09c7f4..59352ba3 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -485,13 +485,13 @@ { ?>
  • - + Material Inspection Report Entry
  • - + View Material Inspection Report diff --git a/application/views/materialinspectionreport.php b/application/views/materialinspectionreport.php old mode 100755 new mode 100644 index 68c6602d..5e2cbc0e --- a/application/views/materialinspectionreport.php +++ b/application/views/materialinspectionreport.php @@ -1,353 +1,351 @@ - - - -
    - -
    -

    -
    Siddharth Industries - Material Receipt And Inspection Report
    -

    -
    -

    -
    -
    -
    - -
    - 'Inward Gate Register Number'); - - - echo form_dropdown('IGRNO', $options,set_value('IGRNO'),'id="IGRNO"' ,'class="form-control select2"' , 'required="true"' ); - - ?> -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    S.NOIGR NoPO NOItem CodeMaterialOrdered QuantityReceived QuantityAccepted QuantityRejected QuantityRemarks
    1IGR0001PO0034Sand12wast sand1000kgs1000kgs950kgs50kgsDamage In Bags
    2IGR0002PO0035Sand12wast sand1000kgs1000kgs1000kgs0No remarks
    -
    -
    -
    - - - - - - \ No newline at end of file +IGRNO; + $PONO = $IGR->PONO; + $VehicleNo = $IGR->VehicleNo; + $CourierNo= $IGR->CourierNo; + $DeliveryChellanOrInvoiceNo=$IGR->DeliveryChellanOrInvoiceNo; + $SupplierName=$IGR->SupplierName; + $DeliveryChellanDate=$IGR->DeliveryChellanDate; + $dc_date = strtotime( $DeliveryChellanDate ); + $dcdate = date( 'd/m/Y', $dc_date ); + $Address=$IGR->Address; + $CreatedBy=$IGR->CreatedBy; + $PODate=$IGR->PODate; + $po_date = strtotime( $PODate ); + $podate = date( 'd/m/Y', $po_date ); + $IGRDate=$IGR->CreatedDate; + $igr_date = strtotime( $IGRDate ); + $igrdate = date( 'd/m/Y', $igr_date ); + $ServiceDescription=$IGR->ServiceDescription; + + + + } +} + ?> + + + +
    + +
    +

    +
    Siddharth Industries - Material Receipt And Inspection Report (MRIR)
    +

    + + 'form-label-left MRIR ','name' => 'MRIR','id' => 'MRIR'); + echo form_open($this->config->base_url().'/MRIRscreen/generateMRIR/',$attributes); ?> +
    +

    +
    +
    +
    +
    + +
    + 'IGRNO','value' => set_value('IGRNO',$IGRNO),'id'=>'IGRNO', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> + +
    +
    +
    + +
    + 'IGRDate','value' => set_value('IGRDate',$igrdate),'id'=>'IGRDate', 'class' => 'form-control num' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    + +
    +
    + +
    + 'SupplierName','value' => set_value('SupplierName',$SupplierName),'id'=>'SupplierName', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    +
    +
    +
    +
    + + +
    'PONO','value' => set_value('PONO',$PONO),'id'=>'PONO', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    +
    +
    + +
    + 'PODate','value' => set_value('PODate',$podate),'id'=>'PODate', 'class' => 'form-control num' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    +
    +
    + +
    'CreatedBy','value' => set_value('CreatedBy',$CreatedBy),'id'=>'CreatedBy', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    +
    + +
    +
    +
    + +
    + 'DeliveryChellanOrInvoiceNo','value' => set_value('DeliveryChellanOrInvoiceNo',$DeliveryChellanOrInvoiceNo),'id'=>'DeliveryChellanOrInvoiceNo', 'class' => 'form-control num' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    +
    +
    + +
    'date','name' => 'DeliveryChellanDate','value' => set_value('DeliveryChellanDate',$dcdate),'id'=>'DeliveryChellanDate', 'class' => 'form-control num','readonly' => 'true'); + echo form_input($data); + ?> +
    +
    +
    + + + 'StoreIncharge','value' => set_value('StoreInchargeID',$name),'id'=>'StoreIncharge', 'class' => 'form-control' ,'readonly' => 'true'); + echo form_input($data); + + ?> +
    +
    +
    +
    + +
    + 'VehicleNo','value' => set_value('VehicleNo',$VehicleNo),'id'=>'VehicleNo', 'class' => 'form-control num', 'required'=>'true' ,'readonly' => 'true','align' => 'left'); + echo form_input($data); + ?> +
    +
    +
    + +
    'CourierNo','value' => set_value('CourierNo',$CourierNo),'id'=>'CourierNo', 'class' => 'form-control num', 'required'=>'true' ,'readonly' => 'true'); + echo form_input($data); + ?> +
    +
    + +
    +
    +
    +
    + +
    + 'Address','value' => set_value('Address',$Address),'id'=>'Address', 'class' => 'form-control' ,'readonly' => 'true' , 'rows'=>'4' ,'columns'=> '3'); + echo Form_textarea($data); + ?> +
    +
    +
    + +
    + 'ServiceDescription','value' => set_value('ServiceDescription',$ServiceDescription),'id'=>'ServiceDescription', 'class' => 'form-control' ,'readonly' => 'true' , 'rows'=>'4' ,'columns'=> '3'); + echo Form_textarea($data); + ?> +
    +
    + +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    S.NOItem CodeMaterialUOMOrdered QuantityAdviced Quantity as per the ChallanActual Quantity ReceivedRemarks
    MaterialCode?>MaterialName?>UOM?>Quantity?>QuantityAsPerInvoice?>
    + + +
    +
    + +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/application/views/viewmaterialinspectionreport.php b/application/views/viewmaterialinspectionreport.php new file mode 100644 index 00000000..d8da8b6b --- /dev/null +++ b/application/views/viewmaterialinspectionreport.php @@ -0,0 +1,401 @@ + + + + +
    + +
    +

    +
    Siddharth Industries - View Material Receipt And Inspection Report
    +

    +
    +

    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    S.NOMRIR NOIGR NOPO NOInvoice NOInvoice DateVechicle NO / Courier NOStore InchargeQuality InchargePlant Incharge
    MRIRNO ?> IGRNO ?>PONO ?>DeliveryChellanOrInvoiceNo ?>DeliveryChellanDate); + echo $date->format('d/m/Y'); ?>VehicleNo ?>StoreInchargeID ?>
    +
    +
    +
    +
    + +
    + + + + + +