Primer commit del sistema avantika sin cambios
This commit is contained in:
132
classes/politica.class.php
Executable file
132
classes/politica.class.php
Executable file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
class Politica extends Main
|
||||
{
|
||||
private $politicaId;
|
||||
private $tipo;
|
||||
private $porcentajeBonificacion;
|
||||
private $porcentajeEvaluacion;
|
||||
|
||||
public function setPoliticaId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->politicaId = $value;
|
||||
}
|
||||
|
||||
public function setPorcentajeBonificacion($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->porcentajeBonificacion = $value;
|
||||
}
|
||||
|
||||
public function setPorcentajeEvaluacion($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->porcentajeEvaluacion = $value;
|
||||
}
|
||||
|
||||
public function setTipo($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value);
|
||||
$this->tipo = $value;
|
||||
}
|
||||
|
||||
public function Enumerate()
|
||||
{
|
||||
$sql = "SELECT COUNT(*) FROM politicaBD 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."/bonificacion-devolucion");
|
||||
|
||||
$sqlAdd = "LIMIT ".$pages["start"].", ".$pages["items_per_page"];
|
||||
|
||||
$sql = "SELECT * FROM politicaBD WHERE baja = '0' ORDER BY idPoliticaBD ASC ".$sqlAdd;
|
||||
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
||||
|
||||
$data["items"] = $result;
|
||||
$data["pages"] = $pages;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function Save()
|
||||
{
|
||||
if($this->Util()->PrintErrors()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO politicaBD(
|
||||
tipo,
|
||||
porcentajeBonificacion,
|
||||
porcentajeEvaluacion)
|
||||
VALUES('".$this->tipo."',
|
||||
".$this->porcentajeBonificacion.",
|
||||
".$this->porcentajeEvaluacion.")";
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->ExecuteQuery();
|
||||
|
||||
$this->Util()->setError(30068, "complete");
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function EnumerateAll()
|
||||
{
|
||||
$sql = "SELECT * FROM politicaBD WHERE baja = '0' ORDER BY porcentajeEvaluacion DESC ";
|
||||
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function EnumerateBonificacion()
|
||||
{
|
||||
$sql = "SELECT * FROM politicaBD
|
||||
WHERE tipo LIKE 'Bonificacion'
|
||||
AND baja = '0'
|
||||
ORDER BY porcentajeEvaluacion DESC ";
|
||||
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$result = $this->Util()->DBSelect($_SESSION["empresaId"])->GetResult();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function Delete()
|
||||
{
|
||||
if($this->Util()->PrintErrors()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM politicaBD WHERE idPoliticaBD = '".$this->politicaId."'";
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->DeleteData();
|
||||
|
||||
$this->Util()->setError(30070, "complete");
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function Baja(){
|
||||
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("
|
||||
UPDATE politicaBD SET baja = '1'
|
||||
WHERE idPoliticaBD = '".$this->politicaId."'"
|
||||
);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
$this->Util()->setError(30070, "complete");
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
|
||||
}//Baja
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user