HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/public_html/baris.beatleanalytics.com/site/template/rbpcbillsummary.php
<!DOCTYPE html>
<?php
// Declare new object 

$objScorecardctsnew = object;

// Assing object 
$objScorecardctsnew = $objDB->objController;

// Assign all variable's value
$pg         = $objScorecardctsnew->pg;
$acn        = $objScorecardctsnew->acn;
$v             = $objScorecardctsnew->v;
$State         = $objScorecardctsnew->State;
$ReligionName  = $objScorecardctsnew->ReligionName;
$sort       = $objScorecardctsnew->sort;
$ReligionID    = $objScorecardctsnew->ReligionID;
$field         = $objScorecardctsnew->field;
$error         = $objScorecardctsnew->error;
$msg        = $objScorecardctsnew->msg;
$perpage       = $objScorecardctsnew->perpage;
$start         = $objScorecardctsnew->start;
$limit         = $objScorecardctsnew->limit;
$SearchValue   = $objScorecardctsnew->SearchValue;
$s          = $objScorecardctsnew->s;

$CustomerID    = $objScorecardctsnew->CustomerID;
$SurveyID      = $objScorecardctsnew->SurveyID;
$TokenID    = $objScorecardctsnew->TokenID;
$pType         = $objScorecardctsnew->pType;

$OrgID         = $objScorecardctsnew->OrgID;
$BranchID      = $objScorecardctsnew->BranchID;
$IndustryID    = $objScorecardctsnew->IndustryID;
$FromDate      = $objScorecardctsnew->FromDate;
$ToDate        = $objScorecardctsnew->ToDate;

$StationId  = $objScorecardctsnew->StationId;
$QuestionId = $objScorecardctsnew->QuestionId;
$AuditorId  = $objScorecardctsnew->AuditorId;
$Month        = $objScorecardctsnew->Month;
$Year        = $objScorecardctsnew->Year;

$valck[] = array();

if (!in_array('RBPC', explode(',', $userdata[0]['reportType']))) {
    ReturnPostFormData($ValidateArr = array(), "error.html", "<span class='error-msg'>Method <strong>" . $acn . "</strong> does not exist in <strong>" . $pg . "</strong> file !</span>", 2);
}

?>
<!-- jQuery 3 -->
<script src="<?php echo $curImagePath ?>/bower_components/jquery/dist/jquery.min.js"></script>
<link rel="stylesheet" href="<?php echo $curImagePath ?>/datatable/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="<?php echo $curImagePath ?>/datatable/css/buttons.dataTables.min.css">
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">-->
<link rel="stylesheet" href="<?php echo $curImagePath ?>/dist/css/Custom.css">
<link rel='stylesheet' type='text/css' href='<?php echo $curImagePath ?>/datepikar2/datepicker3.css'>
<link rel='stylesheet' type='text/css' href='<?php echo $curImagePath ?>/datepikar2/daterangepicker-bs3.css'>
<script src="<?php echo $curImagePath ?>/dist/js/jQuery.print.min.js"></script>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <!-- /.box -->
                <div class="box">
                    <!-- /.box-header -->
                    <div class="box-body">
                        <!------------------------------------------------------------------>

                        <form method="post" action="rbpcbillsummary.html" name="frmSearch" id="frmSearch" class="pe-no-print">
                            <div class="box-header">
                                <h3 class="box-title" style="width:100%;">
                                    <div class="form-group">
                                        <div class="col-md-4"><a class="btn btn-info btn-sm" href="dashboardrbpc.html"> <i class="fa fa-long-arrow-left"></i> Back </a></div>

                                        <div class=" col-xs-12 col-md-3 col-lg-2 form-group">
                                            <select class="form-control input-md" id="month" name="Month">
                                                <option value="01">Janaury</option>
                                                <option value="02">February</option>
                                                <option value="03">March</option>
                                                <option value="04">April</option>
                                                <option value="05">May</option>
                                                <option value="06">June</option>
                                                <option value="07">July</option>
                                                <option value="08">August</option>
                                                <option value="09">September</option>
                                                <option value="10">October</option>
                                                <option value="11">November</option>
                                                <option value="12">December</option>
                                            </select>
                                        </div>
                                        <div class=" col-xs-12 col-md-3 col-lg-2 form-group">

                                            <select class="form-control input-md" id="year" name="Year">
                                                <?php
                                                $firstYear = 2020;
                                                $lastYear = (int)date('Y');
                                                for ($i = $firstYear; $i <= $lastYear; $i++) {
                                                    echo '<option value=' . $i . '>' . $i . '</option>';
                                                } ?>
                                            </select>
                                        </div>

                                        <div class="input-group input-group-sm pull-right- text-right">
                                            <span class="pull-right text-right form-group no-padding">
                                                <a class="btn btn-success btn-sm" onclick="myFunction()" href="#"> <i class="fa fa-search"></i> GO </a>
                                                <script>
                                                    function myFunction() {
                                                        $(".loader").show();
                                                        document.getElementById("frmSearch").submit();
                                                    }
                                                    $(window).bind("load", function() {
                                                        //$(".loader").hide();
                                                    });
                                                </script>
                                                <a href="http://summary.peerless-investments.com/rbpc" target="_blank">
                                                    <button style="color:#00A65A; border: 2px; padding: 2px; border-radius: 6px;">View Previous Reports</button>
                                                </a>
                                            </span>
                                        </div>
                                        <div class="col-md-4"></div>
                                    </div>
                                </h3>
                            </div>
                        </form>

                        <div class="NEWCTS">
                            <div class="fixed-btn">

                                <div class="table_print- pe-no-print">
                                    <form name="myform" class="print_cheked">
                                        <button type="button" class="print print_btn">Print All</button>
                                        <!-- onClick="breakeveryheader()" -->
                                        <input type="checkbox" name="mybox" checked="" style="display: none;">
                                    </form>
                                </div>
                            </div>
                            <div class="printTable pe-preserve-ancestor" id="printTable">
                                <!---<div class="creat_new_page_print"></div>
                           <table id="" class="display-- new_print_display" style="width:100%;     margin-bottom: 87px;  ">
                                aaaaaaa
                             </table>--->

                                <table id="" class="display-- new_print_display" style="width:100%;     margin-bottom: 87px;  ">
                                    <colgroup span="10" width="64"></colgroup>
                                    <tbody>

                                        <tr class="no_br report_header2">
                                            <td colspan="28" height="28" align="center" valign="bottom"> NORTH EASTERN RAILWAY </td>
                                        </tr>

                                        <tr class="no_br report_header2">
                                            <td colspan="28" height="28" align="center" valign="bottom"><span class="report_name">RBPC - Bill Summary</span> </td>
                                        </tr>
                                        <tr class="no_br report_header2 " style="border-bottom: 1px solid #bfbfbf;">
                                            <td colspan="28" height="28" align="center" valign="bottom">
                                                Daily uses of type and quantity of consumables of environmental sanitation, mechanized cleaning and housekeeping contract at <?php echo $objScorecardctsnew->getcommondata('baris_station', 'stationName', 'OrgID', $_SESSION['UserInfo']['OrgID']) ?> Railway station

                                            </td>
                                        </tr>
                                        <tr class="no_br">
                                            <td height="100" style=" height: 12px !important;"></td>
                                        </tr>

                                        <tr class="no_br report_header2">
                                            <td colspan="28" height="28" valign="bottom">
                                                Month :<span class="t_nas" id="dateofinspection00"><?php echo date("F", mktime(null, null, null, $Month)) ?></span>
                                                Year :<span class="t_nas" id="dateofinspection00"><?php echo $Year; ?></span>
                                                Division :<span class="t_nas" id="auditorname00"><?php echo $objScorecardctsnew->getcommondata('baris_division', 'DivisionName', 'OrgID', $_SESSION['UserInfo']['OrgID']) ?></span>
                                                Station :<span class="t_nas" id="trainno00"><?php echo $objScorecardctsnew->getcommondata('baris_station', 'stationName', 'OrgID', $_SESSION['UserInfo']['OrgID']) ?></span>
                                                Name Of Contractor:<span class="t_nas" id="#"><?php echo $objScorecardctsnew->getcommondata('baris_organization', 'db_Orgname', 'OrgID', $_SESSION['UserInfo']['OrgID']) ?> </span>
                                            </td>
                                        </tr>
                                        <tr class="no_br report_header2">
                                            <td colspan="28" height="28" valign="bottom">
                                                Total Payment :<span class="t_nas" id="total_payment">xxxxx</span>
                                                Total Penalty :<span class="t_nas" id="total_penalty">xxxxx</span>
                                            </td>
                                        </tr>

                                        <tr class="no_br">
                                            <td height="100" style=" height: 12px !important;"></td>
                                        </tr>


                                        <tr class="header_bg">
                                            <td height="180" align="center" valign="middle">S.No</td>
                                            <td align="center" valign="middle">Date</td>
                                            <td align="center" valign="middle"><b>Total No Of Coaches</b></td>
                                            <td align="center" valign="middle"><b>No Of Coaches Attended</b></td>
                                            <td align="center" valign="middle"><b>Total Bill @ Rs. 231.74676 per Coach (A)</b></td>
                                            <td align="center" valign="middle"><b>No. Of Coaches not attended due to Contractors Failure (no)</b></td>
                                            <td align="center" valign="middle"><b>Deduction Against work Failure @ 25% of accepted rate (B)</b></td>
                                            <td align="center" valign="middle"><b>Deduction Against Due to Grading (C)</b></td>
                                            <td align="center" valign="middle"><b>Deduction against manpower , machine &amp; dress code </b></td>
                                            <td align="center" valign="middle"><b>Amount Payable (E) = A- (B+C+D)</b></td>
                                        </tr>
                                        <?php
                                        $rsParamIDS = SubQuestionGroupIDS('params', 13); //subquestion
                                        $rsPagesIDS = SubQuestionGroupIDS('pages', $rsParamIDS[0]);

                                        $total_payment = 0;
                                        $total_bill = 0;
                                        $pointC = 0;

                                        $number = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);
                                        for ($i = 1; $i <= $number; $i++) {
                                            $noofcoach_attended = 0;
                                            $totalAverage = 0;
                                            $finalPayment = 0;

                                            $date = $Year . '-' . $Month . '-' . $i;
                                            $coachesCount = fetchTotalCoachesForSummery("RBPC", $date, $date);
                                            $rsQuestionsInfo = $objScorecardctsnew->FetchQuestionsData($date);

                                            if (count($rsQuestionsInfo) > 0) {
                                                // echo "<pre>";
                                                // print_r($rsQuestionsInfo);
                                                // die(); 

                                                for ($q = 0; $q < count($rsQuestionsInfo); $q++) {
                                                    $rsCoachList = $objScorecardctsnew->FetchCoachList($rsQuestionsInfo[$q][0]['tokenid']);
                                                    $vertiScoreZero1 = 0;
                                                    $vertiScoreDash1 = 0;

                                                    $totalCountOfOne = 0;
                                                    $totalCount = 0;

                                                    $noofcoach_nill = 0;
                                                    $noofcoach_10 = 0;
                                                    $noofcoach_20 = 0;

                                                    for ($c = 0; $c < count($rsCoachList); $c++) {
                                                        $vertiScoreZero = 0;
                                                        $vertiScoreDash = 0;

                                                        $vertiScore = 0;
                                                        $vertiCountOfOne = 0;
                                                        for ($j = 0; $j < count($rsQuestionsInfo[$q]); $j++) {
                                                            $avgVal = $objScorecardctsnew->FetchValueScore($rsQuestionsInfo[$q][$j]['db_surveyQuestionId'], '', $rsQuestionsInfo[$q][$j]['db_surveyPageId'], $rsQuestionsInfo[$q][$j]['tokenid'], $rsCoachList[$c][0]);

                                                            if ($avgVal != "-") {
                                                                $totalCountOfOne = $totalCountOfOne + $avgVal;
                                                                $totalCount++;

                                                                $vertiScore = $vertiScore + $avgVal;
                                                                $vertiCountOfOne++;
                                                            }
                                                            if ($avgVal == "0") {
                                                                $vertiScoreZero++;
                                                                $totalCount++;
                                                            }

                                                            if ($avgVal == "-") {
                                                                $vertiScoreDash++;
                                                            }
                                                        }
                                                        if ($vertiScoreZero == 12) {
                                                            $vertiScoreZero1++;
                                                        }

                                                        if ($vertiScoreDash == 12) {
                                                            $vertiScoreDash1++;
                                                        }

                                                        $vertiScoreAvg = round(($vertiScore / $vertiCountOfOne) * 10, 2);

                                                        if ($vertiScoreAvg > 90) {
                                                            $noofcoach_nill++;
                                                        } elseif ($vertiScoreAvg >= 80) {
                                                            $noofcoach_10++;
                                                        } elseif ($vertiScoreAvg >= 70) {
                                                            $noofcoach_20++;
                                                        } else {
                                                            $noofcoach_nopay++;
                                                        }
                                                    }
                                                    $noofcoach_attended += count($rsCoachList) - ($vertiScoreZero1 + $vertiScoreDash1);
                                                    $totalAverage += round(($totalCountOfOne / $totalCount) * 10, 2);

                                                    $paydue_nill = round($noofcoach_nill * 231.74676, 2);
                                                    $paydue_10 = round($noofcoach_10 * (231.74676 - (231.74676 * 10 / 100)), 2);
                                                    $paydue_20 = round($noofcoach_20 * (231.74676 - (231.74676 * 20 / 100)), 2);

                                                    $finalPayment += round($paydue_nill + $paydue_10 + $paydue_20, 2);
                                                }
                                                $totalAverage = round($totalAverage / count($rsQuestionsInfo), 2);
                                            }

                                            $absent = 0;
                                            $foundWoDress = 0;
                                            $foundWoProGlass = 0;
                                            $rsQuestionsInfo = $objScorecardctsnew->FetchQuestionsDataManpower($date);
                                            if (count($rsQuestionsInfo) > 0) {
                                                for ($q = 0; $q < count($rsQuestionsInfo); $q++) {
                                                    foreach ($rsParamIDS as $rsParams) {
                                                        $rsParamData = $objScorecardctsnew->getParamsData($rsParams);
                                                        $desc = explode(',', $rsParamData[0]['paramChoice']);
                                                        foreach ($desc as $key1 => $value) {
                                                            $avgVal1 = 0;
                                                            foreach ($rsPagesIDS as $key2 => $rsPages) {

                                                                $avgVal = $objScorecardctsnew->FetchValueScoreManpower($rsQuestionsInfo[$q][0]['db_surveyQuestionId'], $rsQuestionsInfo[$q][0]['db_surveySubQuestionId'], $rsParams, $rsPages, $value, $rsQuestionsInfo[$q][0]['tokenid']);
                                                                $avgVal1 += $avgVal;
                                                                if ($key2 == 1) {
                                                                    $absent += $avgVal;
                                                                    $avgVal1 -= $avgVal;
                                                                    //$actualAvailable += $avgVal1-$avgVal;
                                                                }
                                                                if ($key2 == 2) {
                                                                    $foundWoDress += $avgVal;
                                                                }
                                                                if ($key2 == 3) {
                                                                    $foundWoProGlass += $avgVal;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        ?>

                                            <?php $pointA = round($noofcoach_attended * 231.74676, 2); ?>
                                            <?php $pointB = round(($coachesCount - $noofcoach_attended) * 57.93669, 2); ?>

                                            <?php $pointD = ($absent * 1000) + ($foundWoDress * 100) + ($foundWoProGlass * 20); ?>
                                            <?php
                                            $pointC = $pointA - $finalPayment;
                                            // if($totalAverage >= 71 &&  $totalAverage <= 80){
                                            // 	$per = 231.74676/100*20;
                                            // 	$pointC = round($per*$noofcoach_attended,2);
                                            // }elseif($totalAverage >= 81 &&  $totalAverage <= 90){
                                            // 	$per = 231.74676/100*10;
                                            // 	$pointC = round($per*$noofcoach_attended,2);
                                            // }elseif($totalAverage <= 70){
                                            // 	$pointC = 0;//todo
                                            // }elseif($totalAverage == 0){
                                            // 	$pointC = 0;
                                            // }
                                            ?>

                                            <?php $pointE = round($pointA - ($pointB + $pointC + $pointD), 2); ?>

                                            <?php $total_payment = $total_payment + $pointE; ?>
                                            <?php $total_bill += $pointA; ?>

                                            <tr>
                                                <td height="40" align="center" valign="middle" sdval="<?php echo $i; ?>" sdnum="1033;"><?php echo $i; ?></td>
                                                <td align="center" valign="middle"><?php echo $i . '-' . date("M", mktime(null, null, null, $Month)) . '-' . $Year ?></td>
                                                <td align="center" valign="middle" sdval="200" sdnum="1033;"><?php echo $coachesCount; ?></td>
                                                <td align="center" valign="middle" sdval="200" sdnum="1033;"><?php echo $noofcoach_attended; ?></td>
                                                <td align="center" valign="middle" sdval="46349.352" sdnum="1033"><?php echo $pointA; ?></td>
                                                <td align="center" valign="middle" sdval="0" sdnum="1033;"><?php echo $coachesCount - $noofcoach_attended; ?></td>
                                                <td align="center" valign="middle" sdval="0" sdnum="1033;"><?php echo $pointB; ?></td>
                                                <td align="center" valign="middle"><?php echo $pointC; ?></td>
                                                <td align="center" valign="middle"><?php echo $pointD; ?></td>
                                                <td align="center" valign="middle"><?php echo $pointE; ?></td>
                                            </tr>

                                        <?php } ?>

                                        <script type="text/javascript">
                                            $("#total_payment").text(<?php echo round($total_payment, 2); ?>)
                                            $("#total_penalty").text(<?php echo round($total_bill - $total_payment, 2); ?>)
                                        </script>


                                        <tr class="no_br report_header2 signature" style="">
                                            <td colspan="28" height="28" valign="bottom" style=" padding-top: 28px !important;">
                                                <span class="t_nas" id="" style=" padding: 0px 20px 36px 20px; margin-right: 20%;">Signature of Contractor Representative </span>
                                                <span class="t_nas" id="" style="padding: 0px 20px 36px 20px; margin-left: 20%;">SSE/JE IN Charge</span>
                                            </td>
                                        </tr>


                                    </tbody>
                                </table>



                            </div>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo $curImagePath ?>/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="<?php echo $curImagePath ?>/datatable/js/jquery.dataTables.min.js"></script>
<script src="<?php echo $curImagePath ?>/datatable/js/dataTables.buttons.min.js"></script>
<script src="<?php echo $curImagePath ?>/datatable/js/buttons.flash.min.js"></script>
<script src="<?php echo $curImagePath ?>/datatable/js/buttons.print.min.js"></script>
<!-- SlimScroll -->
<script src="<?php echo $curImagePath ?>/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="<?php echo $curImagePath ?>/bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo $curImagePath ?>/dist/js/demo.js"></script>
<script src="<?php echo $curImagePath ?>/datepikar2/bootstrap-datepicker.js"></script>
<script src="<?php echo $curImagePath ?>/datepikar2/daterangepicker.js"></script>
<script src="<?php echo $curImagePath ?>/datepikar2/moment.min.js"></script>
<script>
    $(document).ready(function() {
        $("#FromDate").datepicker({
            format: 'dd-mm-yyyy'
        });
        $("#ToDate").datepicker({
            format: 'dd-mm-yyyy'
        });
        //document.forms["frmSearch"].submit();
    });

    function validateDate() {

        var D1 = document.getElementById("ToDate");
        var D2 = document.getElementById("FromDate");

        if (D1.value.trim() == "") {
            D1.style.border = "1px solid red";
            return false;
        }

        if (D2.value.trim() == "") {
            D2.style.border = "1px solid red";
            return false;
        }
    }

    $('#month').val('<?php echo $Month ?>');
    $('#year').val('<?php echo $Year ?>');
</script>
<!---creat_new_page_print--->
<script>
    function breakeveryheader() {
        if (!document.getElementById) {
            alert("You need IE5 or NS6 to run this example")
            return
        }
        var thestyle = (document.forms.myform.mybox.checked) ? "always" : "auto"
        for (i = 0; i < document.getElementsByClassName("creat_new_page_print").length; i++)
            document.getElementsByClassName("creat_new_page_print")[i].style.pageBreakBefore = thestyle
    }
</script>
<script>
    $('.print_btn').on('click', function() { // select print button with class "print," then on click run callback function
        breakeveryheader();
        $.print("#printTable"); // inside callback function the section with class "content" will be printed
    });
</script>
<!--//creat_new_page_print -->
<style>
    @media print {
        .new_print_display {
            page-break-after: always;
        }
    }

    @page {
        size: A4;
    }
</style>