Primer commit del sistema avantika sin cambios
This commit is contained in:
229
classes/rfc.class.php
Executable file
229
classes/rfc.class.php
Executable file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
class Rfc extends Main
|
||||
{
|
||||
private $rfcId;
|
||||
private $empresaId;
|
||||
private $rfc;
|
||||
private $razonSocial;
|
||||
private $calle;
|
||||
private $noInt;
|
||||
private $noExt;
|
||||
private $referencia;
|
||||
private $colonia;
|
||||
private $localidad;
|
||||
private $municipio;
|
||||
private $ciudad;
|
||||
private $estado;
|
||||
private $pais;
|
||||
private $codigoPostal;
|
||||
private $regimenFiscal;
|
||||
|
||||
private $diasDevolucion;
|
||||
private $bonificacion;
|
||||
private $devolucion;
|
||||
|
||||
public function setRfcId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->rfcId = $value;
|
||||
}
|
||||
|
||||
public function setEmpresaId($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->empresaId = $value;
|
||||
}
|
||||
|
||||
public function setRfc($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=13, $minChars = 12, 'RFC');
|
||||
$this->rfc = $value;
|
||||
}
|
||||
|
||||
public function setRazonSocial($value, $checkIfExists = 0)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=300, $minChars = 3, 'Razón Social');
|
||||
$this->razonSocial = $value;
|
||||
}
|
||||
|
||||
public function setCalle($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=200, $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=50, $minChars = 0, 'Localidad');
|
||||
$this->localidad = $value;
|
||||
}
|
||||
|
||||
public function setColonia($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Colonia');
|
||||
$this->colonia = $value;
|
||||
}
|
||||
|
||||
public function setReferencia($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Referencia');
|
||||
$this->referencia = $value;
|
||||
}
|
||||
|
||||
public function setMunicipio($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Municipio');
|
||||
$this->municipio = $value;
|
||||
}
|
||||
|
||||
public function setCiudad($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Ciudad');
|
||||
$this->ciudad = $value;
|
||||
}
|
||||
|
||||
public function setEstado($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Estado');
|
||||
$this->estado = $value;
|
||||
}
|
||||
|
||||
public function setPais($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Pais');
|
||||
$this->pais = $value;
|
||||
}
|
||||
|
||||
public function setCodigoPostal($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=50, $minChars = 0, 'Código Postal');
|
||||
$this->codigoPostal = $value;
|
||||
}
|
||||
|
||||
public function setRegimenFiscal($value)
|
||||
{
|
||||
$this->Util()->ValidateString($value, $max_chars=255, $minChars = 1, 'Regimen Fiscal');
|
||||
$this->regimenFiscal = $value;
|
||||
}
|
||||
|
||||
public function setDiasDevolucion($value)
|
||||
{
|
||||
$this->Util()->ValidateInteger($value);
|
||||
$this->diasDevolucion = $value;
|
||||
}
|
||||
|
||||
public function setBonificacion($value)
|
||||
{
|
||||
$this->bonificacion = $value;
|
||||
}
|
||||
|
||||
public function setDevolucion($value)
|
||||
{
|
||||
$this->devolucion = $value;
|
||||
}
|
||||
|
||||
function Info()
|
||||
{
|
||||
$sql = "SELECT * FROM rfc WHERE rfcId ='".$this->rfcId."'";
|
||||
$this->Util()->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
||||
$rfc = $this->Util()->DBSelect($_SESSION["empresaId"])->GetRow();
|
||||
|
||||
return $rfc;
|
||||
}
|
||||
|
||||
function Update()
|
||||
{
|
||||
if($this->Util()->PrintErrors()){
|
||||
return false;
|
||||
}
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery("
|
||||
UPDATE `rfc` SET
|
||||
`rfc` = '".$this->rfc."',
|
||||
`razonSocial` = '".$this->razonSocial."',
|
||||
`calle` = '".$this->calle."',
|
||||
`noInt` = '".$this->noInt."',
|
||||
`noExt` = '".$this->noExt."',
|
||||
`referencia` = '".$this->referencia."',
|
||||
`colonia` = '".$this->colonia."',
|
||||
`regimenFiscal` = '".$this->regimenFiscal."',
|
||||
`localidad` = '".$this->localidad."',
|
||||
`municipio` = '".$this->municipio."',
|
||||
`ciudad` = '".$this->ciudad."',
|
||||
`estado` = '".$this->estado."',
|
||||
`pais` = '".$this->pais."',
|
||||
`cp` = '".$this->codigoPostal."',
|
||||
`diasDevolucion` = '".$this->diasDevolucion."',
|
||||
`porcentajeBonificacion` = '".$this->bonificacion."',
|
||||
`porcentajeDevolucion` = '".$this->devolucion."'
|
||||
WHERE
|
||||
rfcId = '".$this->rfcId."'"
|
||||
);
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->UpdateData();
|
||||
|
||||
$this->Util()->setError(20007, 'complete');
|
||||
$this->Util()->PrintErrors();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function GetRfcsByEmpresa()
|
||||
{
|
||||
$sql = 'SELECT * FROM rfc';
|
||||
$this->Util()->DBSelect($_SESSION['empresaId'])->setQuery($sql);
|
||||
$rfcs = $this->Util()->DBSelect($_SESSION['empresaId'])->GetResult();
|
||||
|
||||
return $rfcs;
|
||||
}
|
||||
|
||||
function GetCertificadoByRfc(){
|
||||
|
||||
$ruta_dir = DOC_ROOT.'/empresas/'.$this->empresaId.'/certificados/'.$this->rfcId;
|
||||
|
||||
if(is_dir($ruta_dir)){
|
||||
if($gd = opendir($ruta_dir)){
|
||||
while($archivo = readdir($gd)){
|
||||
$info = pathinfo($ruta_dir.'/'.$archivo);
|
||||
if($info['extension'] == 'cer'){
|
||||
$nom_certificado = $info['filename'];
|
||||
break;
|
||||
}//if
|
||||
}//while
|
||||
closedir($gd);
|
||||
}//if
|
||||
}//if
|
||||
|
||||
return $nom_certificado;
|
||||
|
||||
}
|
||||
|
||||
function getRfcActive(){
|
||||
|
||||
$empresaId = $_SESSION['empresaId'];
|
||||
|
||||
$sql = 'SELECT rfcId FROM rfc
|
||||
WHERE rfcId = 1';
|
||||
$this->Util()->DBSelect($id_empresa)->setQuery($sql);
|
||||
$rfcId = $this->Util()->DBSelect($empresaId)->GetSingle();
|
||||
|
||||
return $rfcId;
|
||||
|
||||
}//getRfcActive
|
||||
|
||||
|
||||
}//Rfc
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user