file upload
This commit is contained in:
parent
21ddba9de4
commit
7828743022
10
application/controllers/emergencypurchaseorder.php
Executable file → Normal file
10
application/controllers/emergencypurchaseorder.php
Executable file → Normal file
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
require APPPATH . '/libraries/BaseController.php';
|
require APPPATH . '/libraries/BaseController.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class : purchaseorder (PurchaseorderController)
|
* Class : purchaseorder (PurchaseorderController)
|
||||||
* User Class to control all user related operations.
|
* User Class to control all user related operations.
|
||||||
* @author : VenbaMail Mali
|
* @author : VenbaMail Mali
|
||||||
@ -224,7 +224,7 @@ class emergencypurchaseorder extends BaseController
|
|||||||
/*----------------------------------special po file upload service----------------------------------*/
|
/*----------------------------------special po file upload service----------------------------------*/
|
||||||
function add($pathname)
|
function add($pathname)
|
||||||
{
|
{
|
||||||
echo "add files";
|
// echo "add files";
|
||||||
// die();
|
// die();
|
||||||
//echo $pathname; die();
|
//echo $pathname; die();
|
||||||
|
|
||||||
@ -236,13 +236,13 @@ function add($pathname)
|
|||||||
$config['allowed_types'] = '*';
|
$config['allowed_types'] = '*';
|
||||||
//$config['allowed_types'] = 'jpg|jpeg|png|gif';
|
//$config['allowed_types'] = 'jpg|jpeg|png|gif';
|
||||||
$config['file_name'] = $_FILES[$pathname]['name'];
|
$config['file_name'] = $_FILES[$pathname]['name'];
|
||||||
echo "if";
|
// echo "if";
|
||||||
//Load upload library and initialize configuration
|
//Load upload library and initialize configuration
|
||||||
$this->load->library('upload',$config);
|
$this->load->library('upload',$config);
|
||||||
$this->upload->initialize($config);
|
$this->upload->initialize($config);
|
||||||
if($this->upload->do_upload($pathname))
|
if($this->upload->do_upload($pathname))
|
||||||
{
|
{
|
||||||
echo "uploadif";
|
// echo "uploadif";
|
||||||
$uploadData = $this->upload->data();
|
$uploadData = $this->upload->data();
|
||||||
$picture = $uploadData['file_name'];
|
$picture = $uploadData['file_name'];
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ function add($pathname)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "else";
|
// echo "else";
|
||||||
$picture = '';
|
$picture = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ require APPPATH . '/third_party/mpdf/mpdf.php';
|
|||||||
* Class : purchaseorder (PurchaseorderController)
|
* Class : purchaseorder (PurchaseorderController)
|
||||||
* User Class to control all user related operations.
|
* User Class to control all user related operations.
|
||||||
* @author : Venba InfoTech
|
* @author : Venba InfoTech
|
||||||
* @version : 1.1
|
* @version : 1.1
|
||||||
* @since : 09/06 Feb 2017
|
* @since : 09/06 Feb 2017
|
||||||
*/
|
*/
|
||||||
class purchaseorder extends BaseController
|
class purchaseorder extends BaseController
|
||||||
@ -4165,29 +4165,39 @@ function addloadfile()
|
|||||||
$igr= $this->input->post('igr');
|
$igr= $this->input->post('igr');
|
||||||
|
|
||||||
$new_file_name =$_FILES['file']['name'];
|
$new_file_name =$_FILES['file']['name'];
|
||||||
//echo $new_file_name;die;
|
|
||||||
if(!empty($new_file_name))
|
|
||||||
|
$file = $this->purchaseorder_model->getfies($pono);
|
||||||
|
|
||||||
|
$fcount=0;
|
||||||
|
|
||||||
|
foreach ($file as $value)
|
||||||
|
{
|
||||||
|
|
||||||
|
$lastfile = $value->FilePath;
|
||||||
|
|
||||||
|
|
||||||
|
if($lastfile == $new_file_name)
|
||||||
|
{
|
||||||
|
$fcount++;
|
||||||
|
echo 'File name already Exist';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($fcount == 0)
|
||||||
{
|
{
|
||||||
$Picture = $this->adfile();
|
$Picture = $this->adfile();
|
||||||
|
$filelist =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture);
|
||||||
|
$uploadfile = $this->purchaseorder_model->insertfile($filelist);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$Picture ='';
|
|
||||||
}
|
|
||||||
//echo $Picture;die;
|
|
||||||
|
|
||||||
$filelist =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture);
|
if($uploadfile > 0){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$uploadfile = $this->purchaseorder_model->insertfile($filelist);
|
|
||||||
|
|
||||||
if($uploadfile > 0){
|
|
||||||
echo "file updated successfully!";
|
echo "file updated successfully!";
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
echo "file not updated!";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function adfile()
|
function adfile()
|
||||||
|
|||||||
46
application/controllers/servicepurchaseorder.php
Executable file → Normal file
46
application/controllers/servicepurchaseorder.php
Executable file → Normal file
@ -666,26 +666,52 @@ function uploadfile()
|
|||||||
|
|
||||||
$new_file_name =$_FILES['file']['name'];
|
$new_file_name =$_FILES['file']['name'];
|
||||||
//echo $new_file_name;die;
|
//echo $new_file_name;die;
|
||||||
if(!empty($new_file_name))
|
// if(!empty($new_file_name))
|
||||||
|
// {
|
||||||
|
// $Picture = $this->adfile();
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $Picture ='';
|
||||||
|
// }
|
||||||
|
//echo $Picture;die;
|
||||||
|
$file = $this->purchaseorder_model->getfies($pono);
|
||||||
|
|
||||||
|
$fcount=0;
|
||||||
|
|
||||||
|
foreach ($file as $value)
|
||||||
|
{
|
||||||
|
|
||||||
|
$lastfile = $value->FilePath;
|
||||||
|
|
||||||
|
|
||||||
|
if($lastfile == $new_file_name)
|
||||||
|
{
|
||||||
|
$fcount++;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$upfile='';
|
||||||
|
|
||||||
|
if($fcount == 0)
|
||||||
{
|
{
|
||||||
$Picture = $this->adfile();
|
$Picture = $this->adfile();
|
||||||
|
$filelist =array('PONO'=>$pono,'FilePath'=>$Picture);
|
||||||
|
$upfile = $this->purchaseorder_model->insertfile($filelist);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$Picture ='';
|
|
||||||
}
|
|
||||||
//echo $Picture;die;
|
|
||||||
$filelist =array('PONO'=>$pono,'FilePath'=>$Picture);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$uploadfile = $this->purchaseorder_model->insertfile($filelist);
|
|
||||||
|
|
||||||
|
|
||||||
if($uploadfile > 0){
|
if($upfile > 0){
|
||||||
echo "file updated successfully!";
|
echo "file updated successfully!";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo "file not updated!";
|
echo "File name already Exist";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
application/models/purchaseorder_model.php
Executable file → Normal file
22
application/models/purchaseorder_model.php
Executable file → Normal file
@ -23,7 +23,25 @@ class purchaseorder_model extends CI_Model
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------may25-------------------*/
|
|
||||||
|
/*------------jun15------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
function getfies($pono)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->db->select('*');
|
||||||
|
|
||||||
|
|
||||||
|
$this->db->from('T_PurchaseOrder_BillUpload bill');
|
||||||
|
|
||||||
|
$this->db->where('PONO',$pono);
|
||||||
|
|
||||||
|
$query = $this->db->get();
|
||||||
|
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
/*-----------jun15-------------------*/
|
||||||
|
|
||||||
|
|
||||||
function updateMatStock($itemNo,
|
function updateMatStock($itemNo,
|
||||||
@ -38,9 +56,7 @@ class purchaseorder_model extends CI_Model
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------may25-------------------*/
|
|
||||||
|
|
||||||
/*------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){
|
function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user