<?php 
//activamos almacenamiento en el buffer
//ob_start();
//session_start();
if (!isset($_SESSION['nombre'])) {
  header("Location: login.html");
}else{
  //if ($_SESSION['cxc']==1) {
  if ($_SESSION['cxc']==1) {  
  ?>
      <!-- Main content -->
      <section class="content">
        <!-- Default box -->
        <div class="row">
          <div class="col-md-12">
            <div class="box">
              <!-- <div class="box-header with-border" style="height: 50px;"> -->
              <div class="box-header with-border">
                <button class="btn bg-green btn-app" onclick="mostrarform(true)" id="btnagregar"><i class="fa fa-plus-circle"></i> Agregar</button></h1>
                <div class="box-tools pull-right">
                  <h1 class="box-title">Proceso\Pago de Comisión
                </div> 
              </div>
              <!--box-header-->
              <!--centro-->
              <div class="panel-body table-responsive" id="listadoregistros">
                <table id="tbllistado2" class="table table-striped table-bordered table-condensed table-hover">
                  <thead>
                    <th style="text-align:center" align="center">Opciones</th>
                    <th style="text-align:center" align="center">Fecha</th>
                    <th style="text-align:center" align="center">Monto Total CxC</th>
                    <th style="text-align:center" align="center" colspan="2">Comisión Total</th>
                    <th style="text-align:center" align="center" colspan="6">Comisión Vendedores</th>
                    <th style="text-align:center" align="center" colspan="2">Comisión Gerente</th>
                    <th style="text-align:center" align="center" colspan="2">Comisión Personal</th>
                    <th style="text-align:center" align="center">Estado</th>
                    <tr>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td style="text-align:center" align="center">Monto</td>
                      <td style="text-align:center" align="center">%</td>
                      <td style="text-align:center" align="center" colspan="2">Venta</td>
                      <td style="text-align:center" align="center" colspan="2">Cobranza</td>
                      <td style="text-align:center" align="center" colspan="2">Total</td>
                      <td style="text-align:center" align="center">Monto</td>
                      <td style="text-align:center" align="center">%</td>
                      <td style="text-align:center" align="center">Monto</td>
                      <td style="text-align:center" align="center">%</td>
                      <td> </td>
                    </tr>
                    <tr>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td style="text-align:center" align="center">Monto</td>
                      <td style="text-align:center" align="center">%</td>
                      <td style="text-align:center" align="center">Monto</td>
                      <td style="text-align:center" align="center">%</td>
                      <td style="text-align:center" align="center">Monto</td>
                      <td style="text-align:center" align="center">%</td>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                    </tr>
                  </thead>
                  <tbody>
                  </tbody>
                  <tfoot>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    
                  </tfoot>   
                </table>
              </div>

              <div class="panel-body table-responsive" id="formularioregistros">
                <form action="" name="formulario" id="formulario" method="POST">
                  <input type="hidden" name="idpagocomisiones" id="idpagocomisiones">
                  <div class="col-xs-12">
                    
                    <div class="box box-primary">
                      <div class="box-header with-border">		
                        <h3 class="box-title">Cálculo de Comisión</h3>
                      </div>
                      <div class="box-body">
                        <table id="tbllistado10" class="table table-bordered table-hover">
                            <tr style="background-color:#478ca1;color:#ffffff;font-size:9pt;font-family:Verdana;font-weight:bold;">
                                <td style="text-align:center" colspan="2" align="center">Total CxC</td>
                                <td style="text-align:center" align="center">Total Comisión Venta</td>
                                <td style="text-align:center" align="center">Comisión Vendedores Venta</td>
                                <td style="text-align:center" align="center">Comisión Vendedores Cobranza</td>
                                <td style="text-align:center" align="center">Comisión Gerente</td>
                                <td style="text-align:center" align="center">Comisión Personal Administrativo</td>
                                
                                
                                
                            </tr>
                            <tr style="color:#000014;font-size:9pt;font-family:Verdana;font-weight:bold;">
                                <td style="text-align:center" colspan="2" align="center">
                                  
                                  <input class="form-control" style="text-align:center;width:100%;height:100%" type="text" name="montoventa" id="montoventa"  value="0,00" placeholder="0,00"> 
                                  <input class="form-control" type="hidden" name="montoventasin" id="montoventasin"  value="0,00" placeholder="0,00">
                                  <input class="form-control" type="hidden" name="montocomision" id="montocomision"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="montocomisionv" id="montocomisionv"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="montocomisionvv" id="montocomisionvv"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="montocomisionc" id="montocomisionc"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="montocomisioncg" id="montocomisioncg"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="montocomisionvp" id="montocomisionvp"  value="0,00" placeholder="0,00">
                                </td>
                                
                            </tr>
                            <tr style="background-color:#478ca1;color:#ffffff;font-size:9pt;font-family:Verdana;font-weight:bold;">
                                <td style="text-align:center" colspan="2" align="center">Total Comisión</td>
                                <td style="text-align:center" align="center">% Comisión Ventas</td> 
                                <td style="text-align:center" align="center">% Comisión Vendedores</td>
                                <td style="text-align:center" align="center">% Comisión Cobranza</td>
                                <td style="text-align:center" align="center">% Comisión Gerente</td>
                                <td style="text-align:center" align="center">% Comisión Personal Administrativo</td>
                                
                               
                            </tr>
                            <tr style="color:#000014;font-size:9pt;font-family:Verdana;font-weight:bold;">
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="totalcomisionv" id="totalcomisionv"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="totalcomisionvp" id="totalcomisionvp"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="porcentajecomisionv" id="porcentajecomisionv"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="porcentajecomisionvv" id="porcentajecomisionvv"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="porcentajecomisionc" id="porcentajecomisionc"  value="0,00" placeholder="0,00">
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="porcentajecomisionvg" id="porcentajecomisionvg"  value="0,00" placeholder="0,00">
                                  
                                </td>
                                <td style="text-align:center" align="center">
                                  <input class="form-control" style="text-align:center" type="text" name="porcentajecomisionvp" id="porcentajecomisionvp"  value="0,00" placeholder="0,00">
                                </td>
                                
                            </tr>
                        </table>    
                        <!-- 
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                            <label for="">Total Documento</label>
                            <input class="form-control" type="text" name="montoventa" id="montoventa"  value="0,00" placeholder="0,00">
                            <input class="form-control" type="hidden" name="montoventasin" id="montoventasin"  value="0,00" placeholder="0,00">
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-xs-12">
                          <label for="">Total Comisión</label>
                          <input class="form-control" type="text" name="montocomision" id="montocomision"  value="0,00" placeholder="0,00">
                          
                        </div> -->
                         
                        <!-- <div class="form-group col-lg-3 col-md-3 col-xs-12">
                          <label for="">% Venta</label> -->
                          
                        <!--  </div> 
                        <div class="form-group col-lg-3 col-md-3 col-xs-12">
                          <label for="">% Cobranza</label> -->
                         
                        <!-- </div> --> 



                       <!--  <div class="form-group col-lg-3 col-md-3 col-xs-12">
                          <label for="">Comisión Venta Vendedor</label>
                          <input class="form-control" type="text" name="montocomisionv" id="montocomisionv"  value="0,00" placeholder="0,00">
                        </div>
                        <div class="form-group col-lg-3 col-md-3 col-xs-12">
                          <label for="">Comisión Cobranza Vendedor</label>
                          <input class="form-control" type="text" name="montocomisionc" id="montocomisionc"  value="0,00" placeholder="0,00">
                        </div>
                        <div class="form-group col-lg-3 col-md-3 col-xs-12">
                          <label for="">Comisión Venta Personal</label>
                          <input class="form-control" type="text" name="montocomisionvp" id="montocomisionvp"  value="0,00" placeholder="0,00">
                        </div>
                        <div class="form-group col-lg-3 col-md-3 col-xs-12">
                          <label for="">Comisión Cobranza Personal</label>
                          <input class="form-control" type="text" name="montocomisioncp" id="montocomisioncp"  value="0,00" placeholder="0,00">
                        </div> -->


                      </div>
                    </div>
                    
                  </div>

                  <div class="col-lg-6 col-md-6 col-xs-12">
                    <div class="box">
                      <div class="box-header">
                        <h3 class="box-title">Documentos Pagados</h3>
                        
                      </div>
                      
                      <!-- /.box-header -->
                      <div class="box-body table-responsive no-padding" style="height: 800px;">
                        <table id="tbllistado" class="table table-striped table-bordered table-condensed table-hover">
                          <thead>
                            <th>Elegir</th>
                            <th>Fecha</th>
                            <th>Cliente</th>
                            <th>Vendedor</th>
                            <th>Doc.</th>
                            <th>Días</th>
                            <th>Total</th>
                            <th>Estado</th>
                          </thead>
                          <tbody>
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                          </tfoot>   
                    
                        </table>
                      </div>
                      <!-- /.box-body -->
                    </div>
                  </div>

                  <div class="col-lg-6 col-md-6 col-xs-12">
                    <input type="hidden" name="idpagocomisionesprueba" id="idpagocomisionesprueba" value="prueba">
                    <div class="box">
                      <div class="box-header">
                          <h3 class="box-title">Vendedores</h3>
                          
                      </div>
                                            
                      <!-- /.box-header -->
                      <div class="box-body table-responsive no-padding">
                        
                        <table id="tbllistado51" class="table table-striped table-bordered table-condensed table-hover">  
                          <thead>
                            <th>Elegir</th>
                            <th>Nombre</th>
                            <th>venta</th>
                            <th>Cobranza</th>
                            <th>Total</th>
                            
                          </thead>
                          <tbody>
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            
                          </tfoot>   
                    
                        </table>
                      </div>

                      <div class="box-body table-responsive no-padding">
                        <div class="box-header">
                          <h3 class="box-title">Personal Administrativo</h3>
                          
                        </div>
                        <table id="tbllistado52" class="table table-striped table-bordered table-condensed table-hover">  
                          <thead>
                            <th>Elegir</th>
                            <th>Nombre</th>
                            <th>venta</th>
                            <th>Cobranza</th>
                            <th>Total</th>
                            
                          </thead>
                          <tbody>
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            
                          </tfoot>   
                    
                        </table>
                      </div> 
                      <!-- /.box-body -->
                    </div>
                  </div>
                </form>
              </div>
              <!--fin centro-->
              <div class="box-footer" id="formularioregistros1">
                  <button class="btn bg-blue btn-app pull-right" type="submit" id="btnGuardar"><i class="fa fa-save"></i>  Guardar</button>
                  <button class="btn bg-red btn-app pull-right" onclick="cancelarform()" type="button"><i class="fa fa-arrow-circle-left"></i> Cancelar</button>
              </div>

              <!--Modal-->
              <div class="modal fade" id="myModalcomision" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 80% !important;">
                  <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <h4 class="modal-title">Detalle del Calculo de Comisión</h4>
                    </div>
                    <div class="modal-body">
                      <!-- <div class="col-lg-8 col-md-8 col-xs-12 table-responsive no-padding"> -->
                      <div class="col-lg-8 col-md-8 col-xs-12 table-responsive no-padding">  
                       <!--  <table id="tbcomisionventa" class="table table-striped table-bordered table-condensed table-hover" style="width:80%"> -->
                        <table id="tbcomisionventa" class="table table-hover">
                          
                          <thead>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">CxC</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Cliente</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Vendedor</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Fecha Despacho</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Fecha Cobro</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Días Cobranza</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Monto</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Comisión Venta</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Comisión Venta(%)</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Comisión Cobranza</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Comisión Cobranza(%)</td>
                            <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Total Comisión</td>

                          </thead>
                          <tbody>
                            
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                          </tfoot>
                        </table>
                      </div>
                      <div class="col-lg-3 col-md-3 col-xs-12"> 
                       
                        <div class="col-lg-12 col-md-12 col-xs-12 no-padding">
                          <table id="tbcomisionvendedor" class="table" >
                            
                            <thead>
                              <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Vendedor</td>
                              <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Venta</td>
                              <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Cobranza</td>
                              <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Total</td>
                              
                            </thead>
                            <tbody>
                              
                            </tbody>
                            <tfoot>
                              <th></th>
                              <th></th>
                              <th></th>
                              <th></th>
                            </tfoot>
                          </table> 
                        </div>
                        <div class="col-lg-12 col-md-12 col-xs-12 no-padding">
                          <table id="tbcomisionpersonala" class="table" style="width: 100%">
                            
                            <thead>
                              <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Persona</td>
                              <td style="color:#F4F6F6;text-align:center;background-color:#5D6D7E;font-size:92%;" valign="middle">Comisión Venta</td>
                            
                              
                            </thead>
                            <tbody>
                              
                            </tbody>
                            <tfoot>
                              <th></th>
                              <th></th>
                              
                            </tfoot>
                          </table> 
                        </div>
                      </div>    
                    </div>
                      
                      
                    <div class="modal-footer">
                      <!-- <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button> -->
                    </div>
                  </div>
                </div>
              </div> 
            </div>
            <!-- /.box -->
          </div>
          <!-- /.col-md-12 -->
        </div>
        <!-- /.row -->
      </section>
      <!-- /section -->
    </div>
    <!-- /.content -->
    <?php 
  }else{
    require 'vistas/contenidos/noacceso-view.php'; 
  }
  ?>
          <!-- Main Footer -->
          <?php include "vistas/modulos/mainfooter.php";?>
      </div>

      <!-- ./wrapper -->
      <!-- REQUIRED JS SCRIPTS -->
      <?php include "vistas/modulos/script.php";?>
      <script src="vistas/scripts/pagocomisiones.js"></script>
      </body>
  </html> 
<?php  
}
  ob_end_flush();
?>
