<?php
include_once("../php/config.php");

$sqlBalance= mysql_query("select stock from productos where descripcion='MONCASH'") or die(mysql_error());
$sqlBalance2= mysql_query("select stock from productos where descripcion='NATCASH'") or die(mysql_error());
$moncash = @mysql_result($sqlBalance, 0, "stock");
$natcash = @mysql_result($sqlBalance2, 0, "stock");


$cuentas = mysql_query("select * from enlace_cuentas") or die(mysql_error());
$pagos_clientes = @mysql_result($cuentas, 0, "pagos_clientes");

if(isSet($_POST["aplicar"])){
    mysql_query("update productos set stock=stock + '".$_POST['moncash']."', costo= costo +'".$_POST['moncash']."' where descripcion='MONCASH'") or die(mysql_error());
    mysql_query("update productos set stock=stock + '".$_POST['natcash']."', costo=costo + '".$_POST['natcash']."' where descripcion='NATCASH'") or die(mysql_error());
    echo "<script>opener.location.reload(); self.close()</script>";
}





include_once("../header.php");
?>
<style>
    .nav{
        display:none;
    }
</style>


<div class="container" style="background:white; padding:15px">
 <div class="row">
<form action="" method="POST" id="frm">
	<div class="col-md-5 col-md-offset-3">
               <div class="row mt-2">
                    <div class="col-xs-3">MONCASH</div>
                    <div class="col-xs-9"><input type="text" name="moncash" id="moncash" placeholder="0.00" autofocus></div>
                </div>

                 <div class="row mt-2">
                    <div class="col-xs-3">NATCASH</div>
                    <div class="col-xs-9"><input type="text" name="natcash" id="natcash" placeholder="0.00"></div>
                </div> 

                
<hr>

<button class="btn btn-rojo" name="aplicar" onClick="$('.btn').hide()"><i class="bi bi-database-add"></i> Aceptar</button>
<a class="btn btn-primary" href="javascript:void(0)" onClick="self.close()"><i class="bi bi-database-add"></i> Cancelar</a>
</form>
     </div>

</div>
</div>

