<? include "top.php"; ?>
<!DOCTYPE html>
<html>
<head>
	<?php include('include/head.php'); ?>
	<title>Ticket List</title>
	<link rel="stylesheet" type="text/css" href="https://sarmac.b-cdn.net/plugins/datatables/media/css/jquery.dataTables.css">
	<link rel="stylesheet" type="text/css" href="https://sarmac.b-cdn.net/plugins/datatables/media/css/dataTables.bootstrap4.css">
	<link rel="stylesheet" type="text/css" href="https://sarmac.b-cdn.net/plugins/datatables/media/css/responsive.dataTables.css">
	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
</head>
<body>
	<?php include('include/header.php'); ?>
	<?php include('include/sidebar.php'); 
	

	


	?>
	<style type="text/css">
		.form-control:focus{
        border: 1px solid red;

    }
    td{

    	font-size: 12px;
    }
    th{

    	font-size: 13px;
    }
    .btn:focus{
        border: 1px solid red;

    }
	</style>



	<?

		
				

	?>

<script type="text/javascript">function CheckUncheckAlll(){
   var  selectAllCheckbox=document.getElementById("checkUncheckAll");
   if(selectAllCheckbox.checked==true){
    var checkboxes =  document.getElementsByName("rowSelectCheckBox");
     for(var i=0, n=checkboxes.length;i<n;i++) {
      checkboxes[i].checked = true;
      checkboxes[i].onclick();
     }
    }else {
     var checkboxes =  document.getElementsByName("rowSelectCheckBox");
     for(var i=0, n=checkboxes.length;i<n;i++) {
      checkboxes[i].checked = false;
      checkboxes[i].onclick();
     }
    }
   }</script>
<script type="text/javascript">
                         function setids(idss){

                            var eids=document.getElementById('multirows').value;
                            var n = eids.search(idss);
                            //var array=eids.split(",");
                           // alert(array);
                            // var a = array.find(function(element) { 
                            //           return element = idss; 
                            //         }); 
                            // alert(a);
                            if(n=='-1'){

                                eids=eids+','+idss;
                                // document.getElementById('multirow').value=eids; 
                                document.getElementById('multirows').value=eids;  
                            }else{

                                     eids=eids.replace(idss, "");
                                    //  document.getElementById('multirow').value=eids;
                                     document.getElementById('multirows').value=eids; 

                            }


                       } 


                </script>
	<div class="main-container">
		<div class="pd-ltr-20 customscroll customscroll-10-p height-100-p xs-pd-20-10">
			<div class="min-height-200px">
				<div class="page-header">
					<div class="row">
						<div class="col-md-6 col-sm-12">
							<div class="title">
								<h4>Today Pack Expiry of Cable Customer</h4>
							</div>
							<nav aria-label="breadcrumb" role="navigation">
								<ol class="breadcrumb">
									<li class="breadcrumb-item"><a href="index.php">Home</a></li>
									<li class="breadcrumb-item active" aria-current="page">Today Pack Expiry of Cable Customer</li>
								</ol>
							</nav>
						</div>
						<div class="col-md-6 col-sm-12 text-right">
							<!-- <div class="dropdown">
								<a class="btn btn-secondary dropdown-toggle" href="#" role="button" data-toggle="dropdown">
									January 2018
								</a>
								<div class="dropdown-menu dropdown-menu-right">
									<a class="dropdown-item" href="#">Export List</a>
									<a class="dropdown-item" href="#">Policies</a>
									<a class="dropdown-item" href="#">View Assets</a>
								</div>
							</div> -->
						</div>
					</div>
				</div>
				<!-- Default Basic Forms Start -->
				
				<div class="pd-20 bg-white border-radius-4 box-shadow mb-30">
					<div class="clearfix mb-20">
						<div class="pull-left">
							<h5 class="text-blue">Today Pack Expiry of Cable Customer</h5>
						</div>
					</div>
					<div class="row">
						<div class="col-lg-12" style="margin-bottom:20px;">
						<form action="startbilling.php?action=startb" method="POST">
							<div class="row"  style="border:1px solid gray;padding:2%;border-radius:20px;margin-bottom:20px;">
						
						<div class="col-lg-3">
						<div class="form-group row">
								<label class="col-sm-12 col-md-2 col-form-label">Year</label>
								<div class="col-sm-12 col-md-10">
                                        <select class="form-control" name="yrs" id="yrs" required>
                                        <option value="">Choose Year</option>
                                        <?
                                            for($i=2020;$i<=2030;$i++){
                                        ?>
                                        <option value="<?=$i?>" <? if(date('Y')==$i){?> selected <? } ?>><?=$i?></option>	
                                        <? } ?>	
                                        

                                        </select>
                                </div>
                            </div>

						</div>
						<div class="col-lg-3">
												<?php 

													$mnth = date('m');
												
												
												?>
						<div class="form-group row">
                       <label class="col-sm-12 col-md-3 col-form-label">Month</label>
                            <div class="col-sm-12 col-md-9">
								<select class="form-control" name="mnth" id="mnth" required>
                                    <option value="">Choose Month</option>
									<option value="1" <? if($mnth=='1'){?> selected <? } ?>>Jan</option>	
									<option value="2" <? if($mnth=='2'){?> selected <? } ?>>Feb</option>	
									<option value="3" <? if($mnth=='3'){?> selected <? } ?>>Mar</option>	
									<option value="4" <? if($mnth=='4'){?> selected <? } ?>>Apr</option>	
									<option value="5" <? if($mnth=='5'){?> selected <? } ?>>May</option>	
									<option value="6" <? if($mnth=='6'){?> selected <? } ?>>Jun</option>	
									<option value="7" <? if($mnth=='7'){?> selected <? } ?>>Jul</option>	
									<option value="8" <? if($mnth=='8'){?> selected <? } ?>>Aug</option>	
									<option value="9" <? if($mnth=='9'){?> selected <? } ?>>Sep</option>	
									<option value="10" <? if($mnth=='10'){?> selected <? } ?>>Oct</option>	
									<option value="11" <? if($mnth=='11'){?> selected <? } ?>>Nov</option>	
									<option value="12" <? if($mnth=='12'){?> selected <? } ?>>Dec</option>	
									

								</select>
                            </div>
                                        
						</div>					

						</div>
						<div class="col-lg-6 text-right">

						<button type="submit" class="btn btn-primary"><i class="fa fa-cog"></i> GENERATE BILL SELECTED CUSTOMER</button>
						</div>

						
						</div>
						<div class="row">
						<div class="col-lg-12">
						<input type="checkbox" id="checkUncheckAll" class="largerCheckbox" onclick="CheckUncheckAlll()" /> Select all
						<input type="hidden" id="multirows" name="multirows">
						</div>
						</div>
						</form>
						</div>
						
						<table class="stripe hover data-table nowrap">
							<thead>
								<tr>
									
									<th class="table-plus datatable-nosort">Select</th>
									<th>SL</th>
									<th>Name</th>
									<th>VC</th>
									<th>STB</th>
									<th>Phone</th>
									<th>Pack</th>
									<th>Price</th>	
								</tr>
							</thead>
							<tbody>
								<?	$i=0;
									$getc=mysqli_query($con,"SELECT * FROM adduser WHERE pexpiry=CURDATE() AND is_cable=1 ORDER BY name");
									while($arr=mysqli_fetch_array($getc)){
										$i++;
										
								?>
								<tr>
								<td><input type="checkbox" name="rowSelectCheckBox" style="font-size: 20px;" class="largerCheckbox" onclick="setids(<?php echo $arr['id']?>)"></td>
									<td class="table-plus"><?=$i?></td>
									<td><?=$arr['name']?></td>
									<td><?=$arr['vc']?></td>
									<td><?=$arr['stb']?></td>
									<td><?=$arr['phone']?></td>
									<td><?=$arr['pay_ch']?></td>
									<td><?=$arr['price']?></td>
									
								</tr>
								<? } ?>	
							</tbody>
						</table>

						<!-- <input type="hidden" id="multirow" value="0" > -->
					</div>
				</div>
				

			</div>
			<?php include('include/footer.php'); ?>
		</div>
	</div>
	<?php include('include/script.php'); ?>

	<script src="src/plugins/datatables/media/js/jquery.dataTables.min.js"></script>
	<script src="src/plugins/datatables/media/js/dataTables.bootstrap4.js"></script>
	<script src="src/plugins/datatables/media/js/dataTables.responsive.js"></script>
	<script src="src/plugins/datatables/media/js/responsive.bootstrap4.js"></script>
	<!-- buttons for Export datatable -->
	<script src="src/plugins/datatables/media/js/button/dataTables.buttons.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.bootstrap4.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.print.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.html5.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.flash.js"></script>
	<script src="src/plugins/datatables/media/js/button/pdfmake.min.js"></script>
	<script src="src/plugins/datatables/media/js/button/vfs_fonts.js"></script>
	<script>
		$('document').ready(function(){
			$('.data-table').DataTable({
				scrollCollapse: true,
				autoWidth: false,
				responsive: true,
				paging: false,
				columnDefs: [{
					targets: "datatable-nosort",
					orderable: false,
				}],
				
			});
			$('.data-table-export').DataTable({
				scrollCollapse: true,
				autoWidth: false,
				responsive: true,
				columnDefs: [{
					targets: "datatable-nosort",
					orderable: false,
				}],
				"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
				"language": {
					"info": "_START_-_END_ of _TOTAL_ entries",
					searchPlaceholder: "Search"
				},
				dom: 'Bfrtip',
				buttons: [
				'copy', 'csv', 'pdf', 'print'
				]
			});
			var table = $('.select-row').DataTable();
			$('.select-row tbody').on('click', 'tr', function () {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				}
				else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
			var multipletable = $('.multiple-select-row').DataTable();
			$('.multiple-select-row tbody').on('click', 'tr', function () {
				$(this).toggleClass('selected');
			});
		});
	</script>

<script type="text/javascript">
$(document).ready(function(){
    $('#select_all').on('click',function(){
        if(this.checked){
            $('.chkusers').each(function(){
                this.checked = true;
            });
        }else{
             $('.chkusers').each(function(){
                this.checked = false;
            });
        }
    });
    
    $('.chkusers').on('click',function(){
        if($('.chkusers:checked').length == $('.chkusers').length){
            $('#select_all').prop('checked',true);
        }else{
            $('#select_all').prop('checked',false);
        }
    });
});
</script>

</body>
</html>