
<style>
    #tableWithSearch thead tr >th{
        background-color:#4c0870 ;
        color:#fff;
    }
    #tableWithSearch thead tr th[class*='sorting_'] {
        color: #fff;
    }
    .bg-master-lighter {
        border:none;
        background-color:#fff;
        border-top:1px solid #ddd;  
    }
</style>
<script src="<?php echo JS_PATH; ?>scripts.js"></script>
<script src="<?php echo THEME_PATH; ?>/plugins/moment/moment.min.js"></script>
<!-- End of logging alert -->
<div class="container-fluid container-fixed-lg bg-white">
    <div class="panel panel-transparent">
        <div class="panel-heading">
            <div class="panel-title"> <?php print CommonLanguage::getMessage('service_invoice_list'); ?></div>
            <div class="col-md-4 pull-right">
                <div class="input-daterange input-group" id="datepicker-range">
                    <input id="From_To_Date" type="text" class="form-control" name="From_To_Date" >
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="panel-body">
            <table class="table table-bordered table-hover demo-table-search" id="tableWithSearch">
                <thead>
                    <tr>
                        <th class="text-center" style="width:10%" > <?php print CommonLanguage::getMessage('invoice'); ?>#</th>
                        <th class="text-center" style="width:15%" > <?php print CommonLanguage::getMessage('customer_name'); ?></th>
                        <th class="text-center" style="width:10%"> <?php print CommonLanguage::getMessage('Date'); ?></th>
                        <th class="text-center" style="width:5%" > <?php print CommonLanguage::getMessage('due_date'); ?></th>
                        <th class="text-center" style="width:10%"><?php print CommonLanguage::getMessage('net_total'); ?></th>
                        <th class="text-center no-print" style="width:5%"><?php print CommonLanguage::getMessage('Action'); ?></th>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
        </div>
    </div>
</div>

<script>
    var today = <?php echo json_encode($today) ?>, year =<?php echo json_encode($year); ?>,
            is_actual = <?php echo json_encode($IsActual); ?>;
    $(function () {

        $("input[name=From_To_Date]").daterangepicker({
            locale: {
                format: 'YYYY-MM-DD'
            },
            startDate: year + '-01-01'
        }, function (start, end, label) {
            window.startDate = start.format("YYYY-MM-DD"),
                    window.endDate = end.format("YYYY-MM-DD")
        });
        var DataArr = {
            is_actual : is_actual,
            From_Date: window.startDate ? window.startDate : year + '-01-01',
            To_Date: window.endDate ? window.endDate : today
        };
        RebuildDataTable('title', [0, 1, 2, 3, 4], 'InventoryAjax/ServiceInvoiceList', DataArr)
        $("#From_To_Date").on("change", function () {
            ChangeTable()
        })
    })
    function ChangeTable() {
        var Data = {
            is_actual : is_actual,
            From_Date: window.startDate ? window.startDate : year + '-01-01',
            To_Date: window.endDate ? window.endDate : today
        }
        RebuildDataTable('title', [0, 1, 2, 3, 4], 'InventoryAjax/ServiceInvoiceList', Data)

    }


</script>