403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/(Del)pathways.org.hk/MIS20140127/old20140314/student_invoice/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/(Del)pathways.org.hk/MIS20140127/old20140314/student_invoice/invoice_search.php
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <?php
        require_once '../include/head.php';
        require_once '../include/checkuser.php';
        require_once '../include/Nav_bar.php';
        include_once '../include/DBConnect.php';
        ?>
        <script>
            function cal_total(){
                var i=$('#i').val();
                var total_amount=0;
                for(var j=0;j<i;j++){
                    var temp_amount=parseInt($('#amount_'+j).val());
                    total_amount+=temp_amount;
                }
                $('#total_amount').val(total_amount);
            };
            function cal_discount(){
                var i=$('#i').val();
                var total_discount=0;
                for(var j=0;j<i;j++){
                    var temp_discount=parseInt($('#discount_'+j).val());
                    total_discount+=temp_discount;
                }
                $('#total_discount').val(total_discount);
            };
            $(function() {
                $('.date-picker').datetimepicker({pickTime: false, format: 'yyyy-MM-dd'});
            });
            function change_discount(obj) {
                //alert(obj.id);
                var target_id=obj.id;
                var target_i=target_id.split('_')[1];
                
                    $.ajax({
                        type: "POST",
                        url: "ajax_invoice.php",
                        data: {
                            type: $('#type_'+target_i).val(),
                            linking_id: $('#linking_id').val()
                        },
                        cache: false,
                        success: function(html) {
                            if($('#type_'+target_i).val()==1){//subsidy
                                $('#typerate_'+target_i).val(html);
                                var fee=$('#price_'+target_i).val()*(1-(html/100));//fee=amount wrong naming in the very first beginning
                                var discount=$('#price_'+target_i).val()*((html/100));
                                $('#amount_'+target_i).val(fee);
                                $('#discount_'+target_i).val(discount);
                                $('#typerate_'+target_i).attr("readonly",true);
                                cal_total();
                                cal_discount();
                            }
                            else{
                                if($('#type_'+target_i).val()==2){//package_discount
                                    $('#typerate_'+target_i).val(html);
                                    $('#discount_'+target_i).val(html);
                                    var fee=$('#price_'+target_i).val()-html;
                                    $('#amount_'+target_i).val(fee);
                                    $('#typerate_'+target_i).attr("readonly",true);
                                    cal_total();
                                    cal_discount();
                                }
                                else{
                                    if($('#type_'+target_i).val()==3){//funding
                                        $('#typerate_'+target_i).val(0);
                                        $('#discount_'+target_i).val(0);
                                        $('#amount_'+target_i).val($('#price_'+target_i).val());
                                        $('#typerate_'+target_i).attr("readonly",false);
                                        cal_total();
                                        cal_discount();
                                    }
                                }
                            }
                        }
                    });
            }
            function not_charge(obj){
                var target_id=obj.id;
                var target_i=target_id.split('_')[1];
                $('#typerate_'+target_i).val(0);
                $('#discount_'+target_i).val(0);
                $('#amount_'+target_i).val(0);
                cal_total();
                cal_discount();
            };
            function funding(obj){
                var target_id=obj.id;
                var target_i=target_id.split('_')[1];
                var type_rate=$('#typerate_'+target_i).val();
                var price=$('#price_'+target_i).val();
                var fee=price-type_rate;//typerate_
                $('#discount_'+target_i).val(type_rate);
                $('#amount_'+target_i).val(fee);
                cal_total();
                cal_discount();
            };
            
        </script>
    </head>
    <body>
        <!-- line between nav bar and content -->
        <div class="text-right">
            <ul class="breadcrumb">
                <li class="active"></li>
            </ul>
        </div>
        <!-- line between nav bar and content -->
        <div class="container-fluid pathways-container">
            <?php
            if (isset($_POST['select']) && $_POST['select'] == "Select") {
                $percent = 0;
                $id = $_POST['id'];
                $temp_id = explode("|", $id);
                $stu_id = $temp_id[1];
                $event_id = $temp_id[0];
                $from_date = $_POST['from_date'];
                $to_date = $_POST['to_date'];
                //echo $from_date.'              '.$to_date;
                ?>
                <table border="0" class="table table-striped table-bordered table-hover table-condensed" width="100%">
                    <?php
                    $query = "Select e.event_id,e.event_code,l.lesson_id,l.start_time,l.end_time,l.date,stu.first_name,
                        stu.last_name,stu.linking_id,stu.root_id, e.programme_fee_type,e.program_id,e.subject_id,
                        e.primary_individual_price,e.primary_group_price,e.secondary_individual_price,e.secondary_group_price,
                        e.primary_package_price,e.secondary_package_price,g.grade,la.attendance,la.package_discount,la.is_charge
                        from event as e, lesson_attendance as la,student_grade as sg,grade as g,
                        student as stu,lesson as l,event_lesson as el where e.event_id=el.event_id and
                        el.lesson_id=l.lesson_id and l.lesson_id=la.lesson_id and sg.student_grade_id=stu.linking_id and sg.grade_id=g.grade_id and stu.root_id=la.stu_linking_id and sg.student_grade_id=stu.linking_id and sg.grade_id=g.grade_id
                        and e.deleted=0 and e.actived=1 and sg.deleted=0 and sg.actived=1 and g.deleted=0 and g.actived=1 and la.deleted=0 and la.actived=1 and stu.deleted=0 and stu.actived=1
                        and l.deleted=0 and l.actived=1 and el.deleted=0 and el.actived=1 and stu.linking_id='$stu_id' and l.date>='$from_date' and l.date<='$to_date' and e.event_id='$event_id'";
                    $result = $dbh->query($query); //get invoice data
                    if ($result) {
                        $result->setFetchMode(PDO::FETCH_OBJ);
                        $total_price = 0.0;
                        $total_discount = 0.0;
                        $total_amount = 0.0;
                        $i = 0;

                        while ($row = $result->fetch()) {
                            $query1 = "Select ss.stu_subsidy_id,s.percent as sum_p from student_subsidy as ss, subsidy as s where ss.subsidy_id = s.subsidy_id and ss.deleted=0 and s.deleted=0
                            and s.actived=1 and ss.actived=1 and ss.stu_subsidy_id='$stu_id'";
                            $result1 = $dbh->query($query1); //get percent
                            if ($result1->rowcount() == 0) {
                                $percent = 0;
                            } else {
                                $result1->setFetchMode(PDO::FETCH_OBJ);
                                $row1 = $result1->fetch();
                                $percent = $row1->sum_p;
                            }
                            if ($i == 0) {
                                ?>
                                <tr>
                                    <td colspan="14"><center><h3>INVOICE</h3></center></td>
                                </tr>
                                <tr>
                                    <td colspan="8">
                                        Bill To:<input type="text" name="bill_to" required="true" value="<?= $row->last_name . ' ' . $row->first_name ?>">
                                        <input type="hidden" name="linking_id" id="linking_id" value="<?= $row->linking_id ?>">
                                    </td>
                                    <td>Invoice Date:</td>
                                    <td colspan="6">
                                        <div class="input-append date-picker" id="day_of_birth">
                                            <input type="text" name="invoice_date" id="DOB" class="dateISO">
                                            <span class="add-on">
                                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                                            </span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="8">&nbsp;</td>
                                    <td>Event Code:</td>
                                    <td colspan="6"><input type="text" name="event_code" value="<?= $row->event_code ?>"></td>
                                </tr>
                                <tr>
                                    <th>&nbsp;</th>
                                    <th>Date</th>
                                    <th>Time form</th>
                                    <th>Time to</th>
                                    <th>Hour(s)</th>
                                    <th>Fee type</th>
                                    <th>Price($)</th>
                                    <th>Attendance</th>
                                    <th>Remark</th>
                                    <th>Subsidy(%)/Package discount($)/Funding($)</th>
                                    <th>&nbsp;</th>
                                    <th>Discount($)</th>
                                    <th>Charge?</th>
                                    <th>Amount($)</th>
                                </tr>
                                <?php
                            }
                            /* $query2 = "Insert into invoice set createby=0,createdate=Now(),lastupby=0,lastupdate=Now(),actived=1,deleted=0,
                              stu_linking_id='$row->root_id',code='$row->event_code',remarks=''";
                              $result2 = $dbh->query($query2); */
                            $query4 = "Select Max(invoice_id) as i from invoice";
                            $result4 = $dbh->query($query4);
                            $result4->setFetchMode(PDO::FETCH_OBJ);
                            $row4 = $result4->fetch();
                            $query5 = "Select count(*) as no_of_stu from lesson_attendance where lesson_id ='$row->lesson_id' and deleted=0 and actived=1 group by lesson_id";
                            $result5 = $dbh->query($query5);
                            $result5->setFetchMode(PDO::FETCH_OBJ);
                            $row5 = $result5->fetch();

                            //while ($row5 = $result5->fetch()) {
                            $price = 0.0;
                            $discount = 0.0;
                            $amount = 0.0;
                            if ($row->programme_fee_type != 3) {//3=free
                                if ($row->programme_fee_type == 1) {//1=hour , 2=package
                                    if ($row5->no_of_stu > 1) {//group hr
                                        switch ($row->grade) {
                                            case 'K2':
                                            case 'K3':
                                            case 'P1':
                                            case 'P2':
                                            case 'P3':
                                            case 'P4':
                                            case 'P5':
                                            case 'P6':
                                            case 'Y1':
                                            case 'Y2':
                                            case 'Y3':
                                            case 'Y4':
                                            case 'Y5':
                                            case 'Y6':
                                                $price+=$row->primary_group_price;
                                                break;
                                            case 'S1':
                                            case 'S2':
                                            case 'S3':
                                            case 'S4':
                                            case 'S5':
                                            case 'S6':
                                            case 'Y7':
                                            case 'Y8':
                                            case 'Y9':
                                            case 'Y10':
                                            case 'Y11':
                                            case 'Y12':
                                                $price+=$row->secondary_group_price;
                                                break;
                                        }
                                    } else {
                                        switch ($row->grade) {//induva hr
                                            case 'K2':
                                            case 'K3':
                                            case 'P1':
                                            case 'P2':
                                            case 'P3':
                                            case 'P4':
                                            case 'P5':
                                            case 'P6':
                                            case 'Y1':
                                            case 'Y2':
                                            case 'Y3':
                                            case 'Y4':
                                            case 'Y5':
                                            case 'Y6':
                                                $price+=$row->primary_individual_price;
                                                break;
                                            case 'S1':
                                            case 'S2':
                                            case 'S3':
                                            case 'S4':
                                            case 'S5':
                                            case 'S6':
                                            case 'Y7':
                                            case 'Y8':
                                            case 'Y9':
                                            case 'Y10':
                                            case 'Y11':
                                            case 'Y12':
                                                $price+=$row->secondary_individual_price;
                                                break;
                                        }
                                    }
                                    $price=$price*((strtotime($row->end_time) - strtotime($row->start_time))/3600);
                                    $amount = ($price * (1 - ((double) $percent / 100)));
                                    $discount = $price - ($amount);
                                } else {//package
                                    switch ($row->grade) {
                                        case 'K2':
                                        case 'K3':
                                        case 'P1':
                                        case 'P2':
                                        case 'P3':
                                        case 'P4':
                                        case 'P5':
                                        case 'P6':
                                        case 'Y1':
                                        case 'Y2':
                                        case 'Y3':
                                        case 'Y4':
                                        case 'Y5':
                                        case 'Y6':
                                            $price+=$row->primary_package_price;
                                            break;
                                        case 'S1':
                                        case 'S2':
                                        case 'S3':
                                        case 'S4':
                                        case 'S5':
                                        case 'S6':
                                        case 'Y7':
                                        case 'Y8':
                                        case 'Y9':
                                        case 'Y10':
                                        case 'Y11':
                                        case 'Y12':
                                            $price+=$row->secondary_package_price;
                                            break;
                                    }
                                    $amount = (($price) * (1.0 - ((double) $percent / 100)));
                                    $discount = $price - ($amount);
                                }
                            }
                            $total_price +=$price;
                            $total_discount +=$discount;
                            $total_amount +=$amount;
                            /* echo "<script>alert('".$price."')</script>";
                              echo "<script>alert('".$discount."')</script>";
                              echo "<script>alert('".$fee."')</script>"; */
                            ?>
                            <tr>
                                <td><input type="checkbox" name="lesson_id[]" value="<?= $row->lesson_id ?>"></td>
                                <td><?= $row->date ?><input type="hidden" name="date[]" value=""></td>
                                <td><?= $row->start_time ?><input type="hidden" name="start_time[]" value=""></td>
                                <td><?= $row->end_time ?><input type="hidden" name="end_time[]" value=""></td>
                                <td><?= (strtotime($row->end_time) - strtotime($row->start_time))/3600 ?><input type="hidden" name="hours[]" value=""></td>
                                <td>
                                    <?php
                                    if ($row->programme_fee_type == 1) {
                                        echo 'Hourly' . '<input type="hidden" name="fee_type[]" value="1">';
                                    } else {
                                        if ($row->programme_fee_type == 2) {
                                            echo 'Package' . '<input type="hidden" name="fee_type[]" value="2">';
                                        } else {
                                            echo 'Free' . '<input type="hidden" name="fee_type[]" value="3">';
                                        }
                                    }
                                    ?>
                                </td>
                                <td><?= $price ?><input type="hidden" name="price[]" id='price_<?=$i?>' value="<?= $price ?>"></td>
                                <td>
                                    <?php
                                    if ($row->attendance == 1) {
                                        echo 'Present';
                                        echo '<input type="hidden" name="attendance[]" value="1">';
                                    } else {
                                        echo 'Absent';
                                        echo '<input type="hidden" name="attendance[]" value="0">';
                                    }
                                    ?>
                                </td>
                                <td><textarea name="remarks[]"></textarea></td>
                                <td>
                                    <select name="type[]" id="type_<?= $i ?>" onChange="change_discount(this);">
                                        <option value="1" selected>Subsidy</option>
                                        <option value="2">Package discount</option>
                                        <option value="3">Funding</option>
                                    </select>
                                </td>
                                <td><input type="number" name="type_rate[]" id="typerate_<?= $i ?>" value="<?= $percent ?>" readonly='true' onBlur="funding(this);"></td>
                                <td><input type="number" name="discount[]" id="discount_<?= $i ?>" value="<?= $discount ?>" readonly='true'></td>
                                <td><input type="checkbox" name="is_charge[]" id="charge_<?= $i ?>" onClick="not_charge(this);"></td>
                                <td><input type="text" name="amount[]" id='amount_<?=$i?>' value="<?= $amount ?>" readonly="true"></td>
                            </tr>
                            <?php
                            $i++;
                        }
                    } else {
                        echo '<script>alert("GGGGGGGGGGGg")</script>';
                    }
                    ?>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>Total price:<?= $total_price ?></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>Total discount:<input type='text' name='total_discount' id='total_discount' value='<?= $total_discount ?>' readonly='true'></td>
                        <td>&nbsp;</td>
                        <td>
                            Total amount:<input type='text' name='total_amount' id='total_amount' value='<?= $total_amount ?>' readonly='true'>
                            <input type="hidden" name="i" id="i" value="<?=$i?>">
                        </td>
                    </tr>
                </table>
                <input type="submit" name="generate" value="Generate" class="btn">
                <?php
            } else {
                ?>
                <div>
                    <table border="0" width="100%">
                        <tr>
                            <td><h2>Generate Invoice</h2></td>
                        </tr>
                    </table>
                </div>
                <form action="" method="POST" class="form-inline">
                    <div class="pathways-search">
                        <table border="0" width="100%">
                            <tr>
                                <?php
                                if (isset($_POST['search']) && $_POST['search'] == "Search") {
                                    $from_date = $_POST['from_date'];
                                    $to_date = $_POST['to_date'];
                                    //$yr = $_POST['sem_yr'];
                                    ?>
                                    <!--<td width="20%">
                                        Semaster_Year
                                        <select name="sem_yr">
                                            <?php
                                            $query12 = "Select Sem_yr as yr from student group by Sem_yr";
                                            $result12 = $dbh->query($query12);
                                            $result12->setFetchMode(PDO::FETCH_OBJ);
                                            while ($row12 = $result12->fetch()) {
                                                if ($row12->yr == $yr)
                                                    print '<option value="' . $row12->yr . '" selected>' . $row12->yr . '</option>';
                                                else
                                                    print '<option value="' . $row12->yr . '">' . $row12->yr . '</option>';
                                            }
                                            ?>
                                        </select>
                                    </td>-->
                                    <td width="20%">Date
                                        <div class="input-append date-picker">
                                            <input type="text" name="from_date" class="dateISO" required="true" value="<?= $from_date ?>">
                                            <span class="add-on">
                                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                                            </span>
                                        </div>
                                    </td>
                                    <td width="20%">To
                                        <div class="input-append date-picker">
                                            <input type="text" name="to_date" class="dateISO" required="true" value="<?= $to_date ?>">
                                            <span class="add-on">
                                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                                            </span>
                                        </div>
                                    </td>
                                    <?php
                                } else {
                                    ?>
                                    <!--<td width="20%">
                                        Semaster_Year
                                        <select name="sem_yr">
                                            <?php
                                            /*$curr_yr = date("Y");
                                            $curr_mon = date("M");
                                            echo "<script>alert('.$curr_yr.' '.$curr_mon.')</script>";
                                            $query12 = "Select Sem_yr as yr from student group by Sem_yr";
                                            $result12 = $dbh->query($query12);
                                            $result12->setFetchMode(PDO::FETCH_OBJ);
                                            while ($row12 = $result12->fetch()) {
                                                $year1 = explode("-", $row12->yr)[0];
                                                $year2 = explode("-", $row12->yr)[1];
                                                if ($curr_yr == $year1 && $curr_mon >= 9) {
                                                    print '<option value="' . $row12->yr . '"selected>' . $row12->yr . '</option>';
                                                } else {
                                                    if ($curr_yr == $year2 && $curr_mon < 9) {
                                                        print '<option value="' . $row12->yr . '"selected>' . $row12->yr . '</option>';
                                                    }
                                                    else
                                                        print '<option value="' . $row12->yr . '">' . $row12->yr . '</option>';
                                                }
                                            }*/
                                            ?>
                                        </select>
                                    </td>-->
                                    <td width="20%">
                                        Date
                                        <div class="input-append date-picker">
                                            <input type="text" name="from_date" class="dateISO" required="true">
                                            <span class="add-on">
                                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                                            </span>
                                        </div>
                                    </td>
                                    <td width="20%">
                                        To
                                        <div class="input-append date-picker">
                                            <input type="text" name="to_date" class="dateISO" required="true">
                                            <span class="add-on">
                                                <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i>
                                            </span>
                                        </div>
                                    </td>
                                    <?php
                                }
                                ?>
                                <td><input type="submit" name="search" class="btn" value="Search"></td>
                            </tr>
                        </table>
                    </div>
                    <table border="0" class="table table-striped table-bordered table-hover table-condensed">
                        <thead>
                            <tr>
                                <th>&nbsp;</th>
                                <th>Name</th>
                                <th>Event Code</th>
                            </tr>
                        </thead>
                        <?php
                        if (isset($_POST['search']) && $_POST['search'] == "Search") {
                            $from_date = $_POST['from_date'];
                            $to_date = $_POST['to_date'];
                            //$yr = $_POST['sem_yr'];
                            $query = "Select e.event_id,e.event_code,l.lesson_id,l.start_time,l.end_time,l.date,stu.first_name,stu.last_name,stu.linking_id,stu.root_id,stu.New_stu_ID as id,e.programme_fee_type,e.program_id,e.subject_id,e.primary_individual_price,e.primary_group_price,e.secondary_individual_price,e.secondary_group_price,
                        e.primary_package_price,e.secondary_package_price,g.grade,la.attendance 
                        from event as e, lesson_attendance as la,student_grade as sg,grade as g,
                        student as stu,lesson as l,event_lesson as el where e.event_id=el.event_id and
                        el.lesson_id=l.lesson_id and l.lesson_id=la.lesson_id and sg.student_grade_id=stu.linking_id and sg.grade_id=g.grade_id and stu.root_id=la.stu_linking_id and sg.student_grade_id=stu.linking_id and sg.grade_id=g.grade_id
                        and e.deleted=0 and e.actived=1 and la.deleted=0 and la.actived=1 and stu.deleted=0 and stu.actived=1
                        and l.deleted=0 and l.actived=1 and el.deleted=0 and el.actived=1 and l.date>='$from_date' and l.date<='$to_date' group by stu.linking_id,e.event_code";
                            /* Select e.event_id,e.event_code,ss.subsidy_id,s.subsidy_type,s.percent,l.lesson_id,l.start_time,l.end_time,l.date,stu.first_name,stu.last_name,stu.linking_id,stu.root_id,
                              e.programme_fee_type,e.program_id,e.subject_id,e.primary_individual_price,e.primary_group_price,e.secondary_individual_price,e.secondary_group_price,
                              e.primary_package_price,e.secondary_package_price,e.is_free,g.grade,la.attendance from event as e, lesson_attendance as la,student_grade as sg,grade as g,
                              student as stu,student_subsidy as ss,subsidy as s,lesson as l,event_lesson as el where e.event_id=el.event_id and
                              el.lesson_id=l.lesson_id and l.lesson_id=la.lesson_id and
                              stu.linking_id=ss.stu_subsidy_id and ss.subsidy_id=s.Subsidy_ID and sg.student_grade_id=stu.linking_id and sg.grade_id=g.grade_id
                              and e.deleted=0 and e.actived=1 and la.deleted=0 and la.actived=1 and stu.deleted=0 and stu.actived=1
                              and ss.deleted=0 and ss.actived=1 and s.deleted=0 and s.actived=1 and l.deleted=0 and l.actived=1
                              and el.deleted=0 and el.actived=1 and l.date>='$from_date' and l.date<='$to_date' and stu.New_stu_ID='$stu_id' and stu.Sem_yr='$yr'
                              group by e.event_id"; */
                            /*
                              Select e.event_id,e.event_code,l.lesson_id,l.start_time,l.end_time,l.date, e.programme_fee_type,e.program_id,e.subject_id,e.primary_individual_price,e.primary_group_price,e.secondary_individual_price,e.secondary_group_price,
                              e.primary_package_price,e.secondary_package_price
                              from event as e,lesson as l,event_lesson as el
                              where e.event_id=el.event_id and el.lesson_id=l.lesson_id
                             */
                            $result = $dbh->query($query); //get invoice data
                            $result->setFetchMode(PDO::FETCH_OBJ);
                            while ($row = $result->fetch()) {
                                $query_pro = "Select program_name from program where program_id='$row->program_id'";
                                $query_sub = "Select sub_name from subject where subject_id='$row->subject_id'";
                                $result_pro = $dbh->query($query_pro);
                                $result_sub = $dbh->query($query_sub);
                                $result_pro->setFetchMode(PDO::FETCH_OBJ);
                                $result_sub->setFetchMode(PDO::FETCH_OBJ);
                                $sub = $result_sub->fetch();
                                $pro = $result_pro->fetch();
                                //*****************************************************************//
                                $query1 = "Select ss.stu_subsidy_id,s.percent as sum_p from student_subsidy as ss, subsidy as s where ss.subsidy_id = s.subsidy_id and ss.deleted=0 and s.deleted=0
                            ";
                                $result1 = $dbh->query($query1); //get percent
                                $result1->setFetchMode(PDO::FETCH_OBJ);

                                while ($row1 = $result1->fetch()) {
                                    if ($row->linking_id == $row1->stu_subsidy_id) {
                                        //echo '<script>' . $row->percent . '</script>';
                                        $percent = $row1->sum_p;
                                    }
                                }
                                $query5 = "Select count(*) as no_of_stu from lesson_attendance where lesson_id IN 
                                    (Select lesson_id from lesson_attendance where stu_linking_id='$row->root_id')";
                                $result5 = $dbh->query($query5);
                                $result5->setFetchMode(PDO::FETCH_OBJ);
                                $row5 = $result5->fetch();
                                ?>
                                <tr>
                                    <td>
                                        <input type="radio" name="id" value="<?= $row->event_id . '|' . $row->linking_id ?>">
                                    </td>
                                    <td><?= $row->last_name . " " . $row->first_name."(".$row->id.")" ?></td>
                                    <td><?= $row->event_code ?></td>
                                </tr>
                                <?php
                            }
                        }
                        ?>
                    </table>
                    <input type="submit" name="select" class="btn" value="Select">
                </form>
            <?php } ?>
        </div>
    </body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit