<div  class="panel panel-primary">
  <?php
    require_once "../magic/DataBase.php";
    $dataBase = new DataBase();
    $conn = $dataBase->getConnection();
    require_once "../op/car_history.php";
    $today = date("Y-m-d");
      ?>
  <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">
              <div class="col-md-2"style="float:right;">
              <input type="text" class="form-control" style="float:right;" id="myday" name="myday"  value="<?php echo $today; ?>" readonly/>
            </div>
            <script>
              $(function() {
                var calendar = $.calendars.instance('');
                $('#myday').calendarsPicker({calendar: calendar});
                  });
            </script>
            <div class="col-md-2"style="float:right;padding:2px;">
              <select id="branch" name="branch" class="action form-control">
                  <option value= "" >جميع الفروع </option>
                <?php
                 $sql =$conn->prepare("SELECT branchID , b_name from branches") ;
                 $sql->execute();
                  if($sql->rowCount()>0)
                 {
                    while($row = $sql->fetch()){
                          $branchid = $row["branchID"];
                          $b_name  = $row["b_name"];
                   echo "<option value= $branchid >$b_name</option>";
                        }} ?>
              </select>
            </div>
        </div>
    <div class="row" style="padding:3px;">
      <div class="col-xs-2 col-md-2"style="float:right;">
  <button id="box_trns" 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:left;">
      <button id="insurance_expire" type="button" style="font-weight:bold;float:right;" class="btn btn-success btn-block"> تأمينات منتهية <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
    </div>
        <div class="col-md-2"style="float:left;">
      <button id="lic_expire" type="button" style="font-weight:bold;float:right;" class="btn btn-success btn-block"> استمارات منتهية <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
        </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 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="month_debt" 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="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-md-3">
                        </div>
                      </div>
                      <div class="row" style="padding:3px;">
                        <div class="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-md-6"style="float:right;">
                        </div>
                        <div class="col-md-3"style="float:right;">
                          <button id="courts_in" 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-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-md-2"style="float:right;">
                    <button id="month_contracts" 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="cont_no_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-md-2"style="float:right;">
                    <button id="contracts_vats" 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-2">
                    <button id="aksat_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>
<hr/>
                    <div class="row" style="padding:3px;">
                        <div class="col-md-3"style="float:right;">
                    <button id="vat_create" 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-3"style="float:right;">
                    <button id="asaf_create" 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-2"style="float:right;">
                        <button id="bokame_xl" 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;">
                        <button id="injaz_xl" 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">
                    <button id="asaf_xl" type="button" style="font-weight:bold;" class="btn btn-success btn-block"> كشف العساف <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
                      </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="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-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="active_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>
        <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-xs-3 col-md-3">
  </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-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>

</div><!-- panel body style -->
<script>
$(document).ready(function(){
  $("#vat_create").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
  $.ajax({
    url     : "qrt/vat_create.php",
    method  : "POST",
    data    :{myday:myday},
    success : function(data){
    $("#signup_msg").html(data);
    $("#signup_msg").delay(4000).slideUp(function(){  $("#signup_msg").html(''); });
  },
    error   :function(result){
      alert(result.statusText);
      }
    })
  });
  $("#asaf_create").click(function(event){
  event.preventDefault();
  var asaf = $("#myday").val();
  $.ajax({
    url     : "qrt/vat_create.php",
    method  : "POST",
    data    :{asaf:asaf},
    success : function(data){
      $("#signup_msg").html(data);
      $("#signup_msg").delay(4000).slideUp(function(){  $("#signup_msg").html(''); });
   },
       error   :function(result){
         alert(result.statusText);
          }
    })
  });
  $("#asaf_xl").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("qrt/asaf_xls.php?dd="+myday, '_blank');
});
$("#injaz_xl").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("qrt/injaz_xls.php?dd="+myday, '_blank');
});
$("#bokame_xl").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("qrt/bokame_xl.php?dd="+myday, '_blank');
});

   $("#supp_month").click(function(event){
     event.preventDefault();
     var myday = $("#myday").val();
     var woner = $("#woner").val();
       window.open("acc/acc_month2.php?dd="+myday+"&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 myday = $("#myday").val();
     var model = $("#model").val();
       window.open("acc/acc_month2.php?dd="+myday+"&model="+model, '_blank');
   });
   $("#cont_month").click(function(event){
     event.preventDefault();
     var myday = $("#myday").val();
     var cont_id = $("#cont_id").val();
       window.open("acc/acc_month2.php?dd="+myday+"&cont_id="+cont_id, '_blank');
   });
   $("#kind_month").click(function(event){
     event.preventDefault();
     var myday = $("#myday").val();
     var kind  = $("#kind").val();
     window.open("acc/acc_month2.php?dd="+myday+"&kind="+kind, '_blank');
   });

$("#trans").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("rent/acc_daytrans.php?dd="+myday, '_blank');
});
$("#courts_in").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("jaudge/courts_month.php?dd="+myday, '_blank');
});
$("#box_trns").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("rent/acc_box.php?dd="+myday, '_blank');
});
//month_contracts
$("#month_contracts").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("acc/month_contracts.php?dd="+myday, '_blank');
});
$("#cont_no_vat").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("acc/cont_no_vat.php?dd="+myday, '_blank');
});
//ontracts_vats
$("#contracts_vats").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("acc/contracts_vats.php?dd="+myday, '_blank');
});
$("#acc_month").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("acc/acc_month.php?dd="+myday, '_blank');
});
$("#km_move").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
    window.open("acc/km_move.php?dd="+myday, '_blank');
});
$("#month_debt").click(function(event){
  event.preventDefault();
  var myday = $("#myday").val();
  var branch = $("#branch").val();
  if(branch != ""){window.open("acc/month_debt.php?dd="+myday + "&br="+branch, '_blank');  }
  else{window.open("acc/month_debt.php?dd="+myday, '_blank');}

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

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

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

});
$("#aksat_target").click(function(event){
  event.preventDefault();
  var myday  = $("#myday").val();
  window.open("aksat/aksat_target.php?dd="+myday, '_blank');
});
$("#cars_aksat").click(function(event){
  event.preventDefault();
  var myday  = $("#myday").val();
  if(branch != ""){window.open("acc/cars_aksat.php?dd="+myday, '_blank');  }
  });
  $("#active_aksat").click(function(event){
  event.preventDefault();
  var myday  = $("#myday").val();
  if(branch != ""){window.open("acc/active_aksat.php", '_blank');  }
  });

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

});

// function wh_space(flag){
//   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>
