ok
Direktori : /home2/selectio/www/mm-tailor-billing/hrm/ |
Current File : /home2/selectio/www/mm-tailor-billing/hrm/report-3.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(); $date = date("Y-m-d"); $query = ""; $a=1; foreach($querys as $res){ if($a==1){ $query.= "tbl_reports.pro_".$res['id'].""; }else{ $query.= "+tbl_reports.pro_".$res['id'].""; } $a++; } 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"); } $conditions = ""; $conditions.=" and date between '$start_date' and '$end_date'"; 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(); $statement_users = $pdo->prepare("SELECT h.* FROM tec_users h where h.id!=0 and 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;"> <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;"> </div> </div> </form> <form id="attendance" autocomplete="off"> <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> <th>NET PAY</th> <th>ADVANCE</th> <th>BALANCE</th> </tr> </thead> <tbody> <?php if($users_totalData>0){ $i=1; foreach($product_users as $users){ ?> <?php $sql = "SELECT h.* FROM tbl_reports h where h.date BETWEEN '$date' and '$date'"; $statement_reports = $pdo->prepare($sql); $statement_reports->execute(); $reports_query = $statement_reports->fetchAll(PDO::FETCH_ASSOC); $reports_totalData = $statement_reports->rowCount(); ?> <?php $statement_totals = $pdo->prepare("SELECT SUM(product_total) as product_total, SUM(grand_total) as grand_total, SUM(tbl_reports.leave) AS total_leaves, SUM(advance) as advance_total, SUM(product_total-advance) as grand_total_cal FROM `tbl_reports` WHERE user_id=".$users['id']." $conditions"); $statement_totals->execute(); $totals_reports_query = $statement_totals->fetchAll(PDO::FETCH_ASSOC); $totals_totalData = $statement_totals->rowCount(); ?> <?php $statement_pro_totals = $pdo->prepare("SELECT SUM(".$query.") as product_count_total FROM `tbl_reports` WHERE user_id=".$users['id']." $conditions"); $statement_pro_totals->execute(); $pro_totals_reports_query = $statement_pro_totals->fetchAll(PDO::FETCH_ASSOC); $pro_totals_totalData = $statement_pro_totals->rowCount(); ?> <tr> <td style="text-align: center;"> <b><?=$users['first_name']?></b> <input type="hidden" name="user_id[]" value="<?=$users['id']?>"> </td> <td> <input type="text" name="total" id="total" value="<?=$totals_reports_query[0]['product_total']?>" class="form-control form total"> </td> <td> <input type="text" name="advance" id="advance" value="<?=$totals_reports_query[0]['advance_total']?>" class="form-control form total"> </td> <td> <input type="text" name="grand_total" id="grand_total" value="<?=$totals_reports_query[0]['grand_total_cal']?>" class="form-control form grand_total"> </td> </tr> <?php $i++; } } ?> </tbody> <tfoot> <?php $statement_totals = $pdo->prepare("SELECT SUM(product_total) as product_total, SUM(grand_total) as grand_total, SUM(tbl_reports.leave) AS total_leaves, SUM(advance) as advance_total, SUM(product_total-advance) as grand_total_cal FROM `tbl_reports` WHERE id!=0 $conditions"); $statement_totals->execute(); $totals_reports_query = $statement_totals->fetchAll(PDO::FETCH_ASSOC); $totals_totalData = $statement_totals->rowCount(); ?> <?php $statement_pro_totals = $pdo->prepare("SELECT SUM(".$query.") as product_count_total FROM `tbl_reports` WHERE id!=0 $conditions"); $statement_pro_totals->execute(); $pro_totals_reports_query = $statement_pro_totals->fetchAll(PDO::FETCH_ASSOC); $pro_totals_totalData = $statement_pro_totals->rowCount(); ?> <tr> <th style="text-align: center;"> <b>GRAND TOTAL</b> </th> <td> <input type="text" name="total" id="total" value="<?=$totals_reports_query[0]['product_total']?>" class="form-control form total"> </td> <td> <input type="text" name="advance" id="advance" value="<?=$totals_reports_query[0]['advance_total']?>" class="form-control form total"> </td> <td> <input type="text" name="grand_total" id="grand_total" value="<?=$totals_reports_query[0]['grand_total_cal']?>" class="form-control form grand_total"> </td> </tr> </tfoot> </table> </div> <br> </form> </div> </section> <script> $(document).ready(function(){ $('#attendance').on('submit', function(e){ e.preventDefault(); $("#add_new_product_submit").attr('disabled','disabled'); console.log('Product Submit Option Start...'); var formData = new FormData(this); formData.append('type', 'add_new_reports'); $.ajax({ url: 'apis/reports-add.php', type: 'post', dataType: 'json', data: formData, cache: false, contentType: false, processData: false, enctype: 'multipart/form-data', success: function (response) { console.log(response); if(response['status']==200){ $('#add_new_product').trigger("reset"); $("#add_new_product_submit").removeAttr('disabled'); alert(response['message']); }else{ alert(response['message']); $("#add_new_product_submit").removeAttr('disabled'); } } }); }); }); </script> <script> function isNumberKey(txt, evt) { var charCode = (evt.which) ? evt.which : evt.keyCode; if (charCode == 46) { if (txt.value.indexOf('.') === -1) { return true; } else { return false; } } else { if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; } return true; } </script> <script type="text/javascript"> /*$(document).ready(function(){ grand_advance(); grand_beta(); grand_total(); $("body").on("keyup",".product",function(){ var count=Number($(this).closest("tr").find(".count").val()); var product_count = Number($(this).closest("td").find(".product_count").val()); var product_rate=Number($(this).closest("td").find(".product_rate").val()); var product=Number($(this).val()); total_amount = product*product_rate; $(this).closest("td").find(".product_total").val(total_amount); product_total(count); pro_count(product_count); grand_total(); }); $("body").on("keyup",".advance",function(){ var count=Number($(this).closest("tr").find(".count").val()); var advance=Number($(this).val()); grand_advance(); product_total(count); }); $("body").on("keyup",".beta",function(){ var beta=Number($(this).val()); grand_beta(); }); function pro_count(product_count){ var ptot=0; $(".pro_count_"+product_count).each(function(){ ptot+=Number($(this).val()); }); $("#total_product_"+product_count).val(ptot); } function grand_advance(){ var tot=0; $(".advance").each(function(){ tot+=Number($(this).val()); }); $("#total_advance").val(tot); } function grand_beta(){ var tot=0; $(".beta").each(function(){ tot+=Number($(this).val()); }); $("#total_beta").val(tot); } function product_total(count){ var tot=0; $(".product_total_"+count).each(function(){ tot+=Number($(this).val()); }); var advance = $("#advance_"+count).val(); $("#grand_total_"+count).val(tot-advance); $("#product_total_"+count).val(tot); } function grand_total(){ var tot=0; $(".grand_total").each(function(){ tot+=Number($(this).val()); }); $("#grand_total").val(tot); } });*/ </script> <?php include "footer.php";?>