Files
ventas_php/ajax/reportes-cuentaspagar.php

55 lines
1.9 KiB
PHP
Executable File

<?php
include_once('../init.php');
include_once('../config.php');
include_once(DOC_ROOT.'/libraries.php');
//session_start();
$Usr = $user->Info();
$smarty->assign('Usr', $Usr); /* if(isset($_POST['action'])) $_POST['type'] = $_POST['action'];*/
//reportes-cuentaspagar
echo "en mantenimiento";exit();
switch($_POST["type"])
{
case "tipoCuentasPend"://reporte General de ventas
//$reportes->setFechaI(date('Y-m-d',strtotime($_POST['fechaI'])));
//$reportes->setFechaF(date('Y-m-d',strtotime($_POST['fechaF'])));
$reportes->setFechaI($_POST['fechaI']);
$reportes->setFechaF($_POST['fechaF']);
$smarty->assign("fi",$_POST['fechaI']);
$smarty->assign("ff",$_POST['fechaF']);
$reportes->setUserUsuario($Usr['usuarioId']);
if($Usr['type']=="admin")
{
$reportes->setTypeUser("admin");
$reportes->setIdSuc($Usr['sucursalId']);
}
if($reportes->validaF($_POST['fechaI'],$_POST['fechaF']))
{
$reportes->setProveedor($_POST['proveedor']);
$resCuentasPP=$reportes->cuentasPorpagar();
foreach($resCuentasPP as $rCuentasPP)
{
$reportes->setPedidoId($rCuentasPP['noPedido']);
$rCuentasPP['fecha']=date('d-m-Y H:i:s',strtotime($rCuentasPP['fecha']));
$rCuentasPP['bonificaciones']=$reportes->bonificaciones();
if($rCuentasPP['saldo']==NULL){$rCuentasPP['saldo']=$rCuentasPP['total'];}
if($rCuentasPP['totalparcial']==NULL){$rCuentasPP['totalparcial']="0.00";}
$rCuentasPP['saldoTotal'] =$rCuentasPP['saldo'] - $rCuentasPP['bonificaciones'];
$resultado[]=$rCuentasPP;
}
$smarty->assign("resCuentasPP",$resultado);
$smarty->assign("DOC_ROOT", DOC_ROOT);
$smarty->display(DOC_ROOT.'/templates/lists/reportes-cuentaspagar.tpl');
}
else
{
echo "<div style=\"text-align:center\">fecha inicial no puede ser mayor que fecha final</div>";
}
break;
}//switch
?>