diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php
index 7022944a..a27d679a 100755
--- a/application/controllers/emergencypurchaseorder.php
+++ b/application/controllers/emergencypurchaseorder.php
@@ -229,7 +229,7 @@ function add($pathname)
$picture = '';
if(!empty($_FILES[$pathname]['name']))
{
-
+
$config['upload_path'] = 'uploads/BillFiles/';
$config['allowed_types'] = '*';
//$config['allowed_types'] = 'jpg|jpeg|png|gif';
@@ -483,6 +483,8 @@ function add($pathname)
$count = $this->input->post('hidecounters');
$constant = $this->input->post('hideconstants');
+
+
for($i=1;$i<=$constant;$i++){
$pathname = 'browseFiles'.$i;
if(!empty($_FILES[$pathname]['name']))
@@ -797,6 +799,19 @@ $RequestedBy = $this->input->post('drpDepartment');
$igrM = $this->inwardgateregister_model->addigrM($igr);
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -811,6 +826,12 @@ $RequestedBy = $this->input->post('drpDepartment');
// echo $IGRNO;
+
+
+
+
+
+
if($Qualitycheck==0)
{
@@ -964,32 +985,33 @@ $RequestedBy = $this->input->post('drpDepartment');
}
- // $file =$this->addfile();
+ //$myfile = array('FilePath'=>$filename);
// $emergencyitemcode = $this->input->post('emergencyitemcode'.$i);
// ($this->input->post('materialCode'.$i));
- // $myfile = array('FilePath'=>$file,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
- // // print_r($myfile);
- // $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');
+
+ $counts = $this->input->post('hidecounter');
$constants = $this->input->post('hideconstant');
+// if(empty($filename))
+// {
+// // echo $IGRNO;
+// // echo $PONO;
+
+// $myfile = array('FilePath'=>$filename,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
+// // print_r($myfile);
+// $this->purchaseorder_model->fileupload($myfile);
+
+// }
+// else{
+
+
for($i=1;$i<=$constants;$i++){
$pathname = 'browseFiles'.$i;
+
+
+
if(!empty($_FILES[$pathname]['name']))
{
@@ -998,12 +1020,15 @@ $RequestedBy = $this->input->post('drpDepartment');
//echo $Picture;
$arr[] = array($Picture);
}
- }
+
+
+ }
//print_r($arr);
foreach($arr as $ma){
$index = 0;
+ $filename = null;
foreach($ma as $key=>$value){
$index++;
if($index == 1){
@@ -1011,21 +1036,40 @@ $RequestedBy = $this->input->post('drpDepartment');
}
}
- $myfile = array('FilePath'=>$filename);
- $emergencyitemcode = $this->input->post('materialCode'.$i);
- $myfile = array('FilePath'=>$filename,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
+ //$myfile = array('FilePath'=>$filename);
+ //$emergencyitemcode = $this->input->post('materialCode'.$i);
+ $myfile = array('FilePath'=>$filename,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
+
+ // print_r($myfile);
+
$this->purchaseorder_model->fileupload($myfile);
//addfiledetails($addfilelist);
//print_r($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);
+
+
+ // if($ItemStatus = SPECIAL_PO){
+
}
- //if($result > 0)
+ // }
+ //if($result > 0)
// {
diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php
index 3b5fe990..3ed40997 100755
--- a/application/controllers/purchaseorder.php
+++ b/application/controllers/purchaseorder.php
@@ -516,7 +516,7 @@ function edited(){
}
- $data['getdata'] = $this->purchaseorder_model->getfunction($PONO);
+ $data['getdata'] = $this->purchaseorder_model->getfunctionr($PONO);
$data['MaxPODate'] = $this->purchaseorder_model->getLastReleasedPODate();
$data['TaxType'] = $this->purchaseorder_model->getConfigValue('C006');
@@ -1488,13 +1488,119 @@ function edited(){
}
}
+
+ $counts = $this->input->post('hidecounter');
+ $constants = $this->input->post('hideconstant');
+ //$oldfile = $this->input->post('param2');
+ $newfile = $this->input->post('param1');
-
+// if(empty($newfile))
+// {
+// // echo $IGRNO;
+// // echo $PONO;
+
+// $myfile = array('FilePath'=>$oldfile,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
+// // print_r($myfile);
+// $this->purchaseorder_model->fileupload($myfile);
+
+// }
+
+// else{
+ 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;
+ $newfile = null;
+ foreach($ma as $key=>$value){
+ $index++;
+ if($index == 1){
+ $newfile = $value;
+ }
+ }
+
+ //$myfile = array('FilePath'=>$filename);
+ //$emergencyitemcode = $this->input->post('materialCode'.$i);
+ $myfile = array('FilePath'=>$newfile,'PONO'=>$PONO,'IGRNO'=>$IGRNO);
+
+ // print_r($myfile);
+
+
+ $this->purchaseorder_model->fileupload($myfile);
+ //addfiledetails($addfilelist);
+//print_r($myfile);
+
+
+ }
+ // }
}
echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ;
}
+ 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
+ {
+ $error = array('error' => $this->upload->display_errors());
+ $picture = '';
+ }
+ }
+ else
+ {
+ $picture = '';
+ }
+
+ return $picture ;
+ }
+
+
+
+
+
+
+
+
+
+
function pageNotFound()
{
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
@@ -4165,56 +4271,59 @@ public function enquiry()
}
/*--------------------------------------------------------------------------------------*/
-// function uploadfile()
-// {
-// $bill= $this->input->post('param1');
-// $oldfile= $this->input->post('param2');
+function addloadfile()
+ {
-// if(!empty($_FILES['file']['name']))
-// {
-// $Picture = $this->add();
-// }
+ $pono= $this->input->post('PONO');
+ $new_file_name =$_FILES['param1']['name'];
+ //echo $new_file_name;
+ if(!empty($new_file_name))
+ {
+ $Picture = $this->adfile();
+ }
+ else
+ {
+ $Picture ='';
+ }
+//echo $Picture;die;
+$filelist =array('PONO'=>$pono,'FilePath'=>$Picture);
-// $uploadfile = $this->purchaseorder_model->updatefile($bill,$Picture,$oldfile);
+
+
+ $uploadfile = $this->purchaseorder_model->insertfile($filelist);
-// if($uploadfile > 0){
-// echo "file updated successfully!";
-// }
-// else{
-// echo "file not updated!";
-// }
-// }
+ 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 = '';
-// }
+ function adfile()
+ {
+ $picture = '';
+ if(!empty($_FILES['param1']['name']))
+ {
+ $config['upload_path'] = 'uploads/BillFiles/';
+ $config['allowed_types'] = 'docx|pdf|doc|png|jpg';
+ $config['file_name'] = $_FILES['param1']['name'];
+ // print_r($config) ;
+ //Load upload library and initialize configuration
+ $this->load->library('upload',$config);
+ $this->upload->initialize($config);
+
+ $uploadData = $this->upload->data();
+ $picture = $uploadData['file_name'];
+
+ }
+ else
+ {
+ $picture = '';
+ }
-// return $picture ;
-// }
+ return $picture ;
+ }
function uploadfile()
{
@@ -4228,6 +4337,13 @@ function uploadfile()
$CourierNo= $this->input->post('param6');
$MaterialRcvdDate =$this->input->post('param7');
+
+
+ // $oldfile = $this->input->post('param2');
+ // $newfile = $this->input->post('param8');
+ $newfile =$this->input->post('param8');
+
+
$invdate = date('Y-m-d',strtotime($invdate));
$MaterialRcvdDate =date('Y-m-d',strtotime($MaterialRcvdDate));
@@ -4250,7 +4366,8 @@ function uploadfile()
- if(!empty($_FILES['file']['name']))
+
+ if(!empty($_FILES['param8']['name']))
{
@@ -4268,6 +4385,8 @@ function uploadfile()
// uploadfile();
$igrM = $this->purchaseorder_model->updateigrM($PONO,$IGRNo,$igrMaster);
+
+ // $file =$this->purchaseorder_model->fileup($PONO,$IGRNo,$newfile)
// if($uploadfile > 0){
echo "updated successfully!";
@@ -4280,16 +4399,16 @@ function uploadfile()
function add()
{
$picture = '';
- if(!empty($_FILES['file']['name']))
+ if(!empty($_FILES['param8']['name']))
{
$config['upload_path'] = 'uploads/BillFiles/';
$config['allowed_types'] = 'docx|pdf|doc|png|jpg';
- $config['file_name'] = $_FILES['file']['name'];
- //print_r($config) ;
+ $config['file_name'] = $_FILES['param8']['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'))
+ if($this->upload->do_upload('param8'))
{
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php
index 69742b52..f74c1c69 100755
--- a/application/models/purchaseorder_model.php
+++ b/application/models/purchaseorder_model.php
@@ -142,6 +142,9 @@ Where IGRM.PONO = ? ';
function fileupload($myfile)
{
+
+ //print_r($myfile);die;
+
$this->db->insert('T_PurchaseOrder_BillUpload',$myfile);
$myfile=$this->db->affected_rows();
return $myfile;
@@ -161,6 +164,54 @@ Where IGRM.PONO = ? ';
$this->db->where('bill.PONO',$pono);
//$this->db->or_where('pom.status',SPECIAL_PO);
$this->db->group_by('bill.BillNo');
+
+
+
+
+
+// $this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo,
+// mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate,
+// mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
+
+// $this->db->from('T_IGR_Master mstr');
+// $this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
+// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
+// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
+// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
+// $this->db->where('mstr.PONO',$pono);
+
+ $query = $this->db->get();
+
+ return $query->result();
+ }
+
+function getfunctionr($pono)
+ {
+ $this->db->distinct();
+ // $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');
+ // // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
+ // $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO');
+ // $this->db->where('bill.PONO',$pono);
+ // //$this->db->or_where('pom.status',SPECIAL_PO);
+ // $this->db->group_by('bill.BillNo');
+
+
+
+
+
+ $this->db->select('mstr.PONO,mstr.IGRNO,mstr.DeliveryChellanOrInvoiceNo,
+mstr.DeliveryChellanDate,mstr.VehicleNo,mstr.MaterialRcvdDate,
+mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
+
+ $this->db->from('T_IGR_Master mstr');
+ $this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
+ $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
+ // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
+ $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
+ $this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
@@ -2223,9 +2274,9 @@ function DeleteCounter($DelId)
function updatefile($bill,$Picture,$oldfile)
{
- if($oldfile != ''){
- unlink("uploads/BillFiles/".$oldfile);//this deletes the file on particular folder too
- }
+ // 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
@@ -2336,6 +2387,15 @@ $logpodtl = $this->db->query($SQL);
// }
+ function insertfile($filelist)
+ {
+
+ //print_r($myfile);die;
+
+ $this->db->insert('T_PurchaseOrder_BillUpload',$filelist);
+ $myfile=$this->db->affected_rows();
+ return $myfile;
+ }
/*------------------------------------------------------------------------------*/
diff --git a/application/views/POlist.php b/application/views/POlist.php
index 3f549a30..283e4b2a 100755
--- a/application/views/POlist.php
+++ b/application/views/POlist.php
@@ -102,18 +102,19 @@
-
-
+
+
+
+
+