Primer commit del sistema avantika sin cambios
This commit is contained in:
840
classes/proveedor.class.php
Executable file
840
classes/proveedor.class.php
Executable file
@@ -0,0 +1,840 @@
|
||||
<?php
|
||||
|
||||
class Proveedor extends Main
|
||||
{
|
||||
private $proveedorId;
|
||||
private $proveedorId2;
|
||||
private $productoId;
|
||||
private $prodProvId;
|
||||
private $rfc;
|
||||
private $nombre;
|
||||
private $userId;
|
||||
private $rfcId;
|
||||
private $precio;
|
||||
|
||||
private $calle;
|
||||
private $noInt;
|
||||
private $noExt;
|
||||
private $referencia;
|
||||
private $colonia;
|
||||
private $localidad;
|
||||
private $municipio;
|
||||
private $ciudad;
|
||||
private $estado;
|
||||
private $codigoPostal;
|
||||
private $pais;
|
||||
|
||||
private $nombreVtas;
|
||||
private $telefonoVtas;
|
||||
private $celularVtas;
|
||||
private $emailVtas;
|
||||
|
||||
private $nombrePagos;
|
||||
private $telefonoPagos;
|
||||
private $celularPagos;
|
||||
private $emailPagos;
|
||||
|
||||
private $nombreEnt;
|
||||
private $telefonoEnt;
|
||||
private $celularEnt;
|
||||
private $emailEnt;
|
||||
|
||||
private $banco;
|
||||
private $noCuenta;
|
||||
private $clabe;
|
||||
private $almacen;
|
||||
private $plazo;
|
||||
|
||||
private $publicidad;
|
||||
private $flete;
|
||||
private $desarrollo;
|
||||
private $especial;
|
||||
|
||||
private $compraFirme;
|
||||
private $saldo;
|
||||
private $baja;
|
||||
|
||||
private $pagado;
|
||||
private $noProv;
|
||||
|
||||
private $calificacion;
|
||||
private $comentario;
|
||||
private $pedidoId;
|
||||
|
||||
public function setCompraFirme($value)
|
||||
{
|
||||
$this->compraFirme = $value;
|
||||
}
|
||||
|
||||
public function setPublicidad($value)
|
||||
{
|
||||
$this->publicidad = $value;
|
||||
}
|
||||
|
||||
public function setFlete($value)
|
||||
{
|
||||
$this->flete = $value;
|
||||
}
|
||||
|
||||
public function setDesarrollo($value)
|
||||
{
|
||||
$this->desarrollo = $value;
|
||||
}
|
||||
|
||||
public function setEspecial($value)
|
||||
{
|
||||
$this->especial = $value;
|
||||
}
|
||||
|
||||
public function setProveedorId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->proveedorId = $value;
|
||||
}
|
||||
|
||||
public function setProveedorId2($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->proveedorId2 = $value;
|
||||
}
|
||||
|
||||
public function setProductoId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->productoId = $value;
|
||||
}
|
||||
|
||||
public function setProdProvId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->prodProvId = $value;
|
||||
}
|
||||
|
||||
public function setPrecio($value)
|
||||
{
|
||||
$this->precio = $value;
|
||||
}
|
||||
|
||||
public function setRfc($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 1, 'RFC');
|
||||
$this->rfc = $value;
|
||||
}
|
||||
|
||||
public function setNombre($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 1, 'Nombre Completo o Razón Social');
|
||||
$this->nombre = $value;
|
||||
}
|
||||
|
||||
public function setUserId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->userId = $value;
|
||||
}
|
||||
|
||||
//CONTACTO VENTAS
|
||||
|
||||
public function setNombreVtas($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Nombre');
|
||||
$this->nombreVtas = $value;
|
||||
}
|
||||
|
||||
public function setTelefonoVtas($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Teléfono');
|
||||
$this->telefonoVtas = $value;
|
||||
}
|
||||
|
||||
public function setCelularVtas($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Celular');
|
||||
$this->celularVtas = $value;
|
||||
}
|
||||
|
||||
public function setEmailVtas($value)
|
||||
{
|
||||
if(trim($value) != '')
|
||||
$this->Util()->ValidateMail($value, 'Correo Electrónico Ventas');
|
||||
$this->emailVtas = $value;
|
||||
}
|
||||
|
||||
//CONTACTO PAGOS
|
||||
|
||||
public function setNombrePagos($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Nombre');
|
||||
$this->nombrePagos = $value;
|
||||
}
|
||||
|
||||
public function setTelefonoPagos($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Teléfono');
|
||||
$this->telefonoPagos = $value;
|
||||
}
|
||||
|
||||
public function setCelularPagos($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Celular');
|
||||
$this->celularPagos = $value;
|
||||
}
|
||||
|
||||
public function setEmailPagos($value)
|
||||
{
|
||||
if(trim($value) != '')
|
||||
$this->Util()->ValidateMail($value, 'Correo Electrónico Cobranza');
|
||||
$this->emailPagos = $value;
|
||||
}
|
||||
|
||||
//CONTACTO ENTREGAS
|
||||
|
||||
public function setNombreEnt($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Nombre');
|
||||
$this->nombreEnt = $value;
|
||||
}
|
||||
|
||||
public function setTelefonoEnt($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Teléfono');
|
||||
$this->telefonoEnt = $value;
|
||||
}
|
||||
|
||||
public function setCelularEnt($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Celular');
|
||||
$this->celularEnt = $value;
|
||||
}
|
||||
|
||||
public function setEmailEnt($value)
|
||||
{
|
||||
if(trim($value) != '')
|
||||
$this->Util()->ValidateMail($value, 'Correo Electrónico Entregas');
|
||||
$this->emailEnt = $value;
|
||||
}
|
||||
|
||||
//DIRECCION FISCAL
|
||||
|
||||
public function setCalle($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Dirección');
|
||||
$this->calle = $value;
|
||||
}
|
||||
|
||||
public function setNoInt($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'No. Interior');
|
||||
$this->noInt = $value;
|
||||
}
|
||||
|
||||
public function setNoExt($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'No. Exterior');
|
||||
$this->noExt = $value;
|
||||
}
|
||||
|
||||
public function setLocalidad($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Localidad');
|
||||
$this->localidad = $value;
|
||||
}
|
||||
|
||||
public function setColonia($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Colonia');
|
||||
$this->colonia = $value;
|
||||
}
|
||||
|
||||
public function setReferencia($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Referencia');
|
||||
$this->referencia = $value;
|
||||
}
|
||||
|
||||
public function setMunicipio($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Municipio');
|
||||
$this->municipio = $value;
|
||||
}
|
||||
|
||||
public function setCiudad($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Ciudad');
|
||||
$this->ciudad = $value;
|
||||
}
|
||||
|
||||
public function setEstado($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Estado');
|
||||
$this->estado = $value;
|
||||
}
|
||||
|
||||
public function setPais($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Pais');
|
||||
$this->pais = $value;
|
||||
}
|
||||
|
||||
public function setCodigoPostal($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Codigo Postal');
|
||||
$this->codigoPostal = $value;
|
||||
}
|
||||
|
||||
public function setEmail($value)
|
||||
{
|
||||
if(trim($value) != '')
|
||||
$this->Util()->ValidateMail($value, 'Correo Electrónico');
|
||||
$this->email = $value;
|
||||
}
|
||||
|
||||
public function setTelefono($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Teléfono');
|
||||
$this->telefono = $value;
|
||||
}
|
||||
|
||||
//DATOS BANCARIOS
|
||||
|
||||
public function setBanco($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Banco');
|
||||
$this->banco = $value;
|
||||
}
|
||||
|
||||
public function setNoCuenta($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'No. de Cuenta');
|
||||
$this->noCuenta = $value;
|
||||
}
|
||||
|
||||
public function setClabe($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'CLABE');
|
||||
$this->clabe = $value;
|
||||
}
|
||||
|
||||
public function setAlmacen($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Almacen');
|
||||
$this->almacen = $value;
|
||||
}
|
||||
|
||||
public function setPlazo($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Plazo');
|
||||
$this->plazo = $value;
|
||||
}
|
||||
|
||||
public function setSaldo($value)
|
||||
{
|
||||
$this->Util()->ValidateFloat($value);
|
||||
$this->saldo = $value;
|
||||
}
|
||||
|
||||
//OTHERS
|
||||
|
||||
public function setPagado($value)
|
||||
{
|
||||
$this->pagado = $value;
|
||||
}
|
||||
|
||||
public function setNoProv($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->noProv = $value;
|
||||
}
|
||||
|
||||
public function setCalificacion($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 1, 'Calificación');
|
||||
$this->calificacion = $value;
|
||||
}
|
||||
|
||||
public function setComentario($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 0, 'Comentario');
|
||||
$this->comentario = $value;
|
||||
}
|
||||
|
||||
public function setPedidoId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->pedidoId = $value;
|
||||
}
|
||||
|
||||
function Info()
|
||||
{
|
||||
$sql = "SELECT * FROM proveedor WHERE proveedorId ='".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$cliente = $this->Util()->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
return $cliente;
|
||||
}
|
||||
|
||||
function EnumerateAll()
|
||||
{
|
||||
$sql = 'SELECT * FROM proveedor WHERE baja = "0" ORDER BY nombre ASC';
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
return $proveedores;
|
||||
}
|
||||
|
||||
function Enumerate()
|
||||
{
|
||||
$sql = 'SELECT COUNT(*) FROM proveedor WHERE baja = "0"';
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$total = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
$pages = $this->Util->HandleMultipages($this->page, $total ,WEB_ROOT.'/proveedores');
|
||||
|
||||
$sqlAdd = ' LIMIT '.$pages['start'].', '.$pages['items_per_page'];
|
||||
|
||||
$sql = 'SELECT * FROM proveedor WHERE baja = "0" ORDER BY nombre ASC'.$sqlAdd;
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$data['items'] = $proveedores;
|
||||
$data['pages'] = $pages;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function EnumCtaPagarSaldos()
|
||||
{
|
||||
$sql = 'SELECT COUNT(*) FROM proveedor WHERE baja = "0"';
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$total = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
$pages = $this->Util->HandleMultipages($this->page, $total ,WEB_ROOT.'/cuentas-pagar-saldos');
|
||||
|
||||
$sqlAdd = ' LIMIT '.$pages['start'].', '.$pages['items_per_page'];
|
||||
|
||||
$sql = 'SELECT * FROM proveedor WHERE baja = "0" ORDER BY nombre ASC'.$sqlAdd;
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$data['items'] = $proveedores;
|
||||
$data['pages'] = $pages;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function Save()
|
||||
{
|
||||
if($this->Util()->PrintErrors()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("
|
||||
INSERT INTO `proveedor` (
|
||||
noProv,
|
||||
rfc,
|
||||
nombre,
|
||||
|
||||
nombreVtas,
|
||||
telefonoVtas,
|
||||
celularVtas,
|
||||
emailVtas,
|
||||
|
||||
nombrePagos,
|
||||
telefonoPagos,
|
||||
celularPagos,
|
||||
emailPagos,
|
||||
|
||||
nombreEnt,
|
||||
telefonoEnt,
|
||||
celularEnt,
|
||||
emailEnt,
|
||||
|
||||
calle,
|
||||
noInt,
|
||||
noExt,
|
||||
referencia,
|
||||
colonia,
|
||||
localidad,
|
||||
municipio,
|
||||
estado,
|
||||
pais,
|
||||
codigoPostal,
|
||||
|
||||
banco,
|
||||
noCuenta,
|
||||
clabe,
|
||||
almacen,
|
||||
plazo,
|
||||
bonificacion,
|
||||
|
||||
publicidad,
|
||||
flete,
|
||||
desarrollo,
|
||||
especial,
|
||||
compraFirme
|
||||
)
|
||||
VALUES (
|
||||
'".$this->noProv."',
|
||||
'".utf8_decode($this->rfc)."',
|
||||
'".utf8_decode($this->nombre)."',
|
||||
|
||||
'".utf8_decode($this->nombreVtas)."',
|
||||
'".utf8_decode($this->telefonoVtas)."',
|
||||
'".utf8_decode($this->celularVtas)."',
|
||||
'".$this->emailVtas."',
|
||||
|
||||
'".utf8_decode($this->nombrePagos)."',
|
||||
'".utf8_decode($this->telefonoPagos)."',
|
||||
'".utf8_decode($this->celularPagos)."',
|
||||
'".$this->emailPagos."',
|
||||
|
||||
'".utf8_decode($this->nombreEnt)."',
|
||||
'".utf8_decode($this->telefonoEnt)."',
|
||||
'".utf8_decode($this->celularEnt)."',
|
||||
'".$this->emailEnt."',
|
||||
|
||||
'".utf8_decode($this->calle)."',
|
||||
'".utf8_decode($this->noInt)."',
|
||||
'".utf8_decode($this->noExt)."',
|
||||
'".utf8_decode($this->referencia)."',
|
||||
'".utf8_decode($this->colonia)."',
|
||||
'".utf8_decode($this->localidad)."',
|
||||
'".utf8_decode($this->municipio)."',
|
||||
'".utf8_decode($this->estado)."',
|
||||
'".utf8_decode($this->pais)."',
|
||||
'".utf8_decode($this->codigoPostal)."',
|
||||
|
||||
'".utf8_decode($this->banco)."',
|
||||
'".utf8_decode($this->noCuenta)."',
|
||||
'".utf8_decode($this->clabe)."',
|
||||
'".utf8_decode($this->almacen)."',
|
||||
'".utf8_decode($this->plazo)."',
|
||||
'".utf8_decode($this->bonificacion)."',
|
||||
|
||||
'".$this->publicidad."',
|
||||
'".$this->flete."',
|
||||
'".$this->desarrollo."',
|
||||
'".$this->especial."',
|
||||
'".$this->compraFirme."'
|
||||
)"
|
||||
);
|
||||
$proveedorId = $this->Util()->DBSelect($_SESSION['empresaId'])->InsertData();
|
||||
|
||||
$this->Util()->setError(20034, 'complete', '');
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function Update()
|
||||
{
|
||||
if($this->Util()->PrintErrors()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("
|
||||
UPDATE proveedor SET
|
||||
noProv ='".utf8_decode($this->noProv)."',
|
||||
rfc ='".utf8_decode($this->rfc)."',
|
||||
nombre = '".utf8_decode($this->nombre)."',
|
||||
|
||||
nombreVtas = '".utf8_decode($this->nombreVtas)."',
|
||||
telefonoVtas = '".utf8_decode($this->telefonoVtas)."',
|
||||
celularVtas = '".utf8_decode($this->celularVtas)."',
|
||||
emailVtas = '".utf8_decode($this->emailVtas)."',
|
||||
|
||||
nombrePagos = '".utf8_decode($this->nombrePagos)."',
|
||||
telefonoPagos = '".utf8_decode($this->telefonoPagos)."',
|
||||
celularPagos = '".utf8_decode($this->celularPagos)."',
|
||||
emailPagos = '".utf8_decode($this->emailPagos)."',
|
||||
|
||||
nombreEnt = '".utf8_decode($this->nombreEnt)."',
|
||||
telefonoEnt = '".utf8_decode($this->telefonoEnt)."',
|
||||
celularEnt = '".utf8_decode($this->celularEnt)."',
|
||||
emailEnt = '".utf8_decode($this->emailEnt)."',
|
||||
|
||||
calle = '".utf8_decode($this->calle)."',
|
||||
noInt = '".utf8_decode($this->noInt)."',
|
||||
noExt = '".utf8_decode($this->noExt)."',
|
||||
referencia = '".utf8_decode($this->referencia)."',
|
||||
colonia = '".utf8_decode($this->colonia)."',
|
||||
localidad = '".utf8_decode($this->localidad)."',
|
||||
municipio = '".utf8_decode($this->municipio)."',
|
||||
estado = '".utf8_decode($this->estado)."',
|
||||
pais = '".utf8_decode($this->pais)."',
|
||||
codigoPostal = '".utf8_decode($this->codigoPostal)."',
|
||||
|
||||
banco = '".utf8_decode($this->banco)."',
|
||||
noCuenta = '".utf8_decode($this->noCuenta)."',
|
||||
clabe = '".utf8_decode($this->clabe)."',
|
||||
almacen = '".utf8_decode($this->almacen)."',
|
||||
bonificacion = '".utf8_decode($this->bonificacion)."',
|
||||
plazo = '".utf8_decode($this->plazo)."',
|
||||
|
||||
publicidad = '".$this->publicidad."',
|
||||
flete = '".$this->flete."',
|
||||
desarrollo = '".$this->desarrollo."',
|
||||
especial = '".$this->especial."',
|
||||
compraFirme = '".$this->compraFirme."'
|
||||
|
||||
WHERE proveedorId = '".$this->proveedorId."'"
|
||||
);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
$this->Util()->setError(20036, 'complete', '');
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function Delete()
|
||||
{
|
||||
$sql = "DELETE FROM proveedor WHERE proveedorId = '".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->DeleteData();
|
||||
|
||||
$this->Util()->setError(20035, 'complete', '');
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function Baja(){
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("
|
||||
UPDATE proveedor SET
|
||||
baja = '1'
|
||||
WHERE
|
||||
proveedorId = '".$this->proveedorId."'"
|
||||
);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
$this->Util()->setError(20035, "complete");
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
|
||||
}//Baja
|
||||
|
||||
function GetNameById()
|
||||
{
|
||||
$sql = "SELECT nombre FROM proveedor WHERE proveedorId ='".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$nombre = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
return $nombre;
|
||||
}
|
||||
|
||||
function GetNoProv()
|
||||
{
|
||||
$sql = "SELECT noProv FROM proveedor WHERE proveedorId ='".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$noProv = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
return $noProv;
|
||||
}
|
||||
|
||||
function GetCompraFirme()
|
||||
{
|
||||
$sql = "SELECT compraFirme FROM proveedor WHERE proveedorId ='".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$compraFirme = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
return $compraFirme;
|
||||
}
|
||||
|
||||
function Search()
|
||||
{
|
||||
if($this->noProv)
|
||||
$sqlAdd = ' AND noProv = "'.$this->noProv.'"';
|
||||
|
||||
$sql = "SELECT
|
||||
*
|
||||
FROM
|
||||
proveedor
|
||||
WHERE
|
||||
baja = '0'
|
||||
AND
|
||||
(nombre LIKE '%".$this->nombre."%')
|
||||
".$sqlAdd."
|
||||
ORDER BY
|
||||
nombre ASC
|
||||
LIMIT
|
||||
20";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
$data['items'] = $proveedores;
|
||||
$data['pages'] = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function Suggest()
|
||||
{
|
||||
$sql = "SELECT
|
||||
*
|
||||
FROM
|
||||
proveedor
|
||||
WHERE
|
||||
baja = '0'
|
||||
AND
|
||||
nombre LIKE '%".$this->nombre."%'
|
||||
OR rfc LIKE '%".$this->nombre."%'
|
||||
OR proveedorId = '".$this->nombre."'
|
||||
ORDER BY
|
||||
nombre ASC
|
||||
LIMIT
|
||||
10";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
return $proveedores;
|
||||
}
|
||||
|
||||
function GetProveedores($id)
|
||||
{
|
||||
$sql = "SELECT *
|
||||
FROM productoProveedor
|
||||
LEFT JOIN proveedor ON productoProveedor.proveedorId = proveedor.proveedorId
|
||||
WHERE proveedor.baja = '0'
|
||||
AND productoProveedor.productoId = '".$id."'
|
||||
ORDER BY proveedor.nombre ";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function GetClientesByEmpresa()
|
||||
{
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("SELECT * FROM cliente WHERE empresaId ='".$this->getEmpresaId()."'");
|
||||
$empresaClientes = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
return $empresaClientes;
|
||||
}
|
||||
|
||||
function GetBonificacionById($value)
|
||||
{
|
||||
$sql = "SELECT bonificacion FROM proveedor WHERE proveedorId ='".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$nombre = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
return $nombre;
|
||||
}
|
||||
|
||||
function GetDescuentos()
|
||||
{
|
||||
$sql = "SELECT publicidad, flete, desarrollo, especial FROM proveedor WHERE proveedorId ='".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$descuentos = $this->Util()->DBSelect($_SESSION['empresaId'])->GetRow();
|
||||
|
||||
return $descuentos;
|
||||
}
|
||||
|
||||
function GetLastProveedorId()
|
||||
{
|
||||
$sql = "SELECT MAX(proveedorId) FROM proveedor";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedorId = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
$proveedorId += 1;
|
||||
|
||||
return $proveedorId;
|
||||
}
|
||||
|
||||
function GetLastNoProv()
|
||||
{
|
||||
$sql = "SELECT MAX(noProv) FROM proveedor";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedorId = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
$proveedorId += 1;
|
||||
|
||||
return $proveedorId;
|
||||
}
|
||||
|
||||
function UpdateSaldoCtaPagar()
|
||||
{
|
||||
$sql = "UPDATE proveedor SET saldoCtaPagar = '".$this->saldo."'
|
||||
WHERE proveedorId = '".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
$this->Util()->setError(20105, 'complete', '');
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function ExistProveedorId(){
|
||||
|
||||
$sql = "SELECT COUNT(*) FROM proveedor WHERE proveedorId = '".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$exist = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
return $exist;
|
||||
}
|
||||
|
||||
function ExistNoProv(){
|
||||
|
||||
$sql = "SELECT COUNT(*) FROM proveedor WHERE noProv = '".$this->noProv."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$exist = $this->Util()->DBSelect($_SESSION['empresaId'])->GetSingle();
|
||||
|
||||
return $exist;
|
||||
}
|
||||
|
||||
function SearchSaldos($saldoIni)
|
||||
{
|
||||
$sqlFilter = '';
|
||||
if($this->proveedorId)
|
||||
$sqlFilter .= ' AND proveedorId = "'.$this->proveedorId.'"';
|
||||
|
||||
if($saldoIni != ''){
|
||||
if($saldoIni == 0)
|
||||
$sqlFilter .= ' AND saldoCtaPagar = 0';
|
||||
elseif($saldoIni == 1)
|
||||
$sqlFilter .= ' AND saldoCtaPagar > 0';
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM proveedor
|
||||
WHERE baja = "0" '.$sqlFilter.'
|
||||
ORDER BY nombre ASC';
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$proveedores = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
return $proveedores;
|
||||
}
|
||||
|
||||
function UpdatePagado(){
|
||||
|
||||
$sql = "UPDATE proveedor SET pagadoCtaPagar = '".$this->pagado."'
|
||||
WHERE proveedorId = '".$this->proveedorId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
}
|
||||
|
||||
function UpdateCalifPedido(){
|
||||
|
||||
if($this->Util()->PrintErrors()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "UPDATE pedido SET calificacion = '".$this->calificacion."',
|
||||
comentCalif = '".utf8_decode($this->comentario)."'
|
||||
WHERE pedidoId = '".$this->pedidoId."'";
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
$this->Util()->setError(20127, "complete");
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
|
||||
}//Baja
|
||||
|
||||
}//Proveedor
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user