<?php if(!class_exists('raintpl')){exit;}?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es" >
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <title><?php echo $fsc->page->title;?> &lsaquo; <?php echo $fsc->empresa->nombre;?></title>
   <meta name="description" content="FacturaScripts es un software de facturación y contabilidad para pymes. Es software libre bajo licencia GNU/AGPL." />
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <link rel="shortcut icon" href="view/img/favicon.ico" />
   <link rel="stylesheet" href="<?php echo $fsc->user->css;?>" />
   <link rel="stylesheet" href="view/css/datepicker.css" />
   <link rel="stylesheet" href="view/css/custom.css" />
   <script type="text/javascript" src="view/js/jquery-2.1.1.min.js"></script>
   <script type="text/javascript" src="view/js/bootstrap.min.js"></script>
   <script type="text/javascript" src="view/js/bootstrap-datepicker.js" charset="UTF-8"></script>
   <script type="text/javascript" src="view/js/jquery.autocomplete.min.js"></script>
   <script type="text/javascript" src="view/js/base.js"></script>
   <script type="text/javascript">
      function show_precio(precio)
      {
         <?php if( FS_POS_DIVISA=='right' ){ ?>

         return number_format(precio, <?php  echo FS_NF0;?>, '<?php  echo FS_NF1;?>', '<?php  echo FS_NF2;?>')+' <?php echo $fsc->simbolo_divisa();?>';
         <?php }else{ ?>

         return '<?php echo $fsc->simbolo_divisa();?>'+number_format(precio, <?php  echo FS_NF0;?>, '<?php  echo FS_NF1;?>', '<?php  echo FS_NF2;?>');
         <?php } ?>

      }
      function show_numero(numero)
      {
         return number_format(numero, <?php  echo FS_NF0;?>, '<?php  echo FS_NF1;?>', '<?php  echo FS_NF2;?>');
      }
      function delete_retencion(id)
      {
         if( confirm("¿Realmente desea eliminar esta retencion?") )
            window.location.href = "<?php echo $fsc->url();?>&delete="+id;
      }
   </script>
   <?php $loop_var1=$fsc->extensions; $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

      <?php if( $value1->type=='head' ){ ?><?php echo $value1->text;?><?php } ?>

   <?php } ?>

</head>
<body>
   <?php if( $fsc->get_errors() ){ ?>

   <div class="alert alert-danger hidden-print">
      <ul><?php $loop_var1=$fsc->get_errors(); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?><li><?php echo $value1;?></li><?php } ?></ul>
   </div>
   <?php } ?>

   
   <?php if( $fsc->get_messages() ){ ?>

   <div class="alert alert-success hidden-print">
      <ul><?php $loop_var1=$fsc->get_messages(); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?><li><?php echo $value1;?></li><?php } ?></ul>
   </div>
   <?php } ?>

   
   <?php if( $fsc->get_advices() ){ ?>

   <div class="alert alert-info hidden-print">
      <ul><?php $loop_var1=$fsc->get_advices(); $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?><li><?php echo $value1;?></li><?php } ?></ul>
   </div>
   <?php } ?>

   
   <div class="table-responsive">
      <table class="table table-hover">
         <thead>
            <tr>
               <!--<th class="text-left">Documento</th>-->
               <th class="text-left">Nro.Documento</th>
			      <th class="text-left">Fecha</th>
               <th class="text-left">Tipo/Retención</th>
               <th class="text-left">% Retención</th>
               <th class="text-left">Base</th>
               <th class="text-left">Valor</th>
               <th width="140"></th>
            </tr>
         </thead>
         <?php $loop_var1=$fsc->retenciones; $counter1=-1; if($loop_var1) foreach( $loop_var1 as $key1 => $value1 ){ $counter1++; ?>

         <form class="table-responsive" action="<?php echo $fsc->url();?>" method="post">
            <tr>
               <!--<td><div class="form-control"><?php echo $value1->fase;?></div></td>-->

               <td>
                  <input type="text" name="docreten" class="form-control text-right" value="<?php echo $value1->docreten;?>" autocomplete="off"/>
               </td>
			   
               <td>
                  <!--<input type="hidden" name="idretencion" value="<?php echo $value1->id;?>"/>-->
                 <input type="text" name="fecha" class="form-control datepicker" value="<?php echo $value1->fecha;?>" autocomplete="off"/>
               </td>
			   
               <td>
                  
                  <select type="text"  name="tiporeten" class="form-control text-right" >
                     <!--<option value="tiporeten" selected=""><?php echo $value1->tiporeten;?></option>-->
                    <option value="<?php echo $value1->tiporeten;?>" selected=""><?php echo $value1->tiporeten;?></option> 
                    <option >IVA</option>
                    <option>RENTA</option>
                    </select> 
               </td>
              
               <td>
                  <input type="text" name="porcreten" class="form-control text-right" value="<?php echo $value1->porcreten;?>" autocomplete="off"/>
               </td>
               
               <td>
                  <input type="text" name="basereten" class="form-control text-right" value="<?php echo $value1->basereten;?>" autocomplete="off"/>
               </td>
               <td>
                  <input type="text" name="importe" class="form-control text-right" value="<?php echo $value1->importe;?>" autocomplete="off"/>
               </td>
<!--
               <td>
                  <div class="form-control text-right"><?php echo $fsc->show_precio($value1->importe);?></div>
               </td>
-->
               <td class="text-right">
                  <div class="btn-group">
                     <a class="btn btn-sm btn-danger" title="Eliminar" onclick="delete_retencion('<?php echo $value1->id;?>')">
                        <span class="glyphicon glyphicon-trash"></span>
                     </a>
                     <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                        <span class="glyphicon glyphicon-floppy-disk"></span>
                     </button>
                  </div>
               </td>
            </tr>
         </form>
         <?php } ?>

         <?php if( !$fsc->retenida ){ ?>

         <form class="table-responsive" action="<?php echo $fsc->url();?>" method="post">
            <tr class="bg-info">
               <td>
   			      <input type="text" name="docreten" class="form-control text-right" value="" placeholder="Nro. Retención"autocomplete="off"/>
   			   </td>
			   
               <td>
                  <input type="text" width="25" name="fecha" class="form-control datepicker" value="<?php echo $fsc->today();?>" autocomplete="off"/>
               </td>
               <td>
                   <select type="text"  name="tiporeten" class="form-control text-right" > 
                    <option>IVA</option>
                    <option>RENTA</option>
                    </select> 
               </td>
               <td>
                  <input type="text" name="porcreten" class="form-control text-right" value="0" autocomplete="off"/>
               </td>
               <td>-</td>
               <td>-</td>
               <!--
               <td>
                  <input type="text" name="basereten" class="form-control text-right" value="<?php echo $fsc->basereten;?>" autocomplete="off"/>
               </td>
               
               <td>
                  <input type="text" name="importe" class="form-control text-right" value="<?php echo $fsc->pendiente;?>" autocomplete="off"/>
               </td>
              -->
               <td class="text-right">
                  <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </td>
            </tr>
         </form>
         <?php } ?>

      </table>
   </div>
</body>
</html>