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"; }
/** * 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; }