From ad33ca1aac7c87a922ee8029eb155601bfd65cd5 Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Tue, 10 Apr 2018 14:36:37 +0530 Subject: [PATCH] PONO reset in finance year added --- application/config/routes.php | 4 + application/controllers/purchaseorder.php | 95 +++++++++++ application/models/purchaseorder_model.php | 53 +++++- application/views/includes/header.php | 13 +- application/views/poresetview.php | 187 +++++++++++++++++++++ 5 files changed, 345 insertions(+), 7 deletions(-) create mode 100644 application/views/poresetview.php diff --git a/application/config/routes.php b/application/config/routes.php index 64796a1f..990e1e37 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -321,3 +321,7 @@ $route['ncrlist'] = "purchaseorder/Nonconfirmativelist"; $route['DeliveryPerformance']="user/deliver_perform"; + +//this function ues to ponoreset values + +$route['poresetview']="purchaseorder/poresetview"; diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 816fa144..660399b4 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -27,6 +27,101 @@ class purchaseorder extends BaseController $this->isLoggedIn(); } + + + // start this function used to pono reset financeyear configuration + + +function poresetview() + { + $this->global['pageTitle'] = 'Siddharth : PurchaseOrderNumber/FinanceYear-Configuration '; + + + $data['ponoreset']=$this->purchaseorder_model->ponoresetfinyear(); + + + $this->loadViews("poresetview", $this->global,$data,Null); + + } + + + function addnew() +{ + + + + $pono1 = $this->input->post('pono'); + //echo $pono; + $potype1= $this->input->post('potype'); + //echo $potype; + $posubtype1 = $this->input->post('posubtype'); + //echo $posubtype; + //die; + + + + + + $ponoreset = array('pono'=>$pono1, + 'potype'=>$potype1, + 'posubtype'=>$posubtype1); + + $result = $this->purchaseorder_model->ponoreset($ponoreset); + if( $result >= 0){ + + + + echo ""; + + redirect('purchaseorder/poresetview','refresh'); + + } + + + + +} + +function edited(){ + + $sno=$this->input->post('sno'); + //echo $sno; + + $pono = $this->input->post('pono'); + //echo $pono; + + $potype= $this->input->post('potype'); + // echo $potype; + $posubtype = $this->input->post('posubtype'); + //echo $posubtype; + //die(); + + $ponoreset = array('pono'=>$pono, + 'potype'=>$potype, + 'posubtype'=>$posubtype); + //print_r($ponoreset); die(); + + $result = $this->purchaseorder_model->updateponoreset($ponoreset,$sno,$potype,$posubtype); + if( $result >= 0) + { + + echo "Updated Successfully Saved"; + + redirect('purchaseorder/poresetview','refresh'); + + } + +} + + + + + +//end this function used to pono reset financeyear configuration + /** * This function used to load the first screen of the user */ diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index bc53cf1c..8952adcc 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -22,6 +22,41 @@ class purchaseorder_model extends CI_Model } + /////////////////// start this function used to pono reset financeyear configuration + + function ponoreset($ponoreset) + { + + //print_r($ponoreset); die; + $this->db->insert('T_PONO_Reset_Table',$ponoreset); + + $r = $this->db->affected_rows(); + return $r; + } + + + function updateponoreset($ponoreset,$sno,$potype,$posubtype) +{ + + + $this->db->where('reset_pono_id',$sno,'POType',$potype,'POSubtype',$posubtype); + $this->db->update('T_PONO_Reset_Table',$ponoreset); + $r = $this->db->affected_rows(); + return $r; + +} + + function ponoresetfinyear() + { + $this->db->select('*'); + $this->db->from('T_PONO_Reset_Table'); + $query =$this->db->get(); + return $query->result(); + } + ///////////////////end this function used to pono reset financeyear configuration + + + function fileupload($myfile) { @@ -556,22 +591,28 @@ function GetPOType($ReqNo) * This function is used to add New Purchase order to the system */ - function addPOMaster($POMaster,$POType,$POSubtype) + function addPOMaster($POMaster,$POType,$POSubtype) { $this->db->trans_start(); - $this->db->insert('T_PurchaseOrder_Master', $POMaster); + $this->db->insert('T_PurchaseOrder_Master', $POMaster); + //$this->db->update('T_PONO_Reset_Table') + $insert_id = $this->db->affected_rows(); $this->db->trans_complete(); // print_r($this->db->last_query()); if($insert_id>0) { - //$subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where POType=? and POSubType=?'; - $subQuery = 'select PONO from T_PurchaseOrder_Master where POType=? and POSubType=? and isnull(ParentPO) order by CreatedDate desc limit 1'; + $subQuery = 'select PONO from T_PurchaseOrder_Master where POType=? and POSubType=? and isnull(ParentPO) order by CreatedDate desc limit 1 '; + $query = $this->db->query($subQuery,array($POType,$POSubtype)); - + + //print_r($query->result());die(); return $query->result_array(); } } + + + function addAmendPOMaster($POMaster,$CreatedBy,$ParentPO) @@ -584,7 +625,7 @@ function GetPOType($ReqNo) // print_r($this->db->last_query()); if($insert_id>0) { - $subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=?'; + $subQuery = 'select PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=? order by CreatedDate desc limit 1'; $query = $this->db->query($subQuery,array($CreatedBy,$ParentPO)); diff --git a/application/views/includes/header.php b/application/views/includes/header.php index cd1c9e44..d457df77 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -689,7 +689,12 @@ $(function() { Company Master - +
  • + + + PurchaseOrderNumberReset + +
  • @@ -868,6 +873,12 @@ $(function() { Users
  • +
  • + + + PurchaseOrderNumberReset + +
  • diff --git a/application/views/poresetview.php b/application/views/poresetview.php new file mode 100644 index 00000000..1aea8bc1 --- /dev/null +++ b/application/views/poresetview.php @@ -0,0 +1,187 @@ + + + + + +
    + +
    +

    +
    Siddharth Industries - PurchaseOrderNumber/FinanceYear-Configuration
    +

    +
    +
    +
    +
    + + +
    +
    +
    + + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + $ps){ + //print_r($key); + ?> + + + + + + + + + + + + + + + + +
    SNoPONOPOTypePOSubTypeAction
    PONO ?>POType ?>POSubType ?>
    + +
    +

     

    +
    + + + + +
    +
    + + + + + + + + + + \ No newline at end of file