<?php 
error_reporting(0);
include("common.php"); 
include("config.php"); 
?>

     
        <!-- START: Main Content-->
        <main>
            <div class="container-fluid">
                <!-- START: Breadcrumbs-->
               
                <!-- END: Breadcrumbs-->

                <!-- START: Card Data-->
                <div class="row">
                    <div class="col-12 mt-3">
                        <div class="card">
                            <div class="card-header  justify-content-between align-items-center">                               
                                <h4 class="card-title">Customer Management</h4> 
                            </div>
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table id="example" class="display table dataTable table-striped table-bordered" >
                                        <thead>
                                            <tr>
											 <th>#</th>
											 
											 <th>Branch</th>
											 <th>Customer Name</th>
											  <th>Vehicle Number </th>
											   <th>Points </th>
											<th>Phone </th>
                                             
											   
											   <th>Reg Date</th>
											   <th>Company Name</th>
											    <th>Owner Name</th>
												<th></th>
												
                                            </tr>
                                        </thead>
                                        <tbody>
										<?php
										error_reporting(0);
										include("config.php");
										 $branch = $_SESSION['branch'];
									 $query="select * from customer where  branch='$branch' order by id desc";
    if(!($result=mysql_query($query))){echo mysql_error($query); exit;}
    while($customer=mysql_fetch_assoc($result)){
		$count ++;
		
		 $que = sprintf("SELECT * from  customer_product_point WHERE cid = '%s' ",$customer['id']);
    if(!($res=mysql_query($que))){echo mysql_error($que); exit;}
    $cis_data=mysql_fetch_assoc($res);
		
	?>
                                            <tr>
										
						<td><?php echo $count;?></td>
						   <td><font color="blue"><b>
						   <?php if($customer[branch]=='B1'){?> GNA <?php } ?>
							<?php if($customer[branch]=='B2'){?> RSM <?php } ?>
							<?php if($customer[branch]=='B3'){?> JHU <?php } ?>
							<?php if($customer[branch]=='B4'){?> GNAP <?php } ?>
							<?php if($customer[branch]=='B5'){?> JHUP <?php } ?>
						   </b></font>
						   </td>
						
                                                <td><?php echo strtoupper($customer[customer_name]);?></td>
												<td><?php echo strtoupper($customer[vehicle_number]);?> <br> <?php echo strtoupper($customer[vehicletyp]);?></td>
												<td><font color="blue"> <b><?php if($cis_data[point]==''){?> 0 p<?php } else { ?><?php echo $cis_data[point];?> p <?php } ?> </b> </font></td>
												 <td><?php echo strtoupper($customer[customer_mobile]);?></td>

                                               
                                               
                      <td><?php echo date('d-m-Y',strtotime($customer['regdte'])); ?> <?php echo $customer[regtime];?></td>
   
					   <td><?php echo strtoupper($customer[companyname]);?></td>
					   <td><?php echo strtoupper($customer[owner]);?><br><?php echo $customer[ownermobile];?></td>
					     <td>
				<a title="edit" href="edit-customer.php?flag=edit&id=<?php echo $customer[id];?>">
                <i class="fa fa-edit icon-white"></i>
                 
            </a> &nbsp;
			  <a  title="delete" href="del-customer.php?flag=del&id=<?php echo $customer[id];?>"onclick="if(confirm('Do You Want To Delete This ?')){return true;}else{return false;}">
                <i class="fa fa-trash icon-white"></i>
                 
            </a>
       
			</td>	
                                        
                                            </tr>
	<?php } ?>
                                          
                                           
                                        </tbody>
                            
                                    </table>
                                </div>
                            </div>
                        </div> 

                    </div>                  
                </div>
                <!-- END: Card DATA-->
            </div>
        </main>
        <!-- END: Content-->

      
        <!-- START: Back to top-->
        <a href="#" class="scrollup text-center"> 
            <i class="icon-arrow-up"></i>
        </a>
        <!-- END: Back to top-->

        <!-- START: Template JS-->
        <script src="dist/vendors/jquery/jquery-3.3.1.min.js"></script>
        <script src="dist/vendors/jquery-ui/jquery-ui.min.js"></script>
        <script src="dist/vendors/moment/moment.js"></script>
        <!--  <script src="dist/vendors/bootstrap/js/bootstrap.bundle.min.js"></script> -->  
        <script src="dist/vendors/slimscroll/jquery.slimscroll.min.js"></script>
        <script src="dist/vendors/flag-select/js/jquery.flagstrap.min.js"></script> 
        <!-- END: Template JS-->
        
        <!-- START: APP JS-->
        <script src="dist/js/app.js"></script>
        <!-- END: APP JS-->

        <!-- START: Page Vendor JS-->
        <script src="dist/vendors/datatable/js/jquery.dataTables.min.js"></script> 
        <script src="dist/vendors/datatable/js/dataTables.bootstrap4.min.js"></script>
        <script src="dist/vendors/datatable/jszip/jszip.min.js"></script>
        <script src="dist/vendors/datatable/pdfmake/pdfmake.min.js"></script>
        <script src="dist/vendors/datatable/pdfmake/vfs_fonts.js"></script>
        <script src="dist/vendors/datatable/buttons/js/dataTables.buttons.min.js"></script>
        <script src="dist/vendors/datatable/buttons/js/buttons.bootstrap4.min.js"></script>
        <script src="dist/vendors/datatable/buttons/js/buttons.colVis.min.js"></script>
        <script src="dist/vendors/datatable/buttons/js/buttons.flash.min.js"></script>
        <script src="dist/vendors/datatable/buttons/js/buttons.html5.min.js"></script>
        <script src="dist/vendors/datatable/buttons/js/buttons.print.min.js"></script>
        <!-- END: Page Vendor JS-->

        <!-- START: Page Script JS-->        
        <script src="dist/js/datatable.script.js"></script>
		
        <!-- END: Page Script JS-->
    </body>
   
</html>
