<div  class="panel panel-primary">
  <?php
    // include "../actions/dbPDO.php";
    require_once "../op/car_history.php";
    require_once "../magic/DataBase.php";

$dataBase = new DataBase();
$conn = $dataBase->getConnection();

    $today = date("Y-m-d");
    $myday = date('Y-m-01', strtotime($today));
    $start = date('Y-m-01',  strtotime($myday. ' - 2 month'));
    $end 	= date('Y-m-t', strtotime($myday));
      ?>
  <div class="panel-heading"style="font-size:1.2em;">تقارير فترة</div>
  <div class="panel-body"style="background-color:#00324d;color:#f9feff;">
<div class="container-fluid">
    <form method="post" class="form-horizontal" id="form_box" style="float:center;">
        <div id="box_msg"></div>
        <div class="row" style="padding:4px;">
            <div class="col-xs-1 col-md-1"style="float:right;padding:2px;">
            </div>
            <div class="col-xs-3 col-md-3"style="float:right;padding:2px;">
              <div class="input-group">
               <span class="input-group-addon" style="font-size: 14px;font-weight:bold;background:transparent;color:black;" >فرع</span>
               <select  class="form-control" id="br" name="br">
               <option value= "0" >جميع الفروع </option>
               <?php
               $sql3 =$conn->prepare("SELECT branchID , b_name from branches where branchID > 1") ;
               $sql3->execute();
               if($sql3->rowCount()>0)
               {
                while($row = $sql3->fetch()){
                      $id     = $row["branchID"];
                      $label  = $row["b_name"];
               echo "<option value= $id >$label</option>";
                  }} ?>
               </select>
             </div><!-- /input-group -->
            </div>
            <div class="col-xs-2"style="float:right;padding:2px;margin-right:10px;">
            <div class="input-group">
             <span class="input-group-addon" style="font-size: 14px;font-weight:bold;background:transparent;color:black;" >من</span>
             <input type="text" class="form-control" style="float:right;" id="start" name="start" placeholder="بداية فترة" value="<?php echo $start ; ?>" readonly />
           </div><!-- /input-group -->
           <script>
             $(function() {
               var calendar = $.calendars.instance('');
               $('#start').calendarsPicker({calendar: calendar});
               $('#end').calendarsPicker({calendar: calendar});
               });
           </script>
         </div>
         <div class="col-xs-2"style="float:right;padding:2px;">
           <div class="input-group">
            <span class="input-group-addon" style="font-size: 16px;font-weight:bold;background:transparent;color:black;" >إلي </span>
            <input type="text" class="form-control" style="float:right;" id="end" name="end" placeholder="نهاية فترة" value="<?php echo $end ; ?>" readonly />
          </div><!-- /input-group -->
        </div>
      </div>
  </form><!-- end of box form -->
</div>
<br /><br />
   <div class="container-fluid">
     <div class="row" style="padding:3px;">
       <div class="col-xs-12 col-md-12">
                  <ul class="nav nav-tabs navbar-right" role="tablist"  >
                    <li role="presentation" class="active" style="float:right;"><a href="#cars_cont" aria-controls="home" role="tab" data-toggle="tab">إيرادات و تشغيل</a></li>
                    <li role="presentation" style="float:right;"><a href="#workshope" aria-controls="home" role="tab" data-toggle="tab">مصروفات السيارات </a></li>
                    <li role="presentation" style="float:right;"><a href="#service" aria-controls="home" role="tab" data-toggle="tab">اقساط السيارات </a></li>
                    <li role="presentation" style="float:right;"><a href="#runaway" aria-controls="home" role="tab" data-toggle="tab">ميزانية السيارات </a></li>
                  </ul>
      <!-- Tab panes -->
      <div class="tab-content" style="width:100% ;">
          <div role="tabpanel" class="tab-pane fad active" id="cars_cont">
                                                                      <br /><br /><br /><br />
            <div class="row" style="padding:3px;">
              <div class="col-xs-3"style="float:right;">
                <button id="vat_in" type="button" style="font-weight:bold;" class="btn btn-success btn-block">القيمة المضافة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
              </div>
              <div class="col-xs-3"style="float:right;">
                <button id="vat_in_xls" type="button" style="font-weight:bold;" class="btn btn-success btn-block">اكسيل القيمة المضافة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
              </div>
              <div class="col-xs-3"style="float:right;">
                <button id="debt_at" type="button" style="font-weight:bold;" class="btn btn-danger btn-block">مديونيات فترة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
              </div>
            </div>
            <div class="row">
              <div class="col-xs-3"style="float:right;">
                <button id="vat_xls" type="button" style="font-weight:bold;" class="btn btn-primary btn-block">اكسيل فواتير مرفوعة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
              </div>
            </div>
            <div class="row" style="padding:3px;">
              <div class="col-xs-3"style="float:right;">
                <button id="valid_vat" type="button" style="font-weight:bold;" class="btn btn-danger btn-block">فحص الفواتير مع العقود<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
              </div>
              <div class="col-xs-3"style="float:right;">
              </div>
              <div class="col-xs-3"style="float:right;">
              </div>
            </div>
                      <div class="row" style="padding:3px;">
                        <div class="col-xs-3"style="float:right;">
                    <button id="vat_sanad" type="button" style="font-weight:bold;" class="btn btn-success btn-block">سندات قبض<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3"style="float:right;">
                    <button id="vat_sanad_out" type="button" style="font-weight:bold;" class="btn btn-success btn-block">سندات صرف<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                      </div>
                      <div class="row" style="padding:3px;">
                        <div class="col-xs-3 col-md-4"style="float:right;">
                    <button id="acc_month" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> إيرادات جميع السيارات<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3 col-md-3">
                        </div>
                      </div>
                    <div class="row" style="padding:3px;">
                      <div class="col-md-3"style="float:right;">
                        <select id="woner" name="woner" class="action form-control">
                                    <option value= "">الشركة المالكة </option>
                                  <?php
                                  $sql3 =$conn->prepare("select supp_id , supp_name from supplycomp") ;
                                   $sql3->execute();
                                    if($sql3->rowCount()>0)
                                   {
                                      while($row = $sql3->fetch()){
                                            $id = $row["supp_id"];
                                            $val  = $row["supp_name"];
                                     echo "<option value= $id >$val</option>";
                                        }} ?>
                            </select>
                          </div>
                      <div class="col-md-2"style="float:right;">
                      <button id="supp_month" type="button" style="font-weight:bold;" class="btn btn-success btn-block">إيرادات شركة <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                      </div>
                    <div class="col-md-2"style="float:right;"></div>
                          <div class="col-md-2"style="float:right;padding:2px;">
                            <!-- <select id="cont_id" name="cont_id" class="action form-control">
                                <option value= "" >عقد البيع </option>
                              <?php
                              //    $sql =$conn->prepare("select cont_id , concat(contract_code ,' ', ask_date) as contt from supp_contracts") ;
                              //  $sql->execute();
                              //   if($sql->rowCount()>0)
                              //  {
                              //     while($row = $sql->fetch()){
                              //           $cont_id = $row["cont_id"];
                              //           $contt   = $row["contt"];
                              //       echo "<option value= $cont_id >$contt</option>";
                                      // }} ?>
                            </select> -->
                          </div>
                          <div class="col-md-2"style="float:right;">
                          <!-- <button id="cont_month" type="button" style="font-weight:bold;" class="btn btn-success btn-block">إيرادات عقد<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button> -->
                          </div>
                        </div>
                        <div class="row"  style="padding:3px;">
                          <div class="col-md-3"style="float:right;">
                            <select id="kind" name="kind" class="action form-control">
                                  <option value= "" >طراز السيارة</option>
                                <?php
                               $sql =$conn->prepare("select DISTINCT kind from cars") ;
                                 $sql->execute();
                                  if($sql->rowCount()>0)
                                 {
                                    while($row = $sql->fetch()){
                                          $kind = $row["kind"];
                                          $kind2 = preg_replace('/\s+/', '_', $kind);
                                      echo "<option value= $kind2 >$kind</option>";
                                        }} ?>
                              </select>
                          </div>
                          <div class="col-md-2"style="float:right;">
                          <button id="kind_month" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> إيرادات نوع <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                          </div>
            <div class="col-md-2"style="float:right;"></div>
                          <div class="col-md-2"style="float:right;">
                            <select id="model" name="model" class="action form-control">
                                  <option value= "" >الموديل</option>
                                <?php
                               $sql =$conn->prepare("SELECT DISTINCT model from cars") ;
                                 $sql->execute();
                                  if($sql->rowCount()>0)
                                 {
                                    while($row = $sql->fetch()){
                                          $model = $row["model"];
                                      echo "<option value= $model >$model</option>";
                                        }} ?>
                              </select>
                          </div>
                          <div class="col-md-2"style="float:right;">
                          <button id="model_month" type="button" style="font-weight:bold;" class="btn btn-success btn-block">إيرادات موديل  <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                          </div>
                        </div>
                      <div class="row" style="padding:3px;">
                        <div class="col-md-3"style="float:right;">
                    <button id="km_move" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> كيلومتر الحركة <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3 col-md-3">
                        </div>
                      </div>
                      <div class="row" style="padding:3px;">
                        <div class="col-md-3"style="float:right;">
                    <button id="cont_debt_print" type="button" style="font-weight:bold;" class="btn btn-danger btn-block">عقود مديونة خلال فترة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-md-3">
                        </div>
                      </div>
                      <div class="row" style="padding:3px;">
                        <div class="col-xs-3 col-md-3"style="float:right;">
                    <button id="service" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> سيارات خدمة <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3 col-md-3">
                        </div>
                      </div>
                      <!-- <div class="row" style="padding:3px;">
                        <div class="col-xs-3 col-md-3"style="float:right;">
                    <button id="car_actions" type="button" style="font-weight:bold;" class="btn btn-danger btn-block">حركة السيارات داخل فرع <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3 col-md-3">
                        </div>
                      </div> -->
                      <!-- <div class="row" style="padding:3px;">
                        <div class="col-xs-3 col-md-3"style="float:right;">
                    <button id="car_aksat" type="button" style="font-weight:bold;" class="btn btn-primary btn-block"> أقساط سيارات الفرع <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3 col-md-3">
                        </div>
                      </div> -->
                      <!-- <div class="row" style="padding:3px;">
                        <div class="col-xs-3 col-md-3"style="float:right;">
                    <button id="car_target" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> تارجت الفرع <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                        </div>
                        <div class="col-xs-3 col-md-3">
                        </div>
                      </div> -->
                       <!-- </form> -->
            </div><!-- cars_cont -->
            <div role="tabpanel" class="tab-pane fad" id="workshope">
              <br /><br /><br /><br />

    <div class="row" style="padding:3px;">
          <div class="col-md-3"style="float:right;">
                <button id="vat_out" type="button" style="font-weight:bold;" class="btn btn-success btn-block">مشتريات ضريبية<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
          </div>
          <div class="col-md-3"style="float:right;">
                <button id="vat_out_xls" type="button" style="font-weight:bold;" class="btn btn-danger btn-block">مشتريات ضريبية اكسيل<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
          </div>
  </div>
  <div class="row" style="padding:3px;">
    <div class="col-md-3"style="float:right;">
      <button id="ment_month" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> مصروفات جميع السيارات <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
    </div>
    <div class="col-md-3"style="float:right;">
      <!-- <button id="ment_month2" type="button" style="font-weight:bold;" class="btn btn-success btn-block">وسام2<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button> -->
    </div>
</div>
<div class="row" style="padding:3px;">
<div class="col-xs-3 col-md-3"style="float:right;">
<button id="ment_branch" type="button" style="font-weight:bold;" class="btn btn-danger btn-block"> مصروفات سيارات فرع <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
</div>
<div class="col-md-3"style="float:right;">
  <button id="ment_gr" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> إجماليات مصروفات الفروع <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
</div>
</div>
<!-- <div class="row" style="padding:3px;">
  <center><h4>تحت الإنشاء</h4></center>
</div>
<div class="row" style="padding:3px;">
<div class="col-xs-3 col-md-3"style="float:right;">
<button id="max_ment" type="button" style="font-weight:bold;" class="btn btn-danger btn-block"  disabled="true"> أعلي مصروفات <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
</div>
<div class="col-xs-3 col-md-3">
</div>
</div>
<div class="row" style="padding:3px;">
<div class="col-xs-3 col-md-3"style="float:right;">
<button id="low_ment" type="button" style="font-weight:bold;" class="btn btn-primary btn-block"  disabled="true"> أقل مصروفات <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
</div>
</div>
<div class="row" style="padding:3px;">
<div class="col-xs-3 col-md-3"style="float:right;">
<button id="car_usage" type="button" style="font-weight:bold;" class="btn btn-success btn-block" disabled="true"> معدل الإستخلاك الشهري <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
</div>
</div> -->
      </div><!-- /workshope -->
      <div role="tabpanel" class="tab-pane fad" id="service">
        <br /><br /><br /><br />

        <div class="row" style="padding:3px;">
            <div class="col-md-3"style="float:right;">
              <button id="cars_aksat" type="button" style="font-weight:bold;" class="btn btn-success btn-block" >أقساط جميع السيارات<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
            </div>
            <div class="col-xs-3 col-md-3">
              <button id="cars_price" type="button" style="font-weight:bold;" class="btn btn-success btn-block" >أسعار جميع السيارات<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
            </div>
        </div>
        <!-- <div class="row" style="padding:3px;">
          <center><h4>تحت الإنشاء</h4></center>
        </div>
        <div class="row" style="padding:3px;">
        <div class="col-xs-3 col-md-3"style="float:right;">
        <button id="branch_kest" type="button" style="font-weight:bold;" class="btn btn-danger btn-block"  disabled="true">أقساط سيارات فرع<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
        </div>
        <div class="col-xs-3 col-md-3">
        </div>
        </div>
        <div class="row" style="padding:3px;">
        <div class="col-xs-3 col-md-3"style="float:right;">
        <button id="aksat_debt" type="button" style="font-weight:bold;" class="btn btn-danger btn-block"  disabled="true"> الأقساط المستحقة <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
        </div>
        <div class="col-xs-3 col-md-3">
        </div>
        </div>
        <div class="row" style="padding:3px;">
          <div class="col-xs-3 col-md-3"style="float:right;">
            <button id="tot_debt" type="button" style="font-weight:bold;" class="btn btn-primary btn-block"  disabled="true"> إجمالي الدين العام <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
          </div>
        </div> -->
</div><!-- /service -->
<div role="tabpanel" class="tab-pane fad" id="runaway">
  <br /><br /><br /><br />
  <div class="row" style="padding:3px;">
  <div class="col-md-3"style="float:right;">
      <button id="money_sc" type="button" style="font-weight:bold;" class="btn btn-success btn-block" >جدول الماليات<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>
  <div class="col-md-3" style="float:right;"></div>
  <div class="col-md-2" style="float:right;">
    <input id="nn" name="nn" car="" class="form-control" placeholder="بحث برقم اللوحة"/>
  </div>
  <div class="col-md-3">
    <button id="cars_money" type="button" style="font-weight:bold;" class="btn btn-success btn-block" >إيرادات سيارة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>

  </div>
    <div class="row" style="padding:3px;">
  <div class="col-md-3"style="float:right;">
      <button id="saturday_rep" type="button" style="font-weight:bold;" class="btn btn-success btn-block" >حركة السبت<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>
  <!-- <div class="col-md-3" style="float:right;"></div>
  <div class="col-md-2" style="float:right;">
    <input id="nn" name="nn" car="" class="form-control" placeholder="بحث برقم اللوحة"/>
  </div>
  <div class="col-md-3">
    <button id="cars_money" type="button" style="font-weight:bold;" class="btn btn-success btn-block" >إيرادات سيارة<span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div> -->

  </div>
  <!-- <div class="row" style="padding:3px;">
    <center><h4>تحت الإنشاء</h4></center>
  </div>
  <div class="row" style="padding:3px;">
  <div class="col-xs-3 col-md-3"style="float:right;">
  <button id="cars_mz" type="button" style="font-weight:bold;" class="btn btn-success btn-block"  disabled="true"> ميزانية جميع السيارات <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>
  <div class="col-xs-3 col-md-3">
  </div>
  </div>
  <div class="row" style="padding:3px;">
  <div class="col-xs-3 col-md-3"style="float:right;">
  <button id="month_mm" type="button" style="font-weight:bold;" class="btn btn-danger btn-block"  disabled="true"> تحليل الميزانية <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>
  <div class="col-xs-3 col-md-3">
  </div>
  </div>
  <div class="row" style="padding:3px;">
  <div class="col-xs-3 col-md-3"style="float:right;">
  <button id="branch_m2" type="button" style="font-weight:bold;" class="btn btn-danger btn-block"  disabled="true"> أعلي أرباح <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>
  <div class="col-xs-3 col-md-3">
  </div>
  </div>
  <div class="row" style="padding:3px;">
  <div class="col-xs-3 col-md-3"style="float:right;">
  <button id="car_m3" type="button" style="font-weight:bold;" class="btn btn-primary btn-block"  disabled="true"> أعلي خسائر <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
  </div>
  </div> -->
 </div>
</div><!-- /runaway -->

</div>
</div>
</div>
</div>
<?php
$outcar = array();
    $cars_sr = $conn->prepare("SELECT carid , concat(letters,' ', numbers) as plate FROM cars ORDER by numbers ");
    $cars_sr->execute();
    $i=0;
    if($cars_sr->rowCount()>0)
      {
         while($row = $cars_sr->fetch())
         { $outcar[$i] = array(
               "value" => $row["plate"],
               "data" => $row["carid"]
               );$i++ ;
           }  }
    else {  $outcar[0]= 'لا يوجد '; }
?>

</div><!-- panel body style -->
<script>
$(document).ready(function(){
  var arr=  JSON.parse('<?php echo json_encode($outcar) ; ?>');
  $('#nn').autocomplete({
   lookup: arr,
   maxHeight : 200,
   onSelect: function(suggestion) {
    $('#nn').attr("car", suggestion.data);
        //  one_invoice(suggestion.data);
         },
    })

  $("#vat_in").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_in.php?start="+start+"&end="+end, '_blank');
  });
  $("#valid_vat").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/month_valid_vat.php?start="+start+"&end="+end, '_blank');
  });
  $("#vat_in_xls").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_in_xls.php?start="+start+"&end="+end, '_blank');
  });
  $("#vat_xls").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_xls.php?start="+start+"&end="+end, '_blank');
  });
  $("#vat_out").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_out.php?start="+start+"&end="+end, '_blank');
  });
  $("#vat_out_xls").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_out_xls.php?start="+start+"&end="+end, '_blank');
  });
  $("#debt_at").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/debt_at.php?last="+end, '_blank');
  });
  $("#vat_sanad").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_sanad.php?start="+start+"&end="+end, '_blank');
  });
  $("#vat_sanad_out").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/vat_sanad_out.php?start="+start+"&end="+end, '_blank');
  });
   $("#supp_month").click(function(event){
     event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
      var woner = $("#woner").val();
       window.open("qrt/acc_month2.php?start="+start+"&end="+end+"&woner="+woner, '_blank');
      //  window.open(encodeURIComponent("acc/acc_month.php?dd="+myday+"&col="+col_name+"&val="+col_val, '_blank'));
   });
   $("#model_month").click(function(event){
     event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
     var model = $("#model").val();
       window.open("qrt/acc_month2.php?start="+start+"&end="+end+"&model="+model, '_blank');
   });
   $("#cont_month").click(function(event){
     event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
     var cont_id = $("#cont_id").val();
       window.open("qrt/acc_month2.php?start="+start+"&end="+end+"&cont_id="+cont_id, '_blank');
   });
   $("#kind_month").click(function(event){
     event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
     var kind  = $("#kind").val();
     window.open("qrt/acc_month2.php?start="+start+"&end="+end+"&kind="+kind, '_blank');
   });

$("#trans").click(function(event){
  event.preventDefault();
  var start = $("#start").val();
  var end   = $("#end").val();
    window.open("rent/acc_daytrans.php?start="+start+"&end="+end, '_blank');
});
$("#box_trns").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
    window.open("rent/qrt_box.php?start="+start+"&end="+end, '_blank');
});
$("#service").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
      window.open("qrt/service.php?start="+start+"&end="+end, '_blank');
  });

$("#acc_month").click(function(event){
  event.preventDefault();
  var start = $("#start").val();
  var end   = $("#end").val();

  window.open("qrt/acc_month.php?start="+start+"&end="+end, '_blank');
});
$("#km_move").click(function(event){
  event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
    window.open("qrt/km_move.php?start="+start+"&end="+end, '_blank');
});
$("#cont_debt_print").click(function(event){
    event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
window.open("acc/cont_debt_print.php?start="+start+"&end="+end, '_blank');
  });
$("#car_actions").click(function(event){
  event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
  var branch = $("#br").val();
  if(branch != ""){window.open("qrt/car_actions.php?start="+start+"&end="+end+"&br="+branch, '_blank');  }
  else{alert("اختار فرع أولا");}

});
$("#car_aksat").click(function(event){
  event.preventDefault();
    var start = $("#start").val();
    var end   = $("#end").val();
  window.open("qrt/car_aksat.php?start="+start+"&end="+end, '_blank');  }
 );
$("#car_target").click(function(event){
  event.preventDefault();
  var myday  = $("#myday").val();
  var branch = $("#br").val();
  if(branch != ""){window.open("qrt/car_target.php?start="+start+"&end="+end+"&br="+branch, '_blank');  }
  else{alert("اختار فرع أولا");}

});
$("#cars_aksat").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
  if(branch != ""){window.open("qrt/cars_aksat.php?start="+start+"&end="+end, '_blank');  }
  });
  $("#cars_price").click(function(event){
    event.preventDefault();
    window.open("qrt/cars_price.php", '_blank');
    });

$("#insurance_expire").click(function(event){
  event.preventDefault();
  var start = $("#start").val();
      var end   = $("#end").val();
    window.open("acc/ins_expire.php?start="+start+"&end="+end, '_blank');
});
$("#lic_expire").click(function(event){
  event.preventDefault();
  var start = $("#start").val();
      var end   = $("#end").val();
    window.open("acc/lic_expire.php?start="+start+"&end="+end, '_blank');
});
$("#money_sc").click(function(event){
  event.preventDefault();
  var start = $("#start").val();
  var end = $("#end").val();
    window.open("qrt/money_sc.php?start="+start + "&end="+end, '_blank');
});
$("#cars_money").click(function(event){
  event.preventDefault();
  var start = $("#start").val();
  var end = $("#end").val();
  var carid = $('#nn').attr("car");
    window.open("qrt/cars_money.php?start="+start + "&end="+end+ "&carid=" + carid, '_blank');
});
$("#ment_month").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
    window.open("qrt/ment_month.php?start="+start+"&end="+end, '_blank');
});
$("#ment_month2").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
    window.open("qrt/ment_month2.php?start="+start+"&end="+end, '_blank');
});
$("#ment_gr").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
    window.open("qrt/ment_gr.php?start="+start+"&end="+end, '_blank');
});
$("#ment_branch").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
      var branch = $("#branch").val();
  if(branch != ""){window.open("qrt/ment_branch.php?start="+start+"&end="+end + "&br="+branch, '_blank');  }
  else{alert("اختار فرع أولا");}

});
$("#saturday_rep").click(function(event){
  event.preventDefault();
      var start = $("#start").val();
      var end   = $("#end").val();
    window.open("qrt/saturday.php?day="+start, '_blank');
});
// function wh_space(flag){ aturday_rep
//   var slice = flag.split(' ');
//   var qq = slice.length ;
//   if(qq == 0){return flag ;}
//   var b = 0 ; var str ="";
//   while (b < 5){
//     if(b > 0){
//     str = str +"$"+slice[b];
//     }
//     str = slice[b];
//   }
// return str ;
// }

})//end off page code
</script>
