@include('header')

<style>
    #cover-spin {
    position:fixed;
    width:100%;
    left:0;right:0;top:0;bottom:0;
    background-color: rgba(255,255,255,0.7);
    z-index:9999;
    display:none;
}

@-webkit-keyframes spin {
	from {-webkit-transform:rotate(0deg);}
	to {-webkit-transform:rotate(360deg);}
}

@keyframes spin {
	from {transform:rotate(0deg);}
	to {transform:rotate(360deg);}
}

#cover-spin::after {
    content:'';
    display:block;
    position:absolute;
    left:48%;top:40%;
    width:40px;height:40px;
    border-style:solid;
    border-color:rgb(79, 175, 184);
    border-top-color:transparent;
    border-width: 4px;
    border-radius:50%;
    -webkit-animation: spin .8s linear infinite;
    animation: spin .8s linear infinite;
}
</style>

<div class="container-fluid flex-grow-1 container-p-y">
    <div class="nav-tabs-top mb-4">
        <ul class="nav nav-tabs">
        <li class="nav-item">
                <a class="nav-link active" data-toggle="tab" href="#tab5">All Summary Report</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab1">OPD Patient Report</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab6">OPD Receipt Report</a>
            </li>
             <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab9">Investigation Report</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab10">OPD Counselling Report</a>
            </li>
            {{-- <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab3">Expenses Report</a>
            </li> --}}
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab8">IPD Report</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab7">IPD Receipt Report</a>
            </li>
            
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab11">Referred By Report</a>
            </li>
            
           <!-- <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab8">IPD Madam Receipt Report</a>
            </li>-->
            {{-- <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab2">OPD Summary Report</a>
            </li>
            
          <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#tab4">Expenses Summary Report</a>
            </li>
            --}}

        </ul>
        <div class="tab-content">
            <div class="tab-pane fade" id="tab1">
                <div class="card-body">
                    <form id="validation-form22" method="post" enctype="multipart/form-data">
                        <div class="form-row">
                        <div class="form-group col-md-1">
                                <label class="form-label">Pay Mode </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="PayMode" id="PayMode">
                                    <option value="all" selected="">All</option>
                                    <option value="Cash">Cash</option>
                                    <option value="Coupon">Coupon</option>
                                    <option value="Mobile Payment">Mobile Payment</option>
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-1">
                                <label class="form-label">Pt Type </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="PatientType" id="PatientType">
                                    <option value="all" selected="">All</option>
                                    <option value="New">New</option>
                                    <option value="Old">Old</option>
                                   
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">Consultant </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="Consultant" id="ConsultantId">
                                    <option value="all" selected="">All</option>
                                    @foreach($consultantList as $result)
                                    <option value="{{$result->id}}">{{$result->Name}}</option>
                                    @endforeach
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">Users </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="ConfirmOpto" id="ConfirmOpto">
                                    <option value="all" selected="">All</option>
                                    @foreach($optoList as $result)
                                    <option value="{{$result->id}}">{{$result->Name}}</option>
                                    @endforeach
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate" id="FromDate" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate" id="ToDate" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult">


                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="tab-pane fade" id="tab2">
                <div class="card-body">
                    <form id="validation-form33" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate2" id="FromDate2" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate2" id="ToDate2" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter2" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult2">


                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="tab-pane fade" id="tab3">
                <div class="card-body">
                    <form id="validation-form44" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate3" id="FromDate3" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate3" id="ToDate3" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter3" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult3">


                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="tab-pane fade" id="tab4">
                <div class="card-body">
                    <form id="validation-form55" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate4" id="FromDate4" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate4" id="ToDate4" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter4" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult4">


                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="tab-pane fade show active" id="tab5">
                <div class="card-body">
                    <form id="validation-form66" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate5" id="FromDate5" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate5" id="ToDate5" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter5" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">

                            <div class="row">
                                <div class="col-lg-5">
                                    <div class="table-responsive" id="custresult5">

                                    </div>
                                </div>
                                <div class="col-lg-7">
                                    <div class="table-responsive" id="custresult6">

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <div class="tab-pane fade" id="tab6">
                <div class="card-body">
                    <form id="validation-form66" method="post" enctype="multipart/form-data">
                        <div class="form-row">
                        <div class="form-group col-md-2">
                                <label class="form-label">Pay Mode </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="PayMode6" id="PayMode6">
                                    <option value="all" selected="">All</option>
                                    <option value="Cash">Cash</option>
                                    <option value="Mobile Payment">Mobile Payment</option>
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate6" id="FromDate6" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate6" id="ToDate6" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter6" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult7">


                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <div class="tab-pane fade" id="tab7">
                <div class="card-body">
                    <form id="validation-form44" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                        <div class="form-group col-md-2">
                                <label class="form-label">Pay Mode </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="PayMode7" id="PayMode7">
                                    <option value="all" selected="">All</option>
                                    <option value="Cash">Cash</option>
                                    <option value="Cheque">Cheque</option>
                                    <option value="Mobile Payment">Mobile Payment</option>
                                </select>
                                <div class="clearfix"></div>
                            </div>

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate7" id="FromDate7" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate7" id="ToDate7" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter7" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult8">


                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <div class="tab-pane fade" id="tab8">
                <div class="card-body">
                    <form id="validation-form44" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                        <div class="form-group col-md-2">
                                <label class="form-label">Report Type </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="PayMode8" id="PayMode8">
                                    {{-- <option value="all" selected="">All</option> --}}
                                    <option value="1">OT Report</option>
                                    <option value="2">Counselling Report</option>
                                  
                                </select>
                                <div class="clearfix"></div>
                            </div>

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate8" id="FromDate8" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate8" id="ToDate8" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter8" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult9">


                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <div class="tab-pane fade" id="tab9">
                <div class="card-body">
                    <form id="validation-form99" method="post" enctype="multipart/form-data">
                        <div class="form-row">
                        <div class="form-group col-md-2">
                                <label class="form-label">Consultant </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="Consultant" id="ConsultantId9">
                                    <option value="all" selected="">All</option>
                                    @foreach($consultantList as $result)
                                    <option value="{{$result->id}}">{{$result->Name}}</option>
                                    @endforeach
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">Users </label>
                                <select class="form-control" style="width: 100%;margin-top: 3px !important;"
                                    data-allow-clear="true" name="ConfirmOpto" id="ConfirmOpto9">
                                    <option value="all" selected="">All</option>
                                    @foreach($optoList as $result)
                                    <option value="{{$result->id}}">{{$result->Name}}</option>
                                    @endforeach
                                </select>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate9" id="FromDate9" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate9" id="ToDate9" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter9" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult99">


                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="tab-pane fade" id="tab10">
                <div class="card-body">
                    <form id="validation-form100" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate9" id="FromDate10" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate9" id="ToDate10" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter10" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult100">


                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="tab-pane fade" id="tab11">
                <div class="card-body">
                    <form id="validation-form110" method="post" enctype="multipart/form-data">
                        <div class="form-row">

                            <div class="form-group col-md-2">
                                <label class="form-label">From Date </label>
                                <input type="date" name="FromDate11" id="FromDate11" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>
                            <div class="form-group col-md-2">
                                <label class="form-label">To Date</label>
                                <input type="date" name="ToDate11" id="ToDate11" class="form-control"
                                    value="{{date('Y-m-d')}}" autocomplete="off" required>
                            </div>

                            <input type="hidden" name="Search" value="Search">
                            <div class="form-group col-md-2" style="padding-top:20px;">
                                <button type="button" id="filter11" class="btn btn-primary btn-finish">Search</button>
                            </div>
                        </div>

                    </form>

                    <div class="card">
                        <div class="card-body">


                            <div class="table-responsive" id="custresult11">


                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <div id="cover-spin"></div>

    <input type="hidden" value="Mobile" id="PrevVal">
<input type="hidden" value="{{date('Y-m-d')}}" id="CurrDate">

</div>

@include('footerscript')
@include('excelscript')
<script>
$(document).ready(function() {
    opdExpenseReport('Cash');
var FromDate = $('#CurrDate').val();
var ToDate = $('#CurrDate').val();
    queueList5(FromDate, ToDate);
    $('#filter').click(function() {
        var FromDate = $('#FromDate').val();
        var ToDate = $('#ToDate').val();
        var Consultant = $('#ConsultantId').val();
        var PayMode = $('#PayMode').val();
        var ConfirmOpto = $('#ConfirmOpto').val();
        var PatientType = $('#PatientType').val();
        if (FromDate != '' && ToDate != '') {
            //$('.yajra-datatable').DataTable().destroy();
            //load_data(FromDate, ToDate);
            $('#cover-spin').show(0);
            queueList(FromDate, ToDate, Consultant,PayMode,ConfirmOpto,PatientType);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh').click(function() {
        $('#FromDate').val('');
        $('#ToDate').val('');
        $('#ConsultantId').val('all').attr("selected", true);
        $('#PayMode').val('all').attr("selected", true);
        $('#ConfirmOpto').val('all').attr("selected", true);
        $('#PatientType').val('all').attr("selected", true);
        //$('.yajra-datatable').DataTable().destroy();
        //load_data();
        queueList();
    });

    function queueList(FromDate = '', ToDate = '', Consultant = 'all', PayMode = 'all', ConfirmOpto = 'all', PatientType = 'all') {
        $.ajax({
            url: "{{ url('viewDailyQueueReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate,
                Consultant: Consultant,
                PayMode: PayMode,
                ConfirmOpto: ConfirmOpto,
                PatientType:PatientType
            },
            success: function(data) {
                //console.log(data);
                $('#custresult').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }



    $('#filter2').click(function() {
        var FromDate = $('#FromDate2').val();
        var ToDate = $('#ToDate2').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList2(FromDate, ToDate);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh2').click(function() {
        $('#FromDate2').val('');
        $('#ToDate2').val('');
        queueList2();
    });

    function queueList2(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('viewQueueSummaryReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {

                $('#custresult2').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }


    $('#filter3').click(function() {
        var FromDate = $('#FromDate3').val();
        var ToDate = $('#ToDate3').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList3(FromDate, ToDate);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh3').click(function() {
        $('#FromDate3').val('');
        $('#ToDate3').val('');
        queueList3();
    });

    function queueList3(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('viewExpensesReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {
                //console.log(data);
                $('#custresult3').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }

    $('#filter4').click(function() {
        var FromDate = $('#FromDate4').val();
        var ToDate = $('#ToDate4').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList4(FromDate, ToDate);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh4').click(function() {
        $('#FromDate4').val('');
        $('#ToDate4').val('');
        queueList4();
    });

    function queueList4(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('viewExpensesSummaryReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {
                //console.log(data);
                $('#custresult4').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }

    $('#filter5').click(function() {
        var FromDate = $('#FromDate5').val();
        var ToDate = $('#ToDate5').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList5(FromDate, ToDate);
            opdExpenseReport('Cash');
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh5').click(function() {
        $('#FromDate5').val('');
        $('#ToDate5').val('');
        queueList5();
    });

    function queueList5(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('allSummaryReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {
                //console.log(data);
                $('#custresult5').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }
});

function opdReport(val) {

    var PrevVal = $('#PrevVal').val();
    $('#' + PrevVal).css("background-color", "white");

    var FromDate = $('#FromDate5').val();
    var ToDate = $('#ToDate5').val();
    $.ajax({
        url: "{{ url('opdReport') }}",
        method: "POST",
        data: {
            _token: '{{csrf_token()}}',
            FromDate: FromDate,
            ToDate: ToDate,
            val: val
        },
        success: function(data) {
            //console.log(data);
            $('#PrevVal').val(val);
            $('#' + val).css("background-color", "antiquewhite");
            $('#custresult6').html(data);
            $('#cover-spin').hide(0);
        }
    });
}

function opdReceiptReport(val) {
    var FromDate = $('#FromDate5').val();
    var ToDate = $('#ToDate5').val();
    var PrevVal = $('#PrevVal').val();
    $('#' + PrevVal).css("background-color", "white");
    $.ajax({
        url: "{{ url('opdReceiptReport') }}",
        method: "POST",
        data: {
            _token: '{{csrf_token()}}',
            FromDate: FromDate,
            ToDate: ToDate,
            val:val
        },
        success: function(data) {
            //console.log(data);
            $('#PrevVal').val('Receipt');
            $('#Receipt' + val).css("background-color", "antiquewhite");
            $('#custresult6').html(data);
            $('#cover-spin').hide(0);
        }
    });
}

function invstReport(val) {
    var FromDate = $('#FromDate5').val();
    var ToDate = $('#ToDate5').val();
    var PrevVal = $('#PrevVal').val();
    $('#' + PrevVal).css("background-color", "white");
    $.ajax({
        url: "{{ url('invstReport') }}",
        method: "POST",
        data: {
            _token: '{{csrf_token()}}',
            FromDate: FromDate,
            ToDate: ToDate,
            val:val
        },
        success: function(data) {
            //console.log(data);
            $('#PrevVal').val('Receipt');
            $('#Receipt' + val).css("background-color", "antiquewhite");
            $('#custresult6').html(data);
            $('#cover-spin').hide(0);
        }
    });
}

function opdExpenseReport(val) {
    var FromDate = $('#FromDate5').val();
    var ToDate = $('#ToDate5').val();
    var PrevVal = $('#PrevVal').val();
    $('#' + PrevVal).css("background-color", "white");
    $.ajax({
        url: "{{ url('opdExpenseReport') }}",
        method: "POST",
        data: {
            _token: '{{csrf_token()}}',
            FromDate: FromDate,
            ToDate: ToDate,
            val:val
        },
        success: function(data) {
            //console.log(data);
            $('#PrevVal').val('Expense');
            $('#Expense' + val).css("background-color", "antiquewhite");
            $('#custresult6').html(data);
            $('#cover-spin').hide(0);
        }
    });
}


$('#filter6').click(function() {
        var FromDate = $('#FromDate6').val();
        var ToDate = $('#ToDate6').val();
        var PayMode = $('#PayMode6').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList6(FromDate, ToDate,PayMode);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh6').click(function() {
        $('#FromDate6').val('');
        $('#ToDate6').val('');
        $('#PayMode6').val('');
        queueList6();
    });

    function queueList6(FromDate = '', ToDate = '', PayMode = 'all') {
        $.ajax({
            url: "{{ url('viewReceiptReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate,
                PayMode:PayMode
            },
            success: function(data) {
                //console.log(data);
                $('#custresult7').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }




    $('#filter7').click(function() {
        var FromDate = $('#FromDate7').val();
        var ToDate = $('#ToDate7').val();
        var PayMode = $('#PayMode7').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList7(FromDate, ToDate,PayMode);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh7').click(function() {
        $('#FromDate7').val('');
        $('#ToDate7').val('');
        $('#PayMode7').val('');
        queueList7();
    });

    function queueList7(FromDate = '', ToDate = '', PayMode = 'all') {
        $.ajax({
            url: "{{ url('viewIpd_ReceiptReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate,
                PayMode:PayMode
            },
            success: function(data) {
                //console.log(data);
                $('#custresult8').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }

    $('#filter8').click(function() {
        var FromDate = $('#FromDate8').val();
        var ToDate = $('#ToDate8').val();
        var PayMode = $('#PayMode8').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList8(FromDate, ToDate,PayMode);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh8').click(function() {
        $('#FromDate8').val('');
        $('#ToDate8').val('')
        $('#PayMode7').val('');
        queueList8();
    });

    function queueList8(FromDate = '', ToDate = '', PayMode = '') {
        $.ajax({
            url: "{{ url('viewIpdReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate,
                PayMode:PayMode
            },
            success: function(data) {
                //console.log(data);
                $('#custresult9').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }


    $('#filter9').click(function() {
        var FromDate = $('#FromDate9').val();
        var ToDate = $('#ToDate9').val();
        var Consultant = $('#ConsultantId9').val();
        var ConfirmOpto = $('#ConfirmOpto9').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList9(FromDate, ToDate,Consultant,ConfirmOpto);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh9').click(function() {
        $('#FromDate9').val('');
        $('#ToDate9').val('');
        queueList9();
    });

    function queueList9(FromDate = '', ToDate = '', Consultant = 'all', ConfirmOpto = 'all') {
        $.ajax({
            url: "{{ url('viewInvestigationReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate,
                Consultant:Consultant,
                ConfirmOpto:ConfirmOpto
            },
            success: function(data) {
console.log(data);
                $('#custresult99').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }


    $('#filter10').click(function() {
        var FromDate = $('#FromDate10').val();
        var ToDate = $('#ToDate10').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList10(FromDate, ToDate);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh10').click(function() {
        $('#FromDate10').val('');
        $('#ToDate10').val('');
        queueList10();
    });

    function queueList10(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('viewOpdCounsellingReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {
console.log(data);
                $('#custresult100').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }
    
    
    
    $('#filter11').click(function() {
        var FromDate = $('#FromDate11').val();
        var ToDate = $('#ToDate11').val();
        if (FromDate != '' && ToDate != '') {
            $('#cover-spin').show(0);
            queueList11(FromDate, ToDate);
        } else {
            alert('Both Date is required');
        }
    });

    $('#refresh11').click(function() {
        $('#FromDate11').val('');
        $('#ToDate11').val('');
        queueList11();
    });

    function queueList11(FromDate = '', ToDate = '') {
        $.ajax({
            url: "{{ url('viewReferredByReport') }}",
            method: "POST",
            data: {
                _token: '{{csrf_token()}}',
                FromDate: FromDate,
                ToDate: ToDate
            },
            success: function(data) {

                $('#custresult11').html(data);
                $('#cover-spin').hide(0);
            }
        });
    }
</script>

