<?php

date_default_timezone_set('America/Lima');

session_start();

require_once ("../../config/Cado.php");

require_once ("../egreso/cEgreso.php");

$oEgreso = new cEgreso();

require_once ("../compra/cComprapago.php");

$oComprapago = new cComprapago();



require_once("../almacen/cAlmacen.php");

$oAlmacen = new cAlmacen();



require_once("../formatos/formato.php");



	$dts= $oComprapago->mostrarUno($_POST['compag_id']);

	$dt = mysqli_fetch_array($dts);

	$compag_mon =$dt['tb_comprapago_mon'];

	

	$pro_id		=$dt['tb_proveedor_id'];

	$mone_id		=$dt['tb_moneda_id'];

	$emp_id		=$dt['tb_empresa_id'];

 

	 $pro_doc = $dt['tb_proveedor_doc'];

	 $pro_nom =  $dt['tb_proveedor_nom'];



	$tipcam		=$dt['tb_compra_tipcam'];

	$com_numdoc		=$dt['tb_compra_numdoc'];

	$doc_nom		=$dt['tb_documento_nom'];



	if($dt['tb_comprapago_fecven']=='0000-00-00'){

		$fecven = 'Emitida al contado';

	}else{

		$fecven = mostrarFecha($dt['tb_comprapago_fecven']);

	}



	$compag_ban =$dt['tb_banco_id'];

	$compag_con =$dt['tb_comprapago_con'];

	$compag_numuni =$dt['tb_comprapago_numuni'];

	mysqli_free_result($dts);



	

	$dts1=$oAlmacen->mostrarAlmCajEmp($emp_id);

			$dt1 = mysqli_fetch_array($dts1);

 			$emp=$dt1['tb_empresa_id'];

 			$emp_doc =$dt1['tb_empresa_ruc']; 

 			$emp_nom=$dt1['tb_empresa_nomcom'];

 			$punven_id=$dt1['tb_puntoventa_id'];

 			$piso_id=$dt1['tb_piso_id'];

 			$almid = $dt1['tb_almacen_id'];

	mysqli_free_result($dts1);



	

	

	$mod_id=4;

	$est=1;

	$dts3 = $oEgreso->mostrar_por_modulo($mod_id,$_POST['compag_id'],$est);

	while($dt3 = mysqli_fetch_array($dts3))

	{

		$abonos+= $dt3['tb_egreso_imp'];

	} 

	mysqli_free_result($dts3);



	$saldo=$compag_mon-$abonos;

	

	if($mone_id==1){

		$lbl_mone = 'S/ ';



	$saldosoles = $saldo * $tipcam;

	}else if($mone_id==2){

		$lbl_mone = 'US$ ';



	$saldosoles = $saldo ;

	}



	$fec=date('d-m-Y');



	



list($day,$mon,$year) = explode('-',$fecven);

$nvafecven=date('d-m-Y',mktime(0,0,0,$mon,$day+30,$year));









	$est='1';

	$caj_id 	=$_SESSION['caja_id'];

	$modide 	=$_POST['compag_id'];

	$imp 		=$saldo;



	$det="PAGO LETRA: $doc_nom $com_numdoc | $compag_numuni";



?>

<script type="text/javascript" src="../cotizacion/NumberFormat.js"></script>



<script type="text/javascript">





	// $('.moneda2').autoNumeric({

		// aSep: ',',

		// aDec: '.',

	//aSign: 'S/. ',

	//pSign: 's',

	// vMin: '0.00',

	// vMax: '<?php echo $saldo;?>'

// });

	

restaFechas = function(f1,f2)

 {

 var aFecha1 = f1.split('-');

 var aFecha2 = f2.split('-');

 var fFecha1 = Date.UTC(aFecha1[2],aFecha1[1]-1,aFecha1[0]);

 var fFecha2 = Date.UTC(aFecha2[2],aFecha2[1]-1,aFecha2[0]);

 var dif = fFecha2 - fFecha1;

 var dias = Math.floor(dif / (1000 * 60 * 60 * 24));

 return dias;

 }





 function cal_diamora(){

		

		

		fecpag = $("#txt_egr_fec").val();

		fecven = $("#txt_egr_fecven").val();



		diff_in_days = restaFechas(fecven,fecpag);

		$("#txt_egr_diamor").val(diff_in_days);

	 

 }

 



function calcular_amortizacion(){



 var impori = $("#hdd_egr_imp").val();

 var impnue = $("#txt_egr_nvoimp").val();





var amor = parseFloat(impori) - parseFloat(impnue);



$("#txt_egres_amor").val(new NumberFormat(amor).toFormatted());

}





function calcular_importetotal(){



if($("#txt_egr_intmor").val()==""){

	impmora = 0;

}else{

	impmora=$("#txt_egr_intmor").val();

}



if($("#txt_egr_intven").val()==""){

	impven = 0;

}else{

	impven=$("#txt_egr_intven").val();

}



if($("#txt_egr_intade").val()==""){

	intade = 0;

}else{

	intade=$("#txt_egr_intade").val();

}



if($("#txt_egr_intcom").val()==""){

	intcom = 0;

}else{

	intcom=$("#txt_egr_intcom").val();

}



if($("#txt_egr_gaspro").val()==""){

	gaspro = 0;

}else{

	gaspro=$("#txt_egr_gaspro").val();

}



if($("#txt_egr_compro").val()==""){

	compro = 0;

}else{

	compro=$("#txt_egr_compro").val();

}



if($("#txt_egr_gasope").val()==""){

	gasope = 0;

}else{

	gasope=$("#txt_egr_gasope").val();

}



if($("#txt_egr_porte").val()==""){

	porte = 0;

}else{

	porte=$("#txt_egr_porte").val();

}



if($("#txt_egr_comdeval").val()==""){

	comdeval = 0;

}else{

	comdeval=$("#txt_egr_comdeval").val();

}



if($("#txt_egr_itf").val()==""){

	itf = 0;

}else{

	itf=$("#txt_egr_itf").val();

}





if($("#txt_egr_nvoimp").val()==""){

	nvoimp = 0;

}else{

	nvoimp=$("#txt_egr_nvoimp").val();

}



impori=$("#hdd_egr_imp").val();







tot = parseFloat(impori) + parseFloat(impmora) + parseFloat(impven) + parseFloat(intade) + parseFloat(intcom) + parseFloat(gaspro) + parseFloat(compro) + parseFloat(gasope) + parseFloat(porte) + parseFloat(comdeval) + parseFloat(itf) ;



$("#txt_egr_imptot").val(new NumberFormat(tot-nvoimp).toFormatted());



}





	function cmb_cajalet_id(punven_id,monid)

	{	

		$.ajax({

			type: "POST",

			url: "../caja/cmb_cajaxpuntoventa_id.php",

			async:true,

			dataType: "html",                      

			data: ({

				punven_id: punven_id,

				mon_id: monid

			}),

			beforeSend: function(){

				$('#cmb_cajalet_id').html('<option value="">Cargando...</option>');

			},

			success: function(html){

				$('#cmb_cajalet_id').html(html);

			}

		});

	}





$(function() {

cmb_cajalet_id('<?php echo $_SESSION['puntoventa_id']?>','<?php echo $mone_id?>');



$("#div_fec").hide();

$("#div_nroope").hide();



	$("#txt_egr_intmor,#txt_egr_intven,#txt_egr_intade,#txt_egr_intcom,#txt_egr_gaspro,#txt_egr_compro,#txt_egr_gasope,#txt_egr_porte,#txt_egr_comdeval,#txt_egr_itf").blur(function(){

		calcular_importetotal();

	});





	$("#txt_egr_nvoimp").keydown(function(e){

		if (e.which == 13){  	

	  		calcular_amortizacion();

	  		calcular_importetotal();

			return false; 

		} 

	});



	

	$("#txt_egr_nvoimp").blur(function(e){

		  	

	  		calcular_amortizacion();

	  		calcular_importetotal();

		

	});



	

	$("#txt_egr_nroope").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_tasa").focus();

			return false; 

		} 

	});	



	$("#txt_egr_tasa").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_intmor").focus();

			return false; 

		} 

	});	



	$("#txt_egr_intmor").keydown(function(e){

		if (e.which == 13){  	

			$("#txt_egr_intven").focus();

			return false; 

		} 

	});



	$("#txt_egr_intven").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_intade").focus();

			return false; 

		} 

	});

	$("#txt_egr_intade").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_intcom").focus();

			return false; 

		} 

	});





	$("#txt_egr_intcom").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_gaspro").focus();

			return false; 

		} 

	});



	$("#txt_egr_gaspro").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_compro").focus();

			return false; 

		} 

	});



	$("#txt_egr_compro").keydown(function(e){

		if (e.which == 13){ 

			$("#txt_egr_gasope").focus(); 	

			return false; 

		} 

	});



	$("#txt_egr_gasope").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_porte").focus(); 

			return false; 

		} 

	});



	$("#txt_egr_porte").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_comdeval").focus(); 

			return false; 

		} 

	});



	$("#txt_egr_comdeval").keydown(function(e){

		if (e.which == 13){  	

	  		$("#txt_egr_itf").focus(); 

			return false; 

		} 

	});





	$("#txt_egr_itf").keydown(function(e){

		if (e.which == 13){  	

	  		$("#btn_egre_guardar").focus(); 

			return false; 

		} 

	});



		calcular_amortizacion();



		

cal_diamora();





		fecpagpro = $("#txt_egr_fec").val();

		fecvenpro = $("#txt_egres_fecnva").val();



		diff_in_dayspro = restaFechas(fecpagpro,fecvenpro);

		$("#txt_egres_diaspro").val(diff_in_dayspro);







		//validar_condicion(<?php echo $compag_con ?>);



		

		$('#txt_egr_fec').datepicker({

		format: 'dd-mm-yyyy',

		autoclose:true

		}).on('changeDate', function(e){

			

			fecpag = $("#txt_egr_fec").val();

			fecven = $("#txt_egr_fecven").val();



			diff_in_days = restaFechas(fecven,fecpag);

			$("#txt_egr_diamor").val(diff_in_days);

			

		fecvenpro = $("#txt_egres_fecnva").val();



		diff_in_dayspro = restaFechas(fecpag,fecvenpro);

		$("#txt_egres_diaspro").val(diff_in_dayspro);

			

			

			

		});





		$('#txt_egres_fecnva').datepicker({

		format: 'dd-mm-yyyy',

		autoclose:true

		}).on('changeDate', function(e){

			fecpagpro = $("#txt_egr_fec").val();

			fecvenpro = $("#txt_egres_fecnva").val();



			diff_in_dayspro = restaFechas(fecpagpro,fecvenpro);

			$("#txt_egres_diaspro").val(diff_in_dayspro);

		});





		$('#txt_pro_nom,#txt_pro_doc,#txt_emp_nom,#txt_egr_imp,#cmb_let_conform,#cmb_let_ban_form').attr('disabled','disabled');







		$('#txt_egr_det').focus();



		// proveedor_cargar_datos('<?php echo $pro_id?>');



		$('#txt_egr_det').autocomplete({

			minLength: 1,

			source: "../egreso/egreso_complete_det.php"

		});



		$('#txt_egr_det').change(function(){

			$(this).val($(this).val().toUpperCase());

		});

		

		$("#btn_egre_guardar").click(function() {

			$("#for_egr").submit();

		});

		

		$('#for_egr').bootstrapValidator({ 

	      message: 'Valor no valido',

	      feedbackIcons: {

	      	valid: 'glyphicon glyphicon-ok',

	      	invalid: 'glyphicon glyphicon-remove',

	      	validating: 'glyphicon glyphicon-refresh'

	      },

	      fields: {	      	

	      	txt_egr_fec: {

	      		group: '.col-lg-3',

	      		validators: {	      			 

	      			date: {

	      				format: 'DD-MM-YYYY',

	      				message: 'Fecha no Valida'

	      			}

	      		}

	      	},

			cmb_cajalet_id: {

	      		group: '.col-lg-3',

	      		validators: {	      			 

	      			notEmpty: {

	      				message: 'Seleccione caja *'

	      			}

	      		}

	      	},

	      	txt_egr_imptot: {

	      		group: '.col-lg-10',

	      		validators: {

	      			notEmpty: {

	      				message: 'Campo vacio *'

	      			}

	      		}

	      	}

	      }

	  }).on('success.form.bv', function(e) { 

	  

	  	$.ajax({

	  		type: "POST",

	  		url: "../cuentapagar/cuentapagar_reg.php",

	  		async:true,

	  		dataType: "json",

	  		data: $("#for_egr").serialize(),

	  		beforeSend: function(){

			

				var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	

				$('.div_egresoletra_form').html(div);

			

	  		},

	  		success: function(data){

	  				

			//		 $('.modal').modal('hide');

			//$('.in').removeClass('modal-backdrop');	  

				

				//$('#div_egresoletra_form_dialog').modal('hide');

				toastr["success"](data.egr_msj);	

				

	  		},

	  		complete: function(){

					

			<?php if($_POST['vista']=="cuentapagar_inicio" || $_POST['vista']=="cuentasxpagar_panel"){

			?>

			cuentapagar();

			<?php 	

			}else{?>	

			cuentapagar_tabla_prov_fac_des('<?php echo $_POST['pro_id']; ?>','<?php echo $_POST['emp_id']; ?>','','<?php echo $_POST['mon_id']; ?>',doctod,letr,fac,nd,nc,esttod,pen,canj,pag); 

			<?php } ?>

			

	  			

	  		}

	  	});



	  });



	 

  	$("#txt_egre_gasope").keydown(function(e){

	  	if (e.which == 13){

	  		

	  		var imp = $("#hdd_egr_imp").val();

	  		var gas = $(this).val();



	  		var tot = parseFloat(imp) + parseFloat(gas);



	  		$("#txt_egre_tot").val(new NumberFormat(tot).toFormatted());



	  		return false; 

	  	} 

	});



	$("#cmb_egre_tip").change(function(){

			validar_campos($(this).val(),<?php echo $compag_ban; ?>);			

		});

});





function validar_campos(tipid,banid){

	

	

	if(banid==1){



		$("#lbl_egr_gasope").text('Comision Amortizacion:');

		$("#lbl_egr_porte").text('Gasto Administrativo:');

		$("#lbl_egr_intade").text('Interes Prorroga:');

		$("#div_intven").hide(100);

		$("#div_intcom").hide(100);

		$("#div_comdeval").hide(100);

		$("#div_imptot").show(100);



		if(tipid==""){

				$("#div_fec").hide(100);

				$("#div_bandes").hide(100);

				$("#div_cuendes").hide(100);

				$("#div_nroope").hide(100);

				$("#div_diamor").hide(100);

				$("#div_intmor").hide(100);	

				$("#div_intade").hide(100);			

				$("#div_gaspro").hide(100);

				$("#div_compro").hide(100);

				$("#div_gasope").hide(100);				

				$("#div_tasa").hide(100);



				$("#div_lista").hide(100);



				$("#div_itf").hide(100);

				$("#div_porte").hide(100);

				$("#txt_egr_porte").hide(100);

				

				$("#div_fecnva").hide(100);

				$("#div_nueimp").hide(100);





		}else if(tipid==1){

			

		

				$("#div_bandes").show(100);

				$("#div_cuendes").show(100);

				$("#div_fec").show(100);

				$("#div_nroope").show(100);

				

				$("#div_diamor").show(100);

				$("#div_intmor").show(100);

				$("#div_intade").show(100);

				$("#div_lista").show(100);

				$("#div_gaspro").show(100);

				$("#div_compro").show(100);

				$("#div_gasope").show(100);

				$("#div_tasa").show(100);

				$("#div_itf").show(100);

				$("#div_porte").show(100);

				$("#txt_egr_porte").show(100);

				$("#div_fecnva").hide(100);

				$("#div_nueimp").hide(100);



		}else if(tipid==2){

				$("#div_fec").show(100);

				$("#div_bandes").show(100);

				$("#div_cuendes").show(100);

				$("#div_nroope").show(100);

				$("#div_diamor").show(100);

				$("#div_intmor").show(100);

				$("#div_lista").show(100);

				$("#div_intade").show(100);

				$("#div_gaspro").show(100);

				$("#div_compro").show(100);

				$("#div_gasope").show(100);

				$("#div_tasa").show(100);

				$("#div_itf").show(100);

				$("#div_porte").show(100);

				$("#txt_egr_porte").show(100);

				$("#div_fecnva").show(100);

				$("#div_nueimp").show(100);

		}

	}







	if(banid==2){



		$("#lbl_egr_gasope").text('Comision Gestion:');

		$("#lbl_egr_porte").text('Porte:');

		$("#lbl_egr_intade").text('Interes Nuevo:');

		$("#div_intcom").hide(100);

		$("#div_comdeval").hide(100);

		$("#div_imptot").show(100);



		if(tipid==""){

				$("#div_fec").hide(100);

				$("#div_bandes").hide(100);

				$("#div_cuendes").hide(100);

				$("#div_nroope").hide(100);

				$("#div_diamor").hide(100);

				$("#div_intmor").hide(100);

				$("#div_intven").hide(100);

				$("#div_intade").hide(100);

				$("#div_porte").hide(100);

				$("#div_gaspro").hide(100);

				$("#div_compro").hide(100);

				$("#div_gasope").hide(100);

				$("#div_lista").hide(100);

				$("#div_tasa").hide(100);

				$("#div_itf").hide(100);

				$("#txt_egr_porte").hide(100);

				$("#div_fecnva").hide(100);

				$("#div_nueimp").hide(100);

		}else if(tipid==1){

				$("#div_fec").show(100);

				$("#div_bandes").show(100);

				$("#div_cuendes").show(100);

				$("#div_nroope").show(100);

				$("#div_diamor").show(100);

				$("#div_intmor").show(100);

				$("#div_intven").show(100);

				$("#div_intade").show(100);

				$("#div_lista").show(100);

				$("#div_gaspro").show(100);

				$("#div_compro").show(100);

				$("#div_gasope").show(100);

				$("#div_porte").show(100);

				$("#div_tasa").show(100);

				$("#div_itf").show(100);

				$("#txt_egr_porte").show(100);

				$("#div_fecnva").hide(100);

				$("#div_nueimp").hide(100);

		}else if(tipid==2 ){

				$("#div_fec").show(100);

				$("#div_bandes").show(100);

				$("#div_cuendes").show(100);

				$("#div_nroope").show(100);

				$("#div_diamor").show(100);

				$("#div_intmor").show(100);

				$("#div_intven").show(100);

				$("#div_lista").show(100);

				$("#div_intade").show(100);

				$("#div_gaspro").show(100);

				$("#div_porte").show(100);

				$("#div_compro").show(100);

				$("#div_gasope").show(100);

				$("#div_tasa").show(100);

				$("#div_itf").show(100);

				$("#txt_egr_porte").show(100);

				$("#div_fecnva").show(100);

				$("#div_nueimp").show(100);

		}

	}





	if(banid==3){



		$("#lbl_egr_gasope").text('Comision Renovacion:');

		$("#lbl_egr_porte").text('Porte:');

		$("#lbl_egr_intade").text('Interes Adelantado:');

		$("#div_imptot").show(100);



		if(tipid==""){

				$("#div_fec").hide(100);

				$("#div_bandes").hide(100);

				$("#div_cuendes").hide(100);

				$("#div_nroope").hide(100);

				$("#div_diamor").hide(100);

				$("#div_intmor").hide(100);

				$("#div_intven").hide(100);

				$("#div_intade").hide(100);

				$("#div_intcom").hide(100);

				$("#div_lista").hide(100);

				$("#div_gaspro").hide(100);

				$("#div_compro").hide(100);

				$("#div_porte").hide(100);

				$("#div_gasope").hide(100);

				$("#div_comdeval").hide(100);

				$("#div_tasa").hide(100);

				$("#div_itf").hide(100);

				$("#txt_egr_porte").hide(100);

				$("#div_fecnva").hide(100);

				$("#div_nueimp").hide(100);

		}else if(tipid==1){

				$("#div_fec").show(100);

				$("#div_bandes").show(100);

				$("#div_cuendes").show(100);

				$("#div_nroope").show(100);

				$("#div_diamor").show(100);

				$("#div_intmor").show(100);

				$("#div_lista").show(100);

				$("#div_intven").show(100);

				$("#div_intade").show(100);

				$("#div_intcom").show(100);

				$("#div_gaspro").show(100);

				$("#div_compro").show(100);

				$("#div_porte").show(100);

				$("#div_gasope").show(100);

				$("#div_comdeval").show(100);

				$("#div_tasa").show(100);

				$("#div_itf").show(100);

				$("#txt_egr_porte").show(100);

				$("#div_fecnva").hide(100);

				$("#div_nueimp").hide(100);

		}else if(tipid==2){

			$("#div_fec").show(100);

				$("#div_bandes").show(100);

				$("#div_cuendes").show(100);

				$("#div_nroope").show(100);

				$("#div_diamor").show(100);

				$("#div_intmor").show(100);

				$("#div_intven").show(100);

				$("#div_intade").show(100);

				$("#div_intcom").show(100);

				$("#div_lista").show(100);

				$("#div_gaspro").show(100);

				$("#div_compro").show(100);

				$("#div_gasope").show(100);

				$("#div_porte").show(100);

				$("#div_comdeval").show(100);

				$("#div_tasa").show(100);

				$("#div_itf").show(100);

				$("#txt_egr_porte").show(100);

				$("#div_fecnva").show(100);

				$("#div_nueimp").show(100);

		}

	}



}







</script>







<!-- Form content -->

<div class="modal-header">



	<h4 class="modal-title" id="titlemodal">Información de Pago de Letra | <strong style="color:red;"><?php echo $compag_numuni; ?></strong> </h4> 

		<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

		

</div>



<form id="for_egr">

	<input type="hidden" id="action" name="action" value="<?php echo $_POST['action']?>">

	<input type="hidden" id="hdd_egr_id" name="hdd_egr_id" value="<?php echo $_POST['egr_id']?>">

	<input type="hidden" id="hdd_egr_usureg" name="hdd_egr_usureg" value="<?php echo $_SESSION['usuario_id']?>">

	<input type="hidden" id="hdd_egr_usumod" name="hdd_egr_usumod" value="<?php echo $_SESSION['usuario_id']?>">

	<input type="hidden" id="hdd_emp_id" name="hdd_emp_id" value="<?php echo $emp_id?>">

	<input type="hidden" id="hdd_mod_id" name="hdd_mod_id" value="<?php echo $mod_id?>">

	<input type="hidden" id="hdd_egr_idm" name="hdd_egr_idm" value="<?php echo $modide?>">

	<input type="hidden" id="hdd_egr_moneid" name="hdd_egr_moneid" value="<?php echo $mone_id?>">

	<input type="hidden" id="hdd_egr_cajid" name="hdd_egr_cajid" value="<?php echo $cajid?>">







	<div class="row">



		<div class="col-lg-3 col-sm-6 col-xs-6">

			<label for="txt_pro_nom">Proveedor:</label>

			<input type="text" id="txt_pro_nom" name="txt_pro_nom"  class="form-control"  value="<?php echo $pro_nom .' | '.$pro_doc; ?>" />

			<input type="hidden" id="hdd_pro_id" name="hdd_pro_id" value="<?php echo $pro_id?>" />

		</div>



		<div class="col-lg-3 col-sm-6 col-xs-6">

			<label for="txt_emp_nom">Empresa:</label>

			<input type="text" id="txt_emp_nom" name="txt_emp_nom"  class="form-control"  value="<?php echo $emp_doc .' | '.$emp_nom?>" />

		</div>



		<div class="col-lg-3 col-sm-4 col-xs-6">

			<label for="txt_egr_imp">Importe: </label><?php echo ' '.$lbl_mone; ?>

			<input type="text" name="txt_egr_imp" id="txt_egr_imp" class="moneda2 form-control" style="text-align:right"   value="<?php echo formato_money($imp)?>" >

			<input type="hidden" name="hdd_egr_imp" id="hdd_egr_imp" value="<?php echo moneda_mysql($imp) ?>" >

		</div> 



		<div  id="" class="col-lg-3 col-sm-4 col-xs-6">

			<label id="lbl_let_ban" for="cmb_let_ban_form">Banco :</label>

			<select name="cmb_let_ban_form" id="cmb_let_ban_form"  class="form-control" >

			

			<option value="1"<?php if($compag_ban==1) echo 'selected'; ?> >BCP</option>

			<option value="2"<?php if($compag_ban==2) echo 'selected'; ?> >BBVA</option>

			<option value="3"<?php if($compag_ban==3) echo 'selected'; ?> >SCT</option>

			

			</select>

		</div>



		<div  id="" class="col-lg-3 col-sm-4 col-xs-6">

			<label id="lbl_letcon" for="cmb_let_conform">Condicion:</label>

			<select name="cmb_let_conform" id="cmb_let_conform"  class="form-control" >

			<option value="1"<?php if($compag_con==1) echo 'selected'; ?> >COBRANZA</option>

			<option value="2"<?php if($compag_con==2) echo 'selected'; ?> >DESCUENTOS</option>

			<option value="3"<?php if($compag_con==3) echo 'selected'; ?> >CARTERA</option>	

			</select>

		</div>



		<div class="col-lg-2 col-sm-4 col-xs-6">

			<label for="txt_egr_fecven">Fecha Ven.:</label>

			<input name="txt_egr_fecven" type="text"  id="txt_egr_fecven" value="<?php echo $fecven?>" class="form-control" readonly> 

		</div>



		<div class="col-lg-3 col-sm-4 col-xs-6">

			<label for="cmb_cajalet_id">Caja:</label>

			<select name="cmb_cajalet_id" id="cmb_cajalet_id"  class="form-control" >			

			</select>

		</div>

		

		<div class="col-lg-4 col-sm-12 col-xs-12">

			<label for="txt_egr_det">Detalle:</label>

			<textarea name="txt_egr_det" style="font-weight:bold; font-size:14px;" class="form-control"  rows="2" id="txt_egr_det"><?php echo $det?></textarea> 

		</div> 



		<div class="col-lg-3 col-sm-4 col-xs-6">

			<label for="cmb_egre_tip">Tipo:</label>

			<select name="cmb_egre_tip" id="cmb_egre_tip"  class="form-control" >

			<option value="">---Seleccionar---</option>

			<option value="1">CANCELACION</option>

			<option value="2">AMORTIZACION</option>

			</select>

			</div>



		<div id="div_fec"  style="" class="col-lg-3 col-sm-4 col-xs-6">

			<label id="lbl_egr_fec" for="txt_egr_fec">Fecha Pago:</label>

			<input name="txt_egr_fec" type="text"  id="txt_egr_fec" autocomplete="off" value="<?php echo $fec?>" class="form-control" > 

		</div>

		



		<div id="div_nroope"  style="" class="col-lg-2 col-sm-4 col-xs-6">

			<label id="lbl_egr_nroope" for="txt_egr_nroope">Nro Liquidacion:</label>

			<input name="txt_egr_nroope" type="text"  id="txt_egr_nroope" value="" class="form-control" > 

		</div>



		<div id="div_diamor"  style="display: none" class="col-lg-2 col-sm-4 col-xs-6">

			<label id="lbl_egr_diamor" for="txt_egr_diamor">Dias Mora:</label>

			<input name="txt_egr_diamor" type="text"  id="txt_egr_diamor" value="" readonly="" class="form-control" > 

		</div>



		<div id="div_tasa"  style="display: none" class="col-lg-2 col-sm-4 col-xs-6">

			<label id="lbl_egr_tasa" for="txt_egr_tasa">Tasa:</label>

			<input name="txt_egr_tasa" type="text"  id="txt_egr_tasa" value="" class="form-control" > 

		</div>



<div class="col-lg-12 col-sm-12 col-xs-12" style="height: 10px;"> </div>





<div class="col-lg-8 col-md-12 col-xs-12 " id="div_lista" >

	<div class=" box-solid no-padding"  >

           

    <div class="box-body no-padding">

    <div class="table-responsive">

			    

    <table class="table no-padding">

    <tbody>

	

	

    	<tr id="div_intven" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;">  <label id="lbl_egr_intven" for="txt_egr_intven">Interes Vencido:</label>  </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

					<input name="txt_egr_intven" type="text"  id="txt_egr_intven" value="" class="form-control" > 

			</div>

		</td>



    	</tr>



    	<tr id="div_intmor" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;">  <label id="lbl_egr_intmor" for="txt_egr_intmor">Interes Mora:</label>  </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10 ">			

				<input name="txt_egr_intmor" type="text"  id="txt_egr_intmor" value="" class="form-control" > 

			</div>

		</td>



    	</tr>



    	

    	<tr id="div_intcom" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_intcom" for="txt_egr_intcom">Interes Compensatorio:</label> </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

				<input name="txt_egr_intcom" type="text"  id="txt_egr_intcom" value="" class="form-control" > 

			</div>

		</td>

    	</tr>





    	<tr id="div_gaspro" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_gaspro" for="txt_egr_gaspro">Gasto Protesto:</label> </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10 ">

				<input name="txt_egr_gaspro" type="text"  id="txt_egr_gaspro" value="" class="form-control" >  

			</div>

		</td>

    	</tr>



    	<tr id="div_compro" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_compro" for="txt_egr_compro">Comision Protesto:</label> </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10 ">

				<input name="txt_egr_compro" type="text"  id="txt_egr_compro" value="" class="form-control" >  

			</div>

		</td>

    	</tr>





		

		<tr id="div_intade" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_intade" for="txt_egr_intade">Interes Adelantado:</label>  </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

					<input name="txt_egr_intade" type="text"  id="txt_egr_intade" value="" class="form-control" > 

			</div>

		</td>

    	</tr>



		

		

    	

		<tr id="div_gasope" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_gasope" for="txt_egr_gasope">Gasto Operacion:</label> </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

				<input name="txt_egr_gasope" type="text"  id="txt_egr_gasope" value="" class="form-control" > 

			</div>

		</td>

    	</tr>

		



    	<tr id="div_porte" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_porte" for="txt_egr_porte">Porte:</label> </th>

        <td colspan="2" >

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

				<input name="txt_egr_porte" type="text"  id="txt_egr_porte" value="" class="form-control" >

			</div>

		</td>

    	</tr>



		

		

    	<tr id="div_fecnva" style="display: none" >

		<th  nowrap class="pull-left"  > <label id="lbl_egr_porte" for="txt_egres_fecnva">Nueva Fecha Venc.:</label> </th>

        <td >

        	<div class="col-lg-2 col-md-2 hidden-xs">

			

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-12 ">

				 <input type="text" name="txt_egres_fecnva" autocomplete="off"  class="form-control" id="txt_egres_fecnva" value="<?php echo $nvafecven; ?>" style="text-align:right;font-weight: bold;" >

			</div>

		</td>

		<td>

			<input type="text" name="txt_egres_diaspro" class="form-control" id="txt_egres_diaspro" value="" readonly="" style="text-align:right;font-weight: bold;" >      

		</td>

    	</tr>





    	<tr id="div_nueimp" style="display: none" >

		<th  nowrap class="pull-left" > <label id="lbl_egr_porte" for="txt_egr_nvoimp">Nuevo Importe:</label> </th>

        <td >

			<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-md-10 col-xs-10 ">

		 		<input type="text" name="txt_egr_nvoimp" autocomplete="off"  class="form-control" id="txt_egr_nvoimp" value="<?php echo formato_money('0')?>" style="text-align:right;font-weight: bold;" >

			</div>  

		</td>

		<td>

			<input type="text" name="txt_egres_amor" readonly="" class="form-control" id="txt_egres_amor" value="" style="text-align:right;font-weight: bold;" >     

		</td>

    	</tr>



    	<tr id="div_comdeval" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_comdeval" for="txt_egr_comdeval">Comision de Devolucion Valorada:</label> </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

				<input name="txt_egr_comdeval" type="text"  id="txt_egr_comdeval" value="" class="form-control" >

			</div>

		</td>

    	</tr>



    	<tr id="div_itf" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_itf" for="txt_egr_itf">ITF:</label> </th>

        <td colspan="2">

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

				<input name="txt_egr_itf" type="text"  id="txt_egr_itf" value="" class="form-control" > 

			</div>

		</td>

    	</tr>



    	<tr id="div_imptot" style="display: none" >

		<th  nowrap class="pull-left" style="width:50%;text-align: left;"> <label id="lbl_egr_imptot" for="txt_egr_imptot">Importe Total:</label> </th>

        <td colspan="2" >

        	<div class="col-lg-2 col-md-2 col-xs-2 ">

				<label><?php echo ' '.$lbl_mone; ?></label>

			</div>

			<div class="col-lg-10 col-sm-10 col-xs-10">

				<input name="txt_egr_imptot" type="text"  id="txt_egr_imptot" value="<?php echo $compag_mon; ?>" readonly="" class="form-control" > 

			</div>

		</td>

    	</tr>





	</tbody>

	</table>

    </div>

    </div>

            

    </div> 

</div> 





</div> 







</form>

   

<div class="modal-footer pull-right">	 

	<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Cancelar</button>

	<button type="button" class="btn btn-primary pull-right" id="btn_egre_guardar">Guardar</button>

</div>





