<style>
/* 
Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px
and also iPads specifically.
*/
@media only screen and (max-width: 560px), (min-device-width: 568px) and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
	display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
	position: absolute;
	top: -9999px;
	left: -9999px;
}
tr {
	border: 0px solid #ccc;
}
td {
	/* Behave  like a "row" */
	border: none;
	/*border-bottom: 1px solid #eee; */
	position: relative;
	padding-left: 50%;
}
td:before {
	/* Now like a table header */
	position: unset; /*absolute causing issues*/
	/* Top/left values mimic padding */
	top: 6px;
	left: 6px;
	width: 45%;
	padding-right: 10px;
	white-space: nowrap;
}
/*
Label the data
*/
td:nth-of-type(1):before {content: "S.No";}
td:nth-of-type(2):before {content: "Technician";}
td:nth-of-type(3):before {content: "Partner";}
td:nth-of-type(4):before {content: "User";}
td:nth-of-type(5):before {content: "Status";}
td:nth-of-type(6):before {content: "Actions";}
.table-checkable tr > td:first-child, .table-checkable tr > th:first-child {
  max-width: 20%;  
}
}
@media only screen and (max-width: 480px), (min-device-width: 300px) and (max-device-width: 480px) {
	.table-checkable tr > td:first-child, .table-checkable tr > th:first-child {
	  max-width: 100%;  
	}
	td:nth-of-type(1)::before {
	  content: "";
	}
}
</style>
<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title">Purchase Commission</div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.php?page=home">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                &nbsp;<a class="parent-item" href="index.php?page=view_purchase_partner&id=<?php echo $shopId; ?>">View Shop</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li><li class="active">Purchase Commission</li>
                            </ol>
                        </div>
                    </div>
                    
	 <div class="row">
                        <div class="col-md-12">
                            <div class="card card-topline-red">
                                <div class="card-head">
                                    <header>Purchase Commission</header>
                                    <div class="tools">                                        
	                                    <a class="t-collapse btn-color fa fa-chevron-down" href="javascript:;"></a>
	                                    <a class="t-close btn-color fa fa-times" href="javascript:;"></a>
                                    </div>
                                </div>
                                <div class="card-body ">
                                    <div class="row p-b-20">
                                        <div class="col-md-12 col-sm-12 col-12">
                                            <!--<div class="btn-group">
                                                <button onclick="location.href = 'index.php?page=add_purchase_order';" id="addRow1" class="btn btn-info">
                                                    Add Purchase Order <i class="fa fa-plus"></i>
                                                </button>
                                            </div>-->
                                        </div>                                        
                                    </div>
                                    <?php if(isset($_REQUEST['success'])){ ?><div class="alert alert-success"><?php echo urldecode($_REQUEST['success']); ?></div></div><?php } ?>
                                    <?php if(mysqli_num_rows($orderRs)>0) { ?>
                                    <table class="table table-striped table-bordered table-hover table-checkable order-column" style="width: 100%" id="example4">
                                        <thead>
                                            <tr>
                                                <!--<th>
                                                    <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                        <input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" />
                                                        <span></span>
                                                    </label>
                                                </th>-->
                                                <th> S.No. </th>
                                                <th> Technician </th>
                                                <th> Date </th>
                                                <th> Tot. Amount </th>
                                                <th> Commission(%) </th>
                                                <th> Commission </th>
                                                
                                            </tr>
                                        </thead>
                                        <tbody>
                                        	<?php
                                        	$slNo = 1;											
												while($orderRec = mysqli_fetch_array($orderRs)) {	?>
                                                <tr class="odd gradeX">                                                
                                                    <td><?php echo $slNo; ?></td>
                                                    <td>
                                                        <a target="_blank" href="index.php?page=view_technician&id=<?php echo $orderRec['technician_id']; ?>"><?php echo getTechnicianName($orderRec['technician_id']); ?></a>
                                                    </td>
                                                    <td><?php echo getFormattedDate($orderRec['date']); ?></td>
                                                    <td><?php echo $orderRec['tot_amount']; ?></td>
                                                    <td><?php echo $orderRec['commission'].'%'; ?></td>
                                                    <td><?php $commissionAmount = ($orderRec['tot_amount']*$orderRec['commission'])/100;
													echo number_format((float)$commissionAmount, 2, '.', ''); ?>
                                                     <?php 
                                                        $netTotal+= $orderRec['tot_amount'];
                                                        $netCommission+= $commissionAmount;  ?>
                                                    </td>
                                                      
                                                </tr>
                                            <?php ++$slNo; } ?> 
                                             <tr class="odd gradeX">    
                                             		<td align="right" colspan="3">Order Total</td>                                                    
                                                    <td>
                                                        <?php echo number_format((float)$netTotal, 2, '.', '');  ?>
                                                    </td>                                            
                                                    <td align="right">Total Commission</td>                                                    
                                                    <td>
                                                        <?php echo number_format((float)$netCommission, 2, '.', '');  ?>
                                                    </td> 
                                                    
                                                </tr>                                           
                                        </tbody>
                                    </table>                                    
                                    <?php } else { ?>
                                    	<div class="alert alert-danger">Sorry! No Results Found.</div>					        		
					        		<?php }	?> 
                                </div>
                            </div>
                        </div>
                    </div>
                    

</div>
</div>