153 lines
3.1 KiB
PHP
Executable File
153 lines
3.1 KiB
PHP
Executable File
<?php
|
|
|
|
class Descuento extends Main
|
|
{
|
|
private $descuentoId;
|
|
private $ventaId;
|
|
private $sucursalId;
|
|
private $usuarioId;
|
|
private $fecha;
|
|
private $productoId;
|
|
private $prodItemId;
|
|
private $cantidad;
|
|
private $status;
|
|
|
|
private $metodoPagoId;
|
|
|
|
public function setDescuentoId($value)
|
|
{
|
|
$this->Util()->ValidateInteger($value);
|
|
$this->ventaId = $value;
|
|
}
|
|
|
|
public function setSucursalId($value)
|
|
{
|
|
$this->sucursalId = $value;
|
|
}
|
|
|
|
public function setUsuarioId($value)
|
|
{
|
|
$this->usuarioId = $value;
|
|
}
|
|
|
|
public function setFecha($value)
|
|
{
|
|
$this->fecha = $value;
|
|
}
|
|
|
|
public function setProductoId($value)
|
|
{
|
|
$this->productoId = $value;
|
|
}
|
|
|
|
public function setProdItemId($value)
|
|
{
|
|
$this->prodItemId = $value;
|
|
}
|
|
|
|
public function setCantidad($value)
|
|
{
|
|
$this->cantidad = $value;
|
|
}
|
|
|
|
public function setPrecioUnitario($value)
|
|
{
|
|
$this->precioUnitario = $value;
|
|
}
|
|
|
|
public function setStatus($value)
|
|
{
|
|
$this->status = $value;
|
|
}
|
|
|
|
function Info()
|
|
{
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery("
|
|
SELECT * FROM venta
|
|
WHERE ventaId ='".$this->ventaId."'"
|
|
);
|
|
$info = $this->Util()->DBSelect($_SESSION["empresaId"])->GetRow();
|
|
|
|
return $info;
|
|
}
|
|
|
|
function Enumerate()
|
|
{
|
|
$sql = "SELECT COUNT(*) FROM venta
|
|
WHERE (status = 'Descuento' OR status = 'DescAp')
|
|
AND sucursalId = '".$this->sucursalId."'";
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$total = $this->Util()->DBSelect($_SESSION["empresaId"])->GetSingle();
|
|
|
|
$pages = $this->Util->HandleMultipages($this->page, $total ,WEB_ROOT."/ventas");
|
|
|
|
$sqlAdd = "LIMIT ".$pages["start"].", ".$pages["items_per_page"];
|
|
|
|
$sql = "SELECT *
|
|
FROM venta
|
|
WHERE (status = 'Descuento'
|
|
OR status = 'DescAp')
|
|
AND sucursalId = '".$this->sucursalId."'
|
|
ORDER BY fecha DESC ".$sqlAdd;
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
|
|
|
$data["items"] = $result;
|
|
$data["pages"] = $pages;
|
|
|
|
return $data;
|
|
|
|
}//Enumerate
|
|
|
|
function EnumByStatus()
|
|
{
|
|
$sql = "SELECT *
|
|
FROM venta
|
|
WHERE status = '".$this->status."'
|
|
AND sucursalId = '".$this->sucursalId."'
|
|
AND usuarioId = '".$this->usuarioId."'
|
|
ORDER BY fecha DESC ".$sqlAdd;
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
|
|
|
return $result;
|
|
|
|
}//EnumByStatus
|
|
|
|
function Save(){
|
|
|
|
if($this->Util()->PrintErrors()){
|
|
return false;
|
|
}
|
|
|
|
$sql = "INSERT INTO venta
|
|
(
|
|
sucursalId,
|
|
usuarioId,
|
|
fecha,
|
|
subtotal,
|
|
iva,
|
|
total,
|
|
pago,
|
|
status
|
|
)
|
|
VALUES (
|
|
'".$this->sucursalId."',
|
|
'".$this->usuarioId."',
|
|
'".$this->fecha."',
|
|
'".$this->subtotal."',
|
|
'".$this->iva."',
|
|
'".$this->total."',
|
|
'".$this->pago."',
|
|
'".$this->status."'
|
|
)";
|
|
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
|
$ventaId = $this->Util()->DBSelect($_SESSION['empresaId'])->InsertData();
|
|
|
|
return $ventaId;
|
|
|
|
}
|
|
|
|
}//Descuento
|
|
|
|
?>
|