<div id="screen[index]" style="width: 100%;height:100%">
    <div class="kt-portlet kt-portlet--mobile">
        <div class="kt-portlet__body kt-portlet__body--fit">
            <div class="row">
                <div class="col-lg-12">
                    <input type="hidden" id="isManagerFilter" value="<?php echo isset($isManagerFilter) ? ($isManagerFilter ? 'true' : 'false' ) : 'false';?>" >
                    <!--begin: Datatable -->
                    <div class="kt-datatable kt-datatable--default kt-datatable--brand kt-datatable--loaded" style="">
                        <table class="kt-datatable__table">
                            <thead class="kt-datatable__head">
                            <tr class="dnd-moved kt-datatable__row" style="left: 0px;"><th class="kt-datatable__cell">
                                    <span>BU: </span>
                                </th>
                                <th class="kt-datatable__cell">
                                    <select class="form-control" id="cmbSalesQuotationBUFilter"><?php echo $this->getOptionCompany(); ?></select>
                                </th>
                                <th class="kt-datatable__cell">
                                    <span>Status: </span>
                                </th>
                                <th class="kt-datatable__cell">
                                    <select class="form-control" id="cmbSalesQuotationStatusFilter"><?php echo $this->getOptionSalesQuotationStatus(); ?></select>
                                </th>
                                <th class="kt-datatable__cell">
                                    <select class="form-control" id="cmbSalesQuotationFilterDate">
                                    <option value="0">Create Date</option>
                                    <option value="1">Issue Date</option>
                                    <option value="2">Revise Date</option>
                                    <option value="6">Exp. Accept Date</option>
                                    <option value="3">Accept Date</option>
                                    <option value="4">Close Date</option>
                                    <option value="5">Invoice Date</option>
                                    <option value="7">Exp. Pay Date</option>
                                    </select>
                                </th>
                                <th class="kt-datatable__cell" style="width: 200px;">
                                    <div class="input-group date">
                                        <input type="text" class="form-control" id="txtSalesQuotationFromDateFilter">
                                        <div class="input-group-append">
                                            <span class="input-group-text">
                                                <i class="la la-calendar-check-o"></i>
                                            </span>
                                        </div>
                                    </div>
                                </th>
                                <th class="kt-datatable__cell">
                                    <span>To</span>
                                </th>
                                <th class="kt-datatable__cell" style="width: 200px;">
                                    <div class="input-group date">
                                        <input type="text" class="form-control" id="txtSalesQuotationToDateFilter">
                                        <div class="input-group-append">
                                            <span class="input-group-text">
                                                <i class="la la-calendar-check-o"></i>
                                            </span>
                                        </div>
                                    </div>
                                </th>
                                <th class="kt-datatable__cell">
                                    <button type="button" class="btn btn-default" id="btnFilterReport" onclick='filterSalesQuotationSummary();'><i class="fa fa-filter"></i> Filter </button>
                                </th>
                                <th class="kt-datatable__cell">
                                    <button type="button" class="btn btn-default" id="btnExportReport" onclick='showSalesQuotationExport();'><i class="fa fa-file-export"></i> Export Excel</button>
                                </th>
                                <!-- <th class="kt-datatable__cell">
                                    <button type="button" class="btn btn-default" id="btnPrintReport" onclick='return showReportPrintPreview("<?php echo Command::PortalReportJobBillingStatusSummaryPrintPreview; ?>",0);'><i class="fa fa-print"></i> Print </button>
                                </th> -->
                            </tr>
                            </thead>
                        </table>
                </div>
                <div class="col-lg-12 text-right"><button type="button" class="btn btn-default btn-sm btn-icon btn-icon-md" id="btnFilterReport" onclick="filterRow('report-row-filter',this,true);"><i class="fa fa-filter"></i></button></div><br/>
                <div class="col-lg-12 kt-separator kt-separator--dashed"></div>
                <div class="col-lg-12">
                    <!--begin: Datatable -->
                    <div class="kt-datatable kt-datatable--default kt-datatable--brand kt-datatable--loaded" style="">
                        <table class="kt-datatable__table" id="salesquotationsummary_table_data">
                            <thead class="kt-datatable__head">
                                <tr class="dnd-moved kt-datatable__row" style="left: 0px;">
                                <th data-field="jobid" class="kt-datatable__cell" id="col_jobid" style="display: none;">
                                    <span>ID <i class="fa"></i></span>
                                </th>
                                <th data-field="sno" class="kt-datatable__cell" id="col_sno" style="text-align:center;">
                                    <span>S/No.</span>
                                </th>
                                <th data-field="businessunit" class="kt-datatable__cell" style="width: 3%;" id="col_businessunit" name="salesquotationsummary_sort_column" onclick="sortColumn(this,'col_businessunit','asc');">
                                    <span>BU <i class="fa"></i></span>
                                </th>
                                <th data-field="internalnumber" class="kt-datatable__cell" style="width: 10%;" id="col_internalnumber" name="salesquotationsummary_sort_column" onclick="sortColumn(this,'col_internalnumber','asc');">
                                    <span>Internal # <i class="fa"></i></span>
                                </th>
                                <th data-field="quotnumber" class="kt-datatable__cell" style="width: 8%;" id="col_quotnumber" name="salesquotationsummary_sort_column" onclick="sortColumn(this,'col_quotnumber','asc');">
                                    <span>Quotation # <i class="fa"></i></span>
                                </th>
                                <th data-field="jobtype" class="kt-datatable__cell" style="width: 5%;" id="col_jobtype" name="salesquotationsummary_sort_column" onclick="sortColumn(this,'col_jobtype','asc');">
                                    <span>Type <i class="fa"></i></span>
                                </th>
                                <th data-field="jobcustomer" class="kt-datatable__cell" style="width: 10%;" name="salesquotationsummary_sort_column" id="col_jobcustomer" onclick="sortColumn(this,'col_jobcustomer','asc');">
                                    <span>Customer/Prospect <i class="fa"></i></span>
                                </th>
                                <th data-field="contactname" class="kt-datatable__cell" style="width: 8%;" id="col_contactname" name="salesquotationsummary_sort_column" onclick="sortColumn(this,'col_contactname','asc');">
                                    <span>Contact Name <i class="fa"></i></span>
                                </th>
                                <th data-field="jobtitle" class="kt-datatable__cell" style="width: 10%;" id="col_jobtitle" name="salesquotationsummary_sort_column" onclick="sortColumn(this,'col_jobtitle','asc');">
                                    <span>Title <i class="fa"></i></span>
                                </th>
                                <th data-field="currency" class="kt-datatable__cell" style="width: 5%;" name="salesquotationsummary_sort_column" id="col_currency" onclick="sortColumn(this,'col_currency','asc');">
                                    <span>Currency <i class="fa"></i></span>
                                </th>
                                <th data-field="totalamount" class="kt-datatable__cell" style="width: 8%;text-align:right;" name="salesquotationsummary_sort_column" id="col_totalamount" onclick="sortColumn(this,'col_totalamount','asc');">
                                    <span>Total Amount <i class="fa"></i></span>
                                </th>
                                <th data-field="status" class="kt-datatable__cell" style="width: 5%;" name="salesquotationsummary_sort_column" id="col_status" onclick="sortColumn(this,'col_status','asc');">
                                    <span>Status <i class="fa"></i></span>
                                </th>
                                <th data-field="createdate" class="kt-datatable__cell" style="width: 8%;" name="salesquotationsummary_sort_column" id="col_createdate" onclick="sortColumn(this,'col_createdate','desc');">
                                    <span>Create Date <i class="fa fa-sort-up"></i></span>
                                </th>
                                <th data-field="issuedate" class="kt-datatable__cell" style="width: 8%;" name="salesquotationsummary_sort_column" id="col_issuedate" onclick="sortColumn(this,'col_issuedate','asc');">
                                    <span>Issue Date <i class="fa"></i></span>
                                </th>
                                <th data-field="expacceptdate" class="kt-datatable__cell" style="width: 8%;" name="salesquotationsummary_sort_column" id="col_expacceptdate" onclick="sortColumn(this,'col_expacceptdate','asc');">
                                    <span>Exp. Accept Date <i class="fa"></i></span>
                                </th>
                                <th data-field="acceptdate" class="kt-datatable__cell" style="width: 8%;" name="salesquotationsummary_sort_column" id="col_acceptdate" onclick="sortColumn(this,'col_acceptdate','asc');">
                                    <span>Accept Date <i class="fa"></i></span>
                                </th>
                                <th data-field="closeddate" class="kt-datatable__cell" style="width: 10%;" name="salesquotationsummary_sort_column" id="col_closeddate" onclick="sortColumn(this,'col_closeddate','asc');">
                                    <span>Close Date <i class="fa"></i></span>
                                </th>
                                <th data-field="invoicedate" class="kt-datatable__cell" style="width: 8%;" name="salesquotationsummary_sort_column" id="col_invoicedate" onclick="sortColumn(this,'col_invoicedate','asc');">
                                    <span>Proforma Invoice <i class="fa"></i></span>
                                </th>
                                <th data-field="exppaydate" class="kt-datatable__cell" style="width: 8%;" name="salesquotationsummary_sort_column" id="col_exppaydate" onclick="sortColumn(this,'col_exppaydate','asc');">
                                    <span>Exp. Pay Date <i class="fa"></i></span>
                                </th>
                                <th data-field="percentagepayment" class="kt-datatable__cell" style="width: 6%;" name="salesquotationsummary_sort_column" id="col_percentagepayment" onclick="sortColumn(this,'col_percentagepayment','asc');">
                                    <span>% of Payment <i class="fa"></i></span>
                                </th>
                                <!-- <th data-field="filter" class="kt-datatable__cell" style="width: 1%;" id="col_filter">
                                    <button type="button" class="btn btn-default btn-sm btn-icon btn-icon-md" id="btnFilterReport" onclick="filterRow('report-row-filter',this,true);"><i class="fa fa-filter"></i></button>
                                </th> -->
                            </tr>
                            </thead>
                            <tbody class="kt-datatable__body" style="" id="report-list-table">
                                <tr data-row="salesquotationsummary-rows-0" class="dnd-moved kt-datatable__row" style="left: 0px;" id="report-row-filter">
                                    <td data-field="jobid" class="kt-datatable__cell" id="col_jobid" style="display: none;">&nbsp;</td>
                                    <td data-field="sno" class="kt-datatable__cell" id="col_sno" style="text-align:center;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolsno" onkeyup="filterData(this,1);" />
                                    </td>
                                    <td data-field="businessunit" class="kt-datatable__cell" id="col_businessunit" style="width: 3%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolbusinessunit" onkeyup="filterData(this,2);" />
                                    </td>
                                    <td data-field="internalnumber" class="kt-datatable__cell" id="col_internalnumber" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolinternalnumber" onkeyup="filterData(this,3);" />
                                    </td>
                                    </td>
                                    <td data-field="quotnumber" class="kt-datatable__cell" id="col_quotnumber" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolquotnumber" onkeyup="filterData(this,4);" />
                                    </td>
                                    <td data-field="jobtype" class="kt-datatable__cell" id="col_jobtype" style="width: 5%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcoljobtype" onkeyup="filterData(this,5);" />
                                    </td>
                                    <td data-field="jobcustomer" class="kt-datatable__cell" id="col_jobcustomer" style="width: 10%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcoljobcustomer" onkeyup="filterData(this,6);" />
                                    </td>
                                    <td data-field="contactname" class="kt-datatable__cell" id="col_contactname" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolcontactname" onkeyup="filterData(this,7);" />
                                    </td>
                                    <td data-field="jobtitle" class="kt-datatable__cell" id="col_jobtitle" style="width: 10%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcoljobtitle" onkeyup="filterData(this,8);" />
                                    </td>
                                    <td data-field="currency" class="kt-datatable__cell" id="col_currency" style="width: 5%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolcurrency" onkeyup="filterData(this,9);" />
                                    </td>
                                    <td data-field="totalamount" class="kt-datatable__cell" id="col_totalamount" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcoltotalamount" onkeyup="filterData(this,10);" />
                                    </td>
                                    <td data-field="status" class="kt-datatable__cell" id="col_status" style="width: 5%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolstatus" onkeyup="filterData(this,11);" />
                                    </td>
                                    <td data-field="createdate" class="kt-datatable__cell" id="col_createdate" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolcreatedate" onkeyup="filterData(this,12);" />
                                    </td>
                                    <td data-field="issuedate" class="kt-datatable__cell" id="col_issuedate" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolissuedate" onkeyup="filterData(this,13);" />
                                    </td>
                                    <td data-field="expacceptdate" class="kt-datatable__cell" id="col_expacceptdate" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolexpacceptdate" onkeyup="filterData(this,14);" />
                                    </td>
                                    <td data-field="acceptdate" class="kt-datatable__cell" id="col_acceptdate" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolacceptdate" onkeyup="filterData(this,15);" />
                                    </td>
                                    <td data-field="closeddate" class="kt-datatable__cell" id="col_closeddate" style="width: 10%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolcloseddate" onkeyup="filterData(this,16);" />
                                    </td>
                                    <td data-field="invoicedate" class="kt-datatable__cell" id="col_invoicedate" style="width: 10%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolinvoicedate" onkeyup="filterData(this,17);" />
                                    </td>
                                    <td data-field="exppaydate" class="kt-datatable__cell" id="col_exppaydate" style="width: 8%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolexppaydate" onkeyup="filterData(this,18);" />
                                    </td>
                                    <td data-field="percentagepayment" class="kt-datatable__cell" id="col_percentagepayment" style="width: 6%;">
                                        <input type="text" class="form-control" name="salesquotationsummary_input_filter" id="txtcolpercentagepayment" onkeyup="filterData(this,19);" />
                                    </td>
                                    <!-- <td data-field="filter" class="kt-datatable__cell" id="col_filter">&nbsp;</td> -->
                                </tr>
                            </tbody>
                            <tbody class="kt-datatable__body" id="report-row-footer">
                            </tbody>
                        </table>
                    </div>
                    <!--end: Datatable -->
                </div>
            </div>
        </div>
        <!-- button to trigger the things -->
        <button id="activatebuttonscreen[index]" onclick='reactivatescreen[index]();' style="display: none;">activate screen button</button>
    </div>
</div>
<div id="screen[index]a" style="width: 100%;height:100%"> 

</div>
<script type ="text/javascript">
$(document).ready(function() {
    var claimDayLast = 30;
    var date = new Date();
    var firstDay = new Date();
    var lastDay = new Date();
    var todayDate = new Date();
    var startDate = new Date(new Date().setDate(todayDate.getDate()-claimDayLast));
    // console.log(startDate);
    firstDay.setFullYear(date.getFullYear(), date.getMonth(), 1);
    lastDay.setFullYear(date.getFullYear(), date.getMonth() + 1, 0);

    var dteopt = {
		// todayHighlight: true,
		orientation: "bottom left",
		autoclose: true,
		format: 'dd/mm/yyyy',
		templates: {
			leftArrow: '<i class="la la-angle-left"></i>',
			rightArrow: '<i class="la la-angle-right"></i>'
		}
	}

	$("#txtSalesQuotationFromDateFilter").datepicker(dteopt) ;
    $("#txtSalesQuotationToDateFilter").datepicker(dteopt) ;
    
    // // last xx days
    $('#txtSalesQuotationFromDateFilter').datepicker('setDate', (startDate.getDate() <= 9 ? "0" + startDate.getDate() : startDate.getDate()) + "/" + (startDate.getMonth()+1 <= 9 ? "0" + (startDate.getMonth()+1) : (startDate.getMonth()+1) ) + "/" + startDate.getFullYear());

    $('#txtSalesQuotationToDateFilter').datepicker('setDate', (todayDate.getDate() <= 9 ? "0" + todayDate.getDate() : todayDate.getDate()) + "/" + (todayDate.getMonth()+1 <= 9 ? "0" + (todayDate.getMonth()+1) : (todayDate.getMonth()+1) ) + "/" + todayDate.getFullYear());
    
    $('#cmbSalesQuotationStatusFilter').val(-1);

    sorts = "";
    filterRow("report-row-filter",this,false);
    filterSalesQuotationSummary();
});
</script>