<script type="text/javascript" src="js/tableExport.js"></script>

<script type="text/javascript" src="js/jquery.base64.js"></script>

<style>.top-bar-minimize{display:none;}
thead, tfoot {display: table-header-group;}
.top-bar+.well,.accordion .accordion-heading+.accordion-body{display: inline-block !important;width: 100% !important;overflow: inherit !important;} 
.dynamic{display:none}
table td {
padding: 6px !important;
}
legend{line-height: 16px;font-weight:100;}

.outer .MigrateLeftFee{
  background-color: #DADADA !important;
  border: 5px solid #181616 !important;
  min-height: 440px;
  min-width:700px;
}
.st {
	width: 55px;
	font-size:10px;
	display: inline-block;
	color: #021EF0;
}
.size{
	font-size:12px;
}
.recepit {
	width: 717px !important;
	height: 344px !important;
}
.total{
	color: darkgreen;
    font-weight: 800;
}
</style>
<input type="hidden" name="tog" id="togglevalueforzeoshow" value="0" />
<script>


function checkAll(){
	if($('#checkboxa').prop('checked')) {
		$('.checkboxes').prop('checked', true);
		 
    } else {
		
        $('.checkboxes').prop('checked', false);
    }
	
	//var chk=$('input[name=cat]:checked').length;
	
	//alert(chk);
	
}
function  sendAll(){
	checked = $('input[name=sid]:checked');
        if( checked.length > 0 ) {
            var checkValues = checked.map(function(){
               return $(this).val();
            }).get();
			//alert(checkValues);
			//confirm();
			var chk=checkValues.toString();
			$.post( "?src=sms&page_id=sms&type=student", { type: "POST" ,chk: chk} , function( data ) {
	  
				window.location.href = './?src=sms&page_id=sms&type=student&chk='+chk+'';
		});
          /*$.ajax({
                type: "POST",
				 url: "http://127.0.0.1/sms/?page_id=sms&type=student",
                data: { ids: checkValues },
                success:function(data){
						window.location.href = '?page_id=sms&type=student';
					 },
            });*/
        }else{
             alert("You need to pick at least one checkbox!");
        }
	//var date=$("#date").val();
	//$.post( "ajax.php", { type: "DATE_SEARCH" ,date: date } , function( data ) {
	//  	$("#date_content").html(data);
	//	getTotal();
	//});
}

function SMSComplete(valueid,act){
	$(this).hide();
	var Fee=$("#"+valueid).html();
	var fdate='<?php if($_GET["fdate"]!="")echo $_GET["fdate"];else echo "0" ?>';
	var fmonth='<?php if($_GET["fmonth"]!="")echo $_GET["fmonth"];else echo "0" ?>';
	var fyear='<?php if($_GET["fyear"]!="")echo $_GET["fyear"];else echo "0" ?>';
	var tdate='<?php if($_GET["tdate"]!="")echo $_GET["tdate"];else echo "0" ?>';
	var tmonth='<?php if($_GET["tmonth"]!="")echo $_GET["tmonth"];else echo "0" ?>';
	var tyear='<?php if($_GET["tyear"]!="")echo $_GET["tyear"];else echo "0" ?>';
	var cls='<?php if($_GET["class"]!="")echo $_GET["class"];else echo "0" ?>';
	$.post( "ajax.php", { type: act ,fee: Fee, fdate:fdate, fmonth:fmonth, fyear:fyear, tdate:tdate, tmonth:tmonth, tyear:tyear,class: cls  } , function( data ) {
	  	//$("#ins").html(data);getTotal();
		alert(data);
		$(this).show();
	});
}
function SMS(type){
	if(confirm('Do you want to send sms now..!')){
	//var ids=document.getElementsByName('mobile[]');
	
	var ids=document.getElementsByName('idno[]');
	var detail=document.getElementsByName('details[]');
	var arr = [];
	for(var i=0;i<ids.length;i++){
		arr.push(ids[i].value+"-"+detail[i].value);
	}
	var Fee=arr.join(",");
	var fdate='<?php if($_GET["fdate"]!="")echo $_GET["fdate"];else echo "0" ?>';
	var fmonth='<?php if($_GET["fmonth"]!="")echo $_GET["fmonth"];else echo "0" ?>';
	var fyear='<?php if($_GET["fyear"]!="")echo $_GET["fyear"];else echo "0" ?>';
	var tdate='<?php if($_GET["tdate"]!="")echo $_GET["tdate"];else echo "0" ?>';
	var tmonth='<?php if($_GET["tmonth"]!="")echo $_GET["tmonth"];else echo "0" ?>';
	var tyear='<?php if($_GET["tyear"]!="")echo $_GET["tyear"];else echo "0" ?>';
	var cls='<?php if($_GET["class"]!="")echo $_GET["class"];else echo "0" ?>';
	$.post( "ajax.php", { type: type ,fee: Fee, fdate:fdate, fmonth:fmonth, fyear:fyear, tdate:tdate, tmonth:tmonth, tyear:tyear,class: cls  } , function( data ) {
		alert(data);
	});
}}
function sendSMDTO(){
	//alert("sms sending process under constration...");
}

function filterPayleft(Tval){
	var val=$(Tval).val();
	if(val.trim()==""){
		$(".MyTotalFee").parent().show();
		$(".MyTotalFee").parent().addClass('none');
	}
	else
	if(!isNaN(val)){
		var allTot="";
		$(".MyTotalLeft").each(function(index, element) {
			var myVal=parseInt($(this).html());
			if(myVal>val)
			{
				$(this).parent().hide('slow');
				$(this).parent().removeClass('none');
			}
			else
			{
				$(this).parent().show('slow');
				$(this).parent().addClass('none');
			}
        });
		//alert(allTot);
	}else{
		alert("Please enter only number");
		$(Tval).val('');
		$(".MyTotalFee").parent().show('slow');
		$(".MyTotalFee").parent().addClass('none');
	}
	var MyTotalFee=0,MyTotalpaid=0,MyTotalLeft=0,MyDiscount=0;
	$(".none").each(function(index, element) {
		MyTotalFee+=parseInt($(this).children('.MyTotalFee').html());
		MyTotalpaid+=parseInt($(this).children('.MyTotalpaid').html());
		MyTotalLeft+=parseInt($(this).children('.MyTotalLeft').html());
		MyDiscount+=parseInt($(this).children('.MyDiscount').html());
	});
	$("#MyTotalFee").html(MyTotalFee);
	$("#MyTotalpaid").html(MyTotalpaid);
	$("#MyTotalLeft").html(MyTotalLeft);
	$("#MyDiscount").html(MyDiscount);
}

function filterPay(Tval){
	var val=$(Tval).val();
	if(val.trim()==""){
		$(".MyTotalFee").parent().show('slow');
		$(".MyTotalFee").parent().addClass('none');
		$(".dynamic").hide('slow');
	}
	else
	if(!isNaN(val)){
		$(".dynamic").show('slow');
		var allTot="";
		$(".MyTotalpaid").each(function(index, element) {
			var myVal=parseInt($(this).html());
			if(myVal>val)
			{
				$(this).parent().hide('slow');
				$(this).parent().removeClass('none');
			}
			else
			{
				$(this).parent().show('slow');
				$(this).parent().addClass('none');
			}
        });
		//alert(allTot);
	}
	else{
		alert("Please user only number");
		$(Tval).val('');
		$(".MyTotalFee").parent().show();
		$(".MyTotalFee").parent().addClass('none');
		$(".dynamic").hide();
	}
	var MyTotalFee=0,MyTotalpaid=0,MyTotalLeft=0,MyDiscount=0,MyTotalLeftDynamic=0;
	$(".none").each(function(index, element) {
		var totalleft=val-parseInt($(this).children('.MyTotalpaid').html());
		$(this).children('.MyTotalLeftDynamic').html(totalleft);
		MyTotalFee+=parseInt($(this).children('.MyTotalFee').html());
		MyTotalpaid+=parseInt($(this).children('.MyTotalpaid').html());
		MyTotalLeftDynamic+=parseInt($(this).children('.MyTotalLeftDynamic').html());
		MyTotalLeft+=parseInt($(this).children('.MyTotalLeft').html());
		MyDiscount+=parseInt($(this).children('.MyDiscount').html());
	});
	$("#MyTotalFee").html(MyTotalFee);
	$("#MyTotalpaid").html(MyTotalpaid);
	$("#MyTotalLeftDynamic").html(MyTotalLeftDynamic);
	$("#MyTotalLeft").html(MyTotalLeft);
	$("#MyDiscount").html(MyDiscount);
}
$(document).ready(function(e) {
	$("#btnduesend").click(function () {
		var ch=$("#togglevalueforzeoshow").val();
		if(ch==0){
			$("#togglevalueforzeoshow").val('1');
	   		filterLeftZero(0)
		}else{
			$("#togglevalueforzeoshow").val('0');
			filterLeftZero(1)
		}
	 });
});
function filterLeftZero(ids){
	var allTot="";
	$(".MyTotalLeft").each(function(index, element) {
		var myVal=parseInt($(this).html());
		if(myVal==0 && ids==0)
		{
			$(this).parent().hide('slow');
			$(this).parent().removeClass('none');
		}
		else
		{
			$(this).parent().show('slow');
			$(this).parent().addClass('none');
		}
	});
	//alert(allTot);
	
	var MyTotalFee=0,MyTotalpaid=0,MyTotalLeft=0,MyDiscount=0;
	$(".none").each(function(index, element) {
		MyTotalFee+=parseInt($(this).children('.MyTotalFee').html());
		MyTotalpaid+=parseInt($(this).children('.MyTotalpaid').html());
		MyTotalLeft+=parseInt($(this).children('.MyTotalLeft').html());
		MyDiscount+=parseInt($(this).children('.MyDiscount').html());
	});
	$("#MyTotalFee").html(MyTotalFee);
	$("#MyTotalpaid").html(MyTotalpaid);
	$("#MyTotalLeft").html(MyTotalLeft);
	$("#MyDiscount").html(MyDiscount);
}
</script>
<?php
$pgMod="log";
$pgAct="view";

$monthsList = array(
    'January',
    'February',
    'March',
    'April',
    'May',
  
    'July ',
    'August',
    'September',
    'October',
    'November',
    'December',
);
$monthsList1 = array(
    1=>'Apr',
    2=>'May',
    
    3=>'Jul ',
    4=>'Aug',
    5=>'Sep',
    6=>'Oct',
    7=>'Nov',
    8=>'Dec',
	9=>'Jan',
    10=>'Feb',
    11=>'Mar'
);

if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);
if($pgAct=="delete" && isset($_GET['id']) && trim($_GET['id'])!='')
{
	$res=$db->delete("student","where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET['id']."'");
	if(!is_null($res)) { $_SESSION['msg']='Deleted Successfully'; }
	else { array_push($alert_err,$db->getErMsg()); }
	redirect(URL_ADMIN_HOME.getQueryString(array("src"=>"sms", "page_id"=>$pgMod)));
}
if(isset($_SESSION['msg']) && $_SESSION['msg']!=""){
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0){
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
function inst($str){
	$arr1 = str_split($str);
	if($arr1[1]=="p"){
		$i="Fee ";
		if($arr1[0]=="b")$i="Bus ";
		return $i." "." Installment ".$arr1[2];
	}
	else
		return $str;
}
function instFine($str,$reasion=""){
	global $db;
	$arr1 = explode("-",$str);
	if($arr1[1]=="class")
		$i="<span style='color:#FF0000'>$reasion (Class Fine)</span>";
	elseif($arr1[1]=="bus")
		$i="<span style='color:#00CC00'>$reasion (Bus Fine)</span>";
	elseif($arr1[1]=="otherfee")
		$i="<span style='color:#660000'>$reasion (Other Fee)</span>";
	elseif($arr1[1]=="hostel")
		$i="<span style='color:#FF00FF'>$reasion (Hostel Fine)</span>";
	else{
		$det=$db->getVal("select type from extrafee_type where id='".str_replace("extra","",$arr1[1])."'");
		if($det=="")
		$i="<span style='color:#660000'>$reasion (".$arr1[1].")</span>";
		else
		$i="<span style='color:#660000'>$reasion (".$det.")</span>";
	}
	//if($reasion!="")$i.=" ".$reasion."";
	return $i.$db->getErMsg();;
}
	?>
    <form method="get" action="">
        <input type="hidden" name="src" value="sms" />
    <input type="hidden" name="page_id" value="<?php echo $pgMod; ?>" />
	<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
                    <br />
                
                    <fieldset style="width:100%; float:left">Detail Section</br>
						<button type="submit" name="sms_detail" class="btn-classic margin">sms log Detail</button>
 						
                    </fieldset>


				</div>
				<div class="well no-padding">
                	<div class="controls controls-row">
                	    
                	    
                      <div > <span style="color:green; margin-left:100px;"><strong>Select Date :</strong> </span><input class="btn btn-primary" type="date"  name="date" id="date" onchange="fetchByDate(this)"/> 
        </div>

                
                        
                            
                        
                        
                        
                        
                        
                    </div>
                    
				</div>
			</div>
    </div>
    </form>
	<?php
	$where=array();
	$qry="";
	
	if(isset($_GET["detail"])){
		if(isset($_GET["fyear"]) && trim($_GET["fyear"])!="" && isset($_GET["fmonth"]) && trim($_GET["fmonth"])!="" && isset($_GET["fdate"]) && trim($_GET["fdate"])!="" && isset($_GET["tyear"]) && trim($_GET["tyear"])!="" && isset($_GET["tmonth"]) && trim($_GET["tmonth"])!="" && isset($_GET["tdate"]) && trim($_GET["tdate"])!=""){
			$fdate=$_GET["fyear"]."/".$_GET["fmonth"]."/".$_GET["fdate"];
			$tdate=$_GET["tyear"]."/".$_GET["tmonth"]."/".$_GET["tdate"];
			$where[]=" (s.udate between '$fdate' and '$tdate') ";
		}
		if(isset($_GET["stype"]) && trim($_GET["stype"])!=""){
			$where[]=" s.stype='".$_GET["stype"]."' ";
			$conwhere.=" and student.stype='".$_GET["stype"]."' ";
		}
		if(isset($_GET["medium"]) && trim($_GET["medium"])!=""){
			$where[]=" s.medium='".$_GET["medium"]."' ";
			$conwhere.=" and student.medium='".$_GET["medium"]."' ";
		}
		if(isset($_GET["class"]) && trim($_GET["class"])!=""){
			$where[]=" s.class='".$_GET["class"]."' ";
			$conwhere.=" and student.class='".$_GET["class"]."' ";
		}
		if(isset($_GET["section"]) && $_GET["section"]!=""){
			$where[]=" s.section='".$_GET["section"]."' ";
			$conwhere.=" and student.section='".$_GET["section"]."' ";
		}
		if(isset($_GET["gender"]) && trim($_GET["gender"])!=""){
			$where[]=" s.gender='".$_GET["gender"]."' ";
			$conwhere.=" and student.gender='".$_GET["gender"]."' ";
		}
		if(isset($_GET["cast"]) && trim($_GET["cast"])!=""){
			$where[]=" s.cast='".$_GET["cast"]."' ";
			$conwhere.=" and student.cast='".$_GET["cast"]."' ";
		}
		if(isset($_GET["startage"]) && trim($_GET["startage"])!="" && isset($_GET["endage"]) && trim($_GET["endage"])!=""){
			$start = date('Y-m-d', strtotime('-'.$_GET["startage"].' years'));
			$end = date('Y-m-d', strtotime('-'.$_GET["endage"].' years'));
			$where[]=" (s.dob between '".$end."' and '".$start."')";
			$conwhere.=" and (student.dob between '".$end."' and '".$start."') ";
		}
		if(isset($_GET["location"]) && trim($_GET["location"])!=""){
			$where[]=" s.location='".$_GET["location"]."' ";
			$conwhere.=" and student.location='".$_GET["location"]."' ";
		}
 
 
		$where[]=" s.session='".$_SESSION["admin"]["session"]."' and s.status=1 ";
		$table=" student as s";
		//echo "<pre>";print_r($result);echo "</pre>";echo $db->getLastQuery();		echo $db->getErMsg();
		?>
		 <div class="row-fluid">
        <div class="span12">
            <div class="top-bar">
                <h3><i class="icon-cog"></i> Detail</h3>
                <div style="float:right; margin-top:5px">
				<input  class="btn btn-primary" type="button"  onclick="$('.table').tableExport({type:'excel',escape:'false'});" id="btnExport" value=" Export To Excel " />
                    <button type="button" onclick="printDiv('printDiv2')" class="btn btn-primary">Print</button>
                </div>
            </div>
            <div class="well no-padding" id="printDiv2">
            	<table class="table">
                    <thead>
                        <tr>
                            <th>S.No</th>
                            <th>Name</th>
                            <th>Class</th>
                            <th>Sec</th>
                            <th>Sex</th>
                            <th>DOB</th>
                            <th>Father</th>
                            <th>Mother</th>
                             <th>Bus Root</th>
                            <th>Adm.Date</th>
                            <th>address</th>
                            
                            <th>Mobile</th>
                            <th>Adm. no</th>
                            
                        </tr>
                    </thead>
                    <tbody>
                    	<?php
                    	
                    	 $stu_sib=$db->getval("select bus from driver where idno='".$_GET['driver']."'");
									
		
									$csvString= "$stu_sib";
									
$options = explode(",", $csvString);
//print_r($options);
$options = array_filter($options);    
foreach($options as $val) {

  	$result=$db->getRows("SELECT * FROM student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0  and status='1' and bus='".$val."' order by name");
  //	echo $ss="SELECT * FROM student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and issue_TC=0  and status='1' and bus='".$val."' order by name";

						//if(is_array($result) && count($result)>0){$ijk=0;
							foreach($result as $detail){$ijk++;
								?>
                                <tr>
                                    <td><?php echo $ijk; ?></td>
                                    <td><?php echo ucfirst($detail["name"]); ?></td>
                                    <td><?php echo $detail["class"]; ?></td>
                                    <td><?php echo $detail["section"]; ?></td>
                                    <td><?php echo $detail["gender"]; ?></td>
                                    <td><?php if($detail["dob"]!="")echo date("d-M-Y",strtotime($detail["dob"])); ?></td>
                                    <td><?php echo $detail["fname"]; ?></td>
                                    <td><?php echo $detail["mname"]; ?></td>
                                      <td><?php echo  $stu_root=$db->getval("select root from bus where id='".$detail['bus']."'"); ?></td>
                                     <td><?php echo $detail["doa"]; ?></td>
                                    <td><?php echo $detail["address"]; ?></td>
                                    <td><?php echo $detail["mobile"]; ?></td>
                                    
                                    <td><?php echo $detail["admissionno"]; ?></td>
                                   
                                   
                                </tr>
								<?php
							} //}
						}

					
						?>
                    </tbody>
                    <tfoot>
                    	<tr>
                        	<th colspan="10"></th>
                        </tr>
                    </tfoot>
                 </table>
              </div>
          </div>
		<?php
	}


elseif(isset($_GET["sms_detail"])){

		?>
		 <div class="row-fluid">
        <div class="span12">
            <div class="top-bar">
                <h3><i class="icon-cog"></i> Detail</h3>
                <div style="float:right; margin-top:5px">
				<!--<input  class="btn btn-primary" type="button"  onclick="$('.table').tableExport({type:'excel',escape:'false'});" id="btnExport" value=" Export To Excel " />-->
<button class="btn btn-danger" onclick="exportTableToExcel('tblData', 'SMS Log')" style="float:right;margin-left:10px;">Excel</button>				
                    <button type="button" onclick="printDiv('printDiv2')" class="btn btn-primary">Print</button>  
                </div>  
            </div>
            <div class="well no-padding" id="printDiv2">
            	<table class="table" id="tblData" border="1">
                    <thead>
                        <tr>
                            <th>S.No</th>
                             <th>name</th>
                              <th>father name</th>
                               <th>class</th>
                                <th>section</th>
                            <th>Date</th>
                            <th>Mobile</th>

                            <th>Sms</th>
                            
                        </tr>
                    </thead>
                    <tbody>
                    	<?php
                    	$i=0;
                    	if(isset($_REQUEST["date"]))$where=" AND YEAR(dtime)=".date('Y',strtotime($_REQUEST['date']))." and  MONTH(dtime)=".date('m',strtotime($_REQUEST['date']))." and DAY(dtime)=".date('d',strtotime($_REQUEST['date']))."";
	$sql_limit="select * from sms where school_id='".$_SESSION["admin"]["school_id"]."' AND session='".$_SESSION["admin"]["session"]."' AND (dtime >= DATE_SUB(CURDATE(), INTERVAL 10 DAY)) $where order by dtime ";
	$aryList=$db->getRows($sql_limit);
                    foreach($aryList as $d) {
                        $i++;
                        //$d["mobile"];
                        strlen($d["mobile"]);
                        if(strlen($d["mobile"])=='12')
                        {
                        //echo $d["mobile"];
                        $mob= substr($d["mobile"], 2);
                        }
                        else
                        {
                           $mob=$d['mobile']; 
                        }
                      $detail=$db->getRow("select name, fname,class,section,dob from student where mobile='".$mob."' ");
                      //echo "select name, fname,class,section,dob from student where mobile='".$d["mobile"]."' ";
								?>
                                <tr>
                                    <td><?php echo $i; ?></td>
                                    <td><?php echo $detail["name"]; ?> </td>
                                    <td><?php echo $detail["fname"]; ?> </td>
                                    <td><?php echo $detail["class"]; ?> </td>
                                    <td><?php echo $detail["section"]; ?> </td>

                                    <td><?php echo $d["dtime"]; ?> </td>
                                    <td><?php echo $mob; ?></td>
                                    <td><?php echo $d["msg"]; ?></td>


                                   
                                </tr>
								<?php
							}
						?>
                    </tbody>

                 </table>
              </div>
          </div>
		<?php
	}


	//echo "<pre>";print_r($result);echo $db->getLastQuery();
	echo $db->getErMsg();
	
?>

	<script type="text/javascript">
	$(document).ready(function(e) {
		var oTable = $('.table').dataTable( {
			"bPaginate": false,
			"bLengthChange": false,
			"bFilter": true,
			"bSort": true,
			"bInfo": true,
			"bAutoWidth": false
		});
	});
	function activeNowMe(id){
		$.ajax({
			url: "<?php echo URL_ROOT ?>Promote/ajax.php?type=activeMe&id="+id
		}).done(function(data) {
			$("#row"+id).hide("slow");
		});
	}
	function getStudentPopup(){
		var url="";
		$(".checkboxes").each(function(){
			if($(this).prop('checked')==true){
				var idno=$(this).val();
				var name=$(".name"+idno).html()
				var left=$(".left"+idno).html()
				url+="&"+name+"`"+idno+"="+left;
			}
		})
		if(url!=""){
			getPopup("<?php echo URL_ROOT ?>Promote/?page_id=MigrateLeftFee&class=<?php echo $_GET["class"] ?>"+url,"1","MigrateLeftFee");
			$(".close").click(function() {
				$(this).parent().remove();
			});
			$(".outer").click(function() {
				$(this).remove();
			});

		}else{
			alert("select atleast one student to mgrate");
		}
	}
	
    function exportTableToExcel(tableID, filename = '',e){
    
    var tableType = document.getElementById('tblData').getAttribute("data-tblname");

    var downloadLink;
    var dataType = 'application/vnd.ms-excel';
    var tableSelect = document.getElementById(tableID);
    var tableHTML = tableSelect.outerHTML.replace(/ /g, '%20');

    // Specify file name
    filename = filename?filename+'.xls':'excel_data.xls';
    
    // Create download link element
    downloadLink = document.createElement("a");
    
    document.body.appendChild(downloadLink);
    
    if(navigator.msSaveOrOpenBlob){
        var blob = new Blob(['\ufeff', tableHTML], {
            type: dataType
        });
        navigator.msSaveOrOpenBlob( blob, filename);
    }else{
        // Create a link to the file
        downloadLink.href = 'data:' + dataType + ', ' + tableHTML;
    
        // Setting the file name
        downloadLink.download = filename;
        
        //triggering the function
        downloadLink.click();
    }
    e.preventDefault();
}
	
	</script>
    <style>
    tfoot{display: table-footer-group !important;}
	.MigrateLeftFee{width:650px !important}
    </style>