210 lines
4.7 KiB
PHP
Executable File
210 lines
4.7 KiB
PHP
Executable File
<?php
|
|
|
|
class CuentaBancaria extends Main
|
|
{
|
|
private $cuentaBancariaId;
|
|
private $banco;
|
|
private $noCuenta;
|
|
private $sucursal;
|
|
private $titular;
|
|
private $clabe;
|
|
|
|
public function setCuentaBancariaId($value)
|
|
{
|
|
$this->Util()->ValidateInteger($value);
|
|
$this->cuentaBancariaId = $value;
|
|
}
|
|
|
|
public function setBanco($value)
|
|
{
|
|
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 1, 'Nombre del Banco');
|
|
$this->banco = $value;
|
|
}
|
|
|
|
public function setNoCuenta($value)
|
|
{
|
|
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 1, 'No. de Cuenta');
|
|
$this->noCuenta = $value;
|
|
}
|
|
|
|
public function setSucursal($value)
|
|
{
|
|
$this->sucursal = $value;
|
|
}
|
|
|
|
public function setTitular($value)
|
|
{
|
|
$this->titular = $value;
|
|
}
|
|
|
|
public function setClabe($value)
|
|
{
|
|
$this->clabe = $value;
|
|
}
|
|
|
|
public function Info()
|
|
{
|
|
$sql = 'SELECT
|
|
*
|
|
FROM
|
|
cuentaBancaria
|
|
WHERE
|
|
cuentaBancariaId = "'.$this->cuentaBancariaId.'"';
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$info = $this->Util()->DBSelect($_SESSION["empresaId"])->GetRow();
|
|
|
|
return $info;
|
|
}
|
|
|
|
public function EnumerateAll()
|
|
{
|
|
|
|
$sql = 'SELECT
|
|
*
|
|
FROM
|
|
cuentaBancaria
|
|
WHERE
|
|
baja = "0"
|
|
ORDER BY
|
|
banco ASC';
|
|
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
|
|
|
return $result;
|
|
}
|
|
|
|
public $page = 0;
|
|
|
|
public function SetPage($page)
|
|
{
|
|
$this->page = $page;
|
|
}
|
|
|
|
function Enumerate()
|
|
{
|
|
$db = $this->Util()->DBSelect($_SESSION["empresaId"]);
|
|
|
|
$sql = "SELECT COUNT(*) FROM cuentaBancaria WHERE baja = '0'";
|
|
$db->setQuery($sql);
|
|
$total = $db->GetSingle();
|
|
|
|
$pages = $this->Util()->HandleMultipages($this->page, $total ,WEB_ROOT."/cuentas-bancarias", "p");
|
|
|
|
$sqlAdd = "LIMIT ".$pages["start"].", ".$pages["items_per_page"];
|
|
|
|
$sql = "SELECT * FROM cuentaBancaria WHERE baja = '0' ORDER BY banco ASC ".$sqlAdd;
|
|
$db->setQuery($sql);
|
|
$result = $db->GetResult();
|
|
|
|
$data["items"] = $result;
|
|
$data["pages"] = $pages;
|
|
|
|
return $data;
|
|
}
|
|
|
|
function Save()
|
|
{
|
|
if($this->Util()->PrintErrors()){ return false; }
|
|
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery("
|
|
INSERT INTO `cuentaBancaria` (
|
|
banco,
|
|
noCuenta,
|
|
sucursal,
|
|
titular,
|
|
clabe
|
|
)
|
|
VALUES (
|
|
'".utf8_decode($this->banco)."',
|
|
'".utf8_decode($this->noCuenta)."',
|
|
'".utf8_decode($this->sucursal)."',
|
|
'".utf8_decode($this->titular)."',
|
|
'".utf8_decode($this->clabe)."'
|
|
)"
|
|
);
|
|
$cuentaBancariaId = $this->Util()->DBSelect($_SESSION["empresaId"])->InsertData();
|
|
|
|
$this->Util()->setError(20049, "complete");
|
|
$this->Util()->PrintErrors();
|
|
|
|
return true;
|
|
}
|
|
|
|
function Update()
|
|
{
|
|
if($this->Util()->PrintErrors()){ return false; }
|
|
|
|
$sql = "
|
|
UPDATE `cuentaBancaria` SET
|
|
banco = '".utf8_decode($this->banco)."',
|
|
noCuenta = '".utf8_decode($this->noCuenta)."',
|
|
sucursal = '".utf8_decode($this->sucursal)."',
|
|
titular = '".utf8_decode($this->titular)."',
|
|
clabe = '".utf8_decode($this->clabe)."'
|
|
WHERE
|
|
cuentaBancariaId = '".$this->cuentaBancariaId."'
|
|
";
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->UpdateData();
|
|
|
|
$this->Util()->setError(20050, "complete");
|
|
$this->Util()->PrintErrors();
|
|
|
|
return true;
|
|
}
|
|
|
|
function Delete()
|
|
{
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery("
|
|
DELETE FROM cuentaBancaria
|
|
WHERE cuentaBancariaId = '".$this->cuentaBancariaId."'"
|
|
);
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->DeleteData();
|
|
|
|
$this->Util()->setError(20051, "complete");
|
|
$this->Util()->PrintErrors();
|
|
|
|
return true;
|
|
}
|
|
|
|
function Baja(){
|
|
|
|
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("
|
|
UPDATE cuentaBancaria SET
|
|
baja = '1'
|
|
WHERE
|
|
cuentaBancariaId = '".$this->cuentaBancariaId."'"
|
|
);
|
|
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
|
|
|
$this->Util()->setError(20051, "complete");
|
|
$this->Util()->PrintErrors();
|
|
|
|
return true;
|
|
|
|
}//Baja
|
|
|
|
function GetBancoById()
|
|
{
|
|
$sql = 'SELECT banco FROM cuentaBancaria
|
|
WHERE cuentaBancariaId = "'.$this->cuentaBancariaId.'"';
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$banco = $this->Util()->DBSelect($_SESSION["empresaId"])->GetSingle();
|
|
|
|
return $banco;
|
|
}
|
|
|
|
function GetNameById()
|
|
{
|
|
$sql = 'SELECT CONCAT(banco," ",noCuenta) FROM cuentaBancaria
|
|
WHERE cuentaBancariaId = "'.$this->cuentaBancariaId.'"';
|
|
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$name = $this->Util()->DBSelect($_SESSION["empresaId"])->GetSingle();
|
|
|
|
return $name;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|