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/purchase_history.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@purchaseHistory'], '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>
                                    <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>
@if(session()->has('report-message'))
    <div class="alert alert-success" style="margin-top: 31px;">
        {{ session()->get('report-message') }}
    </div>
@endif
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Student Purchase 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 Number</th>
                            <th>Date</th>
                            <th>Ec No.</th>
                            <th>Name</th>
                            <th>Father </th>
                            <th>Mobile</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Payment Mode</th>
                            <th>Paid</th>
                            <th>Category</th>
                            <th>Received Date</th>
                            <th>Item Received</th>
                            <th>Actions</th>
                            
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1;?>
                        @foreach($transactions as $var)
                        <tr>
                          <?php  $student = \App\AdmEntry::where('idStudent', '=', $var->idStudent)->first();?>
                            <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>
                            <td>
                                {{$var->paymentMode}}
                            </td>
                            <td>{{$var->totalPaid}} </td>
                            <td>
                                @php
                                $items = DB::table('shop_transaction_details')->join('products', 'shop_transaction_details.idProduct', '=', 'products.idProduct')->where('idTransaction',$var->idTransaction)->pluck('productName')->toArray();
                                $isBook = 1;
                                $isUniform = 1;
                                foreach($items as  $key=>$value){
                                    if (str_contains($value, 'Books') || str_contains($value, 'BOOKS')) {
                                        $isBook = 2;
                                    }
                                    if (str_contains($value, 'Uniform')) {
                                        $isUniform = 2;
                                    }
                                }
                                @endphp
                                @if($isBook == 2)
                                Books
                                @endif

                                @if($isUniform == 2)
                                Uniform
                                @endif
                            </td>
                            <td> @if(isset($var->is_received)) @if($var->is_received == "Yes"){{\Carbon\Carbon::parse($var->updated_at)->format('d-m-Y')}} @else - @endif @else - @endif</td>
                            @if(isset($var->is_received))
                            <td>{{$var->is_received}} </td>
                            @else <td>No</td>
                            @endif
                            <td>
                                <a href="{{url('school/purchase-report/'.$var->idTransaction.'/view')}}" target="_blank" class="btn btn-sm btn-info">View Items</a>
                                <a href="{{url('school/purchase-report/'.$var->idTransaction.'/print')}}" target="_blank" class="btn btn-sm btn-info">Print</a>
                                @if($var->is_received == "No")
                                <a href="{{url('school/purchase-report/'.$var->idTransaction.'/sold')}}" class="btn btn-sm btn-success" style="color:black;">Delivered</a>
                                @endif
                            </td>
                        </tr>
                        <?php $i++; ?>
                        @endforeach
                    </tbody>
                </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 Purchase 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