ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/mm-tailor-billing/hrm/
Upload File :
Current File : //proc/self/root/home2/selectio/www/mm-tailor-billing/hrm/report-1-print.php

<?php  include "config/config.php";?>
<?php
$statements = $pdo->prepare("SELECT * FROM `tbl_products` WHERE status=1");
$results = $statements->execute();
$querys = $statements->fetchAll(PDO::FETCH_ASSOC);
$totalDatas = $statements->rowCount();


$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");
}
$date = date("Y-m-d");
$conditions = "";
$conditions.=" and date between '$start_date' and '$end_date'";



    $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>


    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;
        padding: 0px;
    }
</style>
<?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();
?>

         <table style="width: 100%;">
             <thead>
                 <tr>
                     <th style="width: 10%;">Names</th>
                     <th style="width: 10%;">T.P</th>
                     <th style="width: 10%;">SALARY</th>
                     <th style="width: 10%;">AD</th>
                     <th style="width: 10%;">MISC</th>
                     <th style="width: 10%;">T</th>
                     <th style="width: 10%;">G</th>
                     <th style="width: 10%;">P</th>
                 </tr>
             </thead>
            
                
            
            <tbody>
                 <?php
                 if($users_totalData>0){
                     $i=1;
                     foreach($product_users as $users){ ?>
                    
                    
                    <?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>
                        </td>
                        <td> 
                            <?=$pro_totals_reports_query[0]['product_count_total']?>
                        </td>
                        <td> 
                            <?=$totals_reports_query[0]['product_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['advance_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['advance_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['product_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['grand_total_cal']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['total_leaves']?>
                        </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 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>
                        <td style="text-align: center;">
                            <b>GRAND TOTAL</b>
                        </td>
                        <td> 
                            <?=$pro_totals_reports_query[0]['product_count_total']?>
                        </td>
                        <td> 
                            <?=$totals_reports_query[0]['product_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['advance_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['advance_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['product_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['product_total']-$totals_reports_query[0]['advance_total']?>
                        </td>
                        <td>
                            <?=$totals_reports_query[0]['total_leaves']?>
                        </td>
                    </tr> 
             </tfoot>
         </table>


<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>


Zerion Mini Shell 1.0