diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index 8d2ef7ea..7022944a 100755 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -99,43 +99,43 @@ class emergencypurchaseorder extends BaseController } - function addfile() - { +// function addfile() +// { - $file = ''; - //Check whether user upload picture - if(!empty($_FILES['images']['name'])) - { - //echo 'true'; - $config['upload_path'] = 'uploads/BillFiles/'; - $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; - $config['file_name'] = $_FILES['images']['name']; +// $file = ''; +// //Check whether user upload picture +// if(!empty($_FILES['images']['name'])) +// { +// //echo 'true'; +// $config['upload_path'] = 'uploads/BillFiles/'; +// $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; +// $config['file_name'] = $_FILES['images']['name']; - //Load upload library and initialize configuration - $this->load->library('upload',$config); - $this->upload->initialize($config); +// //Load upload library and initialize configuration +// $this->load->library('upload',$config); +// $this->upload->initialize($config); - if($this->upload->do_upload('images')) - { - $uploadData = $this->upload->data(); - //print_r($uploadData); - $file = $uploadData['file_name']; - } - else - { - $error = array('error' => $this->upload->display_errors()); - //print_r($error); - $file = ''; - } - } - else - { - //echo 'false'; - $file = ''; - } +// if($this->upload->do_upload('images')) +// { +// $uploadData = $this->upload->data(); +// //print_r($uploadData); +// $file = $uploadData['file_name']; +// } +// else +// { +// $error = array('error' => $this->upload->display_errors()); +// //print_r($error); +// $file = ''; +// } +// } +// else +// { +// //echo 'false'; +// $file = ''; +// } - return $file ; - } +// return $file ; +// } @@ -143,45 +143,120 @@ class emergencypurchaseorder extends BaseController -function addfile1() - { +// function addfile1() +// { - $file = ''; - //Check whether user upload picture - if(!empty($_FILES['images1']['name'])) - { - //echo 'true'; - $config['upload_path'] = 'uploads/BillFiles/'; - $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; - $config['file_name'] = $_FILES['images1']['name']; - // print_r($config);die; - //Load upload library and initialize configuration - $this->load->library('upload',$config); - $this->upload->initialize($config); +// $file = ''; +// //Check whether user upload picture +// if(!empty($_FILES['images1']['name'])) +// { +// //echo 'true'; +// $config['upload_path'] = 'uploads/BillFiles/'; +// $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; +// $config['file_name'] = $_FILES['images1']['name']; +// // print_r($config);die; +// //Load upload library and initialize configuration +// $this->load->library('upload',$config); +// $this->upload->initialize($config); - if($this->upload->do_upload('images1')) - { - $uploadData = $this->upload->data(); - //print_r($uploadData); - $file = $uploadData['file_name']; - } - else - { - $error = array('error' => $this->upload->display_errors()); - //print_r($error); - $file = ''; - } +// if($this->upload->do_upload('images1')) +// { +// $uploadData = $this->upload->data(); +// //print_r($uploadData); +// $file = $uploadData['file_name']; +// } +// else +// { +// $error = array('error' => $this->upload->display_errors()); +// //print_r($error); +// $file = ''; +// } +// } +// else +// { +// //echo 'false'; +// $file = ''; +// } + +// return $file ; +// } + function addfile($pathname) + + { + // echo "add files"; + // die(); + //echo $pathname; die(); + + $picture = ''; + if(!empty($_FILES[$pathname]['name'])) + { + + $config['upload_path'] = 'uploads/BillFiles/'; + $config['allowed_types'] = '*'; + //$config['allowed_types'] = 'jpg|jpeg|png|gif'; + $config['file_name'] = $_FILES[$pathname]['name']; + + //Load upload library and initialize configuration + $this->load->library('upload',$config); + $this->upload->initialize($config); + if($this->upload->do_upload($pathname)) + { + $uploadData = $this->upload->data(); + $picture = $uploadData['file_name']; } else { - //echo 'false'; - $file = ''; + $error = array('error' => $this->upload->display_errors()); + $picture = ''; } - - return $file ; + } + else + { + $picture = ''; + } + + return $picture ; } +/*----------------------------------special po file upload service----------------------------------*/ +function add($pathname) + { + // echo "add files"; + // die(); + //echo $pathname; die(); + + $picture = ''; + if(!empty($_FILES[$pathname]['name'])) + { + + $config['upload_path'] = 'uploads/BillFiles/'; + $config['allowed_types'] = '*'; + //$config['allowed_types'] = 'jpg|jpeg|png|gif'; + $config['file_name'] = $_FILES[$pathname]['name']; + + //Load upload library and initialize configuration + $this->load->library('upload',$config); + $this->upload->initialize($config); + if($this->upload->do_upload($pathname)) + { + $uploadData = $this->upload->data(); + $picture = $uploadData['file_name']; + } + else + { + $error = array('error' => $this->upload->display_errors()); + $picture = ''; + } + } + else + { + $picture = ''; + } + + return $picture ; + } + @@ -405,13 +480,47 @@ function addfile1() } if($POStatus==SPECIAL_PO){ - $file =$this->addfile1(); - - $myfile = array('FilePath'=>$file,'PONO'=>$PONO); //'MaterialCode'=>$MaterialCode, - $result= $this->purchaseorder_model->fileupload($myfile); + $count = $this->input->post('hidecounters'); + $constant = $this->input->post('hideconstants'); + + for($i=1;$i<=$constant;$i++){ + $pathname = 'browseFiles'.$i; + if(!empty($_FILES[$pathname]['name'])) + { + + + $Picture = $this->add($pathname); + //echo $Picture; + $arr[] = array($Picture); + } + } +//print_r($arr); + foreach($arr as $ma){ + + + $index = 0; + foreach($ma as $key=>$value){ + $index++; + if($index == 1){ + $filename = $value; + } + } + + $myfile = array('FilePath'=>$filename); +$myfile = array('FilePath'=>$filename,'PONO'=>$PONO); + $this->purchaseorder_model->fileupload($myfile); + //addfiledetails($addfilelist); +//print_r($myfile); + + + } +/**/ + // $myfile = array('FilePath'=>$file,'PONO'=>$PONO); //'MaterialCode'=>$MaterialCode, + // $result= $this->purchaseorder_model->fileupload($myfile); } + if($POStatus == REQ_DRAFT) { // echo 'Emergency Service Purchase Order Saved Successfully!The PO NO Is: '.$PONO; @@ -871,12 +980,47 @@ $RequestedBy = $this->input->post('drpDepartment'); - $file =$this->addfile(); - $emergencyitemcode = $this->input->post('materialCode'.$i); - $myfile = array('FilePath'=>$file,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO); - $result= $this->purchaseorder_model->fileupload($myfile); + // $file =$this->addfile(); + // $emergencyitemcode = $this->input->post('materialCode'.$i); + // $myfile = array('FilePath'=>$file,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO); + // $result= $this->purchaseorder_model->fileupload($myfile); - + $counts = $this->input->post('hidecounter'); + $constants = $this->input->post('hideconstant'); + + for($i=1;$i<=$constants;$i++){ + $pathname = 'browseFiles'.$i; + if(!empty($_FILES[$pathname]['name'])) + { + + + $Picture = $this->addfile($pathname); + //echo $Picture; + $arr[] = array($Picture); + } + } +//print_r($arr); + foreach($arr as $ma){ + + + $index = 0; + foreach($ma as $key=>$value){ + $index++; + if($index == 1){ + $filename = $value; + } + } + + $myfile = array('FilePath'=>$filename); + $emergencyitemcode = $this->input->post('materialCode'.$i); + $myfile = array('FilePath'=>$filename,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO); + + $this->purchaseorder_model->fileupload($myfile); + //addfiledetails($addfilelist); +//print_r($myfile); + + + } } diff --git a/application/controllers/report.php b/application/controllers/report.php index 19eecad3..1c9546c3 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -505,6 +505,24 @@ class report extends BaseController $this->loadviews("Report_cumulative_day",$this->global,$data, NULL); } + + + + function Viewfiles() + { + + $PO= $this->input->post('id'); + + $PONO= substr($PO,5); + //echo $PONO; die; + + $data = $this->dahsboard_Model->getfile($PONO); + + // print_r( $data);die; + + echo json_encode($data); + + } public function ipurchase() { diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index ea4a04d3..0f3bc758 100755 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -593,7 +593,6 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); /*-----------------------------------*/ - function uploadfile() { $bill= $this->input->post('param1'); @@ -645,7 +644,6 @@ function uploadfile() return $picture ; } - /*-----------------------------------*/ function pageNotFound() diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 0acca3e5..6ac05dde 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -20,6 +20,22 @@ class dahsboard_Model extends CI_Model } + +function getfile($PONO) + { + //$this->db->distinct(); + $this->db->select('*'); + $this->db->from('T_PurchaseOrder_BillUpload'); + $this->db->where('PONO',$PONO); + + + $query = $this->db->get(); + // print_r( $this->db->last_query()); + $result = $query->result_array(); + return $result; + } + + function totloan() { diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index a014fc34..8b438a53 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -2290,12 +2290,13 @@ $(document).ready(function () { $gd) { ?> - + BillNo ?> + - + FilePath))?$gd->FilePath:"No File"; ?> - + FilePath)) { ?> @@ -2413,7 +2414,7 @@ $(document).ready(function () {