diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index f9132e8a..8d2ef7ea 100755 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -660,6 +660,9 @@ $RequestedBy = $this->input->post('drpDepartment'); $DeliveryChellan = $this->input->post('ChallanInvDate'); $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); + $MaterialReceive = $this->input->post('MRC'); + $MaterialReceivedate = $this->getDateformat($MaterialReceive); + $Vehicle = $this->input->post('VehicleNo'); $Courier = $this->input->post('CourierNo'); @@ -679,7 +682,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $igr = array(); - $igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'MaterialRcvdDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); + $igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'MaterialRcvdDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt,'MaterialRcvdDate'=>$MaterialReceivedate); //print_r($igr); diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 30d77792..09dbee10 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -4165,24 +4165,116 @@ 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 ; +// } + function uploadfile() { + + //alert(); $bill= $this->input->post('param1'); $oldfile= $this->input->post('param2'); + $invno= $this->input->post('param3'); + $invdate= $this->input->post('param4'); + $VehicleNo= $this->input->post('param5'); + $CourierNo= $this->input->post('param6'); + $MaterialRcvdDate =$this->input->post('param7'); + + $invdate = date('Y-m-d',strtotime($invdate)); + $MaterialRcvdDate =date('Y-m-d',strtotime($MaterialRcvdDate)); + + $CreatedBy = $this->session->userdata('userId'); + + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + + + $billdetails = $this->purchaseorder_model->getigrno($bill); + +//print_r($billdetails); + + + $PONO = $billdetails[0]['PONO']; + + + $IGRNo = $billdetails[0]['IGRNO']; + + if(!empty($_FILES['file']['name'])) - { - $Picture = $this->add(); - } + { + + $Picture = $this->add(); + }else{ + $Picture = $this->input->post('param2'); + } + //echo $Picture;die; $uploadfile = $this->purchaseorder_model->updatefile($bill,$Picture,$oldfile); + + + $igrMaster = array('VehicleNo'=>$VehicleNo,'DeliveryChellanOrInvoiceNo'=>$invno,'DeliveryChellanDate'=>$invdate, 'MaterialRcvdDate'=>$MaterialRcvdDate,'CourierNo'=>$CourierNo,'UpdateBY'=>$CreatedBy,'UpdatedOn' =>$createddt); + + // print_r($igrMaster);die; + // uploadfile(); + + $igrM = $this->purchaseorder_model->updateigrM($PONO,$IGRNo,$igrMaster); - if($uploadfile > 0){ + // if($uploadfile > 0){ echo "file updated successfully!"; - } - else{ - echo "file not updated!"; - } + // } + // else{ + // echo "updated successfully!"; + // } } function add() @@ -4201,7 +4293,7 @@ function uploadfile() { $uploadData = $this->upload->data(); $picture = $uploadData['file_name']; - } + } else { $error = array('error' => $this->upload->display_errors()); @@ -4216,7 +4308,6 @@ function uploadfile() return $picture ; } - /*--------------------------------------------------------------------------------------*/ diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 2ca01592..69742b52 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -152,7 +152,7 @@ Where IGRM.PONO = ? '; function getfunction($pono) { $this->db->distinct(); - $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType'); + $this->db->select('bill.PONO,mstr.IGRNO,bill.BillNo,mstr.MaterialRcvdDate,bill.FilePath,mstr.DeliveryChellanOrInvoiceNo,mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.CourierNo,dtl.QuantityAsPerInvoice,pom.POType'); $this->db->from('T_PurchaseOrder_BillUpload bill'); $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left'); $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left'); @@ -2339,5 +2339,26 @@ $logpodtl = $this->db->query($SQL); /*------------------------------------------------------------------------------*/ - +function updateigrM($PONO,$IGRNo,$igrMaster){ + + //print_r($igrMaster);die; + $this->db->where('PONO',$PONO); + $this->db->where('IGRNO',$IGRNo); + + $this->db->update('T_IGR_Master',$igrMaster); + + $r = $this->db->affected_rows(); + return $r; +} +function getigrno($bill){ + + $subQuery ='select bill.BillNo,IGR.IGRNO, IGR.PONO FROM T_IGR_Master IGR + join T_PurchaseOrder_BillUpload bill on bill.IGRNO = IGR.IGRNO + where bill.BillNO = ? '; + + $query = $this->db->query($subQuery,array($bill)); + + return $query->result_array(); + } + /*** ----------------------------- */ } diff --git a/application/views/alterpurchaseorder.php b/application/views/alterpurchaseorder.php index 765367b7..3a1e1488 100755 --- a/application/views/alterpurchaseorder.php +++ b/application/views/alterpurchaseorder.php @@ -180,14 +180,15 @@ if(!empty($INRSYMBOL)) dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10' }); - - - $("#Date1").datepicker({ // minDate : 'now', dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10' }); + $("#MRC").datepicker({ + + dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10' + }); var SelectedMaterialList = { Mat: [] @@ -3074,9 +3075,15 @@ function populateValueMainFormForDeleteItem(rowid)