<!DOCTYPE html>
<style>
	table.factura td, table.factura th{	     	      		  
		  min-width: 80px;		  
		  padding-left: 0px;
		  padding-right: 0px;		  
	 }
	 
	table.factura td, table.factura th{
	      text-align: right;
	      align: right;
	 }
	 	 
	 table.factura td > input{	     
	      text-align: right;	      
	 }	   
	 
	 table.factura td:nth-child(6), table.factura th:nth-child(6){	     	      
		  min-width :20px;		  		  
		  padding-left: 0px;
		  padding-right: 0px;		  	 
	 }
	 
	 table.factura td:nth-child(7), table.factura th:nth-child(7){	     	      
		  width :100px;		  		  
		  padding-left: 0px;
		  padding-right: 0px;	 
	 }
			 	 	 	  
	 table.factura input[type=text]{
	      border:0px solid #000; 
	      margin:0; 
	      background:transparent;
	      width: 90px;	      
	      text-align: right;
	      padding-left: 5px;
	 }
	 
	 table.factura input[type=check]{
	      border:0px solid #000; 
	      margin:0; 
	      background:transparent;
	      min-width: 20px;
	      width: 20px;
	      text-align: left;
	 }
	 
	 table.factura button{	       
	      min-width: 25px;
	      width:    25px;	      
	 }	 	 
	 	 
</style>

<%@include file="/jsp/common/defaultTopLogin.jsp"%>
<script src="${contextPath}/js/dda/factura/general/facturacion.js?v=${versionJS}"></script>
<script src="${contextPath}/js/dda/factura/general/TablaFactura.js?v=${versionJS}"></script>
<script src="${contextPath}/js/dda/factura/general/Factura.js?v=${versionJS}"></script>


<input type="hidden" id="pmn" name="pmn" value="${pmn}" />

<form name="myform" id="formaId" method="POST" enctype="multipart/form-data" action="${contextPath}/factura/general/facturacionGuarda" >

    
 	<input type="hidden" id="facturaIdentificador" value="${factura.idFactura}" name="factura.idFactura">
 	<input type="hidden" id="detalleCto"            name="detalleCto">
	<input type="hidden" id="restCto"               name="restCto">
    	
	<div class="form-group">	
		   <label class="col-xs-1 control-label">Estudio:</label> 
	       <div class="col-xs-3">
              <select name="factura.idEstudio" id="estudioEleccion" class="form-control"  onchange="actualizaForma()" required>
	          <option value=""> Seleccione </option>
	             <c:forEach var="m" items="${estudios}">
		            <option value="${m.idEstudio}" <c:if test="${factura.idEstudio == m.idEstudio}"> selected="selected"  </c:if> > ${m.descripcionEstudio} </option>
	             </c:forEach>
              </select>
    	   </div>

		  <label class="col-xs-1 control-label">Indicador IVA:</label>
		  <div class="col-xs-3">
              <select name="factura.indicadorIva" id="indicadorIva" class="form-control"  onchange="" required>
	          <option value=""> Seleccione </option>
	             <c:forEach var="m" items="${indicadoresIva}">
		            <option value="${m.claveIva}" <c:if test="${factura.indicadorIva == m.claveIva}"> selected="selected"  </c:if> > ${m.descripcion} </option>
	             </c:forEach>
              </select>
    	   </div>

	       <label class="col-xs-1 control-label" for="monto">Amount:</label>
	  	   <div class="col-xs-3">
              <input type="text" id="monto"  value="${factura.monto}" name="factura.monto" class="form-control" readonly> 
    	   </div> 
    </div>

    <div id="divInputFactura" class="form-group">	    
	       <label  class="col-xs-2 control-label" for="numeroFactura">Numero de factura:</label> 		   	
           <div class="col-xs-2">
              <input type="text" id="numeroFactura"  value="${factura.numeroFactura}" name="factura.numeroFactura" class="form-control" required >
              <label id="errLabNumFac">Número de factura demasiado largo</label> 
           </div> 
           
           <label  class="col-xs-2 control-label" for="fechaFactura">Fecha de factura:</label> 		   	
           <div class="col-xs-2">
              <input  id="fechaFactura"  value="<fmt:formatDate pattern='MM/dd/yyyy' value='${factura.fechaFactura}'/>" name="factura.fechaFactura" class="form-control datepicker" 
              required> 
           </div>
           
          <label class="col-xs-2 control-label" for="tipoPago">Tipo Pago:</label>
		  <div class="col-xs-2">
              <select name="factura.tipoPago" id="tipoPago" class="form-control"  onchange="" required>
	          <option value=""> Seleccione </option>
	             <c:forEach var="m" items="${tiposPago}">
		            <option value="${m.value}" <c:if test="${factura.tipoPago == m.value}"> selected="selected"  </c:if> > ${m.desc} </option>
	             </c:forEach>
              </select>
    	  </div>     
    </div>

	<div id="divRadio" class="form-group">	
          <div class="col-xs-1"></div>           
          <div class="form-group col-xs-6">
		          <div class="form-group"></div>
		          <div class="form-group"></div>		        
		          		           			      
			 	  <input type="hidden" id="approvedRadioButtonValor" value="${factura.approved}">
			 	  
		          <div  class="form-group col-xs-6"> 
			          <label   class="col-xs-6 control-label" for="approved">Approved:</label>
			          <div class="col-xs-6">
			              <c:forEach var="m" items="${siNoOpcion}">
				            <input type="radio" value="${m.value}" name="factura.approved"  id="approved" 
					           <c:if test="${factura.approved == m.value}"> checked  </c:if> 
					           required />
					             ${m.desc}
			              </c:forEach>
			          </div>
			      </div>
		    
<%-- 		          <div id="pagadoRadioButton" class="form-group col-xs-6"> 
			          <label  class="col-xs-6 control-label" for="sharepoint">Paid:</label>
			          <div class="col-xs-6">
			              <c:forEach var="m" items="${siNoOpcion}">
				            <input type="radio" value="${m.value}" name="factura.pagado" id="paid"  
					           <c:if test="${factura.pagado == m.value}"> checked  </c:if> 
					           readonly />
					             ${m.desc}
			              </c:forEach>
			          </div>
			      </div>  --%>
			      
		         <div  id="sapRadioButton" class="form-group col-xs-6"> 
			          <label   class="col-xs-6 control-label" for="approved">SAP:</label>
			          <div class="col-xs-6">
			              <c:forEach var="m" items="${siNoOpcion}">
				            <input type="radio" value="${m.value}" name="factura.sap"  id="sap" 
					           <c:if test="${factura.sap == m.value}"> checked  </c:if> 
					           readonly />
					             ${m.desc}
			              </c:forEach>
			          </div>
	      		</div>
	      </div>           
	</div>
	
	<div id="divComentario" class="form-group">
          <div class="col-xs-1"></div> 
    	  <div class="form-group col-xs-10">            
		        <label class="col-xs-1 control-label" for="comentario">Comentarios:</label>
	            <textarea  id="comentario" name="factura.comentario" 
	                         rows="5" maxlength="490" class="col-xs-10 form-control">${factura.comentario}</textarea>
	      </div>           
    </div>
	    	
	<br>        	 		             
    <div class="form-group">
    		 <div class="col-xs-1"></div>
    		 <div class="col-xs-3">    
    	     	<a href="../../factura/listado/index?pmn=${pmnReturn}" class="btn btn-default col-xs-4" roll="button" >Regresar</a>
    	     </div>
    	     <div class="col-xs-1"></div>
	 	     <div class="col-xs-3">       
                 <button class="btn btn-success" id="botonGuardar" type="button" >Guardar cambios</button>
	         </div>
	         <div class="col-xs-1"></div>
	         <div class="col-xs-3">
	 	         <div id='botonConsultarFactura'> </div>
	 	     </div>	
<!-- 	 	     <div class="col-xs-1"></div>-->
 	         <div class="col-xs-2">
	 	         <div id='botonReenvioServicio'> </div>
	 	     </div>  
    </div>
	
	<br>
		
	<div id='tablaFacturaDetalle'> </div>
	<div id='tablaFacturaDetalle2'> </div>
</form>

<jsp:include page="/jsp/dda/contrato/common/uploadDocument.jsp" />
<%@include file="/jsp/common/defaultBottomLogin.jsp"%>