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/fee_paid.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@paidFees'], 'class' => 'form-horizontal']) !!}
                                    <div class="row clearfix">
                                        <div class="col-sm-4">
                                            <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-7">
                                                    <div class="form-group">
                                                        {!! Form::text('fromDate',null,['class' => 'form-control datepicker']) !!}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <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-7">
                                                    <div class="form-group">
                                                        {!! Form::text('toDate',null,['class' => 'form-control datepicker']) !!}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        
                                        
                                        
                                        <div class="col-sm-4">
                                            <div class="row clearfix">
                                                <div class="col-sm-3 form-control-label">
                                                    <label for="headername">Headers</label>
                                                </div>
                                                <div class="col-sm-7">
                                                    <div class="form-group">
                                                        <div id="idHeaders" style="border:1px solid #ccc; width:250px; height: 150px; overflow-y: scroll;">
                                                             @foreach($feeHeaders as $key=>$value)
                                                            <div class="checkbox-inline" style="padding-left:10px;padding-top:5px;">
                                                                <input type="checkbox" name="feeHeaders[]" value="{{$key}}" class="fee_ids">
                                                                <label>{{$value}}</label>
                                                            </div>
                                                            @endforeach
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <div class="row clearfix">
                                                <div class="col-sm-5 form-control-label">
                                                    <label for="classname">Payment Mode</label>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        {!! Form::select('paymentMode',payModeReport(),null,['class' => 'form-control show-tick ms','id'=>'paymode']) !!}
                                                    </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>Students Paid Data</strong></h2>
            </div>
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover dataTable" id="tableexp">
                    <thead>
                        <tr>
                            <th>Receipt No.</th>
                            <th>Date</th>
                            <th>Ec No.</th>
                            <th>Name</th>
                            <th>Father </th>
                            <th>Mobile</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Headers</th>
                            <th>Payment Mode</th>
                            <th>Total Fee</th>
                            <th>Discount</th>
                            <th>Penalty</th>
                            <th>Paid</th>
                            <th>Balance</th>
                            <th>Collector Name</th>
                            <th>Print</th>
                            
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1;$totalFee=0; $discountFee=0;$penaltyAmount=0;$totalPaidAmount=0;$balanceAmount=0; ?>
                        @foreach($transactions as $var)
                        <tr>
                          <?php  $student = \App\AdmEntry::where('idStudent', '=', $var->idStudent)->first();
                            
                                $class_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
                                        ->where('idSection', '=', $student->idSection)
                                        ->where('studentCategory', '=', $student->studentType)
                                        ->where('idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->whereNull('idStudent');
                                //   ->get();
                                $allcat_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
                                        ->where('idSection', '=', $student->idSection)
                                        ->where('studentCategory', '=', 'All')
                                        ->where('idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->whereNull('idStudent');
                                //   ->get();
                                $feeheads = \DB::table('feeheads')->where('idStudent', '=', $student->idStudent)
                                        ->where('idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->union($class_feeheads)
                                        ->union($allcat_feeheads)
                                        ->orderBy('toDate')
                                        ->get();
                                $feetotal = $feeheads->sum('amount');
                                ?>
                            <td>{{$var->receiptNo}}</td>
                            <td>{{$var->paymentDate}}</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>{{$var->className}}</td>
                            <td>{{$var->sectionName}}</td>
                            <?php 
                                $paidHeaders=\DB::table('student_transaction_details')
                                ->join('feeheads', 'student_transaction_details.idFeehead', '=', 'feeheads.idFeehead')
                                ->select('feeheads.feeheadName','student_transaction_details.status')
                                ->where('student_transaction_details.idStudent', '=', $student->idStudent)
                                 ->where('student_transaction_details.idTransaction', '=', $var->idTransaction)
                                            ->get();
                            ?>
                            <td>
                                <?php 
                                $headerNames="";
                                $headerCount=0;
                                foreach($paidHeaders as $headers)
                                {
                                    if($headers->status == null ||
                                  $headers->status == 'Cleared' || $headers->status == 'Success')
                                  $headerNames=$headerNames.$headers->feeheadName;
                                  if($headerCount < (sizeof($paidHeaders)-1))
                                  $headerNames=$headerNames." | ";
                                  $headerCount++;
                                }
                                ?>
                                {{$headerNames}}
                            </td>
                            
                            <td>
                                <?php
                                $mode="";
                                if($var->paymentMode == "Cheque")
                                $mode=$var->paymentMode."( ".$var->chequeNo." )";
                                else $mode=$var->paymentMode;
                                ?>
                                {{$mode}}
                            </td>
                            <td>{{$feetotal}}</td>
                            <td>{{$var->discount}} <?php $discountFee=$discountFee+$var->discount; ?></td>
                            <td>{{$var->penaltyAmount + $var->fine}} <?php $penaltyAmount=$penaltyAmount+($var->penaltyAmount + $var->fine); ?></td>
                            <td>{{$var->totalPaid}} <?php $totalPaidAmount=$totalPaidAmount+$var->totalPaid; ?></td>
                           <td>
                                <?php 
                                   $tp = \App\StudentTransaction::where('idStudent','=',$var->idStudent)
                                        ->where('idFinancialYear','=',$var->idFinancialYear)
                                        ->where(function($query){
                                            $query->whereNull('status');
                                            $query->orWhere('status', '=', 'In-Process');
                                            $query->orWhere('status', '=', 'Cleared');
                                            $query->orWhere('status', '=', 'Success');
                                        })
                                        ->select(DB::raw('SUM(totalPaid) as totalPaid'),DB::raw('SUM(fine) as fineTotal'),DB::raw('SUM(discount) as discountTotal'),DB::raw('SUM(penaltyAmount) as penaltyAmount'))
                                        ->first();
//                                    $less_paid = \App\LesserTransaction::where('idStudent','=',$var->idStudent)
//                                        ->where('idFinancialYear','=',$var->idFinancialYear)
//                                        ->where(function($query){
//                                            $query->whereNull('status');
//                                            $query->orWhere('status', '=', 'In-Process');
//                                            $query->orWhere('status', '=', 'Cleared');
//                                            $query->orWhere('status', '=', 'Success');
//                                        })
//                                        ->select(DB::raw('SUM(totalPaid) as totalPaid'),DB::raw('SUM(fine) as fineTotal'),DB::raw('SUM(discount) as discountTotal'),DB::raw('SUM(penaltyAmount) as penaltyAmount'))
//                                        ->first();
                                    $b = $feetotal + $tp->fineTotal + $tp->penaltyAmount  - ($tp->discountTotal + $tp->totalPaid);
                                   /* $b = $feetotal- ( $tp->totalPaid + $less_paid->totalPaid); */
                                ?>
                                {{$b}}
                            </td>
                            <td>{{$var->name}}</td>
                            <td><a href="{{url('school/stdtransaction/'.$var->idTransaction.'/print')}}" target="_blank" class="btn btn-sm btn-info">Re-Print</a>
                            <a href="{{url('school/stdtransaction/'.$var->idTransaction.'/cancelrcpt')}}" target="_blank" class="btn btn-sm btn-danger">Cancel Receipt</a></td>
                        </tr>
                        <?php $i++; ?>
                        @endforeach
                    </tbody>
                    <tfoot>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td>Total</td>
                            <?php  
                            $totalStudent=array();
                            foreach($transactions as $var){
                                array_push($totalStudent,$var->idStudent);
                            }
                            $totalStudent=array_unique($totalStudent);
                            
                            foreach($totalStudent as $var){
                            $student = \App\AdmEntry::where('idStudent', '=', $var)->first();
                            
                                $class_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
                                        ->where('idSection', '=', $student->idSection)
                                        ->where('studentCategory', '=', $student->studentType)
                                        ->where('idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->whereNull('idStudent');
                                //   ->get();
                                $allcat_feeheads = \DB::table('feeheads')->where('idClass', '=', $student->idClass)
                                        ->where('idSection', '=', $student->idSection)
                                        ->where('studentCategory', '=', 'All')
                                        ->where('idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->whereNull('idStudent');
                                //   ->get();
                                $feeheads = \DB::table('feeheads')->where('idStudent', '=', $student->idStudent)
                                ->where('idFinancialYear', '=', Session::get('idFinancialYear'))
                                        ->union($class_feeheads)
                                        ->union($allcat_feeheads)
                                        ->orderBy('toDate')
                                        ->get();
                                $feetotal = $feeheads->sum('amount');
                                $totalFee=$totalFee+$feetotal;
                                
                                $tp = \App\StudentTransaction::where('idStudent','=',$student->idStudent)
                                        ->where('idFinancialYear','=',$student->idFinancialYear)
                                        ->where(function($query){
                                            $query->whereNull('status');
                                            $query->orWhere('status', '=', 'In-Process');
                                            $query->orWhere('status', '=', 'Cleared');
                                            $query->orWhere('status', '=', 'Success');
                                        })
                                        ->select(DB::raw('SUM(totalPaid) as totalPaid'),DB::raw('SUM(penaltyAmount) as penaltyAmount'))
                                        ->first();
                                    $b = $feetotal- ( $tp->totalPaid);
                                    $balanceAmount=$balanceAmount+$b;
                            }
                            
                            ?>
                            <td>{{$totalFee}}</td>
                            <td>{{$discountFee}}</td>
                            <td>{{$penaltyAmount}}</td>
                            <td>{{$totalPaidAmount}}</td>
                            <td>{{$balanceAmount}}</td>
                            <td></td>
                            <td></td>
                        </tr>
                        </tfoot>
                </table>
            </div>
        </div>
    </div>
</div>
@stop
@section('script')
<script>
$(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 Paid Report',
                exportOptions: {
                    columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],
                    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