@extends('template.app')



@section('meta') @endsection

@section('title') Day Book Report @endsection



@section('styles')

    <style>

         .highlight {

            background-color: #ffff99; 

        }

        #data-table.dataTable tbody td {

            padding: 0px !important;

            height: 20px !important;

            line-height: 35px !important;

            font-size: 15px !important;

            text-align: center;

        }

        .form-group .custom_color {

            background-color: lightgrey !important;

        }

    </style>

@endsection



@section('content')

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">

<link href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" rel="stylesheet">

<link rel="stylesheet" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css">

<style>

    #day-book-data-table td {

        white-space: nowrap;

        padding: 0.5rem !important;

        font-size: 15px;

    }



    .select2-container .select2-selection--single

    {

     

      height: 30px;

    }

    .mt-2

    {

        font-size: 15px;

        margin-left: 15px;

    }

    

    .custom-select {

        width: 200px !important;

    }

    

    .custom-form-spacing {

      margin-bottom: -19px;

    }

    

    

    .width_150 {

        width: 150px;

    }

    .width_200 {

        width: 200px;

    }

    .width_250 {

        width: 250px;

    }

    .width_300 {

        width: 300px;

    }

    .table {

        min-height: 600px;

    }



</style>

<div class="page-breadcrumb">

    <div class="row">

        <div class="col-7 align-self-center">

            <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Day Book Report</h4>

            <div class="d-flex align-items-center">

                <nav aria-label="breadcrumb">

                    <ol class="breadcrumb m-0 p-0">

                        <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('allReport') }}" class="text-muted">Mis Report</a></li>
                        <li class="breadcrumb-item text-muted active" aria-current="page">Day Book Report</li>

                    </ol>

                </nav>

            </div>

        </div>

        <div class="col-5 align-self-center">

            <div class="customize-input float-right">

                <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" type="button" data-toggle="collapse" data-target="#collapseExample">

                    Export

                </button>

                <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right ml-2" type="button" data-toggle="modal" data-target="#downloadModal">

                    View Downloads

                </button>

            </div>

        </div>

        <div class="col-sm-7"></div>



        <div class="col-sm-5 collapse align-self-right" id="collapseExample">

            <form action="{{ route('daybookExport') }}" method="POST">

                @csrf

                <div class="row">

                    <div class="form-group col-md-6">

                        <input type="text" name="filter_booking_date" class="form-control text-capitalize" autocomplete="off" tabindex="5" id="filter_booking_date" placeholder="DD-MM-YYYY to DD-MM-YYYY">

                    </div>

                    <div class="form-group col-md-4">

                        <select name="slug" class="form-control" required>

                            <option value="">Select Status</option>

                            <option value="all">All</option>
                            <option value="booking">Booking Date</option>
                            <option value="invoice">Invoice Date</option>

                        </select>

                    </div>

                    <div class="form-group col-md-2">

                        <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" type="submit">Submit</button>

                    </div>

                </div>

            </form>

        </div>



    </div>

</div>



<div class="container-fluid">

    <div class="row">

        <div class="col-12">

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

                    <table class="table table-bordered data-table" id="day-book-data-table">

                        <thead>

                            <tr>

                                <th>Sr. No.</th>

                                <th>Location</th>

                                <th>KEC Name</th>

                                <th>TL Name</th>

                                <th>Month</th>

                                <th>Booking Date</th>

                                <th>Pricelist (WEF)</th>

                                <th>Bill To : Customer Name</th>

                                <th>Bill To : Company Name</th>

                                <th>Bill To : Address: Registration</th>

                                <th>District</th>

                                <th>State</th>

                                <th>e-invoice Applicable</th>

                                <th>GST No.</th>

                                <th>Ship To : Customer Name</th>

                                <th>Address</th>

                                <th>RTO Type</th>

                                <th>Customer Type</th>

                                <th>Mobile No.</th>

                                <th>Pan No.</th>

                                <th>Aadhar No.</th>

                                <th>Aadhar and Pan Link Status</th>

                                <th>IBS Invoice Date</th>

                                <th>IBS Invoice No.</th>
 
                                <th>Model</th>

                                <th>Variant</th>
                                
                                <th>Fuel Type</th>

                                <th>VIN Number</th>

                                <th>Engine No.</th>

                                <th>Ex Showroom Price</th>

                                <th>Discount with GST</th>

                                <th>After Disc Ex. Sr Price</th>

                                <th>Basic</th>

                                <th>CGST</th>

                                <th>SGST</th>

                                <th>IGST</th>

                                <th>CESS</th>

                                <th>Total</th>

                                <th>TCS</th>

                                <th>RTO</th>

                                <th>RTO Registration No.</th>

                                <th>RTO Custom Handling Charges</th>

                                <th>Municipal Tax</th>

                                <th>Insurance</th>

                                <th>Insurance Type</th>

                                <th>Insurance Company Name</th>

                                <th>RSA</th>

                                <th>CCS</th>

                                <th>EW</th>

                                <th>MCP</th>

                                <th>Fasttag</th>

                                <th>Accessories</th>

                                <th>Total</th>

                                <th>Booking Amount</th>

                                <th>Dowan payment</th>

                                <th>Financer Name</th>

                                <th>Fin. IN House/DSA/Self</th>

                                <th>Finance Discount</th>

                                <th>Exchange</th>

                                <th>Model / Variant</th>

                                <th>Registration No.</th>

                                <th>Excess Shrot</th>

                                <th>Other</th>

                                <th>Total Amount Received</th>

                                <th>Due Amount/Refund Amt</th>

                                <th>Refund Amount Process</th>

                                <th>Refund Amt. Date</th>

                                <th>Difference</th>

                                <th>Date</th>

                                <th>Payment Ref No.</th>

                                <th>On Road Price</th>

                                <th>Make Deal</th>

                                <th>On Road Discount</th>
                                
                                <th>Offer Discount</th>
                                
                                <th>Designation Wise Discount</th>
                                
                                <th>Total Discount ( A + B = C )</th>

                                <th>Remarks</th>

                                <th>KIN Invocie no.</th>

                                <th>KiN Pur. Date</th>

                                <th>Purchase Basic</th>
                                
                                <th>TAT Days</th>
                                
                                <th>TAT Status</th>

                                <th>MFG Year</th>

                            </tr>

                            <tr>

                                <th></th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="location" value="{{ request()->get('location', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="1">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="kec_name" value="{{ request()->get('kec_name', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="2">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="tl_name" value="{{ request()->get('tl_name', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="3">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="booking_month_year" value="{{ request()->get('booking_month_year', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="4">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="booking_date" value="{{ request()->get('booking_date', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="5" id="booking_date" placeholder="DD-MM-YYYY to DD-MM-YYYY">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="price_list_name" value="{{ request()->get('price_list_name', '') }}" class="form-control text-capitalize" autocomplete="off" tabindex="6">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="customer_name" value="{{ request()->get('customer_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="7">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="company_name" value="{{ request()->get('company_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="8">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="registration" value="{{ request()->get('registration', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="9">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="district_name" value="{{ request()->get('district_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="10">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="state_name" value="{{ request()->get('state_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="11">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="einvoicing_applicable" value="{{ request()->get('einvoicing_applicable', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="12">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="gst" value="{{ request()->get('gst', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="13">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ship_to_customer_name" value="{{ request()->get('ship_to_customer_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="14">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ship_to_address" value="{{ request()->get('ship_to_address', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="15">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="rto_type" value="{{ request()->get('rto_type', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="16">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="customer_type_master" value="{{ request()->get('customer_type_master', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="17">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="contact_number" value="{{ request()->get('contact_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="18">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="pan_number" value="{{ request()->get('pan_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="19">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="adhar_number" value="{{ request()->get('adhar_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="20">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="aadhar_pan_link" value="{{ request()->get('aadhar_pan_link', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="21">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ibs_invoice_date" value="{{ request()->get('ibs_invoice_date', '') }}" class="form-control text-capitalize" id="ibs_invoice_date" placeholder="DD-MM-YYYY to DD-MM-YYYY" autocomplete="off" autofocus tabindex="22">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ibs_invoice_no" value="{{ request()->get('ibs_invoice_no', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="23">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="model" value="{{ request()->get('model', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="24">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="varient" value="{{ request()->get('varient', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="25">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="fuel_type" value="{{ request()->get('fuel_type', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="26">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="vin_number" value="{{ request()->get('vin_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="27">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="engine_number" value="{{ request()->get('engine_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="28">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ex_showroom_price" value="{{ request()->get('ex_showroom_price', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="29">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="discount_with_gst" value="{{ request()->get('discount_with_gst', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="30">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="after_dis_ex_showroom_price" value="{{ request()->get('after_dis_ex_showroom_price', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="31">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="basic" value="{{ request()->get('basic', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="32">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="cgst" value="{{ request()->get('cgst', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="33">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="sgst" value="{{ request()->get('sgst', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="34">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="igst" value="{{ request()->get('igst', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="35">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="cess" value="{{ request()->get('cess', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="36">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="after_dis_ex_showroom_price" value="{{ request()->get('after_dis_ex_showroom_price', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="37">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="tcs" value="{{ request()->get('tcs', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="38">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="rto" value="{{ request()->get('rto', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="39">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="vehicle_number" value="{{ request()->get('vehicle_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="40">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="rto_custom_handling_charges" value="{{ request()->get('rto_custom_handling_charges', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="41">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="municipal_tax" value="{{ request()->get('municipal_tax', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="42">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="insurance" value="{{ request()->get('insurance', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="43">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="insurance_type" value="{{ request()->get('insurance_type', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="44">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="insurance_name" value="{{ request()->get('insurance_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="45">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="rsa" value="{{ request()->get('rsa', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="46">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ccs" value="{{ request()->get('ccs', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="47">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="ew" value="{{ request()->get('ew', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="48">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="mcp" value="{{ request()->get('mcp', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="49">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="fastag" value="{{ request()->get('fastag', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="50">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="accessory_amount" value="{{ request()->get('accessory_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="51">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="total" value="{{ request()->get('total', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="52">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="booking_amount" value="{{ request()->get('booking_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="53">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="dp_amount" value="{{ request()->get('dp_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="54">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_200">

                                        <div class="form-group is-empty">

                                            <input type="text" name="financer_name" value="{{ request()->get('financer_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="55">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="finance_type" value="{{ request()->get('finance_type', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="56">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="finance_discount" value="{{ request()->get('finance_discount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="57">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="exchange_amount" value="{{ request()->get('exchange_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="58">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="exchange_name" value="{{ request()->get('exchange_name', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="59">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="registration_number" value="{{ request()->get('registration_number', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="60">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="access_sort_amount" value="{{ request()->get('access_sort_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="61">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="other_amount" value="{{ request()->get('other_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="62">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="total_amt_received" value="{{ request()->get('total_amt_received', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="63">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="refund_amount" value="{{ request()->get('refund_amount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="64">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="refund_amt_process" value="{{ request()->get('refund_amt_process', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="65">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="refund_amt_date" value="{{ request()->get('refund_amt_date', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="66">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="refund_diff" value="{{ request()->get('refund_diff', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="67">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="date" value="{{ request()->get('date', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="68">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="payment_ref_no" value="{{ request()->get('payment_ref_no', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="69">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="on_road_price" value="{{ request()->get('on_road_price', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="70">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="total" value="{{ request()->get('total', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="71">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="on_road_discount" value="{{ request()->get('on_road_discount', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="72">

                                        </div>

                                    </div>

                                </th>
                                
                                <th>
                                    <div class="search-box-container datatable-form-filter width_150">
                                        <div class="form-group is-empty"></div>
                                    </div>
                                </th>
                                
                                <th>
                                    <div class="search-box-container datatable-form-filter width_150">
                                        <div class="form-group is-empty"></div>
                                    </div>
                                </th>
                                
                                <th>
                                    <div class="search-box-container datatable-form-filter width_150">
                                        <div class="form-group is-empty"></div>
                                    </div>
                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_300">

                                        <div class="form-group is-empty">

                                            <input type="text" name="remarks" value="{{ request()->get('remarks', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="73">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="kin_invoice_no" value="{{ request()->get('kin_invoice_no', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="74">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="kin_invoice_date" value="{{ request()->get('kin_invoice_date', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="75">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="purchase_price" value="{{ request()->get('purchase_price', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="76">

                                        </div>

                                    </div>

                                </th>
                                
                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="tat_days" value="{{ request()->get('tat_days', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="78">

                                        </div>

                                    </div>

                                </th>
                                
                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="tat_status" value="{{ request()->get('tat_status', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="79">

                                        </div>

                                    </div>

                                </th>

                                <th>

                                    <div class="search-box-container datatable-form-filter width_150">

                                        <div class="form-group is-empty">

                                            <input type="text" name="manufacturing_year" value="{{ request()->get('manufacturing_year', '') }}" class="form-control text-capitalize" autocomplete="off" autofocus tabindex="77">

                                        </div>

                                    </div>

                                </th>

                            </tr>

                        </thead>

                    </table>

                </div>

            </div>

        </div>

        

        <div class="modal fade" id="downloadModal" tabindex="-1" role="dialog" aria-labelledby="downloadModalLabel">

            <div class="modal-dialog modal-lg" role="document">

                <div class="modal-content">

                    <div class="modal-header">

                        <h5 class="modal-title">Your Exported Reports</h5>

                        <button type="button" class="close" data-dismiss="modal">

                            <span>&times;</span>

                        </button>

                    </div>

                    <div class="modal-body">

                        @php

                            $files = \DB::table('excel_exports')

                                ->where('user_id', auth()->id())

                                ->where('status', '!=', 'downloaded')

                                ->orderByDesc('created_at')

                                ->take(5)

                                ->get();

                        @endphp

        

                        @if($files->isEmpty())

                            <p>No exported reports found.</p>

                        @else

                            <ul class="list-group">

                                @foreach ($files as $file)

                                    <li class="list-group-item d-flex justify-content-between align-items-center">

                                        {{ $file->file_name }}

                                        <div>

                                            <small>{{ \Carbon\Carbon::parse($file->created_at)->diffForHumans() }}</small>

                                            <a class="btn btn-sm btn-outline-primary ml-2"

                                               href="{{ route('daybook.export.download', $file->id) }}">

                                                Download

                                            </a>

                                        </div>

                                    </li>

                                @endforeach

                            </ul>

                        @endif

                    </div>

                </div>

            </div>

        </div>

    </div>

</div>

@endsection



@section('scripts')

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

    <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>

    <script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

    <script src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.min.js"></script>

    <script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>

    

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />

    <script src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>

    

    <script type="text/javascript">

        $.ajaxSetup({

            headers: {

                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

            }

        });

    </script>    

    

    <script type="text/javascript">    

        $(document).ready(function() {

            $('#booking_date,#ibs_invoice_date,#filter_booking_date').daterangepicker({

                autoUpdateInput: false,

                locale: {

                    format: 'DD-MM-YYYY',

                    cancelLabel: 'Clear'

                }

            });

        

            $('#booking_date,#ibs_invoice_date,#filter_booking_date').on('apply.daterangepicker', function(ev, picker) {

                $(this).val(picker.startDate.format('DD-MM-YYYY') + ' to ' + picker.endDate.format('DD-MM-YYYY'));

                $('#day-book-data-table').DataTable().draw();

            });

        

            $('#booking_date,#ibs_invoice_date,#filter_booking_date').on('cancel.daterangepicker', function(ev, picker) {

                $(this).val('');

                $('#day-book-data-table').DataTable().draw();

            });

            

            var tableColumns = [

                {data: null, title: 'Sr. No.', class: 'text-center', orderable: false, width: 100,

                    render: function (data, type, row, meta) {

                        return meta.row + meta.settings._iDisplayStart + 1;

                    }

                },

                {data: 'location', name: 'location',class:'text-center',title: 'Location', orderable: true,default: true},

                {data: 'kec_name', name: 'kec_name',class:'text-center',title: 'KEC Name', orderable: true,default: true},

                {data: 'tl_name', name: 'tl_name',class:'text-center',title: 'TL Name', orderable: true,default: true},

                {data: 'booking_month_year', name: 'booking_month_year',class:'text-center',title: 'Month', orderable: true,default: true},

                {data: 'booking_date', name: 'booking_date',class:'text-center',title: 'Booking Date', orderable: true,default: true},

                {data: 'price_list_name', name: 'price_list_name',class:'text-center',title: 'Pricelist (WEF)', orderable: true,default: true},

                {data: 'customer_name', name: 'customer_name',class:'text-center',title: 'Bill To : Customer Name', orderable: true,default: true},

                {data: 'company_name', name: 'company_name',class:'text-center',title: 'Bill To : Company Name', orderable: true,default: true},

                {data: 'registration', name: 'registration',title: 'Bill To : Address: Registration',

                    render: function(data, type, row) {

                        if (!data) return '';

                        let shortText = data.length > 25 ? data.substring(0, 25) + '...' : data;

                        return `<span title="${data}" data-toggle="tooltip">${shortText}</span>`;

                    }

                },

                {data: 'district_name', name: 'district_name',class:'text-center',title: 'District', orderable: true,default: true},

                {data: 'state_name', name: 'state_name',class:'text-center',title: 'State', orderable: true,default: true},

                {data: 'einvoicing_applicable', name: 'einvoicing_applicable',class:'text-center',title: 'e-invoice Applicable', orderable: true,default: true},

                {data: 'gst', name: 'gst',class:'text-center',title: 'GST No.', orderable: true,default: true},

                {data: 'ship_to_customer_name', name: 'ship_to_customer_name',class:'text-center',title: 'Ship To : Customer Name', orderable: true,default: true},

                {data: 'ship_to_address', name: 'ship_to_address',title: 'Address',

                    render: function(data, type, row) {

                        if (!data) return '';

                        let shortText = data.length > 25 ? data.substring(0, 25) + '...' : data;

                        return `<span title="${data}" data-toggle="tooltip">${shortText}</span>`;

                    }

                },

                {data: 'rto_type', name: 'rto_type',class:'text-center',title: 'RTO Type', orderable: true,default: true},

                {data: 'customer_type_master', name: 'customer_type_master',class:'text-center',title: 'Customer Type', orderable: true,default: true},

                {data: 'contact_number', name: 'contact_number',class:'text-center',title: 'Mobile No.', orderable: true,default: true},

                {data: 'pan_number', name: 'pan_number',class:'text-center',title: 'Pan No.', orderable: true,default: true},

                {data: 'adhar_number', name: 'adhar_number',class:'text-center',title: 'Aadhar No.', orderable: true,default: true},

                {data: 'aadhar_pan_link', name: 'aadhar_pan_link',class:'text-center',title: 'Aadhar and Pan Link Status', orderable: true,default: true},

                {data: 'ibs_invoice_date', name: 'ibs_invoice_date',class:'text-center',title: 'IBS Invoice Date', orderable: true,default: true},

                {data: 'ibs_invoice_no', name: 'ibs_invoice_no',class:'text-center',title: 'IBS Invoice No.', orderable: true,default: true},

                {data: 'model', name: 'model',class:'text-center',title: 'Model', orderable: true,default: true},

                {data: 'varient', name: 'varient',class:'text-center',title: 'Variant', orderable: true,default: true},

                {data: 'fuel_type', name: 'fuel_type',class:'text-center',title: 'Fuel Type', orderable: true,default: true},

                {data: 'vin_number', name: 'vin_number',class:'text-center',title: 'VIN Number', orderable: true,default: true},

                {data: 'engine_number', name: 'engine_number',class:'text-center',title: 'Engine No.', orderable: true,default: true},

                {data: 'ex_showroom_price', name: 'ex_showroom_price',class:'text-center',title: 'Ex Showroom Price', orderable: true,default: true},

                {data: 'discount_with_gst', name: 'discount_with_gst',class:'text-center',title: 'Discount with GST', orderable: true,default: true},

                {data: 'after_dis_ex_showroom_price', name: 'after_dis_ex_showroom_price',class:'text-center',title: 'After Disc Ex. Sr Price', orderable: true,default: true},

                {data: 'basic', name: 'basic',class:'text-center',title: 'Basic', orderable: true,default: true},

                {data: 'cgst', name: 'cgst',class:'text-center',title: 'CGST', orderable: true,default: true},

                {data: 'sgst', name: 'sgst',class:'text-center',title: 'SGST', orderable: true,default: true},

                {data: 'igst', name: 'igst',class:'text-center',title: 'IGST', orderable: true,default: true},

                {data: 'cess', name: 'cess',class:'text-center',title: 'CESS', orderable: true,default: true},

                {data: 'after_dis_ex_showroom_price', name: 'after_dis_ex_showroom_price',class:'text-center',title: 'Total', orderable: true,default: true},

                {data: 'tcs', name: 'tcs',class:'text-center',title: 'TCS', orderable: true,default: true},

                {data: 'rto', name: 'rto',class:'text-center',title: 'RTO', orderable: true,default: true},

                {data: 'vehicle_number', name: 'vehicle_number',class:'text-center',title: 'RTO Registration No.', orderable: true,default: true},

                {data: 'rto_custom_handling_charges', name: 'rto_custom_handling_charges',class:'text-center',title: 'RTO Custom Handling Charges', orderable: true,default: true},

                {data: 'municipal_tax', name: 'municipal_tax',class:'text-center',title: 'Municipal Tax', orderable: true,default: true},

                {data: 'insurance', name: 'insurance',class:'text-center',title: 'Insurance', orderable: true,default: true},

                {data: 'insurance_type', name: 'insurance_type',class:'text-center',title: 'Insurance Type', orderable: true,default: true},

                {data: 'insurance_name', name: 'insurance_name',class:'text-center',title: 'Insurance Company Name', orderable: true,default: true},

                {data: 'rsa', name: 'rsa',class:'text-center',title: 'RSA', orderable: true,default: true},

                {data: 'ccs', name: 'ccs',class:'text-center',title: 'CCS', orderable: true,default: true},

                {data: 'ew', name: 'ew',class:'text-center',title: 'EW', orderable: true,default: true},

                {data: 'mcp', name: 'mcp',class:'text-center',title: 'MCP', orderable: true,default: true},

                {data: 'fastag', name: 'fastag',class:'text-center',title: 'Fastage', orderable: true,default: true},

                {data: 'accessory_amount', name: 'accessory_amount',class:'text-center',title: 'Accessories', orderable: true,default: true},

                {data: 'total', name: 'total',class:'text-center',title: 'Total', orderable: true,default: true},

                {data: 'booking_amount', name: 'booking_amount',class:'text-center',title: 'Booking Amount', orderable: true,default: true}, 

                {data: 'dp_amount', name: 'dp_amount',class:'text-center',title: 'Dowan payment', orderable: true,default: true},

                {data: 'financer_name', name: 'financer_name',class:'text-center',title: 'Financer Name', orderable: true,default: true},

                {data: 'finance_type', name: 'finance_type',class:'text-center',title: 'Fin. IN House/DSA/Self', orderable: true,default: true},

                {data: 'finance_discount', name: 'finance_discount',class:'text-center',title: 'Finance Disbusment', orderable: true,default: true},

                {data: 'exchange_amount', name: 'exchange_amount',class:'text-center',title: 'Exchange', orderable: true,default: true},

                {data: 'exchange_name', name: 'exchange_name',class:'text-center',title: 'Model / Variant', orderable: true,default: true},

                {data: 'registration_number', name: 'registration_number',class:'text-center',title: 'Registration No.', orderable: true,default: true},

                {data: 'access_sort_amount', name: 'access_sort_amount',class:'text-center',title: 'Excess Shrot', orderable: true,default: true},

                {data: 'other_amount', name: 'other_amount',class:'text-center',title: 'Other', orderable: true,default: true},

                {data: 'total_amt_received', name: 'total_amt_received',class:'text-center',title: 'Total Amount Received', orderable: true,default: true},

                {data: 'refund_amount', name: 'refund_amount',class:'text-center',title: 'Due Amount/Refund Amt', orderable: true,default: true},

                {data: 'refund_amt_process', name: 'refund_amt_process',class:'text-center',title: 'Refund Amount Process', orderable: true,default: true},

                {data: 'refund_amt_date', name: 'refund_amt_date',class:'text-center',title: 'Refund Amt. Date', orderable: true,default: true},

                {data: 'refund_diff', name: 'refund_diff',class:'text-center',title: 'Difference', orderable: true,default: true},

                {data: 'date', name: 'date',class:'text-center',title: 'Date', orderable: true,default: true},

                {data: 'payment_ref_no', name: 'payment_ref_no',class:'text-center',title: 'Payment Ref No.', orderable: true,default: true},

                {data: 'on_road_price', name: 'on_road_price',class:'text-center',title: 'On Road Price', orderable: true,default: true},

                {data: 'total', name: 'total',class:'text-center',title: 'Make Deal', orderable: true,default: true},

                {data: 'on_road_discount', name: 'on_road_discount',class:'text-center',title: 'On Road Discount', orderable: true,default: true},
                
                {data: 'offer_discount', name: 'offer_discount',class:'text-center',title: 'Offer Discount (A)', orderable: true,default: true},
                
                {data: 'approval_discount', name: 'approval_discount',class:'text-center',title: 'Designation Wise Discount (B)', orderable: true,default: true}, 
                
                {data: 'total_discount', name: 'total_discount',class:'text-center',title: 'Total Discount ( A + B = C )', orderable: true,default: true}, 

                {data: 'remarks', name: 'remarks',class:'text-center',title: 'Remarks', orderable: true,default: true},

                {data: 'kin_invoice_no', name: 'kin_invoice_no',class:'text-center',title: 'KIN Invocie no.', orderable: true,default: true},

                {data: 'kin_invoice_date', name: 'kin_invoice_date',class:'text-center',title: 'KIN Pur. Date', orderable: true,default: true},

                {data: 'purchase_price', name: 'purchase_price',class:'text-center',title: 'Purchase Basic', orderable: true,default: true},
                
                {data: 'tat_days', name: 'tat_days',class:'text-center',title: 'TAT Days', orderable: true,default: true},
                
                {data: 'tat_status', name: 'tat_status',class:'text-center',title: 'TAT Status', orderable: true,default: true},

                {data: 'manufacturing_year', name: 'manufacturing_year',class:'text-center',title: 'MFG Year', orderable: true,default: true},
                
                

            ];

    

            (function(window, $) {

                window.LaravelDataTables = window.LaravelDataTables || {};

                window.LaravelDataTables["dataTableBuilder"] = $("#day-book-data-table").DataTable({

                    processing: true,

                    serverSide: true,

                    language: {

                        "info": "_START_ - _END_ of _TOTAL_",

                        "lengthMenu": "_MENU_ ",

                        "infoFiltered": ""

                    },

                    // scrollY: '400px',

                    scrollCollapse: true,

                    paging: true,

                    searching: false,

    

                    bSortCellsTop : true,

                    ajax: {

                        url: '{!! route("DayBookReportFetch") !!}',

                        type: 'POST',

                        data: function (d) { 

                            d.location = jQuery(".datatable-form-filter input[name='location']").val();

                            d.kec_name = jQuery(".datatable-form-filter input[name='kec_name']").val();

                            d.tl_name = jQuery(".datatable-form-filter input[name='tl_name']").val();

                            d.booking_month_year = jQuery(".datatable-form-filter input[name='booking_month_year']").val();

                            d.booking_date = jQuery(".datatable-form-filter input[name='booking_date']").val();

                            d.price_list_name = jQuery(".datatable-form-filter input[name='price_list_name']").val();

                            d.customer_name = jQuery(".datatable-form-filter input[name='customer_name']").val();

                            d.company_name = jQuery(".datatable-form-filter input[name='company_name']").val();

                            d.registration = jQuery(".datatable-form-filter input[name='registration']").val();

                            d.district_name = jQuery(".datatable-form-filter input[name='district_name']").val();

                            d.state_name = jQuery(".datatable-form-filter input[name='state_name']").val();

                            d.einvoicing_applicable = jQuery(".datatable-form-filter input[name='einvoicing_applicable']").val();

                            d.gst = jQuery(".datatable-form-filter input[name='gst']").val();

                            d.ship_to_customer_name = jQuery(".datatable-form-filter input[name='ship_to_customer_name']").val();

                            d.ship_to_address = jQuery(".datatable-form-filter input[name='ship_to_address']").val();

                            d.rto_type = jQuery(".datatable-form-filter input[name='rto_type']").val();

                            d.customer_type_master = jQuery(".datatable-form-filter input[name='customer_type_master']").val();

                            d.contact_number = jQuery(".datatable-form-filter input[name='contact_number']").val();

                            d.pan_number = jQuery(".datatable-form-filter input[name='pan_number']").val();

                            d.adhar_number = jQuery(".datatable-form-filter input[name='adhar_number']").val();

                            d.aadhar_pan_link = jQuery(".datatable-form-filter input[name='aadhar_pan_link']").val();

                            d.ibs_invoice_date = jQuery(".datatable-form-filter input[name='ibs_invoice_date']").val();

                            d.ibs_invoice_no = jQuery(".datatable-form-filter input[name='ibs_invoice_no']").val();

                            d.model = jQuery(".datatable-form-filter input[name='model']").val();

                            d.varient = jQuery(".datatable-form-filter input[name='varient']").val();

                            d.fuel_type = jQuery(".datatable-form-filter input[name='fuel_type']").val();

                            d.vin_number = jQuery(".datatable-form-filter input[name='vin_number']").val();

                            d.engine_number = jQuery(".datatable-form-filter input[name='engine_number']").val();

                            d.ex_showroom_price = jQuery(".datatable-form-filter input[name='ex_showroom_price']").val();

                            d.discount_with_gst = jQuery(".datatable-form-filter input[name='discount_with_gst']").val();

                            d.after_dis_ex_showroom_price = jQuery(".datatable-form-filter input[name='after_dis_ex_showroom_price']").val();

                            d.basic = jQuery(".datatable-form-filter input[name='basic']").val();

                            d.cgst = jQuery(".datatable-form-filter input[name='cgst']").val();

                            d.sgst = jQuery(".datatable-form-filter input[name='sgst']").val();

                            d.igst = jQuery(".datatable-form-filter input[name='igst']").val();

                            d.cess = jQuery(".datatable-form-filter input[name='cess']").val();

                            d.after_dis_ex_showroom_price = jQuery(".datatable-form-filter input[name='after_dis_ex_showroom_price']").val();

                            d.tcs = jQuery(".datatable-form-filter input[name='tcs']").val();

                            d.rto = jQuery(".datatable-form-filter input[name='rto']").val();

                            d.vehicle_number = jQuery(".datatable-form-filter input[name='vehicle_number']").val();

                            d.rto_custom_handling_charges = jQuery(".datatable-form-filter input[name='rto_custom_handling_charges']").val();

                            d.municipal_tax = jQuery(".datatable-form-filter input[name='municipal_tax']").val();

                            d.insurance = jQuery(".datatable-form-filter input[name='insurance']").val();

                            d.insurance_type = jQuery(".datatable-form-filter input[name='insurance_type']").val();

                            d.insurance_name = jQuery(".datatable-form-filter input[name='insurance_name']").val();

                            d.rsa = jQuery(".datatable-form-filter input[name='rsa']").val();

                            d.ccs = jQuery(".datatable-form-filter input[name='ccs']").val();

                            d.ew = jQuery(".datatable-form-filter input[name='ew']").val();

                            d.mcp = jQuery(".datatable-form-filter input[name='mcp']").val();

                            d.fastag = jQuery(".datatable-form-filter input[name='fastag']").val();

                            d.accessory_amount = jQuery(".datatable-form-filter input[name='accessory_amount']").val();

                            d.total = jQuery(".datatable-form-filter input[name='total']").val();

                            d.booking_amount = jQuery(".datatable-form-filter input[name='booking_amount']").val();

                            d.dp_amount = jQuery(".datatable-form-filter input[name='dp_amount']").val();

                            d.financer_name = jQuery(".datatable-form-filter input[name='financer_name']").val();

                            d.finance_type = jQuery(".datatable-form-filter input[name='finance_type']").val();

                            d.finance_discount = jQuery(".datatable-form-filter input[name='finance_discount']").val();

                            d.exchange_amount = jQuery(".datatable-form-filter input[name='exchange_amount']").val();

                            d.exchange_name = jQuery(".datatable-form-filter input[name='exchange_name']").val();

                            d.registration_number = jQuery(".datatable-form-filter input[name='registration_number']").val();

                            d.access_sort_amount = jQuery(".datatable-form-filter input[name='access_sort_amount']").val();

                            d.other_amount = jQuery(".datatable-form-filter input[name='other_amount']").val();

                            d.total_amt_received = jQuery(".datatable-form-filter input[name='total_amt_received']").val();

                            d.refund_amount = jQuery(".datatable-form-filter input[name='refund_amount']").val();

                            d.refund_amt_process = jQuery(".datatable-form-filter input[name='refund_amt_process']").val();

                            d.refund_amt_date = jQuery(".datatable-form-filter input[name='refund_amt_date']").val();

                            d.refund_diff = jQuery(".datatable-form-filter input[name='refund_diff']").val();

                            d.date = jQuery(".datatable-form-filter input[name='date']").val();

                            d.payment_ref_no = jQuery(".datatable-form-filter input[name='payment_ref_no']").val();

                            d.on_road_price = jQuery(".datatable-form-filter input[name='on_road_price']").val();

                            d.total = jQuery(".datatable-form-filter input[name='total']").val();

                            d.on_road_discount = jQuery(".datatable-form-filter input[name='on_road_discount']").val();

                            d.remarks = jQuery(".datatable-form-filter input[name='remarks']").val();

                            d.kin_invoice_no = jQuery(".datatable-form-filter input[name='kin_invoice_no']").val();

                            d.kin_invoice_date = jQuery(".datatable-form-filter input[name='kin_invoice_date']").val();

                            d.purchase_price = jQuery(".datatable-form-filter input[name='purchase_price']").val();
                            
                            d.tat_days = jQuery(".datatable-form-filter input[name='tat_days']").val();
                            
                            d.tat_status = jQuery(".datatable-form-filter input[name='tat_status']").val();
                            
                            d.manufacturing_year = jQuery(".datatable-form-filter input[name='manufacturing_year']").val();
                            
                            

                        },

                        headers: {

                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') // ✅ CSRF token

                        },

                        error : function(d) {}

                    },

                    columns: tableColumns,

                    lengthMenu: [

                        [25, 50,100, -1 ],['25', '50','100', 'Show all' ]

                    ],

                    order: [ [0,'DESC'] ],

                    responsive: true,

                    colReorder:{

                        enable: false,

                    },

                    dom: '<"top"f>rt<"bottom"ipl><"clear">',

                    fnInitComplete: function(settings, json) {

                        jQuery('table.table input:checkbox').map(function() {

                            if(jQuery(this).prop("checked") != true){

                                var column = table.column( jQuery(this).attr('data-column') );

                                column.visible(false);

                            }

                        });

                    },

                    pageLength: 25,

                });

            })(window, jQuery);

            

            $('.datatable-form-filter input').on('keyup', function (e) {

                if($(this).val().length >= 3 || e.keyCode == 13 || !$(this).val()) {

                    window.LaravelDataTables["dataTableBuilder"].draw();

                    e.preventDefault();

                }

            });

        

            $('.datatable-form-filter select').on('change', function (e) {

                window.LaravelDataTables["dataTableBuilder"].draw();

                e.preventDefault();

            });

        

            $('input:checkbox[name="name_sort_asc"],input:checkbox[name="name_sort_desc"]').on('click', function (e) {

                window.LaravelDataTables["dataTableBuilder"].draw();

                e.preventDefault();

            });

        });

    </script>

@endsection

