/// <summary>
        /// Ejecución de eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Nombre o ID de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="bubbleEvent">Evento</param>
        public override void eventos(string FormUID, ref ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.FormUID == formID && pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)
                    {
                        _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                        _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                        Dispose();
                        application           = null;
                        company               = null;
                        _oRptCorteSolicitudes = false;
                        Addon.typeList.RemoveAll(p => p._forma == formID);
                        return;
                    }

                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTN_CANCELAR)
                        {
                            _oForma.Close();
                        }

                        if (pVal.ItemUID == BTN_IMPRIMIR)
                        {
                            _oTxtFechaInicial  = _oForma.Items.Item(TXT_FECHA_INICIAL).Specific;
                            _oTxtFechaFinal    = _oForma.Items.Item(TXT_FECHA_FINAL).Specific;
                            _oCmbOficinaVentas = _oForma.Items.Item(CMB_OFICINA_VENTAS).Specific;
                            //_oTxtUsuario = _oForma.Items.Item(TXT_USUARIO).Specific;

                            if (ValidarCampos())
                            {
                                if (Extensor.ValidarImpresionCorteSolicitudes(_Company, _oCmbOficinaVentas.Selected.Value.ToString()))
                                {
                                    if (_Application.MessageBox("¿Desea generar el corte de solicitudes?", 2, "Si", "No") == 1)
                                    {
                                        if (ImprimirReporteCorteSolicitudes())
                                        {
                                            _Application.StatusBar.SetText("Generar reporte terminado correctamente...", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                                        }
                                    }
                                }
                                else
                                {
                                    _Application.MessageBox("El reporte ya fue impreso");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsReporteOficinasContratos* : " + ex.Message);
            }
        }
        /// <summary>
        /// Inserta o actualiza la fecha de impresion;
        /// </summary>
        private void InsertarFechaImpresion()
        {
            try
            {
                _oRec = null;
                _oRec = _Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                _oRec.DoQuery(@"SELECT TOP 1
                                        U_Oficina
                                FROM    dbo.[@SAPCP_CONFIGCORTSOL]
                                WHERE   U_Oficina = '" + _oCmbOficinaVentas.Selected.Value.ToString() + "' ");

                if (_oRec.RecordCount == 0)
                {
                    _oRec = null;
                    _oRec = _Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    _oRec.DoQuery(@"SELECT  ISNULL(MAX(CONVERT(INT, Code)), 0) + 1 AS Code
                                    FROM    dbo.[@SAPCP_CONFIGCORTSOL]");
                    string code = _oRec.Fields.Item("Code").Value.ToString();


                    _oRec = null;
                    _oRec = _Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    _oRec.DoQuery(@"INSERT	INTO	dbo.[@SAPCP_CONFIGCORTSOL] (
	                                    Code,
	                                    [Name],
	                                    U_Oficina,
	                                    U_FechaImpresion
                                    ) VALUES ( 
	                                    '"     + code + "', " +
                                  "'" + code + "', " +
                                  "'" + _oCmbOficinaVentas.Selected.Value.ToString() + "', " +
                                  "'" + DateTime.Now.ToShortDateString() + "') ");
                }
                else
                {
                    if (Extensor.ValidarImpresionCorteSolicitudes(_Company, _oCmbOficinaVentas.Selected.Value.ToString()))
                    {
                        _oRec = null;
                        _oRec = _Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                        _oRec.DoQuery(@"UPDATE  dbo.[@SAPCP_CONFIGCORTSOL]
                                        SET     U_FechaImpresion = CONVERT(VARCHAR(10), GETDATE(), 103)
                                        WHERE   U_Oficina = '" + _oCmbOficinaVentas.Selected.Value.ToString() + "'");
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (_oRec != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(_oRec);
                }
            }
        }