This commit is contained in:
venbatechnologies 2018-07-24 15:38:48 +05:30
parent 6c5704ac60
commit 7ce38fd82f
8 changed files with 1250 additions and 135 deletions

View File

@ -87,39 +87,191 @@ class inwardgateregister extends BaseController
/** /**
* To upload IGR files * To upload IGR files
*/ */
function uploadFile() function adfile()
{ {
$pathinfo = pathinfo($_FILES['myfile']['name']); $picture = '';
if(!empty($_FILES['file']['name']))
{
$config['upload_path'] = 'uploads/Igrfiles/'; $config['upload_path'] = 'uploads/Igrfiles/';
$config['allowed_types'] = 'png|jpg|jpeg|pdf|docx'; $config['allowed_types'] = '*';
$config['file_name'] = $_FILES['myfile']['name']; $config['file_name'] =str_replace(" ","", $_FILES['file']['name']);
//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('myfile')) if($this->upload->do_upload('file'))
{ {
$uploadData = $this->upload->data(); $uploadData = $this->upload->data();
$uploadfilename = $uploadData['file_name']; $picture = $uploadData['file_name'];
return $uploadfilename; // return $uploadfilename;
} }
else else
{ {
$error = array('error' => $this->upload->display_errors()); $error = array('error' => $this->upload->display_errors());
$uploadfilename = ''; $picture = '';
print_r($error);
return 0;
} }
}
else
{
$picture = '';
}
return $picture ;
}
function addloadfile()
{
//echo 'Add new file ';
$upfiles = '';
$pono= $this->input->post('PONO');
$igr= $this->input->post('igr');
//print_r($igr);
$new_file_name =$_FILES['file']['name'];
$new_file_name = str_replace(" ","",$new_file_name);
// print_r($new_file_name);
$files = $this->inwardgateregister_model->getfies($igr);
//print_r($files);
$fcount = 0;
foreach ($files as $value)
{
$lastfile = $value->FilePath;
if($lastfile == $new_file_name)
{
//echo 'eqal';
// echo 'cm'.$fcount;
$fcount ++;
//echo 'cp'.$fcount;
}
}
if($fcount == 0)
{
//echo 'if'.$fcount.'</br>';
if(!empty($new_file_name))
{
$Picture = $this->adfile();
// print_r($Picture); die;
$myfiles =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture);
$upfiles = $this->inwardgateregister_model->fileupload($myfiles);
//print_r($upfiles);
}
}
//echo 'filename'.$upfiles;
if( $upfiles > 0){
echo "file updated successfully!";
}
else
{
echo "File name already Exist";
}
}
function add($pathname)
{
// echo "add files";
// die();
//echo $pathname; die();
$picture = '';
if(!empty($_FILES[$pathname]['name']))
{
$config['upload_path'] = 'uploads/Igrfiles/';
$config['allowed_types'] = '*';
//$config['allowed_types'] = 'jpg|jpeg|png|gif';
$config['file_name'] = str_replace(" ","",$_FILES[$pathname]['name']);
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload($pathname))
{
// echo "uploadif";
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
}
else
{
$error = array('error' => $this->upload->display_errors());
// $uploadfilename = '';
// print_r($error);
// return 0;
$picture = '';
}
}
else
{
// echo "else";
$picture = '';
}
return $picture ;
} }
/** /**
* To Store IGR data into DB * To Store IGR data into DB
*/ */
function edituploadfile()
{
$bill= $this->input->post('param1');
$oldfile = $this->input->post('param2');
$newfile =$this->input->post('file');
// $new_file_name =$_FILES['file']['name'];
$newfile = str_replace(" ","",$newfile);
if(!empty($_FILES['file']['name']))
{
$Picture = $this->adfile();
}else{
$Picture = $oldfile ;
}
//echo $Picture;die;
$uploadfile = $this->inwardgateregister_model->updatefile($bill,$Picture,$oldfile);
// if($uploadfile > 0){
echo "updated successfully!";
// }
// else{
// echo "updated successfully!";
// }
}
function addNewigr() function addNewigr()
{ {
@ -377,6 +529,19 @@ $prefile =array();
} }
function ViewIGRfile()
{
$IGRNO= $this->input->post('id');
// echo($IGRNO);
$igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$billfile = $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
$data = array_merge($igrfile,$billfile);
echo json_encode($data);
}
/** /**
*To Update igr Datas form ajax *To Update igr Datas form ajax
*/ */

View File

@ -496,6 +496,45 @@ class report extends BaseController
$this->loadviews("Report_cumulative_day",$this->global,$data, NULL); $this->loadviews("Report_cumulative_day",$this->global,$data, NULL);
} }
function Viewfiles()
{
$PO= $this->input->post('id');
$PONO= substr($PO,10);
//echo $PONO; die;
$data = $this->dahsboard_Model->getfile($PONO);
// print_r( $data);die;
echo json_encode($data);
}
function Viewnormaligrfiles()
{
$igr= $this->input->post('id');
$PONO= $this->input->post('id1');
// $PONO= substr($PO,5);
//echo $PONO; die;
$igrfile= $this->dahsboard_Model->getfiles($igr,$PONO);
// $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$billfile = $this->dahsboard_Model->viewIGRFile1($igr,$PONO);
$data = array_merge($igrfile,$billfile);
// print_r( $data);die;
echo json_encode($data);
}
public function ipurchase() public function ipurchase()
{ {
@ -1260,18 +1299,7 @@ class report extends BaseController
} }
function Viewfiles()
{
$PO= $this->input->post('id');
$PONO= substr($PO,5);
$data = $this->dahsboard_Model->getfile($PONO);
echo json_encode($data);
}
} }
?> ?>

View File

@ -30,8 +30,51 @@ class dahsboard_Model extends CI_Model
return $query->result(); return $query->result();
} }
function getfiles($igr,$PONO)
{
//$this->db->distinct();
$this->db->select('*');
$this->db->from('T_Inwardgateregister_fileupload');
$this->db->where('IGRNO',$igr);
$this->db->where('PONO',$PONO);
$query = $this->db->get();
// print_r( $this->db->last_query());
$result = $query->result_array();
return $result;
}
function viewIGRFile1($igr,$PONO)
{
$this->db->distinct();
$this->db->select('igrm.file,igrm.PONO as pono'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_IGR_Master igrm');
$this->db->where('igrm.IGRNO',$igr);
$this->db->where('igrm.PONO',$PONO);
$query = $this->db->get();
$result = $query->result();
// print_r($result);die;
//print_r($this->db->last_query());
return $result;
}
function selectigrfiles()
{
$this->db->select('*');
$this->db->from('T_Inwardgateregister_fileupload');
//$this->db->where('PONO',$PONO);
$query = $this->db->get();
// print_r( $this->db->last_query());
$result = $query->result_array();
return $result;
}
function totloan() function totloan()
{ {
@ -1472,7 +1515,7 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
- round(ifnull(if(POType = 'REVENUE', - round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
from T_IGR_Master im from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@ -1482,6 +1525,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
left join T_Inwardgateregister_fileupload infiles on infiles.IGRNO = im.IGRNO
where pm.Status != 'ST030' "; where pm.Status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1576,7 +1620,7 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
- round(ifnull(if(POType = 'REVENUE', - round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
from T_IGR_Master im from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@ -1586,6 +1630,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
left join T_Inwardgateregister_fileupload infiles on infiles.IGRNO = im.IGRNO
where pm.Status != 'ST030' "; where pm.Status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1671,7 +1716,7 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){ function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
$sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name, $sql="select pono,igrn,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
sum(total) as total,file,ifile sum(total) as total,file,ifile
from igr from igr
where status != 'ST030' where status != 'ST030'
@ -1712,9 +1757,33 @@ if ($cname!= ''){
// echo $sid; // echo $sid;
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); $filequery = $query->result();
}
$resultArray = array();
foreach ($filequery as $value) {
$tempArray['pono'] = $value->pono;
$tempArray['potype'] =$value->potype;
$tempArray['supplier_name'] = $value->supplier_name;
$tempArray['materialrcvddate'] = $value->materialrcvddate;
$tempArray['total'] = $value->total;
$tempArray['created_date'] = $value->created_date;
$tempArray['file'] = $value->file;
$tempArray['ifile'] = $value->ifile;
$tempArray['igrn'] =$value->igrn;
$sqli ="select FilePath as Infiles from T_Inwardgateregister_fileupload where PONO =? and IGRNO =? ";
$querys = $this->db->query($sqli,array( $tempArray['pono'],$tempArray['igrn']));
$filepath = $querys->result();
$tempArray['Infiles'] = $filepath;
$resultArray[] = $tempArray;
}
return $resultArray;
}
function ireport_year_wise($a,$b){ function ireport_year_wise($a,$b){

View File

@ -89,14 +89,16 @@ class inwardgateregister_model extends CI_Model
function igrListing() function igrListing()
{ {
$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,igr.file,igrdetail.*,POL.Quantity,MM.MaterialName'); //$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,fileup.FilePath,igr.file');
$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,fileup.FilePath,igr.file,igrdetail.*,POL.Quantity,MM.MaterialName');
$this->db->from('T_IGR_Master igr'); $this->db->from('T_IGR_Master igr');
$this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO'); $this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO');
$this->db->join('T_Inwardgateregister_fileupload fileup',' igr.IGRNO = fileup.IGRNO','left');
$this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID'); $this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID');
$this->db->join('T_IGR_Details igrdetail','igrdetail.IGRNO = igr.IGRNO'); $this->db->join('T_IGR_Details igrdetail','igrdetail.IGRNO = igr.IGRNO');
$this->db->join('T_PurchaseOrder_LineItem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrdetail.MaterialCode'); $this->db->join('T_PurchaseOrder_LineItem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrdetail.MaterialCode');
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrdetail.MaterialCode'); $this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrdetail.MaterialCode');
$this->db->order_by('igr.IGRNO','desc'); $this->db->group_by('igr.IGRNO','desc');
//$this->db->group_by('igr.IGRNO'); //$this->db->group_by('igr.IGRNO');
$query = $this->db->get(); $query = $this->db->get();
$result = $query->result(); $result = $query->result();
@ -119,10 +121,26 @@ class inwardgateregister_model extends CI_Model
return $result; return $result;
} }
/** function viewIGRFile1($IGRNO)
* To get the po details {
* @return array $result : result of the query (returns po information) $this->db->distinct();
*/ $this->db->select('igrm.file,igrm.PONO as pono'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_IGR_Master igrm');
//$this->db->join('T_Inwardgateregister_fileupload igrf','igrm.IGRNO = igrf.IGRNO','left');
//$this->db->join('T_IGR_Details igrd','igrm.IGRNO = igrd.IGRNO','left');
$this->db->where('igrm.IGRNO',$IGRNO);
$query = $this->db->get();
$result = $query->result();
// print_r($result);die;
//print_r($this->db->last_query());
return $result;
}
function getpurchaseorder() function getpurchaseorder()
{ {
$this->db->distinct(); $this->db->distinct();

View File

@ -230,31 +230,43 @@
$tot_tot = 0; $tot_tot = 0;
foreach($purchase as $rel) foreach($purchase as $rel)
{ {
//print_r($rel);
?> ?>
<tr> <tr>
<td><span> <td><span>
<a href="<?php echo base_url().'purchaseorder/CreatePOPrint?PONO='.$rel->pono.'&ReqType='.$rel->potype; ?>"><?php echo $rel->pono;?></a> <a href="<?php echo base_url().'purchaseorder/CreatePOPrint?PONO='.$rel['pono'],'&ReqType='.$rel['potype']; ?>"><?php echo $rel['pono'];?></a>
</span></td> </span></td>
<td style="text-align:center"><span><?php echo $rel->created_date;?></span></td> <td style="text-align:center"><span><?php echo $rel['created_date'];?></span></td>
<td style="text-align:center"><span><?php echo $rel->materialrcvddate;?></span></td> <td style="text-align:center"><span><?php echo $rel['materialrcvddate'];?></span></td>
<td><span> <td><span>
<a href="<?= base_url() ?>report/ilink_purchase?po=<?php echo $rel->pono;?>"><?php echo $rel->supplier_name;?> </a> <a href="<?= base_url() ?>report/ilink_purchase?po=<?php echo $rel['pono'];?>"><?php echo $rel['supplier_name'];?> </a>
</span></td> </span></td>
<td style="text-align:right"><span><?php <td style="text-align:right">
$tot_tot= $tot_tot + round($rel->total,2); <span><?php
echo $rel->total; $tot_tot= $tot_tot + round($rel['total'],2);
echo $rel['total'];
?></span></td> ?></span></td>
<!-- $record->IGRNO.'-'.$record->PONO -->
<td style="text-align:center"><span> <td style="text-align:center"><span>
<?php <?php
if(!empty($rel->file)){ ?> if(!empty($rel['file'])){ ?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="files<?php echo $rel->pono;?>">Download</button></a> <a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="<?php echo $rel['igrn'].'-'.$rel['pono'];?>">Download</button></a>
<?php }else if(!empty($rel->ifile)) { ?>
<a target="_blank" href="<?php echo base_url().''. $rel->ifile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm">Download</button></a> <?php } elseif(!empty($rel['ifile'])){?>
<?php
}else { <a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel['igrn'].'-'.$rel['pono'];?>">Download</button></a>
echo 'N/A'; <?php } elseif(!empty(sizeof($rel['Infiles'])) !=0){?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel['igrn'].'-'.$rel['pono'];?>">Download</button></a>
<?php }else{
echo "N/A";
} }
?> ?>
</span></td> </span></td>
@ -306,7 +318,101 @@
<script> <script>
$('.IGRfile').click(function() {
var id = $(this).attr('id');
//alert(id);
var igr = id.substring(0, 9);
//alert(igr);
var po = id.substring(10, 33);
//alert(po);
$("#Fileshow").modal("show");
$.ajax({
data:{id:igr,id1:po},
type:"POST",
//dataType: 'json',
url:"<?php echo base_url() ?>report/Viewnormaligrfiles",
success: function(data){
//console.log((data));
// var trHTML = '';
// $.each($.parseJSON(data), function (i, item) {
var trHTML = '';
var trHTML = '';
var FilePath ='';
var Filename = '';
var PONO ='';
var BillNO ='';
$.each($.parseJSON(data), function (i, item) {
if(item.file == null)
{ if(item.Remarks ==null)
{
//alert()
PONO =item.PONO;
BillNO =item.BillNo;
Filename =item.FilePath;
FilePath = "<?php echo base_url()?>uploads/Igrfiles/"+item.FilePath;
}
// else{
// Filename ="BillDetails";
// PONO =item.PONO;
// BillNO =item.BillNo;
// FilePath = item.FilePath;
// }
}else{
Filename = item.file;
PONO =item.pono;
BillNO = '-';
FilePath =item.file;
}
// i=i+1;
// trHTML += '<tr>' +
// '<td align="right">' + i + '</td>' +
// '<td>' + item.BillNo+ '</td>' +
// '<td>' + item.PONO+ '</td>' +
// '<td><a target="_blank" href = <?php echo base_url()?>uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
// // '<td>' +item.FilePath+"<?php echo base_url().'uploads/BillFiles/'?>"> +'</td>'
// '</tr>';
if(Filename != null)
{
i=i+1;
trHTML += '<tr id='+i+'>' +
'<td align="right">' + i + '</td>' +
'<td id="billno'+i+'">' + BillNO+ '</td>' +
'<td>' + PONO+ '</td>' +
'<td id="file'+i+'"><a target="_blank" href = '+FilePath+'>'+ Filename +'</a></td>' +
// '<td name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' +
'</tr>';
}
});
$("#tbleAppend1").empty();
$('#Inwardgateregistertable1 > tbody').append(trHTML);
}
});
});
// Bootstrap datepicker // Bootstrap datepicker
// Set up your table // Set up your table
$(document).ready(function() { $(document).ready(function() {

View File

@ -352,11 +352,14 @@ table.dataTable thead > tr > td.sorting {
<td id="download<?php echo $key?>" style="text-align:center"><span> <td id="download<?php echo $key?>" style="text-align:center"><span>
<?php <?php
if(!empty($rel->file)){ ?><!-- if for Inward po file --> if(!empty($rel->file)){ ?><!-- if for Inward po file -->
<a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="files<?php echo $rel->pono;?>">Download</button></a> <a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="<?php echo $rel->igrn.'-'.$rel->pono;?>">Download</button></a>
<?php }else if(!empty($rel->ifile)) { ?><!-- else if for igr file --> <?php }
<a target="_blank" href="<?php echo base_url().''.$rel->ifile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"> else if(!empty($rel->ifile )) { ?><!-- else if for igr file -->
<button class="btn btn-info btn-sm">Download</button> <a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View">
<button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel->igrn.'-'.$rel->pono;?>">Download</button>
</a> </a>
<?php } else if (!empty($rel->Infiles)){ ?><!-- if for Inward po file -->
<a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel->igrn.'-'.$rel->pono;?>">Download</button></a>
<?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means --> <?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means -->
</span></td> </span></td>
@ -461,6 +464,86 @@ $('.splpofile').click(function() {
}); });
});//onclick function closed });//onclick function closed
$('.IGRfile').click(function() {
var id = $(this).attr('id');
var igr = id.substring(0, 9);
//alert(igr);
var po = id.substring(10, 33);
$("#Fileshow").modal("show");
$.ajax({
data:{id:igr,id1:po},
type:"POST",
url:"<?php echo base_url() ?>report/Viewnormaligrfiles",
success: function(data){
var trHTML = '';
var trHTML = '';
var FilePath ='';
var Filename = '';
var PONO ='';
var BillNO ='';
$.each($.parseJSON(data), function (i, item) {
if(item.file == null)
{ if(item.Remarks ==null)
{
//alert()
PONO =item.PONO;
BillNO =item.BillNo;
Filename =item.FilePath;
FilePath = "<?php echo base_url()?>uploads/Igrfiles/"+item.FilePath;
}else{
Filename ="BillDetails";
PONO =item.PONO;
BillNO =item.BillNo;
FilePath = item.FilePath;
}
}else{
Filename = item.file;
PONO =item.pono;
BillNO = '-';
FilePath =item.file;
}
// i=i+1;
// trHTML += '<tr>' +
// '<td align="right">' + i + '</td>' +
// '<td>' + item.BillNo+ '</td>' +
// '<td>' + item.PONO+ '</td>' +
// '<td><a target="_blank" href = <?php echo base_url()?>uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
// '</tr>';
if(Filename != null)
{
i=i+1;
trHTML += '<tr id='+i+'>' +
'<td align="right">' + i + '</td>' +
'<td id="billno'+i+'">' + BillNO+ '</td>' +
'<td>' + PONO+ '</td>' +
'<td id="file'+i+'"><a target="_blank" href = '+FilePath+'>'+ Filename +'</a></td>' +
// '<td name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' +
'</tr>';
}
});
$("#tbleAppend1").empty();
$('#Inwardgateregistertable1 > tbody').append(trHTML);
}
});
});// onclick function innormal igrfiles
/******************** Datatable codes starts here **************************/ /******************** Datatable codes starts here **************************/
$.fn.dataTable.moment( 'DD-MM-YYYY' ); $.fn.dataTable.moment( 'DD-MM-YYYY' );

View File

@ -70,15 +70,13 @@ Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
<section class="content" style="margin: 15px;"><br/> <section class="content" style="margin: 15px;"><br/>
<div style="border:2px solid #333;"> <div style="border:2px solid #333;">
<form action ="<?php echo base_url()?>inwardgateregister/addNewigr"
<div><br/><br/> method="post" enctype="multipart/form-data">
<div class="row"><br/><br/>
<div id="content" > </div> <div id="content" > </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-3"> <div class="col-md-3">
<?php
$attributes = array('class' => 'form-label-left IGR ','name' => 'IGR','id' => 'IGR');
echo form_open($this->config->base_url().'/inwardgateregister/addNewigr/',$attributes); ?>
<label>Select Purchase Order No </label> <label>Select Purchase Order No </label>
<?php <?php
@ -159,7 +157,9 @@ Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
?> ?>
</div> </div>
</div> </div>
<div class="col-md-12">
<!-- <div class="col-md-12">
<div class="col-md-offset-4"> <div class="col-md-offset-4">
<div class="box-header"> <div class="box-header">
<input type="file" accept=".png,.jpg,.pdf" id="myfile" name="myfile" /> <input type="file" accept=".png,.jpg,.pdf" id="myfile" name="myfile" />
@ -168,7 +168,16 @@ Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
<label for="photo">Select File to upload<br/></label> <label for="photo">Select File to upload<br/></label>
</div> </div>
</div> </div>
</div> -->
</div> </div>
<div class="col-md-12" style="margin-top: 10px;">
<input type="button" class="btn btn-primary" id ="addemorebutton" value=" + ADD FILES..">
<div id="newsdiv"></div><!-- this div for add more section-->
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
</div> </div>
<div class="row"> <div class="row">
@ -200,7 +209,7 @@ Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
</table> </table>
<input type="hidden" name="txtRowCount" id="txtRowCount" /> <input type="hidden" name="txtRowCount" id="txtRowCount" />
<div class="col-md-1 col-md-offset-10"> <div class="col-md-1 col-md-offset-10">
<a class="btn btn-primary" id='IGRLink' name='IGRLink' onclick="filecheck();">Generate IGR</a> <button class="btn btn-primary" id='IGRLink' name='IGRLink' onclick="filecheck();">Generate IGR</button>
</div> </div>
</div> </div>
</div> </div>
@ -466,15 +475,6 @@ function validate()
value:item.PendingQty value:item.PendingQty
}).appendTo('form'); }).appendTo('form');
// $.ajax({
// data:{PO:id},
// type:"POST",
// url:"<?php echo base_url() ?>inwardgateregister/UpdateStatus",
// success:function(data) {
// }});
if(item.PendingQty == 0.00) if(item.PendingQty == 0.00)
{ {
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true'); $('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
@ -592,31 +592,202 @@ function Save()
}//save function closed }//save function closed
</script>
<script>
var counters = 0;
var counterConstants = 0;
$("#addemorebutton").click(function(){
//alert('sda');
if(counters>4){
swal("No more files to add");//this allows only 5 files;
return false;
}
else{
counters++;
counterConstants++;
var div = document.createElement('div');
div.id = "divid"+counters;
div.className="row";
div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+
'<label><br></label>'+
'<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
'</div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-primary" type ="button" onclick="addRow('+counters+')"id="addbtn1" ><i class="fa fa-plus-square"></i></button></div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i> </button></div>'+
'</div>';
$('#newsdiv').append(div);
$('#hidecounters').val(counters);
$('#hideconstants').val(counterConstants);
if(counters > 1){
swal("Add button click here");//this allows only 5 files;
return false;
}
else {
$('#addemorebutton').hide();
}
// document.write("browseFiles"+length);
}
});
function addRow(inputs)
{ if(inputs <5){
if(inputs ==0){
inputs = inputs+1;
$("#addbtn"+inputs).hide();
$("#removebtn"+inputs).hide();
}else{
$("#addbtn"+inputs).hide();
$("#removebtn"+inputs).hide();
}
}else{
$("#addbtn"+inputs).show();
$("#removebtn"+inputs).show();
}
// alert(s);
if(counters>4){
swal("No more files to add");//this allows only 5 files;
return false;
}
else{
counters++;
counterConstants++;
//alert("count"+counterConstants);
var div = document.createElement('div');
div.id = "divid"+counters;
div.className="row";
div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+
'<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilenames(this.name); "><br>'+
'</div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-primary" type ="button" id="addbtn'+counters+'" onclick="addRow('+counters+')"><i class="fa fa-plus-square"></i></button></div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
'</div>'+
'</div>';
$('#newsdiv').append(div);
$('#hidecounters').val(counters);
$('#hideconstants').val(counterConstants);
if(counters > 1){
//alert("Next File choose + button click here");//this allows only 5 files;
//return false;
$('#addbtn').hide();
$("#removebtn").hide();
}
else {
$('#addemorebutton').hide();
}
}
}
function filecheck() function filecheck()
{ {
var myfile = $('#myfile').val(); var myfile = $('#images').val();
if(myfile=='') if(myfile==''){
{ swal('File not Found');
alert('File not Found'); //Save();
Save();
} }
else else
{ {
var sizef = document.getElementById('myfile').files[0].size; // var sizef = document.getElementById('myfile').files[0].size;
var myfile = $('#myfile').val(); // var myfile = $('#myfile').val();
if(myfile!='' && sizef < 2100000) // if(myfile!='' && sizef < 2100000)
{ // {
alert('Your file added successfully'); // alert('Your file added successfully');
Save(); Save();
} }
else }
function Copyfilenames(id)
{ {
alert('Sorry Your File is Large To 2MB');
$('#myfile').val(''); var size = $('input[name='+id+']')[0].files[0].size;
}
var number = id.replace(/[^0-9]+/ig,"");
if(size > 2100000){
//alert(id);
swal('Sorry Your File is Large To 2MB');
removeRows(id);
//$('input[name = browseFiles'+number+']').val(' ');
}else {
var name = $('input[name='+id+']')[0].files[0].name;
} }
}
function removeRows(inputs) {
// alert(input);
var number = inputs.replace(/[^0-9]+/ig,"");
//alert(number);
if(counters >= 1){
counters --;
$("#divid"+number).remove();
$('#hidecounters').val(counters);
}
var rm_count = $("#hideconstants").val();
if(counters !=0){
if(number != rm_count){
// alert("if");
$("#addbtn"+counters).show();
$("#removebtn"+counters).show();
}else{
//alert('else');
$("#addbtn"+counters).show();
$("#removebtn"+counters).show();
} }
}else{
$("#addemorebutton").show();
}
}
</script> </script>

View File

@ -42,6 +42,15 @@
<div class="box-header"> <div class="box-header">
<!-- <CENTER><h3 class="box-title">Resico Industries -View Inward Gate Register</h3></CENTER> --> <!-- <CENTER><h3 class="box-title">Resico Industries -View Inward Gate Register</h3></CENTER> -->
<CENTER><h3 class="box-title"><?php echo $pageTitle; ?></h3></CENTER> <CENTER><h3 class="box-title"><?php echo $pageTitle; ?></h3></CENTER>
</div>
<div class="row">
<div class="col-md-12 text-right" style="margin-bottom:-3%;">
<div class="form-group">
<a class="btn btn-primary" onclick="Test()" href="<?php echo base_url(); ?>Addigr">Add New </a>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -49,7 +58,7 @@
<table id="Inwardgateregistertable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;"> <table id="Inwardgateregistertable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf"> <thead style="background-color:#ddf">
<tr> <tr>
<th>S.No</th> <!-- <th>S.No</th> -->
<th>IGR No</th> <th>IGR No</th>
<th>PO No</th> <th>PO No</th>
<th>Supplier Name</th> <th>Supplier Name</th>
@ -71,13 +80,13 @@
{ $index = 0; { $index = 0;
foreach($IGR as $record) foreach($IGR as $record)
{ {
// print_r($record);
$index = $index +1; $index = $index +1;
?> ?>
<tr id="<?php echo $index ?>" > <tr id="<?php echo $index ?>" >
<td style="text-align: center;"><?php echo $index?></td> <!-- <td style="text-align: center;"><?php echo $index?></td> -->
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $record->IGRNO.",".$record->IGRItemNo ?>" > <u><?php echo $record->IGRNO ?></u></a></td> <td><a data-toggle="modal" data-target="#Igrshow" data-id="<%=index%>" data-userid="<?php echo $record->IGRNO.",".$record->IGRItemNo ?>" > <u><?php echo $record->IGRNO ?></u></a></td>
<!-- <td><a data-toggle="modal" data-target="#Igrshow" data-id=""<%=index%>" data-userid="<?php echo $record->IGRNO ?>" > <u><?php echo $record->IGRNO ?></u></a></td>--> <!-- <td><a data-toggle="modal" data-target="#Igrshow" data-id=""<%=index%>" data-userid="<?php echo $record->IGRNO ?>" > <u><?php echo $record->IGRNO ?></u></a></td>-->
<td><?php echo $record->PONO ?></a></td> <td><?php echo $record->PONO ?></a></td>
<td><?php echo $record->SupplierName ?></td> <td><?php echo $record->SupplierName ?></td>
@ -93,18 +102,32 @@
<td><?php echo $record->CourierNo ?></td> <td><?php echo $record->CourierNo ?></td>
<td> <td>
<?php <?php
if(!empty($record->file)) if(!empty($record->FilePath))
{ {
?> ?>
<a target="_blank" href="<?php echo base_url().$record->file ?>"><i class="fa fa-download" ></i></a>
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-userid="<?php echo $record->IGRNO.'-'.$record->PONO ?>"><button class="btn btn-info btn-sm " >Download</button></a>
<?php <?php
} else{ } else if(!empty($record->file))
echo "NO FILE"; { ?>
}
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-userid="<?php echo $record->IGRNO ?>"><button class="btn btn-info btn-sm ">Download</button></a>
<?php }
else
{?>
<!-- echo "NO FILE"; -->
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-userid="<?php echo $record->IGRNO.'-'.$record->PONO ?>"><i class="fa fa-pencil" style="text-align: center;"></i></a>
<?php }
?> ?>
</td> </td>
<!--<td><?php echo $record->file ?></td>-->
</tr> </tr>
@ -124,6 +147,118 @@
</div> </div>
</div> </div>
</div> </div>
<!-- ######################################edit file########################### -->
<div class="modal fade" id="Fileshow" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content" style="width:800px;">
<div class="modal-header" style="background-color: #5d0411;color:#fff;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Inward Gate File Details</h4></center> <!-- IGR number should display here-->
</div>
<!-- Table to show the line item of po -->
<div id="contents" > </div>
<table class="table table-bordered" id="Inwardgateregisterfile" style="font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>SNo</th>
<th>BillNO</th>
<th>PONO</th>
<th>FileName</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tblefile">
</tbody>
</table>
<div class="col-md-12">
<div class="col-md-offset-10 col-md-8" >
<input type="button" class="btn btn-primary" id ="addmorebutton" value=" ADD FILES..">
</div>
<div id="newdiv"></div>
<input type="hidden" name="hidecounter" id="hidecounter" value="0" />
<!-- <input type="hidden" name="hideconstant" id="hideconstant" value="0" /> -->
<input type ="hidden" name ="hiddenIGRNO" id="hiddenIGRNO"/>
<input type ="hidden" name ="hiddenPONO" id="hiddenPONO" />
</div>
<div class="modal-footer">
<!-- <a class="btn btn-primary" data-dismiss="modal" id='editfileadd' value="">ADD</a> -->
<br>
</br>
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
</form>
</div>
</div>
<div id="billModel" class="modal fade" data-backdrop-limit="1" role="dialog" aria-labelledby="myModalLabel" >
<div class="modal-dialog">
<div class="modal-content" style="width:950px;">
<div class="modal-header">
<h4 class="modal-title">Update Bill Details</h4>
</div>
<form class="tagForm" id="tag-form" method="post" enctype="multipart/form-data" >
<div class="modal-body" style="padding:0px;">
<div class="col-md-12">
<div class="col-md-5">
<!-- onChange="filecheck();" -->
<input type = "file" size = "20" input accept=".docx,.pdf,.doc.JPG,.PNG,.jpg" id="billimag" name="images" />
<label for="images">Select file <br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label>
</div>
</div>
<input type="hidden" name="hideoldfile" id="hideoldfile" class="form-control" readonly>
<input type="hidden" name="hidebillno" id="hidebillno" class="form-control"
readonly>
</div><!-- /.modal body -->
<div class="modal-footer">
<div class="col-md-12 text-right">
<div class="col-md-4 col-md-offset-8">
<a class="btn btn-primary" onclick="fileupdate()" >&nbsp;&nbsp;<span class="bold">Update</span>
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
</div><!-- /.modal footer -->
</form>
</div><!-- /.modal content -->
</div><!-- /.modal dialog -->
</div><!-- /#filemodal -->
<div class="modal fade" id="Igrshow" role="dialog"> <div class="modal fade" id="Igrshow" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<!-- Modal content--> <!-- Modal content-->
@ -133,6 +268,7 @@
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Inward Gate Register Details</h4></center> <!-- IGR number should display here--> <center><h4>Inward Gate Register Details</h4></center> <!-- IGR number should display here-->
</div> </div>
<input type="hidden" id="counts">
<!--<div class="col-md-12"> <!--<div class="col-md-12">
<div class="col-md-3"> <div class="col-md-3">
<label>IGR Number :</label> <label>IGR Number :</label>
@ -271,34 +407,86 @@
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<script> <script>
<!-- script for table , It works under the datatable plugin-->
$(document).ready(function() {
// buttons: [ {name: 'copy', extend: 'copy', exportOptions: {columns: ':gt(0)', orthogonal: 'export'}} ]
table = $('#Inwardgateregistertable').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-3'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
"lengthMenu": [ 25, 50, 75, 100 ],
buttons: [
function filecheck()
{ {
extend: 'excelHtml5', var sizef = document.getElementById('billimag').files[0].size;
footer: 'true', var file = $('#billimag').val();
//messageTop: $('h3').text(),
title: $('h3').text(), if(file!='' && sizef < 2100000)
exportOptions: { { // alert('Your file added successfully');
//columns: ':lt(13)', orthogonal: 'export' }
columns: ':visible' else
{
alert('Sorry Your File is Large To 2MB');
$('#billimag').val('');
}
}
function fileupdate(){
var formData = new FormData();
//var file = document.getElementById('billimag').files[0];
var file = $("#billimag").prop('files')[0];
var param1 = $('#hidebillno').val();
// alert(param1);
var param2 = $('#hideoldfile').val();
// alert(param2);
// var filename = $("#billimag").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:"<?php echo base_url() ?>inwardgateregister/edituploadfile",
cache : false,
contentType : false,
processData : false,
success:function(data) {
if(data){
alert(data);
window.location.reload();
$('.content').loader('hide');
// $('#spl').find('td').eq(5).text(filename[2]);
$('#billModel').modal('hide');
}
} }
},
]
} );
}); });
}
$(document).ready(function() {
// // buttons: [ {name: 'copy', extend: 'copy', exportOptions: {columns: ':gt(0)', orthogonal: 'export'}} ]
// table = $('#Inwardgateregistertable').DataTable( {
// "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
// "<'row'<'col-md-3'><'col-md-6'>>" +
// "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
// "lengthMenu": [ 25, 50, 75, 100 ], buttons: {
// extend: 'excelHtml5',
// footer: 'true',
// //messageTop: $('h3').text(),
// title: $('h3').text(),
// exportOptions: {
// //columns: ':lt(13)', orthogonal: 'export'
// columns: ':visible'}
// },
// ]
// } );
// } );
// $(function () { // $(function () {
// $('#Inwardgateregistertable').DataTable({ // $('#Inwardgateregistertable').DataTable({
// "paging": true, // "paging": true,
@ -310,6 +498,140 @@ $(document).ready(function() {
// }); // });
// }); // });
$("#Fileshow").on("shown.bs.modal",function(e) {
//var id = $(this).attr('id');
var id = $(e.relatedTarget).data('userid');
//swal(id);
// SIA/2018-2019/10243.01
// IGRNO0505
var igr = id.substring(0, 9);
var po = id.substring(10, 33);
$("#hiddenIGRNO").val(igr);
$("#hiddenPONO").val(po);
if(id !=''){
$.ajax({
data:{id:igr,id1:po},
type:"POST",
//dataType: 'json',
url:"<?php echo base_url() ?>inwardgateregister/ViewIGRfile",
success: function(file)
{
$("#counts").val(JSON.parse(file).length);
var trHTML = '';
var FilePath ='';
var Filename = '';
var PONO ='';
var BillNO ='';
$.each(JSON.parse(file), function (i, item)
{
if(item.file == null)
{ if(item.Remarks ==null)
{
//alert()
PONO =item.PONO;
BillNO =item.BillNo;
Filename =item.FilePath;
FilePath = "<?php echo base_url()?>uploads/Igrfiles/"+item.FilePath;
// }else{
// Filename ="BillDetails";
// PONO =item.PONO;
// BillNO =item.BillNo;
// FilePath = item.FilePath;
// }
}else{
Filename = item.file;
PONO =item.pono;
BillNO = '-';
FilePath =item.file;
}
if(Filename != null)
{
i=i+1;
trHTML += '<tr id='+i+'>' +
'<td align="right">' + i + '</td>' +
'<td id="billno'+i+'">' + BillNO+ '</td>' +
'<td>' + PONO+ '</td>' +
'<td id="file'+i+'"><a target="_blank" href = '+FilePath+'>'+ Filename +'</a></td>' +
'<td name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' +
'</tr>';
}
}
});
$("#tblefile").empty();
$("#tblefile").append(trHTML);
}
});
}
});
});
function openbillmodel(i){
// alert(i);
// return false;
var igr = $("#tblefile").find('tr').find('td').eq(2).text();
// alert(igr);
var Billno = $("#billno"+i).text();
// alert(Billno);
var file = $("#file"+i).text();
//alert(file);
$("#billModel").modal("show");
$("#bill").text(Billno);
$("#hideoldfile").val(file);
$("#hidebillno").val(Billno);
}
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
<!-- script for table , It works under the datatable plugin-->
$(function () {
$.fn.dataTable.moment( 'DD-MM-YYYY' );
$('#Inwardgateregistertable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 4, "desc" ]],
"info": true,
"autoWidth": true
});
});
</script> </script>
<script> <script>
$("#Igrshow").on("shown.bs.modal", function(e) { $("#Igrshow").on("shown.bs.modal", function(e) {
@ -317,6 +639,7 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
var igr_nos = $(e.relatedTarget).data('id'); var igr_nos = $(e.relatedTarget).data('id');
var igr = igr_nos.split(','); var igr = igr_nos.split(',');
igr = igr[1]; igr = igr[1];
//alert(igr_nos+igr); //alert(igr_nos+igr);
$('#content').loader('show'); $('#content').loader('show');
$.ajax({ $.ajax({
@ -375,3 +698,155 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
}); });
</script> </script>
<script>
var counter = 0;
//var counterConstant = 0;
$("#addmorebutton").click(function(){
var file_count = $("#counts").val();
counter++;
var bil_count = +counter+ +file_count;
// alert(bil_count);
// alert(file_count);
if(bil_count>=6){
swal("You have to upload five files only");//this allows only 5 files;
$('#addmorebutton').hide();
return false;
}
var div = document.createElement('div');
div.id = "divid";
div.className="row";
//alert(counter);
div.innerHTML='<div class="col-md-12">'+
// '<div class="col-md-3">'+
// '<label>File Name</label>'+
// '<input type="text" id="maint_filename'+counterConstant+'" name="filename'+counterConstant+'" class="form-control" onkeypress="return false;" readonly/>'+
// '</div>'+
'<div class="col-md-3">'+
'<label><br></label>'+
'<input type="file" name="browseFiles" id="images'+counter+'" ><br>'+
'</div>'+
// '<div class="col-md-3">'
// '<label><br><br></label>'+
// '<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+
'<div class="col-md-2">'+
'<label><br><br></label>'+
'<button class="btn btn-primary" type ="button" id="addbtn" onclick="addRow()">ADD</button></div>'+
'</div>'+
'</div>';
$('#newdiv').append(div);
$('#hidecounter').val(counter);
if(counter>1){
alert("Add button click here");//this allows only 5 files;
return false;
}
else{
$('#addmorebutton').hide();
}
//}
});
function addRow()
{
//var file = $('#imag').val();
var file = $('#images'+counter).val();
if (file == '')
{
alert('File not found');
}
else {
fileupload(counter);
}
}
// function Copyfilename(id)
// {
// var size = $('input[name='+id+']')[0].files[0].size;
// var number = id.replace(/[^0-9]+/ig,"");
// if(size > 2100000){
// //alert(id);
// alert('Sorry Your File is Large To 2MB');
// removeRow(id);
// //$('input[name = browseFiles'+number+']').val(' ');
// }else {
// var name = $('input[name='+id+']')[0].files[0].name;
// //alert(name);
// $("#maint_filename"+number).val(name);
// }
// }
function fileupload(counter)
{
//alert(counter);
var formData = new FormData();
// var file = $("#images"+counter).prop('file')[0];
var file = document.getElementById('images'+counter).files[0];
// alert(file);
var PONO =$('#hiddenPONO').val();
// alert(PONO);
var igr =$('#hiddenIGRNO').val();
//alert(igr);
formData.append('file',file);
formData.append('PONO',PONO);
formData.append('count',counter);
formData.append('igr',igr);
$('.content').loader('show');
$.ajax({
data:formData,
type:"POST",
url:"<?php echo base_url() ?>inwardgateregister/addloadfile",
cache : false,
contentType : false,
processData : false,
success:function(data) {
if(data){
alert(data);
window.location.reload();
$('.content').loader('hide');
// $('#spl').find('td').eq(5).text(filename[2]);
$('#billModel').modal('hide');
}
}
});
}
</script>