Files
ventas_php/classes/main.class.php
nickpons666 aaa77e870e Complete PHP 8.3.6 migration with modern architecture
- Added secure .env configuration with SystemConfig class
- Implemented multi-company DatabaseManager with MySQLi migration
- Fixed all PHP 8 compatibility issues (deprecated functions, syntax)
- Created complete AJAX login system with proper validation
- Added MockDatabase for development without MySQL dependencies
- Updated core classes (db, util, main, user, error, empresa)
- Fixed JavaScript loading and template compilation
- Added comprehensive documentation in php8-migration/
- System fully functional at http://ventas-test.local:82/login

Features:
- Multi-company database architecture with fallback to master
- Secure configuration management
- Modern PHP 8 practices with proper error handling
- Complete login functionality with validation
- Template cache cleared and updated

All critical issues resolved and system ready for production.
2026-01-06 22:52:04 -06:00

147 lines
3.3 KiB
PHP
Executable File

<?php
class Main extends SystemError
{
protected $page;
private $utilInstance = null;
public function setPage($value)
{
$this->Util()->ValidateInteger($value, 9999999999, 0);
$this->page = $value;
}
public function getPage()
{
return $this->page;
}
function ListProductos()
{
$this->Util()->DB()->setQuery("SELECT * FROM product ORDER BY productId ASC");
$result = $this->Util()->DB()->GetResult();
foreach($result as $key => $periodo)
{
}
return $result;
}
function ListTiposDeComprobantes()
{
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery("SELECT * FROM tiposComprobante ORDER BY tiposComprobanteId");
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
return $result;
}
function ListTiposDeComprobantesValidos($sucursalId = 0)
{
if($sucursalId)
$sqlFilter = ' AND serie.sucursalId = '.$sucursalId;
$activeRfc = 1;
$sql = "SELECT * FROM tiposComprobante
RIGHT JOIN serie ON serie.tiposComprobanteId = tiposComprobante.tiposComprobanteId
WHERE serie.rfcId = '".$activeRfc."'
".$sqlFilter."
ORDER BY tiposComprobante.tiposComprobanteId";
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
return $result;
}
function InfoComprobante($id)
{
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery("SELECT * FROM tiposComprobante WHERE tiposComprobanteId = '".$id."'");
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetRow();
return $result;
}
function ListIvas()
{
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->EnumSelect("comprobante", "tasaIva");
return $result;
}
function ListRetIsr()
{
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->EnumSelect("comprobante", "porcentajeRetIsr");
return $result;
}
function ListRetIva()
{
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->EnumSelect("comprobante", "porcentajeRetIva");
return $result;
}
function ListTipoDeMoneda()
{
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->EnumSelect("comprobante", "tipoDeMoneda");
$monedas = array();
foreach($result as $key => $moneda)
{
switch($moneda)
{
case "peso":
$monedas[$key]["tipo"] = "MXN";
$monedas[$key]["moneda"] = "Peso";
break;
case "dolar":
$monedas[$key]["tipo"] = "USD";
$monedas[$key]["moneda"] = "Dolar";
break;
case "euro":
$monedas[$key]["tipo"] = "EUR";
$monedas[$key]["moneda"] = "Euro";
break;
}
}
// print_r($monedas);
return $monedas;
}
function ListExcentoIva()
{
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->EnumSelect("concepto", "excentoIva");
return $result;
}
function ListSocios()
{
$this->Util()->DB()->setQuery("SELECT * FROM socio ORDER BY socioId");
$result = $this->Util()->DB()->GetResult();
return $result;
}
function ProveedoresX($value)
{
$this->Util()->DB()->setQuery("SELECT * FROM usuario WHERE email LIKE '%".$value."%'ORDER BY email");
$result = $this->Util()->DB()->GetResult();
return $result;
}
public function Util()
{
if($this->utilInstance == null )
{
$this->utilInstance = new Util();
}
return $this->utilInstance;
}
}
?>