From 23c8d32edc8cef7f5641b3808d51b06ea08c317e Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Mon, 14 May 2018 23:20:11 +0530 Subject: [PATCH] poedit --- .../controllers/emergencypurchaseorder.php | 50 +- application/controllers/purchaseorder.php | 241 +- .../controllers/servicepurchaseorder.php | 99 +- application/models/purchaseorder_model.php | 194 +- .../views/EditservicePurchaseorder.php | 222 +- application/views/editCapitalPo.php | 3743 +++++++++-------- .../views/editRevenuepurchaseorder.php | 291 +- application/views/editimportpo.php | 153 +- 8 files changed, 3052 insertions(+), 1941 deletions(-) diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index 64b06007..27faf75d 100755 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -376,6 +376,14 @@ function addfile1() $LineItemNo = $POLineItem[0]['LineItemNo']; } + /*----------------------------*/ + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + $this->purchaseorder_model->newlogpo($logpo); + + + + /*----------------------------*/ + if(trim($POType) == SERVICE ) { @@ -609,7 +617,17 @@ $RequestedBy = $this->input->post('drpDepartment'); { $LineItemNo = $POLineItem[0]['LineItemNo']; } - //echo $LineItemNo; + //echo $LineItemNo; + + /*----------------------------*/ + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + + $logaddpo = $this->purchaseorder_model->newlogpo($logpo); + + + + /*----------------------------*/ + if(trim($POType) == REVENUE ) { @@ -1311,7 +1329,11 @@ $RequestedBy = $this->input->post('drpDepartment'); $LineItemNo = $POLineItem[0]['LineItemNo']; } //echo $LineItemNo; + /*--------------*/ + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$Rate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + $addlog= $this->purchaseorder_model->newlogpo($logpo); + /*--------------*/ if(trim($POType) == REVENUE ) { // echo 'Success'; @@ -1333,6 +1355,13 @@ $RequestedBy = $this->input->post('drpDepartment'); $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); + + +/*-----------------------------------*/ + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); +/*-----------------------------------*/ $DeliveryAddr = $this->input->post('txtDeliveryAddress'); $dt = $this->input->post('Deliverydt'); $Deliverydt = $this->getDateformat($dt); @@ -1369,6 +1398,10 @@ $RequestedBy = $this->input->post('drpDepartment'); $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); + /*-----------------------------------*/ + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); +/*-----------------------------------*/ $DiscountType = $this->input->post('DisType'.$i); $DiscountValue = $this->input->post('DisVal'.$i); @@ -1400,6 +1433,21 @@ $RequestedBy = $this->input->post('drpDepartment'); $LineItemNo = ''; + /*---------start---------------------*/ + + if(($PODate != $b4podate )||( $SupplierID != $b4supplier) || ($itemRate !=$b4rate) || + ($Quantity != $b4qty )) + { + $logpo =array('UpdateBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updatelogpo($MaterialCode,$POLineItemNo,$logpo); + } + + + /*----------end--------------------*/ + + $SkipInsert = "False"; if( count($comma_separated) > 0) { diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 15e2911d..17c30fb2 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -529,7 +529,9 @@ function edited(){ $data['getdata'] = $this->purchaseorder_model->getfunction($PONO); //s print_r($data['getdata']); - + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); + + $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); //$data['WorkStatus']=$this->purchaseorder_model->GetWorkStatus('C019'); @@ -542,6 +544,9 @@ function edited(){ $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetails($PONO); $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); $this->global['pageTitle'] = 'Siddharth : Edit Revenue Purchase order form'; $this->loadViews("editRevenuepurchaseorder", $this->global, $data, NULL); @@ -567,6 +572,7 @@ function edited(){ // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; $data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); //print_r($data['PaymentTerms']); $unicode =''; @@ -606,7 +612,7 @@ function edited(){ } $data['requestedBy'] = $this->purchaseorder_model->GetRequesedByDetails($PONO); - + $data['getlogpodtl']=$this->purchaseorder_model->getlogpodtl($PONO); //$CapitalRange=''; foreach($data['POItem'] as $Rate) { @@ -1158,7 +1164,11 @@ function edited(){ $LineItemNo = $POLineItem[0]['LineItemNo']; } //echo $LineItemNo; - +/*---------*/ + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$Rate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + + $addlog= $this->purchaseorder_model->newlogpo($logpo); +/*---------*/ if(trim($POType) == REVENUE ) { // echo 'Success'; @@ -1194,9 +1204,11 @@ function edited(){ $Deliverydt = $this->getDateformat($dt); $DeliverySchedule = ''; } - - - +/*-----------------------------------*/ + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); +/*-----------------------------------*/ $Modeofshipment=$this->input->post('editmodeofshipment'); $supplierreference=$this->input->post('editsupplierreference'); $supplieroffno=$this->input->post('editsupplierofferno'); @@ -1252,6 +1264,10 @@ function edited(){ $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); +/*-----------------------------------*/ + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); +/*-----------------------------------*/ $itemRate = $this->input->post('itemRate'.$i); $per=$this->input->post('per'.$i); $DiscountType = $this->input->post('DisType'.$i); @@ -1277,8 +1293,19 @@ function edited(){ $CostCenter = $this->input->post('costCode'.$i); $LineItemNo = ''; + /*---------start---------------------*/ - + if(($PODate != $b4podate )||( $SupplierID != $b4supplier) || ($itemRate !=$b4rate) || + ($Quantity != $b4qty )) + { + $logpo =array('UpdateBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updatelogpo($MaterialCode,$POLineItemNo,$logpo); + } + + + /*----------end--------------------*/ $SkipInsert = "False"; if( count($comma_separated) > 0) @@ -1296,17 +1323,64 @@ function edited(){ } } - /*------------------------------*/ + /*-------------start-----------------*/ //if($MaterialCode!= ''){ - $ReqDetails = array( 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); //print_r($ReqDetails); - $this->purchaseorder_model->updateReqDetails($Reqnumber,$ReqDetails); + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); // } - /*------------------------------*/ + + + + + $recqty=0; + + if($POStatus == SPECIAL_PO) + { + + $recqty= $Quantity; + + } + + + $IGRD= $this->purchaseorder_model->IGRDetailsupdate($PONO); + + $IGRItem=0; + $IGRNO=0; + + foreach($IGRD as $value) + { + + + $IGRItemNo=$value['IGRItemNo']; + $IGRNO= $value['IGRNO']; + + } + + + // print_r($IGRD); die; + $IGRDs = array('QuantityAsPerInvoice'=>$Quantity,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt); + + //print_r($IGRDs);die; + $this->purchaseorder_model->updateIGR($IGRItemNo,$IGRNO,$MaterialCode,$IGRDs); + + + + + + + + + //print_r($data['IGRDetails']); + + /*-----------end-------------------*/ + + + @@ -1330,6 +1404,8 @@ function edited(){ $LineItemNo = $POLineItemNo; $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); + + //print_r($POLineItemList); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); @@ -1987,7 +2063,13 @@ function addNewImportPurchaseOrder() { $LineItemNo = $POLineItem[0]['LineItemNo']; } - //echo $LineItemNo; + //echo $LineItemNo; + + /* --------------------------------------------*/ + + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=> $itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + $this->purchaseorder_model->newlogpo($logpo); + /* --------------------------------------------*/ if(trim($POType) == IMPORT ) { @@ -2003,7 +2085,9 @@ function addNewImportPurchaseOrder() } } - } + } + + echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; } @@ -2019,6 +2103,12 @@ function addNewImportPurchaseOrder() $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); + + /*-----------------------------------*/ + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); +/*-----------------------------------*/ $DeliveryAddr = $this->input->post('DeliveryAddr'); $dt = $this->input->post('Deliverydt'); $Deliverydt = $this->getDateformat($dt); @@ -2131,7 +2221,10 @@ function addNewImportPurchaseOrder() //echo $Quantity; $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); - ; + /*-----------------------------------*/ + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); +/*-----------------------------------*/ //die(); //$Exchangerate = $this->input->post('Exchangerate'.$i); @@ -2217,6 +2310,20 @@ function addNewImportPurchaseOrder() // echo $per; //die(); $LineItemNo = ''; + + /*---------start---------------------*/ + + if(($PODate != $b4podate )||( $SupplierID != $b4supplier) || ($itemRate !=$b4rate) || + ($Quantity != $b4qty )) + { + $logpo =array('UpdateBy'=>$CreateBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updatelogpo($MaterialCode,$POLineItemNo,$logpo); + } + + + /*----------end--------------------*/ //echo "sdsfsd"; //die(); @@ -2239,13 +2346,10 @@ function addNewImportPurchaseOrder() /*------------------------------*/ - //if($MaterialCode!= ''){ - - $ReqDetails = array( 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt); //print_r($ReqDetails); - $this->purchaseorder_model->updateReqDetails($Reqnumber,$ReqDetails); - // } + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); /*------------------------------*/ @@ -2309,7 +2413,7 @@ function addNewImportPurchaseOrder() } - + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } @@ -2629,7 +2733,11 @@ function addNewImportPurchaseOrder() $LineItemNo = $POLineItem[0]['LineItemNo']; } - + /* --------------------------------------------*/ + + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=> $itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + $this->purchaseorder_model->newlogpo($logpo); + /* --------------------------------------------*/ if(trim($POType) == CAPITAL ) { if($CapitalRange=='1') @@ -2660,7 +2768,9 @@ function addNewImportPurchaseOrder() } } - } + } + + echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; } @@ -2691,7 +2801,11 @@ function addNewImportPurchaseOrder() $Deliverydt = ''; $DeliverySchedule = ''; } */ - +/*-----------------------------------*/ + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); +/*-----------------------------------*/ $DeliveryOption = $this->input->post('DateRange'); @@ -2785,7 +2899,10 @@ function addNewImportPurchaseOrder() $Quantity = $this->input->post('quantity'.$i); $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); - +/*-----------------------------------*/ + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); +/*-----------------------------------*/ $Exchangerate = $this->input->post('echangeRate'.$i); $BasicPriceinmton = $this->input->post('rateInUs'.$i); $Productprice = $this->input->post('basicvalInINR'.$i); @@ -2871,7 +2988,19 @@ function addNewImportPurchaseOrder() // die(); +/*---------start---------------------*/ + if(($PODate != $b4podate )||( $SupplierID != $b4supplier) || ($itemRate !=$b4rate) || + ($Quantity != $b4qty )) + { + $logpo =array('UpdateBy'=>$CreateBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updatelogpo($MaterialCode,$POLineItemNo,$logpo); + } + + + /*----------end--------------------*/ $SkipInsert = "False"; @@ -2891,13 +3020,11 @@ function addNewImportPurchaseOrder() } /*------------------------------*/ - //if($MaterialCode!= ''){ - - $ReqDetails = array( 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$updateddt); //print_r($ReqDetails); - $this->purchaseorder_model->updateReqDetails($Reqnumber,$ReqDetails); - // } + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); + /*------------------------------*/ @@ -2970,7 +3097,8 @@ function addNewImportPurchaseOrder() } - } + } + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; } @@ -3884,7 +4012,60 @@ public function enquiry() } } +/*--------------------------------------------------------------------------------------*/ +function uploadfile() + { + $bill= $this->input->post('param1'); + $oldfile= $this->input->post('param2'); + if(!empty($_FILES['file']['name'])) + { + $Picture = $this->add(); + } + + $uploadfile = $this->purchaseorder_model->updatefile($bill,$Picture,$oldfile); + + if($uploadfile > 0){ + echo "file updated successfully!"; + } + else{ + echo "file not updated!"; + } + } + + function add() + { + $picture = ''; + if(!empty($_FILES['file']['name'])) + { + $config['upload_path'] = 'uploads/BillFiles/'; + $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; + $config['file_name'] = $_FILES['file']['name']; + //print_r($config) ; + //Load upload library and initialize configuration + $this->load->library('upload',$config); + $this->upload->initialize($config); + if($this->upload->do_upload('file')) + { + $uploadData = $this->upload->data(); + $picture = $uploadData['file_name']; + } + else + { + $error = array('error' => $this->upload->display_errors()); + $picture = ''; + } + } + else + { + $picture = ''; + } + + return $picture ; + } + + +/*--------------------------------------------------------------------------------------*/ } diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index 004d9011..a5ba5a07 100755 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -342,7 +342,11 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); //echo $PONO; $POdt =$this->input->post('PODate'); $PODate = $this->getDateformat($POdt); - +/*-----------------------------------*/ + $b4supplier=$this->input->post('b4supplier'); + $b4date=$this->input->post('b4podate'); + $b4podate = $this->getDateformat($b4date); +/*-----------------------------------*/ $SupplierID = $this->input->post('drpSupplier'); $DeliveryAddr = $this->input->post('txtDeliveryAddress'); $dt = $this->input->post('Deliverydt'); @@ -399,6 +403,10 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); { $MaterialCode = $this->input->post('materialCode'.$i); $Quantity = $this->input->post('quantity'.$i); + /*-----------------------------------*/ + $b4qty=$this->input->post('b4qty'.$i); + $b4rate=$this->input->post('b4rate'.$i); +/*-----------------------------------*/ $Reqnumber = $this->input->post('Reqnumber'.$i); $itemRate = $this->input->post('itemRate'.$i); $Cgst = $this->input->post('Cgst'.$i); @@ -419,18 +427,36 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); /*------------------------------*/ //if($MaterialCode!= ''){ - - $ReqDetails = array( 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt); //print_r($ReqDetails); - $this->purchaseorder_model->updateReqDetails($Reqnumber,$ReqDetails); + $this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails); // } /*------------------------------*/ + + + + /*---------start---------------------*/ + + if(($PODate != $b4podate )||($SupplierID != $b4supplier) || ($itemRate!=$b4rate) || + ($Quantity != $b4qty )) + { + $logpo =array('UpdateBy'=>$updatedBy,'UpdatedOn'=>$updateddt); + + + $this->purchaseorder_model->updatelogpo($MaterialCode,$POLineItemNo,$logpo); + } + + + /*----------end--------------------*/ $POLineItem = array(); $LineItemNo = ''; + + + $SkipInsert = "False"; if( count($comma_separated) > 0) { @@ -505,6 +531,71 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); } echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO; } + + + + + + + + + +/*-----------------------------------*/ + +function uploadfile() + { + $bill= $this->input->post('param1'); + $oldfile= $this->input->post('param2'); + + if(!empty($_FILES['file']['name'])) + { + $Picture = $this->add(); + } + + $uploadfile = $this->purchaseorder_model->updatefile($bill,$Picture,$oldfile); + + if($uploadfile > 0){ + echo "file updated successfully!"; + } + else{ + echo "file not updated!"; + } + } + + function add() + { + $picture = ''; + if(!empty($_FILES['file']['name'])) + { + $config['upload_path'] = 'uploads/BillFiles/'; + $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; + $config['file_name'] = $_FILES['file']['name']; + //print_r($config) ; + //Load upload library and initialize configuration + $this->load->library('upload',$config); + $this->upload->initialize($config); + if($this->upload->do_upload('file')) + { + $uploadData = $this->upload->data(); + $picture = $uploadData['file_name']; + } + else + { + $error = array('error' => $this->upload->display_errors()); + $picture = ''; + } + } + else + { + $picture = ''; + } + + return $picture ; + } + + +/*-----------------------------------*/ + function pageNotFound() { $this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found'; diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index d56f38d2..bf456cfa 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -24,18 +24,62 @@ class purchaseorder_model extends CI_Model /*------------------------------*/ -function updateReqDetails($Reqnumber,$ReqDetails){ + +function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){ //echo'hi'; - $this->db->where('ReqNo',$Reqnumber); + $this->db->where('ReqNo',$Reqnumber,'MaterialCode',$MaterialCode); + //$this->db->where('MaterialCode',$MaterialCode); + // $this->db->where('Quantity',$Quantity); - $this->db->update('T_Requestion_Details',$ReqDetails); + $this->db->update('T_Requestion_Details',$ReqDetail); $r = $this->db->affected_rows(); return $r; } +function IGRDetailsupdate($PONO) +{ + //echo 'hi'; + + + $subQuery ='select IGRM.PONO,IGRD.IGRItemNo,IGRD.IGRNO from +T_IGR_Master IGRM +join T_IGR_Details IGRD on IGRD.IGRNO = IGRM.IGRNO +Where IGRM.PONO = ? '; + + $query = $this->db->query($subQuery,array($PONO)); + + return $query->result_array(); + + + } + + + function updateIGR($IGRItemNo,$IGRNO,$MaterialCode,$IGRDs) + { + +// echo $IGRItemNo; +// echo $IGRNO; +// die(); + $this->db->where('IGRItemNo',$IGRItemNo,'IGRNO',$IGRNO,'MaterialCode',$MaterialCode); + + + $this->db->update('T_IGR_Details',$IGRDs); + + $r = $this->db->affected_rows(); + + // print_r( $this->db->last_query()); + + return $r; + + + + } + + + /*------------------------------*/ @@ -2153,5 +2197,149 @@ function DeleteCounter($DelId) //print_r($this->db->last_query()); return TRUE; } + + +/*------------------------------------------------------------------------------*/ + +function updatefile($bill,$Picture,$oldfile) +{ + + if($oldfile != ''){ + unlink("uploads/BillFiles/".$oldfile);//this deletes the file on particular folder too + } + +$this->db->set('FilePath', $Picture); //value that used to update column +$this->db->where('BillNo', $bill); //which row want to upgrade +$this->db->update('T_PurchaseOrder_BillUpload'); +$afftectedRows = $this->db->affected_rows(); +return $afftectedRows; + +} + + + +function newlogpo($logpo) +{ + + $this->db->trans_start(); + $this->db->insert('T_ponewlogs_Details',$logpo); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return $insert_id; + +} + + + +function updatelogpo($MaterialCode,$POLineItemNo,$logpo){ + + + + + $this->db->where('MaterialCode',$MaterialCode,'LineItemNos',$POLineItemNo); + $this->db->update('T_ponewlogs_Details',$logpo); + + $r = $this->db->affected_rows(); + return $r; + +} +function getlogpodtl($PONO){ + + + +// $SQL = "select +// log.Date as Ldate,log.PONO as LPONO,log.Quantity as Lqty,log.LineItemNos,log.MaterialCode as lmaterial, +// log.Rate as Lrate,log.SupplierID as LSuppid,log.UpdateBy,log.UpdatedOn,pm.PONO,pm.PODate,pm.SupplierID,pl.MaterialCode,pl.Quantity,pl.Rate +// from T_ponewlogs_Details log +// join T_PurchaseOrder_LineItem pl on log.LineItemNos = pl.LineItemNo + +// join T_PurchaseOrder_Master pm on pm.PONO = log.PONO + +// where pm.PONO ='".$PONO."'"; + + + +// select distinct log.PONO as LPONO, +// case +// WHEN log.Quantity <> pl.Quantity THEN log.Quantity +// else '-' +// ENd as Lqty, + +// case +// WHEN log.SupplierID <> pm.SupplierID THEN log.SupplierID +// else '-' +// ENd as LSuppid, +// case +// WHEN log.Date <> pm.PODate THEN log.Date +// else '-' +// ENd as logDate , +// case +// WHEN log.Rate <> pl.Rate THEN log.Rate +// else '-' +// ENd as logRate , + + +// log.LineItemNos,log.MaterialCode,log.UpdatedOn,log.UpdateBy + + +// from T_ponewlogs_Details log +// join T_PurchaseOrder_LineItem pl on log.LineItemNos = pl.LineItemNo +// join T_PurchaseOrder_Master pm on pm.PONO = log.PONO +// where pm.PONO + + + + $SQL = "select distinct log.PONO as LPONO, +case + WHEN log.Quantity <> pl.Quantity THEN log.Quantity + else '-' + ENd as Lqty, + + case + WHEN log.SupplierID <> pm.SupplierID THEN sup.Suppliername + else '-' + ENd as LSuppid, + case + WHEN log.Date <> pm.PODate THEN log.Date + else '-' + ENd as logDate , + case + WHEN log.Rate <> pl.Rate THEN log.Rate + else '-' + ENd as logRate , + + +log.LineItemNos,log.MaterialCode,log.UpdatedOn,log.UpdateBy,emp.FirstName + + +from T_ponewlogs_Details log +join T_PurchaseOrder_LineItem pl on log.LineItemNos = pl.LineItemNo +join T_PurchaseOrder_Master pm on pm.PONO = log.PONO +join tbl_users user on user.userId = log.UpdateBy + left join T_Employee_Details emp on emp.EmpID= user.EmpID +left join T_SupplierDetailsN sup on sup.SupplierID = log.SupplierID +where log.PONO ='".$PONO."'"; + + +$logpodtl = $this->db->query($SQL); + + return $logpodtl->result(); +} + + + // function EditpoValues($pono) + // { + // $this->db->select('*'); + // $this->db->from('T_ponewlogs_Details'); + // $this->db->where('PONO',$pono); + // // $this->db->where('MaterialCode',$materialcode); + // $query = $this->db->get(); + // return $query->result_array(); + // } + + + +/*------------------------------------------------------------------------------*/ + } diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index d4c502da..27bd2793 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -126,7 +126,13 @@ foreach ($PaymentTerms as $TER) $Terms=$TER->PaymentTerms; } - +if(!empty($getlogpodtl )) +{ +foreach ($getlogpodtl as $values ) +{ + $update=$values->UpdateBy; +} +} // foreach ($POSTATUS as $PST ) // { @@ -200,6 +206,22 @@ else } +/*****************************/ +var update = ''; + + +if(update !='null') + +{ + $('#editpodiv').show(); +} + +else +{ + $('#editpodiv').hide(); +} +/*****************************/ + @@ -505,7 +527,7 @@ function ExceedQuantityCheck() { var EnterQuantity = $("#Quantity").val()== '' ? "0.00" : parseFloat($("#Quantity").val()); var ReqQuantity = parseFloat(RequistQuantity); - if(EnterQuantity > ReqQuantity) + //if(EnterQuantity > ReqQuantity) // { // alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.'); @@ -513,9 +535,9 @@ function ExceedQuantityCheck() // return false; // } // else - { + //{ return true; - } + //} } function EditExceedQuantityCheck() { @@ -523,13 +545,13 @@ function ExceedQuantityCheck() var EnterQuantity = $("#EditQuantity").val()== '' ? "0.00" : parseFloat($("#EditQuantity").val()); var ReqQuantity = parseFloat(RequistQuantity); //alert(ReqQuantity); - if(EnterQuantity != ReqQuantity) - { + //if(EnterQuantity != ReqQuantity) + //{ // alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity +'.Please adjust the Quantity to proceed further.'); // $('#EditQuantity').focus(); return true; - } + //} } function ExceedBudget(ValuetoCheck,budgetAmount) @@ -746,7 +768,7 @@ $(document).ready(function () { 'PODate','value' => set_value('PODate',$PODate),'id'=>'PODate', 'class' => 'form-control num' ,'required' => 'true','onkeypress'=>'return false;'); echo form_input($data); - ?> + ?> @@ -771,7 +793,7 @@ $(document).ready(function () { echo form_dropdown('drpSupplier', $options,set_value('drpSupplier',$SupId ),'id="drpSupplier"' ,'required="true"' ,'class="form-control select2'); - ?> + ?>

@@ -2091,8 +2113,11 @@ $(document).ready(function () { + + + @@ -2123,7 +2148,7 @@ $(document).ready(function () {     - + VehicleNo?> CourierNo?> --> - FilePath?> - + + + + + + FilePath))?$gd->FilePath:"No File"; ?> + + FilePath)) { ?> + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SnoDateQuantityRateSupplierUpdatedByUpdateOn
logdate)?"-":date('d-m-Y',strtotime($oldpo->logdate)); ?>Lqty;?>logRate?>LSuppid?>FirstName ?>UpdatedOn); + echo $date->format('d-m-Y'); ?>
+
+
+ + + + + + + + @@ -3506,8 +3645,65 @@ $('#insuranceTxtDiv').hide(); $('#insuranceNo').val(''); } }); + + + + + + +function splpoupdate(){ + var formData = new FormData(); + + var file = $("#imag").prop('files')[0]; + var param1 = $('#hidebillno').val(); + var param2 = $('#hideoldfile').val(); + var filename = $("#imag").val(); + filename = filename.split('\\'); + + formData.append('file',file); + formData.append('param1',param1); + formData.append('param2',param2); + + $('.content').loader('show'); + $.ajax({ + data:formData, + type:"POST", + url:"servicepurchaseorder/uploadfile", + cache : false, + contentType : false, + processData : false, + success:function(data) { + if(data){ + alert(data); + $('.content').loader('hide'); + $('#spl').find('td').eq(1).text(filename[2]); + $('#EditServiceSplPOModel').modal('hide'); + } + + } + }); + +} + + + +function filecheck() + { +var sizef = document.getElementById('imag').files[0].size; + var file = $('#imag').val(); + + if(file!='' && sizef < 2100000) + { // alert('Your file added successfully'); + } + else + { + alert('Sorry Your File is Large To 2MB'); + $('#imag').val(''); + } + } + diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index 0e5f4d9a..f69dbf44 100755 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -3,26 +3,26 @@ array("name"=>"NO","value"=>"0"),array("name"=>"YES","value"=>"1") ); $requestedBy=$RequistionDetails[0]->FirstName; - $Updateddt = new DateTime($RequistionDetails[0]->ReqDate); - $UpdatedOn=$Updateddt->format('d-m-Y'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $Updateddt = new DateTime($RequistionDetails[0]->ReqDate); + $UpdatedOn=$Updateddt->format('d-m-Y'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $CurrentDate = $dt->format('d-m-Y'); - $res_arr_values = array(); - $DeliverOption=''; - $SupId = ''; + $res_arr_values = array(); + $DeliverOption=''; + $SupId = ''; $SupName = ''; - $Address = ''; - $PODate = ''; + $Address = ''; + $PODate = ''; $TotalCgst=''; - $TotalSgst=''; - $TotalIgst=''; - $DeliveryAddress =''; - $POStatus = ''; - $PONO = ''; - $TotalCgst = 0; - $TotalSgst = 0.0; - $TotalIgst = 0.0; - $OtherAmt = 0.0; + $TotalSgst=''; + $TotalIgst=''; + $DeliveryAddress =''; + $POStatus = ''; + $PONO = ''; + $TotalCgst = 0; + $TotalSgst = 0.0; + $TotalIgst = 0.0; + $OtherAmt = 0.0; $TotalFreightvalue=0.0; @@ -30,10 +30,10 @@ $totassesable=0; $totSubtotal=0; $totigst=0; - - $TotalSummary = 0.0; - $TotalBasicAmount = 0.0; - $ServiceDescription = ''; + + $TotalSummary = 0.0; + $TotalBasicAmount = 0.0; + $ServiceDescription = ''; $Import_DispatchDetails=''; $Import_PlaceofOrgin=''; $CapitalRange=''; @@ -107,9 +107,9 @@ if(!empty($MaxPODate)) { foreach ($MaxPODate as $date) { - $MaxPoDate = $date->PODate; - - } + $MaxPoDate = $date->PODate; + + } } if(!empty($POMaster)) { @@ -119,32 +119,32 @@ if(!empty($POMaster)) { - $SupId = $Req->SupplierID; + $SupId = $Req->SupplierID; $SupName = $Req->SupplierName; - $Address = $Req->Address; - $pdt = new DateTime($Req->PODate); - $PODate = $pdt->format('d-m-Y'); - $DeliverOption = $Req->DeliveryOption; + $Address = $Req->Address; + $pdt = new DateTime($Req->PODate); + $PODate = $pdt->format('d-m-Y'); + $DeliverOption = $Req->DeliveryOption; $DeliverSchedule = $Req->DeliverySchedule; - $Ddt = new DateTime($Req->DeliveryDate); - $Deliverydt = $Ddt->format('d-m-Y'); + $Ddt = new DateTime($Req->DeliveryDate); + $Deliverydt = $Ddt->format('d-m-Y'); - $DeliveryAddress =$Req->DeliveryAddress; - $PONOStatus = $Req->StatusCode; - $POStatus = $Req->StatusCode; + $DeliveryAddress =$Req->DeliveryAddress; + $PONOStatus = $Req->StatusCode; + $POStatus = $Req->StatusCode; $PoStatusName=$Req->StatusName; - $PONO = $Req->PONO; - $ServiceDescription = $Req->ServiceDescription; + $PONO = $Req->PONO; + $ServiceDescription = $Req->ServiceDescription; - $Exchangedt = new DateTime($Req->ExchangeRateCalculatedon); + $Exchangedt = new DateTime($Req->ExchangeRateCalculatedon); $ExchangeRateOn=$Exchangedt->format('d-m-Y'); $PaymentTerms=$Req->PaymentTerms; $otherPayment = $Req->PaymentOtherDescription; - + $CapitalRange=$Req->CapitalRange; $Import_DispatchDetails=$Req->Import_DispatchDetails; @@ -159,14 +159,14 @@ if(!empty($POMaster)) $ExitTotalOrderValue=$Req->TotalOrderValue; } - $ModeOfShipment=$Req->Mode_Of_Shipment; - $SupplierReference=$Req->Supplier_Reference; - $SuppliersOfferNo=$Req->Supplier_Offer_No; - $OtherReferences=$Req->Other_Reference; - $Fincap=$Req->Fincap; - $InsuranceOptions=$Req->InsuranceStatus; - $InsuranceNo=$Req->InsuranceNumber; - $ServiceTypeOptions=$Req->POSubType; + $ModeOfShipment=$Req->Mode_Of_Shipment; + $SupplierReference=$Req->Supplier_Reference; + $SuppliersOfferNo=$Req->Supplier_Offer_No; + $OtherReferences=$Req->Other_Reference; + $Fincap=$Req->Fincap; + $InsuranceOptions=$Req->InsuranceStatus; + $InsuranceNo=$Req->InsuranceNumber; + $ServiceTypeOptions=$Req->POSubType; $BudgetType = $Req->BudgetType; } @@ -185,24 +185,33 @@ if(!empty($POItem) && $CapitalRange=='1') $currentPoDiscountedAmt=$currentPoDiscountedAmt+$getTotalAmt->Afterdiscountval; - + } if(!empty($AvlBudAmt)) { - $AvlAmount = number_format($AvlCapitalBudAmt+$currentPoBasicAmt-$currentPoDiscountedAmt, 2, '.', ''); + $AvlAmount = number_format($AvlCapitalBudAmt+$currentPoBasicAmt-$currentPoDiscountedAmt, 2, '.', ''); - + } } else { - $AvlAmount = number_format($AvlCapitalBudAmt+$ExitTotalOrderValue, 2, '.', ''); + $AvlAmount = number_format($AvlCapitalBudAmt+$ExitTotalOrderValue, 2, '.', ''); } +//print_r($getlogpodtl);die; +if(!empty($getlogpodtl)) +{ + +foreach ($getlogpodtl as $values ) +{ + $update=$values->UpdateBy; +} +} @@ -223,12 +232,12 @@ else { .select2{ width:100% ! important; } - .num{ - text-align:right; - } - .content-wrapper { - min-height:600px ! important; - } + .num{ + text-align:right; + } + .content-wrapper { + min-height:600px ! important; + } @@ -249,7 +258,7 @@ else { z-index: 1080 !important; } - + diff --git a/application/views/editimportpo.php b/application/views/editimportpo.php index d35a9b20..e38a46c6 100755 --- a/application/views/editimportpo.php +++ b/application/views/editimportpo.php @@ -15,7 +15,7 @@ $Currencycode=$currencycode; //echo $Currencycode; $Terms=''; $DeliverySchedule=''; - + foreach ($CurrencyDetail as $Detail) { $Cur=$Detail->Currency_Code.' '.' - '.' '.$Detail->Country_and_Currency; @@ -151,7 +151,7 @@ if(!empty($POMaster)) // $PaymentDays=$Req->PaymentDays; $StatusName=$Req->StatusName; $Currency_Type=$Req->CurrencyType; - $parentPO =$Req->ParentPO; + $parentPO =$Req->ParentPO; $DeliverySchedule=$Req->DeliverySchedule; $Import_DispatchDetails=$Req->Import_DispatchDetails; $Import_PlaceofOrgin=$Req->Import_PlaceofOrgin; @@ -209,6 +209,17 @@ if(!empty($RequistionDetails)) } } + +if(!empty($getlogpodtl)) +{ + + +foreach ($getlogpodtl as $values ) +{ + $update=$values->UpdateBy; +} +} + ?>