<?php
if (isset($conexion)) {
    $_SESSION['numero_mesa'] = $numero_mesa;
    ?>
  <!-- Modal -->
  <form class="form-horizontal" method="post" id="guardar_cobro4" name="guardar_cobro4">
    <div class="modal fade" id="cobroGen2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title"><i class='fa fa-dollar'></i> Cobro</h4>
            <div class="col-md-4">
              <div id="f_resultado4"></div><!-- Carga los datos ajax del incremento de la fatura -->
            </div>
          </div>
          <div class="modal-body">
            <div id="totalg2"></div><!-- Carga los datos ajax --><!-- Carga los datos ajax total de factura -->
            <div class="form-group row">
              <label class="col-2 col-form-label"></label>
              <div class="col-12">
                <div class="input-group">
                  <input style="border-radius: 5px;" type="text" id="nombre_cliente2" class="form-control" placeholder="Buscar Cliente" required  tabindex="1" value="<?php echo $row["nombre_cliente"]; ?>" onClick="this.select()">
                  <span class="input-group-btn">
                    <button type="button" class="btn waves-effect waves-light btn-success" data-toggle="modal" data-target="#nuevoCliente"><li class="fa fa-plus"></li></button>
                  </span>
                  <input id="id_cliente2" name="id_cliente2" type='hidden' value="<?php echo $row["id_cliente"]; ?>">
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-md-6">
                <div class="form-group">
                  <label for="condiciones2">Pago</label>
                  <select class="form-control input-sm condiciones" id="condiciones2" name="condiciones2" onchange="showDiv(this)">
                  <option value="1">Efectivo</option>
                    <option value="2">Tarjeta</option>
                    <option value="3">Transferencia Bancaria</option>
                    <option value="4">Crédito</option>
										<option value="5">Pedidos ya</option>
                  </select>
                </div>
              </div>
              <div class="col-md-6">
                <div class="form-group">
                <label for="resibido">Dinero Resibido</label>
		              <input style=" background-color:#F5B7B1; border-radius: 5px; border: 1px solid #39c; text-align: center; font-size: 30px; height: 50px" type="text" class="form-control resibido number-only" title="Ingresa sólo números con 0 ó 2 decimales" maxlength="8" autocomplete="off" id="resibidocobros" required name="resibidocobros" tabindex="3" placeholder="$ 0.00">

                  <script type="text/javascript">
                      $(function(){

                    $('.number-only').keyup(function(e) {
                          if(this.value!='-')
                            while(isNaN(this.value))
                              this.value = this.value.split('').reverse().join('').replace(/[\D]/i,'')
                                                    .split('').reverse().join('');
                      })
                      .on("cut copy paste",function(e){
                          e.preventDefault();
                      });

                  });
                    </script>


                </div>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button type="submit" id="guardar_datog" class="btn btn-primary waves-effect waves-light" onclick="obtener_cobros('<?php echo $numero_mesa; ?>');">Guardar Pago</button>
          </div>
        </form>
      </div>
    </div>
  </div>

  <?php
}
?>