IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/reports/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/reports/pending_fee.blade.php

@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12">
        <!--<div class="card">-->
        <div class="body">
            <button class="btn btn-raised btn-warning btn-round waves-effect" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">Advance Search</button>
            <div class="collapse" id="collapseExample">
                <div class="well">
                    <div class="row clearfix">
                        <div class="col-lg-12 col-md-12 col-sm-12">
                            <div class="card">
                                <div class="header">
                                    <h2><strong>Advance Search</strong></h2>
                                </div>
                                <div class="body">
                                    {!! Form::open(['method' => 'GET',  'action' => ['School\StdTransactionReportController@pendingDues'], 'class' => 'form-horizontal']) !!}
                                    <div class="row clearfix">
                                        <div class="col-sm-6">
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">Class</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        <div style="border:1px solid #ccc; width:250px; height: 150px; overflow-y: scroll;">
                                                            @foreach($classes as $key=>$value)
                                                            <div class="checkbox-inline" style="padding-left:10px;padding-top:5px;">
                                                                <input type="checkbox" name="classes[]" value="{{$key}}" class="class_ids">
                                                                <label>{{$value}}</label>
                                                            </div>
                                                            @endforeach
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">From Date</label>
                                                </div>
                                                <div class="col-sm-5">
                                                    <div class="form-group">
                                                        {!! Form::text('fromDate',null,['class' => 'form-control datepicker']) !!}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">Section</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        <div id="idSection" style="border:1px solid #ccc; width:250px; height: 150px; overflow-y: scroll;">

                                                        </div>
                                                        <!--<select name='idSection' id="idSection" class="form-control show-tick ms"></select>-->
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="classname">To Date</label>
                                                </div>
                                                <div class="col-sm-5">
                                                    <div class="form-group">
                                                        {!! Form::text('toDate',null,['class' => 'form-control datepicker']) !!}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row clearfix">
                                        <div class="col-sm-8 offset-sm-2">
                                            {!! Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                                            {!! Form::close() !!} 
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--</div>-->
    </div>
</div>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Student Due Data</strong></h2>
           </div>
           
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover dataTable"  id="tableexp">
                    <thead>
                        <tr>
                            <th>Ec No.</th>
                            <th>Name</th>
                            <th>Father </th>
                            <th>Mobile</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Total Fee</th>
                            <th>Paid</th>
                            <th>Discount</th>
                            <th>Penalty</th>
                            <th>Total Due</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($students as $var)
                        <?php
                            $class_feeheads = \DB::table('feeheads')->where('idClass', '=', $var->idClass)
                                    ->where('idFinancialYear','=', getFinancialYear())
                                    ->where('idSection', '=', $var->idSection)
                                    ->where('studentCategory', '=', $var->studentType)
                                    ->whereNull('idStudent');
                            //   ->get();
                            $allcat_feeheads = \DB::table('feeheads')->where('idClass', '=', $var->idClass)
                                    ->where('idFinancialYear','=', getFinancialYear())
                                    ->where('idSection', '=', $var->idSection)
                                    ->where('studentCategory', '=', 'All')
                                    ->whereNull('idStudent');
                            //   ->get();
                            $feeheads = \DB::table('feeheads')->where('idStudent', '=', $var->idStudent)
                                    ->union($class_feeheads)
                                    ->union($allcat_feeheads)
                                    ->orderBy('toDate')
                                    ->get();
                            $feetotal = $feeheads->sum('amount');
                            $transaction = DB::table('student_transaction')
                                    ->leftJoin('excess_transaction', 'student_transaction.idExcessTransaction', '=', 'excess_transaction.idExcessTransaction')
                                    ->where('idStudent', '=', $var->idStudent)
                                    ->where('student_transaction.idFinancialYear','=', getFinancialYear())
                                    ->where(function($query) {
                                        $query->whereNull('status');
                                        $query->orWhere('status', '=', 'In-Process');
                                        $query->orWhere('status', '=', 'Cleared');
                                        $query->orWhere('status', '=', 'Success');
                                    })
                                    ->select(DB::raw('SUM(excessAmount) as excessAmount'), DB::raw('SUM(totalPaid) as totalPaid'), DB::raw('SUM(discount) as discount'), DB::raw('SUM(fine) as fine'), DB::raw('SUM(penaltyAmount) as penaltyAmount'),'student_transaction.chequeBounceCharge')
                                    ->first();
                            $lesstransaction = DB::table('lesser_transaction')
                                    ->leftJoin('excess_transaction', 'lesser_transaction.idExcessTransaction', '=', 'excess_transaction.idExcessTransaction')
                                    ->where('idStudent', '=', $var->idStudent)
                                    ->where('lesser_transaction.idFinancialYear','=', getFinancialYear())
                                    ->where(function($query) {
                                        $query->whereNull('status');
                                        $query->orWhere('status', '=', 'In-Process');
                                        $query->orWhere('status', '=', 'Cleared');
                                        $query->orWhere('status', '=', 'Success');
                                    })
                                    ->select(DB::raw('SUM(excessAmount) as excessAmount'), DB::raw('SUM(totalPaid) as totalPaid'), DB::raw('SUM(discount) as discount'), DB::raw('SUM(fine) as fine'), DB::raw('SUM(penaltyAmount) as penaltyAmount'),'lesser_transaction.chequeBounceCharge')
                                    ->first();
                                $b = $feetotal + ($transaction->fine+$lesstransaction->fine) + ($transaction->penaltyAmount+$lesstransaction->penaltyAmount) + ($transaction->chequeBounceCharge+$lesstransaction->penaltyAmount) - ($transaction->discount+$lesstransaction->discount) - ($transaction->totalPaid+$lesstransaction->totalPaid);
                            ?>
                            @if($b > 0)
                        <tr>
                            <!--<td><input type="checkbox" name="students[]" value="{{ $var->idStudent }}"></td>-->
                            <td>{{$var->ecNo}}</td>
                            <td>{{$var->firstName}} {{$var->middleName}} {{$var->lastName}}</td>
                            <td>{{$var->father_fname}} {{$var->father_lname}}</td>
                            <td>{{$var->father_mobile}}</td>
                            <td>@if(isset($var->classM)) {{$var->classM->className}} @endif</td>
                            <td>@if(isset($var->section)) {{$var->section->sectionName}} @endif</td>
                            <td>{{$feetotal}}</td>
                            <td>
                                {{$transaction->totalPaid+$lesstransaction->totalPaid}}
                            </td>
                            <td>
                                 {{$transaction->discount+$lesstransaction->discount}}
                            </td>
                            <td>
                                @if($transaction->fine!=null || $transaction->penaltyAmount!=null)
                                {{$transaction->fine +$transaction->penaltyAmount + $transaction->chequeBounceCharge}}
                                @else
                                0.00
                                @endif
                            </td>
                            <td>
                             {{$b}}
                            </td>
<!--                            <td>
                            <?php
                            $datewise_feeclass = \App\FeeHead::where('idClass', '=', $var->idClass)
                                    ->where('idSection', '=', $var->idSection)
                                     ->where('idFinancialYear','=', getFinancialYear())
                                    ->where('studentCategory', '=', 'All')
                                    ->whereNull('idStudent')
                                    ->whereDate('toDate', '>=', today_date())
                                    ->select(DB::raw('SUM(amount) as feetotal'))
                                    ->first();

                            $datewise_catwise = \App\FeeHead::where('idClass', '=', $var->idClass)
                                     ->where('idFinancialYear','=', getFinancialYear())
                                    ->where('idSection', '=', $var->idSection)
                                    ->where('studentCategory', '=', $var->studentType)
                                    ->whereDate('toDate', '>=', today_date())
                                    ->select(DB::raw('SUM(amount) as feetotalcat'))
                                    ->first();

                            $datewise_std = \App\FeeHead::where('idClass', '=', $var->idClass)
                                     ->where('idFinancialYear','=', getFinancialYear())
                                    ->where('idSection', '=', $var->idSection)
                                    ->where('idStudent', '=', $var->idStudent)
                                    ->whereDate('toDate', '>=', today_date())
                                    ->select(DB::raw('SUM(amount) as feetotalstd'))
                                    ->first();
                            $totalpaid = $transaction->totalPaid + $lesstransaction->totalPaid;
                            $unpaid = $datewise_feeclass->feeTotal + $datewise_catwise->feetotalcat + $datewise_std->feetotalstd;
                            $unpaiddue = $unpaid - $totalpaid;
                            ?>
                                {{$unpaiddue}}
                            </td>-->
                        </tr>
                        @endif
                        @endforeach
                    </tbody>
                </table>
           </div>
        </section>
    </div>
</div>
@stop
@section('script')
<script>
    $('.selectAll').on('click', function () {
        var checkAll = this.checked;
        if (checkAll === true) {
            $('input[type=checkbox]').each(function () {
                this.checked = checkAll;
            });
        } else {
            $('input[type=checkbox]').each(function () {
                this.checked = checkAll;
            });
        }
    });
    $(document).on('click', '.class_ids', function () {
        //var checkAll = this.checked;
        var classIds = [];
        $("input:checkbox[name='classes[]']:checked").each(function () {
            classIds.push($(this).val());
        });
        if (classIds.length > 0) {
            $.ajax({
                url: "{{url('/school/schclass') }}" + '/' + classIds + "/sections",
                type: "GET",
                dataType: "json",
                success: function (data) {
                    $('#idSection').empty();
                    $('#idSection').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><input type="checkbox" class="select-all" id="selectall"><label><strong>Select All</label></strong></div>');
                    $.each(data, function (key, value) {
                        $('#idSection').append('<div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="sections[]" value="' + key + '" class="sectionclass"><label>' + value + '</label></div>');
                    });
                }
            });
        }
    });
    $(function () {
        $('#tableexp').DataTable({
        
            dom: 'Bfrtip',
            scrollY:        "500px",
            scrollX:        true,
            scrollCollapse: true,
            fixedColumns:   {
                left: 1
            },
            buttons: [
                { extend: 'csv', footer: true, text: 'Export to Excel',title:'Student Due Report',
                    exportOptions: {
                        columns: [0,1,2,3,4,5,6,7,8,9,10],
                        format: {
                        body: function (data, row, column, node ) {
                                    if(column === 2 )
                                    return "\0" + data ;
                                    else if( column === 5 )
                                    return data.replace( '<br>', '\r\n');
                                    else return data;
                                
                                    }
                                }
                    }}
                
            ]
        });
    });
    $(document).on('click', '.select-all', function () {
        var checkAll = this.checked;
        if (checkAll === true) {
            $('.sectionclass').each(function () {
                this.checked = checkAll;
            });
        } else {
            $('.sectionclass').each(function () {
                this.checked = checkAll;
            });
        }
    });
</script>
@stop

Copyright © 2021 - 2025 IMMREX7