<style>
    .myresult {
        -webkit-print-color-adjust: exact;
    }
    .nodata{
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }
    .borderRight{ border-right: 3px solid #E57373;}
    .borderTop{ border-top: 3px solid #E57373;}
    .borderThin{ border-top: 1px solid #E0E0E0;}//E57373
</style>

<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المطاعم</a></li>
            <li class="active"> تقرير سائق دليفرى</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading"> تقرير سائق دليفرى
                <a href="{$youtubes[191]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
            </div>
            <div class="panel-body">
                <form class="form-inline hidden-print" action="orderdeliveryreport.php" method="post">
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">السائق</label>
                        </div>
                        <select id="driver" name="driver" class="select2">
                            <option value="-1">-- اختر سائق --</option>
                            {foreach $drivers as $row}
                            <option value="{$row->userid}">{$row->employeename}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div style="clear: both"></div>
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <div  class="input-group date form_datetime col-md-5 hidden-print" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                            <input class="form-control" size="16" type="text" value="" name="datefrom" id="datefrom" readonly="" >
                            <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                            <span class="input-group-addon"  style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                            <input class="form-control" size="16" type="text" value="" name="dateto" id="dateto" readonly="" >
                            <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                            <span class="input-group-addon" style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                        </div>
                    </div>
                    <div class="clearfix"></div>

                    <br />
                    <button type="submit" class="btn btn-primary" >بحث</button>
        
                    <button type="submit"   class="btn btn-success pull-right"  id="submitprint">طباعة</button>

                </form>


            </div>

            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">

                    {if $ordersData > 0}
                    <hr/>
                    <table class="willprint table-black dataTableClass" style="width: 100%">
                        <thead>
                            <tr>
                                <th>رقم الاوردر</th>
                                <th>العميل</th>
                                <th>العنوان</th>
                                <th>التاريخ</th>
                                <th>اجمالى</th>
                                <th>السائق</th>
                                <th class="hidden-print">تفاصيل</th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=i value=0}
                            {assign var=total value=0}
                            {foreach $ordersData as $data}
                            <tr>
                                <td>{$data->id}</td>
                                <td>{$data->clientname}</td>
                                <td>{if $data->showAddress == 1}{$data->clientaddress}{elseif $data->showDetails}{$data->clientdetails}{/if}</td>
                                <td>{$data->sysdate}</td>
                                <td>{$data->netBill}{assign var=total value=$total+$data->netBill}</td>
                                <td>{$data->employeename}</td>
                                <td class="hidden-print"><a href="sellbillController.php?do=showDetail&sellbillid={$data->sellBillId}" type="button" target="_blank" class="btn btn-default btn-lg editicon"></a></td>
                            </tr>
                            {assign var=i value=$i+1}
                            {/foreach}
                        </tbody>
                    </table>
                    <div class="clearfix"></div>
                    <br/>
                    <div class="col-lg-4 ">
                        <div class="well well-sm">
                            <h4 class="text-center">عدد الأوردرات:  {$i}</h4>
                        </div>
                    </div>
                    <div class="col-lg-4 ">
                        <div class="well well-sm">
                            <h4 class="text-center">الإجمالى:  {$total}</h4>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <div  class="noprint">
                        <div class="col-lg-12">
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-success pull-right hidden-print">طباعة</button>
                                </div>
                                
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    {else}
                    <div class="nodata">عفوا لا توجد نتائج</div>
                    {/if}

                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
 {literal}
        <script>
           
              
             $('body').on('click', '#submitprint', function () {
                  var datefrom = $("#datefrom").val();
                  var dateto = $("#dateto").val();
                  var driver = $("#driver").val();
                  if (driver && driver != -1) {
                      window.open('orderdeliveryreport.php?do=print&id='+driver+'&datefrom='+datefrom+'&dateto='+dateto+'');
                  }else{
                    alert('يجب اختيار سائق اولا  ');
                     return false;
                 } 
             });

            //  $('body').on('click', '.printnew', function () {
             
            //      var datefrom = $("#datefrom").val();
            //      var dateto = $("#dateto").val();
            //      var driver = $("#driver").val();
            //      if (driver && driver != -1) {
            //          window.open('orderdeliveryreport.php?do=print&id='+driver+'&datefrom='+datefrom+'&dateto='+dateto+'');
            //      } else{
            //         alert('يجب اختيار سائق اولا  ');
            //      }              
                   


            // });


        </script>
        {/literal}
