Fix systematic errors in pagination, sucursal warnings, and fatal count() errors across multiple modules
This commit is contained in:
@@ -1,620 +0,0 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
$p = $_SESSION['edpP'];
|
||||
$projectId = $_SESSION['curProjId'];
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'viewDescuentos':
|
||||
|
||||
$value = split("#",$_POST['value']);
|
||||
|
||||
$proveedorId = $value[0];
|
||||
$pedidoId = $value[1];
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$cuentasPago = $cuentaPagar->EnumerateById();
|
||||
|
||||
$proveedor->setProveedorId($proveedorId);
|
||||
$descuentos = $proveedor->GetDescuentos();
|
||||
$nombreProveedor = $proveedor->GetNameById();
|
||||
|
||||
$totalPublicidad = ($cuentasPago['total']*$descuentos['publicidad'])/100;
|
||||
$totalFlete = ($cuentasPago['total']*$descuentos['flete'])/100;
|
||||
$totalDesarrollo = ($cuentasPago['total']*$descuentos['desarrollo'])/100;
|
||||
$totalEspecial = ($cuentasPago['total']*$descuentos['especial'])/100;
|
||||
|
||||
//$totalDescuentos = $descuentos['publicidad'] + $descuentos['flete'] + $descuentos['desarrollo'] + $descuentos['especial'];
|
||||
$totalDescuentos = $totalPublicidad+$totalDesarrollo+$totalFlete+$totalEspecial;
|
||||
|
||||
$smarty->assign('totalPublicidad', $totalPublicidad);
|
||||
$smarty->assign('totalFlete', $totalFlete);
|
||||
$smarty->assign('totalDesarrollo', $totalDesarrollo);
|
||||
$smarty->assign('totalEspecial', $totalEspecial);
|
||||
|
||||
$smarty->assign('totalDescuentos', $totalDescuentos);
|
||||
$smarty->assign('descuentos', $descuentos);
|
||||
$smarty->assign('nombreProveedor', $nombreProveedor);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/ver-descuentos-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
//PAGOS
|
||||
|
||||
case 'addPago':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$infP = $pedido->Info();
|
||||
|
||||
if($infP['total2'] > 0)
|
||||
$infP['total'] = $infP['total2'];
|
||||
|
||||
$info['folioProv'] = $infP['folioProv'];
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $infP['totalPub'] + $infP['totalDes'] + $infP['totalFlete'] + $infP['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$info['saldo'] = $infP['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
|
||||
$metodosPago = $metodoPago->EnumerateAll();
|
||||
$metodosPago = $util->EncodeResult($metodosPago);
|
||||
|
||||
$ctasBancarias = $cuentaBancaria->EnumerateAll();
|
||||
$ctasBancarias = $util->EncodeResult($ctasBancarias);
|
||||
|
||||
$info['noPedido'] = $infP['noPedido'];
|
||||
$info['pedidoId'] = $pedidoId;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('metodosPago', $metodosPago);
|
||||
$smarty->assign('ctasBancarias', $ctasBancarias);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-pago-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddPago':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$metodoPagoId = $_POST['metodoPagoId'];
|
||||
$cuentaBancariaId = $_POST['cuentaBancariaId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
$noCheque = $_POST['noCheque'];
|
||||
$fecha = ($_POST['fecha'] != '') ? date('Y-m-d',strtotime($_POST['fecha'])) : '';
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
if($info['total2'] > 0)
|
||||
$info['total'] = $info['total2'];
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$cuentaPagar->setMetodoPagoId($metodoPagoId);
|
||||
$cuentaPagar->setProveedorId($info['proveedorId']);
|
||||
$cuentaPagar->setCantidad($cantidad);
|
||||
$cuentaPagar->setFecha($fecha);
|
||||
$cuentaPagar->setNoCheque($noCheque);
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $info['totalPub'] + $info['totalDes'] + $info['totalFlete'] + $info['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
if($cantidad > $saldo){
|
||||
$util->setError(20075, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$cuentaPagar->SavePago())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
//Checamos si ya esta pagado totalmente
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
$pagado = ($saldo == 0) ? 1 : 0;
|
||||
|
||||
//Actualizamos el status a Pagado
|
||||
if($pagado){
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->setPagado(1);
|
||||
$pedido->UpdatePagado();
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deletePago':
|
||||
|
||||
$pedidoPagoId = $_POST['id'];
|
||||
|
||||
$cuentaPagar->setPedidoPagoId($pedidoPagoId);
|
||||
$infP = $cuentaPagar->InfoPago();
|
||||
|
||||
$pedidoId = $infP['pedidoId'];
|
||||
|
||||
if(!$cuentaPagar->DeletePago())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
//Quitamos el status de Pagado
|
||||
$pedido->setPagado(0);
|
||||
$pedido->UpdatePagado();
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//NOTAS CREDITOS
|
||||
|
||||
case 'addNota':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$infP = $pedido->Info();
|
||||
|
||||
if($infP['total2'] > 0)
|
||||
$infP['total'] = $infP['total2'];
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $infP['totalPub'] + $infP['totalDes'] + $infP['totalFlete'] + $infP['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$info['saldo'] = $infP['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
|
||||
$info['noPedido'] = $infP['noPedido'];
|
||||
$info['pedidoId'] = $pedidoId;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-nota-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveAddNota':
|
||||
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
$noNota = $_POST['noNota'];
|
||||
$fecha = ($_POST['fecha'] != '') ? date('Y-m-d',strtotime($_POST['fecha'])) : '';
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
if($info['total2'] > 0)
|
||||
$info['total'] = $info['total2'];
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$cuentaPagar->setProveedorId($info['proveedorId']);
|
||||
$cuentaPagar->setNoNota($noNota);
|
||||
$cuentaPagar->setCantidad($cantidad);
|
||||
$cuentaPagar->setFecha($fecha);
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $info['totalPub'] + $info['totalDes'] + $info['totalFlete'] + $info['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
if($cantidad > $saldo){
|
||||
$util->setError(20075, 'error', '', '');
|
||||
$util->PrintErrors();
|
||||
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$cuentaPagar->SaveNota())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
//Checamos si ya esta pagado totalmente
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
$saldo = number_format($saldo,2,'.','');
|
||||
|
||||
$pagado = ($saldo == 0) ? 1 : 0;
|
||||
|
||||
//Actualizamos el status a Pagado
|
||||
if($pagado){
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$pedido->setPagado(1);
|
||||
$pedido->UpdatePagado();
|
||||
}
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $pedidoId;
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($totalNotas,2);
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($saldo,2);
|
||||
|
||||
echo '[#]';
|
||||
echo $pagado;
|
||||
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
echo '[#]';
|
||||
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$resNotas = $cuentaPagar->EnumNotas();
|
||||
|
||||
$notas = array();
|
||||
foreach($resNotas as $val){
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$notas[] = $val;
|
||||
}
|
||||
$item['notas'] = $notas;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-notas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteNota':
|
||||
|
||||
$pedidoNotaId = $_POST['id'];
|
||||
|
||||
$cuentaPagar->setPedidoNotaId($pedidoNotaId);
|
||||
$infN = $cuentaPagar->InfoNota();
|
||||
|
||||
$pedidoId = $infN['pedidoId'];
|
||||
|
||||
if(!$cuentaPagar->DeleteNota())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
if($info['total2'] > 0)
|
||||
$info['total'] = $info['total2'];
|
||||
|
||||
//Quitamos el status de Pagado
|
||||
$pedido->setPagado(0);
|
||||
$pedido->UpdatePagado();
|
||||
|
||||
//Obtenemos las notas realizadas
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$abonos = $cuentaPagar->GetTotalPagos();
|
||||
$totalNotas = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificaciones = $bonificacion->getBonificaciones();
|
||||
$devoluciones = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $info['totalPub'] + $info['totalDes'] + $info['totalFlete'] + $info['totalEsp'];
|
||||
$totalDesctos = number_format($totalDesc,2,'.','');
|
||||
|
||||
//$res['saldo'] = $res['total'] - $res['abonos'] - $res['bonificaciones'] - $res['devoluciones'];
|
||||
|
||||
$saldo = $info['total'] - $abonos - $bonificaciones - $devoluciones - $totalDesctos - $totalNotas;
|
||||
|
||||
echo 'ok[#]';
|
||||
echo $pedidoId;
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($totalNotas,2);
|
||||
|
||||
echo '[#]';
|
||||
echo '$'.number_format($saldo,2);
|
||||
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
|
||||
echo '[#]';
|
||||
$cuentaPagar->setPedidoId($pedidoId);
|
||||
$resNotas = $cuentaPagar->EnumNotas();
|
||||
|
||||
$notas = array();
|
||||
foreach($resNotas as $val){
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$notas[] = $val;
|
||||
}
|
||||
$item['notas'] = $notas;
|
||||
|
||||
$smarty->assign('item', $item);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-notas.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//OTHERS
|
||||
|
||||
case 'search':
|
||||
|
||||
$cuentaPagar->setProveedorId($_POST['proveedorId2']);
|
||||
$resCuenta = $cuentaPagar->Search();
|
||||
|
||||
$info['total'] = 0;
|
||||
$info['totalAbonos'] = 0;
|
||||
$info['totalNotas'] = 0;
|
||||
$info['totalDesc'] = 0;
|
||||
$info['totalBonif'] = 0;
|
||||
$info['totalDev'] = 0;
|
||||
$info['totalSaldo'] = 0;
|
||||
|
||||
$items = array();
|
||||
foreach($resCuenta as $res){
|
||||
|
||||
if(preg_match('/FOLIO/i',$res['folioProv']))
|
||||
continue;
|
||||
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$res['abonos'] = $cuentaPagar->GetTotalPagos();
|
||||
|
||||
//Obtenemos las notas de credito
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$res['totalNotas'] = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$bonificacion->setPedidoId($res['pedidoId']);
|
||||
$res['bonificaciones'] = $bonificacion->getBonificaciones();
|
||||
$res['devoluciones'] = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $res['totalPub'] + $res['totalDes'] + $res['totalFlete'] + $res['totalEsp'];
|
||||
$res['totalDescuentos'] = number_format($totalDesc,2,'.','');
|
||||
|
||||
if($res['total2'] > 0)
|
||||
$res['total'] = $res['total2'];
|
||||
|
||||
$res['saldo'] = $res['total'] - $res['abonos'] - $res['bonificaciones'] - $res['devoluciones'] - $res['totalDescuentos'] - $res['totalNotas'];
|
||||
|
||||
//Obtenemos las Notas de Credito
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$resNotas = $cuentaPagar->EnumNotas();
|
||||
|
||||
$notas = array();
|
||||
foreach($resNotas as $val){
|
||||
|
||||
$val['fecha'] = date('d-m-Y',strtotime($val['fecha']));
|
||||
|
||||
$notas[] = $val;
|
||||
}
|
||||
$res['notas'] = $notas;
|
||||
|
||||
$info['total'] += $res['total'];
|
||||
$info['totalAbonos'] += $res['abonos'];
|
||||
$info['totalNotas'] += $res['totalNotas'];
|
||||
$info['totalDesc'] += $res['totalDescuentos'];
|
||||
$info['totalBonif'] += $res['bonificaciones'];
|
||||
$info['totalDev'] += $res['devoluciones'];
|
||||
$info['totalSaldo'] += $res['saldo'];
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$cuentasPagar['items'] = $items;
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('tipo', 'search');
|
||||
$smarty->assign('cuentasPagar', $cuentasPagar);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagar.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case 'search2':
|
||||
|
||||
$cuentaPagar->setProveedorId($_POST['proveedorId2']);
|
||||
$resProv = $cuentaPagar->EnumProveedores();
|
||||
|
||||
$info['total'] = 0;
|
||||
$info['totalAbonos'] = 0;
|
||||
$info['totalNotas'] = 0;
|
||||
$info['totalDesc'] = 0;
|
||||
$info['totalBonif'] = 0;
|
||||
$info['totalDev'] = 0;
|
||||
$info['totalSaldo'] = 0;
|
||||
$info['totalSaldoInicial'] = 0;
|
||||
$info['totalTotal'] = 0;
|
||||
|
||||
$proveedores = array();
|
||||
foreach($resProv as $val){
|
||||
|
||||
$proveedor->setProveedorId($val['proveedorId']);
|
||||
$infPv = $proveedor->Info();
|
||||
$val['noProv'] = $infPv['noProv'];
|
||||
$val['proveedor'] = utf8_encode($proveedor->GetNameById());
|
||||
|
||||
$proveedor->setProveedorId($val['proveedorId']);
|
||||
$infP = $proveedor->Info();
|
||||
|
||||
$cuentaPagar->setProveedorId($val['proveedorId']);
|
||||
$resCuenta = $cuentaPagar->Search();
|
||||
|
||||
$totalG = 0;
|
||||
$totAbonos = 0;
|
||||
$totNotas = 0;
|
||||
$totBonificaciones = 0;
|
||||
$totDevoluciones = 0;
|
||||
$totDescuentos = 0;
|
||||
$totSaldo = 0;
|
||||
$facturas = array();
|
||||
foreach($resCuenta as $res){
|
||||
|
||||
if(preg_match('/FOLIO/i',$res['folioProv']))
|
||||
continue;
|
||||
|
||||
//Obtenemos los abonos realizados
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$res['abonos'] = $cuentaPagar->GetTotalPagos();
|
||||
$res['totalNotas'] = $cuentaPagar->GetTotalNotas();
|
||||
|
||||
$bonificacion->setPedidoId($res['pedidoId']);
|
||||
$res['bonificaciones'] = $bonificacion->getBonificaciones();
|
||||
$res['devoluciones'] = $bonificacion->getDevoluciones();
|
||||
|
||||
$totalDesc = $res['totalPub'] + $res['totalDes'] + $res['totalFlete'] + $res['totalEsp'];
|
||||
$res['totalDescuentos'] = number_format($totalDesc,2,'.','');
|
||||
|
||||
if($res['total2'] > 0)
|
||||
$res['total'] = $res['total2'];
|
||||
|
||||
$res['saldo'] = $res['total'] - $res['abonos'] - $res['bonificaciones'] - $res['devoluciones'] - $res['totalDescuentos'] - $res['totalNotas'];
|
||||
|
||||
$totalG += $res['total'];
|
||||
$totAbonos += $res['abonos'];
|
||||
$totNotas += $res['totalNotas'];
|
||||
$totBonificaciones += $res['bonificaciones'];
|
||||
$totDevoluciones += $res['devoluciones'];
|
||||
$totDescuentos += $res['totalDescuentos'];
|
||||
$totSaldo += $res['saldo'];
|
||||
|
||||
$info['total'] += $res['total'];
|
||||
$info['totalAbonos'] += $res['abonos'];
|
||||
$info['totalNotas'] += $res['totalNotas'];
|
||||
$info['totalDesc'] += $res['totalDescuentos'];
|
||||
$info['totalBonif'] += $res['bonificaciones'];
|
||||
$info['totalDev'] += $res['devoluciones'];
|
||||
$info['totalSaldo'] += $res['saldo'];
|
||||
|
||||
//Obtenemos los Pagos
|
||||
$cuentaPagar->setPedidoId($res['pedidoId']);
|
||||
$resPagos = $cuentaPagar->EnumPagos();
|
||||
|
||||
$pagos = array();
|
||||
foreach($resPagos as $res2){
|
||||
|
||||
$metodoPago->setMetodoPagoId($res2['metodoPagoId']);
|
||||
$res2['metodoPago'] = $metodoPago->GetNameById();
|
||||
|
||||
$res2['fecha'] = date('d-m-Y',strtotime($res2['fecha']));
|
||||
|
||||
$pagos[] = $res2;
|
||||
}
|
||||
$res['pagos'] = $pagos;
|
||||
|
||||
$facturas[] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
$val['facturas'] = $facturas;
|
||||
|
||||
if($totalG > 0){
|
||||
|
||||
$cuentaPagar->setProveedorId($val['proveedorId']);
|
||||
$abonosSaldoIni = $cuentaPagar->GetTotalPagosProv();
|
||||
|
||||
$val['total'] = $totalG + $infP['saldoCtaPagar'];
|
||||
$val['abonos'] += ($totAbonos + $abonosSaldoIni);
|
||||
$val['totalNotas'] += $totNotas;
|
||||
$val['bonificaciones'] += $totBonificaciones;
|
||||
$val['devoluciones'] += $totDevoluciones;
|
||||
$val['totalDescuentos'] += $totDescuentos;
|
||||
$val['saldo'] += ($totSaldo + $infP['saldoCtaPagar'] - $abonosSaldoIni);
|
||||
$val['saldoInicial'] = $infP['saldoCtaPagar'];
|
||||
$val['totalTotal'] = $val['saldo'] + $infP['saldoCtaPagar'];
|
||||
|
||||
$info['totalSaldoInicial'] += $infP['saldoCtaPagar'];
|
||||
$info['totalTotal'] += $val['totalTotal'];
|
||||
|
||||
$info['total'] += $infP['saldoCtaPagar'];
|
||||
$info['totalSaldo'] += ($infP['saldoCtaPagar'] - $abonosSaldoIni);
|
||||
$info['totalAbonos'] += $abonosSaldoIni;
|
||||
|
||||
$proveedores[] = $val;
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
$proveedores = $util->orderMultiDimensionalArray($proveedores, 'proveedor');
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('tipo', 'search');
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/cuentas-pagar2.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,518 +0,0 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
session_start();
|
||||
$p = $_SESSION['edpP'];
|
||||
$projectId = $_SESSION['curProjId'];
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'suggestBonificacion':
|
||||
$bonificacion->setPedidoId($_POST['search1']);
|
||||
$bonificacion->setSearch($_POST['search2']);
|
||||
$bonificacion->setStatus($_POST['filtraStatus']);
|
||||
|
||||
$bonificaciones = $bonificacion->EnumerateSearch();
|
||||
|
||||
//$bonificaciones = $bonificacion->Enumerate();
|
||||
|
||||
foreach($bonificaciones['items'] as $key => $productosBonificacion)
|
||||
{
|
||||
$proveedor->setProveedorId($productosBonificacion['proveedorId']);
|
||||
$bonificaciones['items'][$key]['nombreProveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$bonificacion->setProductoId($productosBonificacion['productoId']);
|
||||
$bonificacion->setPedidoId($productosBonificacion['pedidoId']);
|
||||
$resP = $bonificacion->searchProductoById();
|
||||
|
||||
$producto->setProductoId($productosBonificacion['productoId']);
|
||||
$infoProd = $producto->Info();
|
||||
|
||||
/* $atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());*/
|
||||
//echo $productosBonificacion['totalProductos']."***".$productosBonificacion['costoProducto']."<br>";
|
||||
$bonificaciones['items'][$key]['nombreProducto'] = $infoProd['modelo'];//$productosBonificacion['modelo'];//.' '.$talla.' '.$color;
|
||||
$bonificaciones['items'][$key]['codigoBarra'] = $infoProd['codigoBarra'];
|
||||
$bonificaciones['items'][$key]['costoTotal'] = $productosBonificacion['totalProductos']*$productosBonificacion['costoProducto'];
|
||||
$bonificaciones['items'][$key]['costoTotalVendido'] = $productosBonificacion['vendido']*$productosBonificacion['costoProducto'];
|
||||
@$bonificaciones['items'][$key]['porcentajeUtilidad'] = ($bonificaciones['items'][$key]['costoTotal']-$bonificaciones['items'][$key]['costoTotalVendido'])/$bonificaciones['items'][$key]['costoTotalVendido'];
|
||||
if($bonificaciones['items'][$key]['costoTotal'] > $bonificaciones['items'][$key]['costoTotalVendido'])
|
||||
$bonificaciones['items'][$key]['porcentajeUtilidad'] = "-".$bonificaciones['items'][$key]['porcentajeUtilidad'];
|
||||
}
|
||||
//print_r($bonificaciones);
|
||||
|
||||
$bonificacion->setPedidoId($_POST['search1']);
|
||||
$bonificacion->setSearch($_POST['search2']);
|
||||
$bonificacion->setStatus($_POST['filtraStatus']);
|
||||
$resPedidos = $bonificacion->GetPedidos();
|
||||
//print_r($resPedidos);
|
||||
foreach($resPedidos as $key => $resPedido)
|
||||
{
|
||||
$evaluacion->setPedidoId($resPedido['pedidoId']);
|
||||
$proveedor->setProveedorId($resPedido['proveedorId']);
|
||||
$resPedidos[$key]['compraFirme'] = $proveedor->GetCompraFirme();
|
||||
$totalBonificaciones = $evaluacion->getTotalBonificaciones();
|
||||
$totalDevoluciones = $evaluacion->getTotalDevoluciones();
|
||||
$resPedidos[$key]["totalBonificacion"] = $totalBonificaciones;
|
||||
$resPedidos[$key]["totalDevolucion"] = $totalDevoluciones;
|
||||
}
|
||||
//print_r($bonificaciones);
|
||||
$bonificaciones['items'] = $bonificacion->Util()->EncodeResult($bonificaciones['items']);
|
||||
$resPedidos = $bonificacion->Util()->EncodeResult($resPedidos);
|
||||
echo "ok[#]";
|
||||
$smarty->assign('bonificaciones', $bonificaciones);
|
||||
$smarty->assign('resPedidos', $resPedidos);
|
||||
$smarty->assign('pedidoStatus',$_POST['filtraStatus']);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/bonificaciones-pendientes.tpl');
|
||||
break;
|
||||
case 'cambiarStatus':
|
||||
|
||||
//$bonificacionId = $_POST['bonificacionId'];
|
||||
//$justificante = $_POST['justificante'];
|
||||
//$aux = $_POST['aux'];
|
||||
|
||||
/*if($status == "Rechazado" && $aux == 1)
|
||||
{
|
||||
$smarty->assign('status', $status);
|
||||
$smarty->assign('bonificacionId', $bonificacionId);
|
||||
echo 'Rechazo[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/justificar-rechazo-bonificacion.tpl');
|
||||
exit(0);
|
||||
}*/
|
||||
|
||||
//$bonificacion->setBonificacionId($bonificacionId);
|
||||
$bonificacion->setPedidoId($_POST['pedidoId']);
|
||||
$bonificacion->setTotalDevolucion($_POST['totalDevolucion']);
|
||||
$bonificacion->setTotalBonificacion($_POST['totalBonificacion']);
|
||||
//$bonificacion->setCantidad($totalBonificacion);
|
||||
/*if($status == "Rechazado")
|
||||
$bonificacion->setJustificanteRechazo($justificante);*/
|
||||
|
||||
if(!$bonificacion->updateStatus())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
$bonificaciones = $bonificacion->Enumerate();
|
||||
|
||||
foreach($bonificaciones['items'] as $key => $productosBonificacion)
|
||||
{
|
||||
$proveedor->setProveedorId($productosBonificacion['proveedorId']);
|
||||
$bonificaciones['items'][$key]['nombreProveedor'] = $proveedor->GetNameById();
|
||||
|
||||
$bonificacion->setProductoId($productosBonificacion['productoId']);
|
||||
$bonificacion->setPedidoId($productosBonificacion['pedidoId']);
|
||||
$resP = $bonificacion->searchProductoById();
|
||||
|
||||
$producto->setProductoId($productosBonificacion['productoId']);
|
||||
$infoProd = $producto->Info();
|
||||
|
||||
/* $atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());*/
|
||||
//echo $productosBonificacion['totalProductos']."***".$productosBonificacion['costoProducto']."<br>";
|
||||
$bonificaciones['items'][$key]['nombreProducto'] = $infoProd['modelo'];//$productosBonificacion['modelo'];//.' '.$talla.' '.$color;
|
||||
$bonificaciones['items'][$key]['codigoBarra'] = $infoProd['codigoBarra'];
|
||||
$bonificaciones['items'][$key]['costoTotal'] = $productosBonificacion['totalProductos']*$productosBonificacion['costoProducto'];
|
||||
$bonificaciones['items'][$key]['costoTotalVendido'] = $productosBonificacion['vendido']*$productosBonificacion['costoProducto'];
|
||||
@$bonificaciones['items'][$key]['porcentajeUtilidad'] = ($bonificaciones['items'][$key]['costoTotal']-$bonificaciones['items'][$key]['costoTotalVendido'])/$bonificaciones['items'][$key]['costoTotalVendido'];
|
||||
if($bonificaciones['items'][$key]['costoTotal'] > $bonificaciones['items'][$key]['costoTotalVendido'])
|
||||
$bonificaciones['items'][$key]['porcentajeUtilidad'] = "-".$bonificaciones['items'][$key]['porcentajeUtilidad'];
|
||||
}
|
||||
//print_r($bonificaciones);
|
||||
|
||||
$resPedidos = $evaluacion->GetPedidos();
|
||||
//print_r($resPedidos);
|
||||
foreach($resPedidos as $key => $resPedido)
|
||||
{
|
||||
$evaluacion->setPedidoId($resPedido['pedidoId']);
|
||||
$proveedor->setProveedorId($resPedido['proveedorId']);
|
||||
$resPedidos[$key]['compraFirme'] = $proveedor->GetCompraFirme();
|
||||
$totalBonificaciones = $evaluacion->getTotalBonificaciones();
|
||||
$totalDevoluciones = $evaluacion->getTotalDevoluciones();
|
||||
$resPedidos[$key]["totalBonificacion"] = $totalBonificaciones;
|
||||
$resPedidos[$key]["totalDevolucion"] = $totalDevoluciones;
|
||||
}
|
||||
|
||||
$smarty->assign('resPedidos', $resPedidos);
|
||||
$smarty->assign('bonificaciones', $bonificaciones);
|
||||
$bonificaciones['items'] = $bonificacion->Util()->EncodeResult($bonificaciones['items']);
|
||||
$smarty->assign('bonificaciones', $bonificaciones);
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/bonificaciones-pendientes.tpl');
|
||||
}
|
||||
break;
|
||||
case 'addPago':
|
||||
$menuBon = $_POST['menu'];
|
||||
$ids = $_POST['id'];
|
||||
//{$it.productoId}##{$it.prodItemId}##{$item.pedidoId}##{$item.proveedorId}
|
||||
$ids = split("##", $ids);
|
||||
|
||||
$productoId = $ids[0];
|
||||
$prodItemId = $ids[1];
|
||||
$pedidoId = $ids[2];
|
||||
$proveedorId = $ids[3];
|
||||
|
||||
$costo = $ids[4];
|
||||
$total = $ids[5];
|
||||
$disponible = $ids[6];
|
||||
$vendido = $ids[7];
|
||||
$porcentajeVendido = $ids[8];
|
||||
$porcentajeAplicado = $ids[9];
|
||||
$pagoTotal = $ids[10];
|
||||
|
||||
$evaluacion->setPedidoId($pedidoId);
|
||||
|
||||
$infoPro = $evaluacion->InfoPedidoProveedor();
|
||||
|
||||
$evaluacion->setProdItemId($prodItemId);
|
||||
//echo "<br>";
|
||||
$producto = $evaluacion->searchProductoById();
|
||||
|
||||
//print_r($producto);// exit(0);
|
||||
$smarty->assign('productoId', $productoId);
|
||||
$smarty->assign('prodItemId', $prodItemId);
|
||||
$smarty->assign('pedidoId', $pedidoId);
|
||||
$smarty->assign('proveedorId', $proveedorId);
|
||||
|
||||
$smarty->assign('costo', $costo);
|
||||
$smarty->assign('total', $total);
|
||||
$smarty->assign('disponible', $disponible);
|
||||
$smarty->assign('vendido', $vendido);
|
||||
$smarty->assign('porcentajeVendido', $porcentajeVendido);
|
||||
$smarty->assign('porcentajeAplicado', $porcentajeAplicado);
|
||||
$smarty->assign('pagoTotal', $pagoTotal);
|
||||
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-bonificacion-popup.tpl');
|
||||
break;
|
||||
|
||||
case 'saveAddPago':
|
||||
|
||||
$productoId = $_POST['productoId'];
|
||||
$prodItemId = $_POST['prodItemId'];
|
||||
$pedidoId = $_POST['pedidoId'];
|
||||
$proveedorId = $_POST['proveedorId'];
|
||||
|
||||
$costo = $_POST['costo'];
|
||||
$total = $_POST['total'];
|
||||
$disponible = $_POST['disponible'];
|
||||
$vendido = $_POST['vendido'];
|
||||
$porcentajeVendido = $_POST['porcentajeVendido'];
|
||||
$porcentajeAplicado = $_POST['porcentajeAplicado'];
|
||||
$pagoTotal = $_POST['pagoTotal'];
|
||||
|
||||
$porcentajeBonifica = $_POST['bonificacion'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
|
||||
$restante = $pagoTotal - $cantidad;
|
||||
|
||||
$bonificacion->setProdItemId($prodItemId);
|
||||
$bonificacion->setProveedorId($proveedorId);
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$bonificacion->setPorcentajeBonifica($porcentajeBonifica);
|
||||
$bonificacion->setPagoTotal($pagoTotal);
|
||||
$bonificacion->setRestante($restante);
|
||||
$bonificacion->setPorcentajeAplicado($porcentajeAplicado);
|
||||
$bonificacion->setTotal($total);
|
||||
$bonificacion->setCosto($costo);
|
||||
$bonificacion->setDisponible($disponible);
|
||||
$bonificacion->setVendido($vendido);
|
||||
$bonificacion->setPorcentajeVendido($porcentajeVendido);
|
||||
$bonificacion->setCantidad($cantidad);
|
||||
|
||||
//exit(0);
|
||||
if(!$bonificacion->Save())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
/////////////
|
||||
$evaluarPedidos = $evaluacion->Enumerate();
|
||||
|
||||
$rfc->setRfcId("1");
|
||||
$rfcInfo = $rfc->Info();
|
||||
$items = array();
|
||||
$politicas = $politica->EnumerateAll();
|
||||
|
||||
foreach($evaluarPedidos['items'] as $res)
|
||||
{
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = $proveedor->GetNameById();
|
||||
$proveedorInfo = $proveedor->Info();
|
||||
$porcentajeBonifProveedor = $proveedorInfo['bonificacion'];
|
||||
|
||||
$evaluacion->setPedidoId($res['pedidoId']);
|
||||
$evaluacion->setPlazo($res['plazo']);
|
||||
$evaluacion->setFecha($res['fechaEntrega']);
|
||||
$evaluacion->setBonificacion($res['bonificacion']);
|
||||
|
||||
if($evaluacion->evaluar())
|
||||
{
|
||||
$productosRes = $evaluacion->searchProductos();
|
||||
$productosR = array();
|
||||
|
||||
foreach($productosRes as $resP)
|
||||
{
|
||||
// print_r($resP); exit(0);
|
||||
|
||||
$bonificacion->setProdItemId($resP['prodItemId']);
|
||||
$bonificacion->setProveedorId($resP['proveedorId']);
|
||||
$bonificacion->setPedidoId($resP['pedidoId']);
|
||||
$bonificacion->setProductoId($resP['productoId']);
|
||||
|
||||
if($bonificacion->checkBonificacion())
|
||||
{
|
||||
$atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$evaluacion->setProdItemId($resP['prodItemId']);
|
||||
|
||||
$resP['disponible'] = $evaluacion->GetDisponible();
|
||||
$resP['total'] = $evaluacion->GetTotalProductosPedido();
|
||||
$resP['vendido'] = $evaluacion->GetTotalVendidos();
|
||||
$resP['porcentajeVendido'] = $evaluacion->evaluarVentas();
|
||||
|
||||
$resP['costoTotal'] = $resP['total']*$resP['costo'];
|
||||
foreach($politicas as $key => $politica)
|
||||
{
|
||||
$porcentaje1 = $politicas[$key]['porcentajeEvaluacion'];
|
||||
if(isset($politicas[$key+1]['porcentajeEvaluacion']))
|
||||
$porcentaje2 = $politicas[$key+1]['porcentajeEvaluacion'];
|
||||
else
|
||||
$porcentaje2 = 0;
|
||||
|
||||
if($resP['porcentajeVendido'] <= $porcentaje1 && $resP['porcentajeVendido'] > $porcentaje2)
|
||||
{
|
||||
//$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$porcentajeBonifProveedor)/100);
|
||||
$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$politicas[$key]['porcentajeBonificacion'])/100);
|
||||
$resP['porcentajeAplicado'] = $politicas[$key]['porcentajeBonificacion'];//$politica['porcentajeBonificacion'];
|
||||
if($politica['tipo'] == "Devolucion")
|
||||
{
|
||||
$resP['costoDevolucion'] = $resP['disponible']*$resP['costo'];
|
||||
$resP['costoBonificacion'] = "";
|
||||
$resP['porcentajeAplicado'] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resP['nombre'] = $resP['modelo'].' '.$talla.' '.$color;
|
||||
|
||||
$productosR[] = $resP;
|
||||
}
|
||||
}
|
||||
$res['productos'] = $productosR;
|
||||
$items[] = $res;
|
||||
}
|
||||
}
|
||||
$evaluarPedidos['items'] = $items;
|
||||
|
||||
$smarty->assign('rfcInfo',$rfcInfo);
|
||||
|
||||
$smarty->assign('msg', $msg);
|
||||
$smarty->assign('evaluarPedidos', $evaluarPedidos);
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/evaluar-pedidos.tpl');
|
||||
|
||||
/*$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');*/
|
||||
}
|
||||
break;
|
||||
case 'saveDevolucion':
|
||||
$ids = $_POST['id'];
|
||||
//{$it.productoId}##{$it.prodItemId}##{$item.pedidoId}##{$item.proveedorId}
|
||||
$ids = split("##", $ids);
|
||||
|
||||
$productoId = $ids[0];
|
||||
$prodItemId = $ids[1];
|
||||
$pedidoId = $ids[2];
|
||||
$proveedorId = $ids[3];
|
||||
|
||||
$costo = $ids[4];
|
||||
$total = $ids[5];
|
||||
$disponible = $ids[6];
|
||||
$vendido = $ids[7];
|
||||
$porcentajeVendido = $ids[8];
|
||||
$porcentajeAplicado = $ids[9];
|
||||
$pagoTotal = $ids[10];
|
||||
|
||||
$porcentajeBonifica = $_POST['bonificacion'];
|
||||
$cantidad = $_POST['cantidad'];
|
||||
|
||||
$restante = $pagoTotal - $cantidad;
|
||||
|
||||
$bonificacion->setProdItemId($prodItemId);
|
||||
$bonificacion->setProveedorId($proveedorId);
|
||||
$bonificacion->setPedidoId($pedidoId);
|
||||
$bonificacion->setProductoId($productoId);
|
||||
$bonificacion->setPorcentajeBonifica($porcentajeBonifica);
|
||||
$bonificacion->setPagoTotal($pagoTotal);
|
||||
$bonificacion->setRestante($restante);
|
||||
$bonificacion->setPorcentajeAplicado($porcentajeAplicado);
|
||||
$bonificacion->setTotal($total);
|
||||
$bonificacion->setCosto($costo);
|
||||
$bonificacion->setDisponible($disponible);
|
||||
$bonificacion->setVendido($vendido);
|
||||
$bonificacion->setPorcentajeVendido($porcentajeVendido);
|
||||
$bonificacion->setCantidad($cantidad);
|
||||
|
||||
//exit(0);
|
||||
if(!$bonificacion->SaveDevolucion())
|
||||
{
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}else
|
||||
{
|
||||
/////////////
|
||||
$evaluarPedidos = $evaluacion->Enumerate();
|
||||
|
||||
$rfc->setRfcId("1");
|
||||
$rfcInfo = $rfc->Info();
|
||||
$items = array();
|
||||
$politicas = $politica->EnumerateAll();
|
||||
|
||||
foreach($evaluarPedidos['items'] as $res)
|
||||
{
|
||||
$proveedor->setProveedorId($res['proveedorId']);
|
||||
$res['proveedor'] = $proveedor->GetNameById();
|
||||
$proveedorInfo = $proveedor->Info();
|
||||
$porcentajeBonifProveedor = $proveedorInfo['bonificacion'];
|
||||
|
||||
$evaluacion->setPedidoId($res['pedidoId']);
|
||||
$evaluacion->setPlazo($res['plazo']);
|
||||
$evaluacion->setFecha($res['fechaEntrega']);
|
||||
$evaluacion->setBonificacion($res['bonificacion']);
|
||||
|
||||
if($evaluacion->evaluar())
|
||||
{
|
||||
$productosRes = $evaluacion->searchProductos();
|
||||
$productosR = array();
|
||||
|
||||
foreach($productosRes as $resP)
|
||||
{
|
||||
// print_r($resP); exit(0);
|
||||
|
||||
$bonificacion->setProdItemId($resP['prodItemId']);
|
||||
$bonificacion->setProveedorId($resP['proveedorId']);
|
||||
$bonificacion->setPedidoId($resP['pedidoId']);
|
||||
$bonificacion->setProductoId($resP['productoId']);
|
||||
|
||||
if($bonificacion->checkBonificacion())
|
||||
{
|
||||
$atribVal->setAtribValId($resP['tallaId']);
|
||||
$talla = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$atribVal->setAtribValId($resP['colorId']);
|
||||
$color = utf8_encode($atribVal->GetNameById());
|
||||
|
||||
$evaluacion->setProdItemId($resP['prodItemId']);
|
||||
|
||||
$resP['disponible'] = $evaluacion->GetDisponible();
|
||||
$resP['total'] = $evaluacion->GetTotalProductosPedido();
|
||||
$resP['vendido'] = $evaluacion->GetTotalVendidos();
|
||||
$resP['porcentajeVendido'] = $evaluacion->evaluarVentas();
|
||||
|
||||
$resP['costoTotal'] = $resP['total']*$resP['costo'];
|
||||
foreach($politicas as $key => $politica)
|
||||
{
|
||||
$porcentaje1 = $politicas[$key]['porcentajeEvaluacion'];
|
||||
if(isset($politicas[$key+1]['porcentajeEvaluacion']))
|
||||
$porcentaje2 = $politicas[$key+1]['porcentajeEvaluacion'];
|
||||
else
|
||||
$porcentaje2 = 0;
|
||||
|
||||
if($resP['porcentajeVendido'] <= $porcentaje1 && $resP['porcentajeVendido'] > $porcentaje2)
|
||||
{
|
||||
//$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$porcentajeBonifProveedor)/100);
|
||||
$resP['costoBonificacion'] = $resP['disponible']*(($resP['costo']*$politicas[$key]['porcentajeBonificacion'])/100);
|
||||
$resP['porcentajeAplicado'] = $politicas[$key]['porcentajeBonificacion'];//$politica['porcentajeBonificacion'];
|
||||
if($politica['tipo'] == "Devolucion")
|
||||
{
|
||||
$resP['costoDevolucion'] = $resP['disponible']*$resP['costo'];
|
||||
$resP['costoBonificacion'] = "";
|
||||
$resP['porcentajeAplicado'] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resP['nombre'] = $resP['modelo'].' '.$talla.' '.$color;
|
||||
|
||||
$productosR[] = $resP;
|
||||
}
|
||||
}
|
||||
$res['productos'] = $productosR;
|
||||
$items[] = $res;
|
||||
}
|
||||
}
|
||||
$evaluarPedidos['items'] = $items;
|
||||
|
||||
$smarty->assign('rfcInfo',$rfcInfo);
|
||||
|
||||
$smarty->assign('msg', $msg);
|
||||
$smarty->assign('evaluarPedidos', $evaluarPedidos);
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
echo 'ok[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
echo '[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/evaluar-pedidos.tpl');
|
||||
|
||||
/*$atributos = $atributo->Enumerate();
|
||||
$atributos["items"] = $util->EncodeResult($atributos["items"]);
|
||||
|
||||
$items = array();
|
||||
foreach($atributos['items'] as $res){
|
||||
$card = $res;
|
||||
|
||||
$atribVal->setAtributoId($res['atributoId']);
|
||||
$valores = $atribVal->EnumerateAll();
|
||||
$card['valores'] = $util->EncodeResult($valores);
|
||||
|
||||
$items[] = $card;
|
||||
}
|
||||
$atributos['items'] = $items;
|
||||
|
||||
$smarty->assign('atributos', $atributos);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/atributos.tpl');*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
ini_set('display_errors', 'Off'); // Suppress errors in AJAX response
|
||||
session_start();
|
||||
require_once '../init.php';
|
||||
require_once '../config.php';
|
||||
@@ -16,15 +17,27 @@
|
||||
|
||||
$empresa->setEmail($email);
|
||||
$empresa->setPassword($password);
|
||||
$empresa->setEmpresaId(15);
|
||||
$empresa->setEmpresaId("15");
|
||||
|
||||
// Check for validation errors set by setEmail, setPassword, setEmpresaId
|
||||
if($empresa->Util()->GetError())
|
||||
{
|
||||
$empresa->Util()->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$empresa->DoLogin())
|
||||
{
|
||||
// If DoLogin itself sets errors (e.g., incorrect credentials), print them here
|
||||
if($empresa->Util()->GetError()){
|
||||
$empresa->Util()->PrintErrors();
|
||||
}
|
||||
echo 'fail[#]';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'ok[#]';
|
||||
echo 'ok[#]ok';
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
296
ajax/php_errors.log
Normal file
296
ajax/php_errors.log
Normal file
@@ -0,0 +1,296 @@
|
||||
[06-Jan-2026 22:39:39 America/Mexico_City] WARNING: No hay conexión a base de datos. Usando modo desarrollo. Connection refused
|
||||
[06-Jan-2026 22:39:39 America/Mexico_City] PHP Warning: Undefined array key "email" in /var/www/html/ventas/ajax/login.php on line 8
|
||||
[06-Jan-2026 22:39:39 America/Mexico_City] PHP Warning: Undefined array key "password" in /var/www/html/ventas/ajax/login.php on line 9
|
||||
[06-Jan-2026 22:39:39 America/Mexico_City] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Util::ValidateInteger(), 1 passed in /var/www/html/ventas/classes/empresa.class.php on line 333 and exactly 2 expected in /var/www/html/ventas/classes/util.class.php:143
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/empresa.class.php(333): Util->ValidateInteger()
|
||||
#1 /var/www/html/ventas/ajax/login.php(10): Empresa->setEmpresaId()
|
||||
#2 {main}
|
||||
thrown in /var/www/html/ventas/classes/util.class.php on line 143
|
||||
[06-Jan-2026 22:42:33 America/Mexico_City] WARNING: No hay conexión a base de datos. Usando modo desarrollo. Connection refused
|
||||
[06-Jan-2026 22:42:41 America/Mexico_City] WARNING: No hay conexión a base de datos. Usando modo desarrollo. Connection refused
|
||||
[06-Jan-2026 22:42:41 America/Mexico_City] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Util::ValidateMail(), 1 passed in /var/www/html/ventas/classes/empresa.class.php on line 347 and exactly 2 expected in /var/www/html/ventas/classes/util.class.php:167
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/empresa.class.php(347): Util->ValidateMail()
|
||||
#1 /var/www/html/ventas/ajax/login.php(17): Empresa->setEmail()
|
||||
#2 {main}
|
||||
thrown in /var/www/html/ventas/classes/util.class.php on line 167
|
||||
[06-Jan-2026 22:43:35 America/Mexico_City] WARNING: No hay conexión a base de datos. Usando modo desarrollo. Connection refused
|
||||
[06-Jan-2026 22:43:35 America/Mexico_City] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Util::ValidateMail(), 1 passed in /var/www/html/ventas/classes/empresa.class.php on line 347 and exactly 2 expected in /var/www/html/ventas/classes/util.class.php:167
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/empresa.class.php(347): Util->ValidateMail()
|
||||
#1 /var/www/html/ventas/ajax/login.php(17): Empresa->setEmail()
|
||||
#2 {main}
|
||||
thrown in /var/www/html/ventas/classes/util.class.php on line 167
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] WARNING: No hay conexión a base de datos. Usando modo desarrollo. Connection refused
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] Mock Query: SELECT usuarioId FROM usuario
|
||||
WHERE email = 'admin@novomoda.com.mx'
|
||||
AND password = 'MiPo6425@@'
|
||||
AND empresaId = '15'
|
||||
AND baja = '0'
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/db.class.php on line 208
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] Mock Query: SELECT * FROM usuario
|
||||
LEFT JOIN empresa ON usuario.empresaId = empresa.empresaId
|
||||
WHERE usuarioId = '0'
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/empresa.class.php on line 412
|
||||
[06-Jan-2026 22:58:41 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/empresa.class.php on line 414
|
||||
[06-Jan-2026 22:58:43 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:58:43 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:58:43 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:58:43 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:03 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:03 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:03 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:03 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:05 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:05 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:05 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:05 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:20 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:20 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:20 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:20 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:21 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 22:59:22 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 23:01:07 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:01:07 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:01:07 America/Mexico_City] PHP Warning: Undefined array key "errors" in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 23:01:07 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/util.class.php on line 487
|
||||
[06-Jan-2026 23:03:06 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:03:06 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:04:03 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:04:03 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:05:11 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:05:11 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:05:43 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:05:43 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:07:18 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:07:18 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:15:43 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:15:43 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:20:12 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:20:12 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:22:14 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:22:14 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:29:26 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:29:26 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:29:26 America/Mexico_City] PHP Warning: Undefined property: Util::$complete in /var/www/html/ventas/classes/util.class.php on line 430
|
||||
[06-Jan-2026 23:30:14 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:30:14 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:30:14 America/Mexico_City] PHP Warning: Undefined property: Util::$complete in /var/www/html/ventas/classes/util.class.php on line 430
|
||||
[06-Jan-2026 23:31:15 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:31:15 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:31:20 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:31:20 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:32:07 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:32:07 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[06-Jan-2026 23:32:07 America/Mexico_City] PHP Warning: Undefined array key "tipoUsr" in /var/www/html/ventas/ajax/logout.php on line 10
|
||||
[06-Jan-2026 23:32:13 America/Mexico_City] WARNING: No hay conexión a base de datos. Usando modo desarrollo. Connection refused
|
||||
[06-Jan-2026 23:32:13 America/Mexico_City] Mock Query: SELECT usuarioId FROM usuario
|
||||
WHERE email = 'admin@novomoda.com.mx'
|
||||
AND password = 'MiPo6425@@'
|
||||
AND empresaId = '15'
|
||||
AND baja = '0'
|
||||
[06-Jan-2026 23:32:13 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/db.class.php on line 208
|
||||
[06-Jan-2026 23:32:13 America/Mexico_City] Mock Query: SELECT * FROM usuario
|
||||
LEFT JOIN empresa ON usuario.empresaId = empresa.empresaId
|
||||
WHERE usuarioId = '0'
|
||||
[06-Jan-2026 23:32:13 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/empresa.class.php on line 407
|
||||
[06-Jan-2026 23:32:13 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/classes/empresa.class.php on line 409
|
||||
[06-Jan-2026 23:33:18 America/Mexico_City] Error validando BD avantikads_nm15: Connection refused
|
||||
[06-Jan-2026 23:33:18 America/Mexico_City] Base de datos avantikads_nm15 no encontrada, usando fallback a master
|
||||
[07-Jan-2026 00:29:06 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to a member function EncodeRow() on null in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:29:27 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to a member function EncodeRow() on null in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:30:39 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to a member function EncodeRow() on null in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:31:01 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to a member function EncodeRow() on null in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:31:36 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(227): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(109): DB->InsertData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(19): MetodoPago->Save()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:31:45 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(227): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(109): DB->InsertData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(19): MetodoPago->Save()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:32:30 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to a member function EncodeRow() on null in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:34:00 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to undefined method Util::EncodeRow() in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:34:28 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to undefined method Util::EncodeRow() in /var/www/html/ventas/classes/metodoPago.class.php:33
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/ajax/metodos-pago.php(42): MetodoPago->Info()
|
||||
#1 {main}
|
||||
thrown in /var/www/html/ventas/classes/metodoPago.class.php on line 33
|
||||
[07-Jan-2026 00:35:39 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:36:11 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:39:28 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:39:47 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:40:01 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:40:47 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:41:35 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:41:37 America/Mexico_City] PHP Fatal error: Uncaught TypeError: mysqli_free_result(): Argument #1 ($result) must be of type mysqli_result, true given in /var/www/html/ventas/classes/db.class.php:257
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/classes/db.class.php(257): mysqli_free_result()
|
||||
#1 /var/www/html/ventas/classes/db.class.php(242): DB->CleanQuery()
|
||||
#2 /var/www/html/ventas/classes/metodoPago.class.php(128): DB->UpdateData()
|
||||
#3 /var/www/html/ventas/ajax/metodos-pago.php(55): MetodoPago->Update()
|
||||
#4 {main}
|
||||
thrown in /var/www/html/ventas/classes/db.class.php on line 257
|
||||
[07-Jan-2026 00:43:01 America/Mexico_City] PHP Fatal error: Uncaught Error: Call to undefined method Util::EncodeResult() in /var/www/html/ventas/ajax/metodos-pago.php:66
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in /var/www/html/ventas/ajax/metodos-pago.php on line 66
|
||||
[07-Jan-2026 01:03:00 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:00 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:00 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:00 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:00 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/templates_c/a2d84734284ccd0cf65c401208f8cbb3abc2582f.file.pages_new.tpl.php on line 24
|
||||
[07-Jan-2026 01:03:00 America/Mexico_City] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/ventas/templates_c/a2d84734284ccd0cf65c401208f8cbb3abc2582f.file.pages_new.tpl.php:24
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(405): include()
|
||||
#1 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(517): Smarty_Internal_Template->renderTemplate()
|
||||
#2 /var/www/html/ventas/templates_c/9463f5eb94e258299f76f9fcf7196e1f49f4ffbd.file.usuarios.tpl.php(47): Smarty_Internal_Template->getRenderedTemplate()
|
||||
#3 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(405): include('...')
|
||||
#4 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(517): Smarty_Internal_Template->renderTemplate()
|
||||
#5 /var/www/html/ventas/libs/Smarty.class.php(308): Smarty_Internal_Template->getRenderedTemplate()
|
||||
#6 /var/www/html/ventas/libs/Smarty.class.php(325): Smarty->fetch()
|
||||
#7 /var/www/html/ventas/ajax/usuarios.php(191): Smarty->display()
|
||||
#8 {main}
|
||||
thrown in /var/www/html/ventas/templates_c/a2d84734284ccd0cf65c401208f8cbb3abc2582f.file.pages_new.tpl.php on line 24
|
||||
[07-Jan-2026 01:03:13 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:13 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:13 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 27
|
||||
[07-Jan-2026 01:03:13 America/Mexico_City] PHP Warning: Trying to access array offset on null in /var/www/html/ventas/templates_c/a2d84734284ccd0cf65c401208f8cbb3abc2582f.file.pages_new.tpl.php on line 24
|
||||
[07-Jan-2026 01:03:13 America/Mexico_City] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/ventas/templates_c/a2d84734284ccd0cf65c401208f8cbb3abc2582f.file.pages_new.tpl.php:24
|
||||
Stack trace:
|
||||
#0 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(405): include()
|
||||
#1 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(517): Smarty_Internal_Template->renderTemplate()
|
||||
#2 /var/www/html/ventas/templates_c/9463f5eb94e258299f76f9fcf7196e1f49f4ffbd.file.usuarios.tpl.php(47): Smarty_Internal_Template->getRenderedTemplate()
|
||||
#3 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(405): include('...')
|
||||
#4 /var/www/html/ventas/libs/sysplugins/smarty_internal_template.php(517): Smarty_Internal_Template->renderTemplate()
|
||||
#5 /var/www/html/ventas/libs/Smarty.class.php(308): Smarty_Internal_Template->getRenderedTemplate()
|
||||
#6 /var/www/html/ventas/libs/Smarty.class.php(325): Smarty->fetch()
|
||||
#7 /var/www/html/ventas/ajax/usuarios.php(191): Smarty->display()
|
||||
#8 {main}
|
||||
thrown in /var/www/html/ventas/templates_c/a2d84734284ccd0cf65c401208f8cbb3abc2582f.file.pages_new.tpl.php on line 24
|
||||
[07-Jan-2026 01:06:20 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 28
|
||||
[07-Jan-2026 01:06:20 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 28
|
||||
[07-Jan-2026 01:06:20 America/Mexico_City] PHP Warning: Undefined array key "sucursal" in /var/www/html/ventas/templates_c/e85f9d694d4f200f132b4040dda6b61222954514.file.usuarios-base.tpl.php on line 28
|
||||
@@ -231,6 +231,7 @@ switch($_POST["type"])
|
||||
$usuario->setEmpresaId($_SESSION["empresaId"]);
|
||||
$resUsuarios = $usuario->Search();
|
||||
|
||||
$usuarios = array();
|
||||
foreach($resUsuarios as $key => $res ){
|
||||
$card = $res;
|
||||
|
||||
@@ -242,13 +243,25 @@ switch($_POST["type"])
|
||||
$sucursal->setSucursalId($res['sucursalId'] );
|
||||
$nomSucursal = $sucursal->GetNameById();
|
||||
$card['sucursal'] = strtoupper(urldecode($nomSucursal));
|
||||
} else {
|
||||
$card['sucursal'] = '';
|
||||
}
|
||||
|
||||
$usuarios[] = $card;
|
||||
}
|
||||
|
||||
$pages = array(
|
||||
'numbers' => array(),
|
||||
'first' => false,
|
||||
'prev' => false,
|
||||
'next' => false,
|
||||
'last' => false,
|
||||
'current' => 1
|
||||
);
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign("pages", $pages);
|
||||
$smarty->assign("usuarios", $usuarios);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/usuarios.tpl');
|
||||
|
||||
Reference in New Issue
Block a user