ok
Direktori : /proc/self/root/home2/selectio/www/mm-tailor-billing/hrm/ |
Current File : //proc/self/root/home2/selectio/www/mm-tailor-billing/hrm/report-2.php |
<?php include "header.php";?> <?php $statements = $pdo->prepare("SELECT * FROM `tbl_products` WHERE status=1"); $results = $statements->execute(); $querys = $statements->fetchAll(PDO::FETCH_ASSOC); $totalDatas = $statements->rowCount(); $pquery = ""; $sum_pro = ""; $a=1; foreach($querys as $res){ if($a==1){ $sum_pro.= "SUM(h.pro_".$res['id'].") as sum_pro_".$res['id'].", "; $pquery.= "h.pro_".$res['id'].""; }else{ $sum_pro.= "SUM(h.pro_".$res['id'].") as sum_pro_".$res['id'].", "; $pquery.= "+h.pro_".$res['id'].""; } $a++; } ?> <?php if(isset($_GET['start_date'])){ $start_date = $_GET['start_date']; }else{ $start_date = date("Y-m-d"); } if(isset($_GET['end_date'])){ $end_date = $_GET['end_date']; }else{ $end_date = date("Y-m-d"); } $date = date("Y-m-d"); $conditions = ""; $conditions.=" and h.date between '$start_date' and '$end_date'"; $statement_reports = $pdo->prepare("SELECT h.* FROM tbl_reports h where h.date='$date'"); $statement_reports->execute(); $reports_query = $statement_reports->fetchAll(PDO::FETCH_ASSOC); $reports_totalData = $statement_reports->rowCount(); if($reports_totalData>0){ $message = ""; }else{ $message = " --> New Datas"; } $timestamp = strtotime($date); $weekday= date("l", $timestamp ); if ($weekday =="Sunday") { $Week_Days = 0; }else { $Week_Days = 1; } ?> <style> body { font-weight: 400; background: aliceblue; } </style> <style> tr:hover{ background-color: red !important; color: white !important; } tr:hover td, tr:hover th { background-color: red !important; color: white !important; } .p0{ padding: 0px; } .tcenter{ text-align: center; } .font_weak_days{ font-size: 28px; font-family: sans-serif; font-style: normal; } .message{ font-size: 20px; font-family: sans-serif; font-style: normal; } table{ width: 100%; border: 1px solid black; } td,th{ border: 1px solid black; } th{ padding: 5px 0px 5px 0px; background: blue; color: white; font-family: sans-serif; font-size: 16px; } .form{ text-align: center; font-size: 24px; font-weight: 800; font-family: system-ui; padding: 0px; } </style> <link href="input-css.css" rel="stylesheet" type="text/css" /> <?php $statement_product = $pdo->prepare("SELECT h.* FROM tbl_products h where h.id!=0 ORDER BY h.order_no ASC"); $statement_product->execute(); $product_query = $statement_product->fetchAll(PDO::FETCH_ASSOC); $product_totalData = $statement_product->rowCount(); $no_records_found = 2+$product_totalData; $statement_users = $pdo->prepare("SELECT h.* FROM tec_users h where hrms='HRMS' ORDER BY h.order_no ASC"); $statement_users->execute(); $product_users = $statement_users->fetchAll(PDO::FETCH_ASSOC); $users_totalData = $statement_users->rowCount(); ?> <section class="content" style="background-color: aliceblue; margin: 10px 10px 10px 10px;"> <?php //echo phpinfo() ?> <div class="row" style="margin-top: 22px;"> <form action="" method="get"> <div class="row" style="margin-left:10px;"> <div class="col-md-3"> <div class="form-group"> <label>Start Date</label> <input type="date" name="start_date" class="form-control date" value="<?=$start_date?>" style="width:100%" id="start_date" required> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>End Date</label> <input type="date" name="end_date" class="form-control date" value="<?=$end_date?>" style="width:100%" id="end_date" required> </div> </div> <div class="col-md-1"> <button type="submit" id="filter" class="btn btn-warning btn-sm" style="margin-top: 28px;"><i class="fa fa-filter"></i> Filter</button> </div> <div class="col-md-4" style="margin-top: 28px;"> <center><b class="font_weak_days"><?=date('d-m-Y',strtotime($date))?>, <?=$weekday?></b><b class="message" style="color: green;"><?=$message?></b></center> </div> </div> </form> <form id="attendance" autocomplete="off"> <input type="hidden" name="type" class="form-control add_new_reports" value="add_new_reports" style="width:100%" id="add_new_reports" required> <input type="hidden" name="date" class="form-control date" value="<?=$date?>" style="width:100%" id="date" required> <div class="row" style="margin-left:10px;"> <!--<div class="col-md-3"> <div class="form-group"> <label>Date</label> <input type="date" name="date" class="form-control date" value="<?//=date('Y-m-d')?>" style="width:100%" id="date" required> </div> </div>--> <div class="col-md-1"> <!--<span id="filter" class="btn btn-warning btn-sm" style="margin-top: 28px;"><i class="fa fa-filter"></i> Filter</span>--> </div> </div> <div id="product_section" style="margin: 10px 10px 10px 10px;"> <table style=""> <thead> <tr> <th> Names </th> <?php if($product_totalData>0){ foreach($product_query as $query){ if($query['category']=="SHIRT"){ $style="background: brown"; }else{ $style="background: chocolate;"; } echo "<th style='".$style."'>".$query['short_name']."</th>"; } } ?> <th>TOTAL</th> </tr> </thead> <tbody> <?php if($users_totalData>0){ $i=1; foreach($product_users as $users){ ?> <?php $statement_att = $pdo->prepare("SELECT h.*,$sum_pro SUM(".$pquery.") as product_count_total FROM tbl_reports h WHERE h.id!=0 and h.user_id='".$users['id']."' ".$conditions.""); error_log("SELECT h.*,$sum_pro SUM(".$pquery.") as product_count_total FROM tbl_reports h WHERE h.id!=0 and h.user_id='".$users['id']."' ".$conditions.""); $statement_att->execute(); $att_results = $statement_att->fetchAll(PDO::FETCH_ASSOC); $att_totalData = $statement_att->rowCount(); if($att_totalData>0){ ?> <tr> <td style="text-align: center;"> <b><?=$users['first_name']?></b> <input type="hidden" name="user_id[]" value="<?=$users['id']?>"> </td> <?php if($product_totalData>0){ $p=1; echo '<input type="hidden" name="product_count[]" class="product_count" value="'.$product_totalData.'">'; foreach($product_query as $query){ if($query['category']=="SHIRT"){ $style="background: bisque; color: black;"; }else{ $style="background: cyan; color: black;"; } $product_id = "sum_pro_".$query['id'].""; if($att_results[0][$product_id]==0){ $valuees = ""; }else{ $valuees = $att_results[0][$product_id]; } echo '<td> <input type="text" name="product_'.$p.'[]" id="product_'.$i.'" value="'.$valuees.'" class="form-control form product product_'.$i.' pro_count_'.$p.'" style="'.$style.'"> </td>'; $p++; } } ?> <td> <input type="text" name="product_total[]" id="product_total_<?=$i?>" value="<?=$att_results[0]['product_count_total']?>" class="form-control form product_total"> </td> </tr> <?php }else{ ?> <tr> <td style="text-align: center;" colspan="<?=$no_records_found?>">No Records Found</td> </tr> <?php } ?> <?php $i++; } } ?> </tbody> <tfoot> <tr> <th>Total</th> <?php if($product_totalData>0){ $i=1; foreach($product_query as $query){ echo "<td style=''><input type='text' name='total_product_".$query['id']."' id='total_product_".$i."' value='' class='form-control product tcenter total_product'></td>"; $i++; } } ?> <td><input type="text" name="grand_total" id="grand_total" value="" class="form-control p0 tcenter"></td> </tr> </tfoot> </table> </div> <br> <center><input type="submit" id="add_new_product_submit" name="add_product" value="Add Product" class="btn btn-success" /></center> </form> </div> <div class="form-group" style="text-align:center;"> <a href="product-create.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="product.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> </section> <script> $(document).ready(function(){ grand_total(); function grand_total(){ var tot=0; $(".product_total").each(function(){ tot+=Number($(this).val()); }); $("#grand_total").val(tot); } }); </script> <?php include "footer.php";?>