<?php

date_default_timezone_set('America/Lima');

session_start();

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





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

$oComprapago = new cComprapago();







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



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

	$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'];



	$compag_ban =$dt['tb_banco_id'];

	$compag_con =$dt['tb_comprapago_con'];

	$compag_numuni =$dt['tb_comprapago_numuni'];

	mysqli_free_result($dts);

	

	



	

	if($mone_id==1){

		$lbl_mone = 'S/ ';



	$saldosoles = $saldo * $tipcam;

	}else if($mone_id==2){

		$lbl_mone = 'US$ ';



	$saldosoles = $saldo ;

	}



?>



<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" id="titlemodal">RENOVAR | <strong style="color:red;"><?php echo $compag_numuni ?></strong> </h4> 

</div>





<div class="modal-body">

<div class="row">

<div class="col-xs-12"> 



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

			<strong style="font-size:1.5rem;" >IMPORTE ORIGINAL: </strong> <strong class="text-blue" style="font-size:2rem;"><?php echo $compag_mon; ?></strong>

			<br />

			<br />

</div>



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

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



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

			<label for="txt_compag_liq">IMPORTE A RENOVAR:</label>

			<input name="txt_compag_liq" type="text"  id="txt_compag_liq" value="" autocomplete="off" class="form-control" > 

</div>



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

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

	<button type="button" onclick="actualizarliq();" class="btn btn-primary pull-right" id="btn_egre_guardar">Guardar</button>

</div>



</div>

</div>

</div>



<script type="text/javascript">



function actualizarliq(){

			

			

			$.ajax({

				type: "POST",

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

				async:true,

				dataType: "json",                      

				data: ({

					action:$("#action").val(),

					compagid:$("#hdd_compagid").val(),

					mon:$("#txt_compag_liq").val()

				}),

				beforeSend: function() {

					var divmen = "<center><div class='overlay col-lg-12 col-sm-12 col-xs-12' style='background-color:#fff;padding:0%;font-size:3rem;' >  <i class='fa fa-refresh fa-spin ' ></i> PROCESANDO PETICIÓN</div>  </center>";	

				$('.div_reno_form_dialog').html(divmen);

			

				},

				success: function(data){

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

						

						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); 

				}

			});

		}



</script>

