public function __construct($request)
 {
     // Cargar lo que viene en el request
     $this->request = $request;
     // Cargar la configuracion del modulo (modules/moduloName/config.yaml)
     $this->form = new Form($this->entity);
     // Cargar los permisos.
     // Si la entidad no está sujeta a control de permisos, se habilitan todos
     if ($this->form->getPermissionControl()) {
         if ($this->parentEntity == '') {
             $this->permisos = new ControlAcceso($this->entity);
         } else {
             $this->permisos = new ControlAcceso($this->parentEntity);
         }
     } else {
         $this->permisos = new ControlAcceso();
     }
     $this->values['titulo'] = $this->form->getTitle();
     $this->values['ayuda'] = $this->form->getHelpFile();
     $this->values['permisos'] = $this->permisos->getPermisos();
     $this->values['request'] = $this->request;
     // Cargas las variables
     $this->cargaVariables();
     // Registrar en el archivo log
     if ($this->varEnvPro[log]) {
         Log::write($this->request);
     }
     $empresa = new PcaeEmpresas($_SESSION['emp']);
     $this->DIGCC = $empresa->getDigitosCuentaContable();
     unset($empresa);
     $this->idTraspaso = date('Ymd_His');
     $this->fileDiario = $_SERVER['DOCUMENT_ROOT'] . $_SESSION['appPath'] . "/docs/docs{$_SESSION['emp']}/interfaces/contaplus/{$this->idTraspaso}_diario.txt";
     $this->fileSubcuentas = $_SERVER['DOCUMENT_ROOT'] . $_SESSION['appPath'] . "/docs/docs{$_SESSION['emp']}/interfaces/contaplus/{$this->idTraspaso}_subcuentas.txt";
 }
 /**
  * Devuelve un array de objetos \PcaeEmpresas que
  * constituyen el grupo de empresas en curso.
  *
  * @return array Array de objetos \PcaeEmpresas
  */
 public function getEmpresas()
 {
     $empresas = array();
     $emp = new PcaeEmpresas();
     $rows = $emp->cargaCondicion("IdEmpresa", "IdGrupo='{$this->Id}'");
     unset($emp);
     foreach ($rows as $row) {
         $empresas[] = new PcaeEmpresas($row['IdEmpresa']);
     }
     return $empresas;
 }
Пример #3
0
 /**
  * Crea un registro (insert)
  */
 public function create()
 {
     $lastId = parent::create();
     if ($lastId != NULL) {
         $this->setPrimaryKeyValue($lastId);
         //ACTUALIZAR LA CUENTA CONTABLE EN BASE AL PREFIJO PARA LA SUCURSAL
         //Y AL NUMERO DE DIGITOS PARA LA EMPRESA
         $cContable = '';
         $idSucursal = $this->IDSucursal;
         $this->conecta();
         // Comertar esto para importar
         // localiza la cta. contable mayor para la sucursal
         if (is_resource($this->_dbLink)) {
             $query = "SELECT `CContable` FROM `{$this->_dataBaseName}`.`{$this->_tableName}` WHERE IDSucursal='{$this->IDSucursal}' ORDER BY `CContable` DESC Limit 1;";
             $this->_em->query($query);
             $row = $this->_em->fetchResult();
             $this->_em->desConecta();
             unset($this->_em);
             $cContable = (int) $row[0]['CContable'];
         }
         if ($cContable > 0) {
             $cContable += 1;
             $this->setCContable($cContable);
         } else {
             $prefijo = $this->getIDSucursal()->getCtaContableClientes();
             $empresa = new PcaeEmpresas($_SESSION['emp']);
             $digitos = $empresa->getDigitosCuentaContable();
             unset($empresa);
             $this->setCContable(str_pad($prefijo, $digitos - 1, '0') . '1');
         }
         // ***** hasta aqui
         //
         //PONER EL MISMO NOMBRE COMERCIAL SI ES QUE ESTE ESTÁ VACIO
         if ($this->getNombreComercial() == '') {
             $this->setNombreComercial($this->getRazonSocial());
         }
         $this->setIDSucursal($idSucursal);
         //CREAR LA DIRECCION DE ENTREGA POR DEFECTO
         $this->createDireccionEntrega();
     }
     return $lastId;
 }
Пример #4
0
 static function makeRemesa($parametros, $filtro)
 {
     self::$parametros = $parametros;
     $ficheroRemesa = '';
     if (self::valida()) {
         self::openCuaderno();
         $empresas = new PcaeEmpresas();
         $ordenantes = $empresas->cargaCondicion("*", "Id>='{$_SESSION['emp']}' and Id<='{$_SESSION['emp']}'", "Id ASC");
         unset($empresas);
         foreach ($ordenantes as $ordenante) {
             self::addOrdenante($ordenante);
             //RECORRO LOS RECIBOS DEL ORDENANTE EN CURSO.
             if (self::$parametros['agrupar']) {
                 self::RecibosAgrupados($filtro);
             } else {
                 self::RecibosIndividuales($filtro);
             }
             self::closeOrdenate();
         }
         $ficheroRemesa = self::closeCuaderno();
         self::escribeLog();
     }
     return $ficheroRemesa;
 }
 function Header()
 {
     $empresa = new PcaeEmpresas($_SESSION['emp']);
     $sucursal = new Sucursales($_SESSION['suc']);
     $logo = $empresa->getLogo();
     if (file_exists($logo)) {
         $this->Image($empresa->getLogo(), 10, 8, 23);
     }
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, $empresa->getRazonSocial(), 0, 1, "R");
     $this->SetFont('Arial', '', 8);
     $this->Cell(0, 5, $sucursal->getNombre(), 0, 1, "R");
     $this->SetFont('Arial', 'B', 11);
     $this->Cell(0, 5, $this->opciones['title'], 0, 1, "C");
     $this->Ln(5);
     $this->SetFont('Courier', 'B', 8);
     //PINTAR LOS TITULOS DE LAS COLUMNAS
     $this->Cell(10, 4, "Hora", 0, 0, "C");
     $this->Cell(100, 4, "Cliente", 0, 0, "C");
     $this->Cell(20, 4, "Poblacion", 0, 0, "C");
     $this->Cell(45, 4, "Telefonos", 0, 0, "C");
     $this->Cell(10, 4, "Riesgo", 0, 0, "C");
     $this->Cell(0, 4, "Comentarios", 0, 0, "C");
     $this->Ln();
 }
Пример #6
0
 function Header()
 {
     $empresa = new PcaeEmpresas($_SESSION['emp']);
     $sucursal = new Sucursales($_SESSION['suc']);
     $this->Image($empresa->getLogo(), 10, 8, 23);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, $empresa->getRazonSocial(), 0, 1, "R");
     $this->SetFont('Arial', '', 8);
     $this->Cell(0, 5, $sucursal->getNombre(), 0, 1, "R");
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, $this->opciones['title'], 0, 1, "C");
     // Pintar la leyenda del filtro en la primera pagina
     if ($this->page == 1) {
         $this->Ln(5);
         $this->SetFont('Arial', '', '8');
         foreach ($this->opciones['leyendaFiltro'] as $filtro) {
             $this->Cell(25, 4, $filtro['Column'], 0, 0);
             $this->Cell(0, 4, $filtro['Value'], 0, 1);
         }
     }
     // Para los títulos pongo el mismo font que para el cuerpo del listado
     $this->Ln(5);
     $this->SetFont($this->opciones['titleFont'][0], $this->opciones['titleFont'][1], $this->opciones['titleFont'][2]);
     //PINTAR LOS TITULOS DE LAS COLUMNAS
     foreach ($this->opciones['columns'] as $value) {
         $caracteres = (int) $value['length'];
         $texto = trim((string) $value['title']);
         $ancho = $this->getStringWidth(str_pad(" ", $caracteres)) + 1;
         $this->Cell($ancho, 4, $this->DecodificaTexto($texto, $caracteres), 0, 0, "C", 1);
     }
     $this->Ln();
     //$this->Line($this->GetX(), $this->GetY(), $this->GetX() + 190, $this->GetY());
 }
Пример #7
0
 static function makeRemesa($parametros, $filtro)
 {
     self::$parametros = $parametros;
     $ordenante = new PcaeEmpresas($_SESSION['emp']);
     if (self::$parametros['agrupar']) {
         $recibos = self::RecibosAgrupados($filtro);
     } else {
         $recibos = self::RecibosIndividuales($filtro);
     }
     $fecha = new Fecha($parametros['fechaCobro']);
     $fechaCargo = $fecha->getaaaammdd();
     self::$idRemesa = $ordenante->getCif() . date('Y-m-d') . "T" . date('H:i:s');
     $arrayRemesa = array('header' => array('id' => self::$idRemesa, 'fecha' => date('Y-m-d') . "T" . date('H:i:s'), 'fechaCargo' => $fechaCargo, 'nRecibos' => $recibos['nRecibos'], 'total' => number_format($recibos['importeTotal'], 2, ".", ""), 'razonSocial' => $ordenante->getRazonSocial(), 'direccion1' => $ordenante->getDireccion(), 'direccion2' => $ordenante->getCodigoPostal() . " " . $ordenante->getIdMunicipio()->getMunicipio() . " " . $ordenante->getIdProvincia()->getProvincia(), 'cif' => $ordenante->getCif(), 'sufijo' => $ordenante->getSufijoRemesas(), 'identificadorPresentador' => "ES" . self::digitoControlPresentador($ordenante->getCif() . "ES00") . $ordenante->getSufijoRemesas() . $ordenante->getCif(), 'iban' => $ordenante->getIban(), 'bic' => $ordenante->getBic()), 'recibos' => $recibos['recibos']);
     self::escribeLog($arrayRemesa);
     return SepaXml19::makeDocument("docs/docs{$_SESSION['emp']}/remesas/" . self::$idRemesa . ".xml", $arrayRemesa);
 }
Пример #8
0
 /**
  * Devuelve un array anidado con las empresa, proyectos
  * y aplicaciones a los que tiene acceso el usuario en curso.
  *
  * @return array
  */
 public function getArrayAccesos()
 {
     $accesos = array();
     $permisos = new PcaePermisos();
     $rows = $permisos->cargaCondicion("IdEmpresa,IdProyecto,IdApp", "IdUsuario='{$this->Id}'", "IdEmpresa,IdProyecto,IdApp ASC");
     unset($permisos);
     $empAnt = '';
     $proAnt = '';
     foreach ($rows as $row) {
         if ($empAnt != $row['IdEmpresa']) {
             $empresa = new PcaeEmpresas($row['IdEmpresa']);
             $accesos['empresas'][$row['IdEmpresa']] = array('empresa' => $empresa->getRazonSocial(), 'perfil' => $this->getPerfilEmpresa($row['IdEmpresa'])->getPerfil());
             unset($empresa);
         }
         if ($proAnt != $row['IdProyecto']) {
             $proyecto = new PcaeProyectos($row['IdProyecto']);
             $accesos['empresas'][$row['IdEmpresa']]['proyectos'][$row['IdProyecto']] = array('proyecto' => $proyecto->getProyecto());
             unset($proyecto);
         }
         $app = new PcaeApps($row['IdApp']);
         $proyectoApp = new PcaeProyectosApps();
         $keyProyectoApp = $proyectoApp->cargaCondicion("PrimaryKeyMD5", "IdProyecto='{$row['IdProyecto']}' AND IdApp='{$row['IdApp']}'");
         $accesos['empresas'][$row['IdEmpresa']]['proyectos'][$row['IdProyecto']]['apps'][$row['IdApp']] = array('aplicacion' => $app->getAplicacion(), 'url' => $app->getUrl(), 'IdProyectoApp' => $keyProyectoApp[0]['PrimaryKeyMD5']);
         unset($app);
         unset($proyectoApp);
         $proAnt = $row['IdProyecto'];
         $empAnt = $row['IdEmpresa'];
     }
     return $accesos;
 }
 function Header()
 {
     $empresa = new PcaeEmpresas($_SESSION['emp']);
     $sucursal = new Sucursales($_SESSION['suc']);
     $this->Image($empresa->getLogo(), 10, 8, 23);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, $empresa->getRazonSocial(), 0, 1, "R");
     $this->SetFont('Arial', '', 8);
     $this->Cell(0, 5, $sucursal->getNombre(), 0, 1, "R");
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(0, 5, "ORDEN DE REPARTO " . $this->opciones['almacen'] . " " . $this->opciones['dia'] . " Ruta: " . $this->opciones['ruta'], 0, 1, "C");
     $this->SetFont('Arial', 'B', 9);
     $this->Cell(15, 4, "Orden", 1, 0, "C");
     $this->Cell(15, 4, "Hora", 1, 0, "C");
     $this->Cell(150, 4, "Cliente / Direccion", 1, 0, "C");
     $this->Cell(50, 4, "Comercial", 1, 0, "C");
     $this->Cell(50, 4, "Observaciones", 1, 0, "C");
     $this->Ln();
     $this->SetFont('Arial', '', 8);
 }