Esempio n. 1
0
        /// <summary>
        /// This method is only to keep a child form a modal!
        /// Could not find a way to make a form modal in the new SBO 9 UI.
        /// </summary>
        /// <param name="FormUID"></param>
        /// <param name="pVal"></param>
        /// <param name="BubbleEvent"></param>
        void SBO_Application_ItemEvent(string FormUID, ref ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                switch (pVal.EventType)
                {
                case BoEventTypes.et_ITEM_PRESSED:
                case BoEventTypes.et_FORM_ACTIVATE:
                case BoEventTypes.et_CLICK:
                    SAPbouiCOM.Form oForm = eCommon.SBO_Application.Forms.Item(FormUID);
                    //Check if a child form is opened for this form. if yes, dont click
                    //Find if a finder for this form exists... if it is then close it first
                    try
                    {
                        if (oForm.DataSources.UserDataSources.Item("ChildUID").Value != "")
                        {
                            SAPbouiCOM.Form oChildForm = eCommon.SBO_Application.Forms.Item(oForm.DataSources.UserDataSources.Item("ChildUID").Value);
                            oChildForm.Select();
                            BubbleEvent = false;
                            return;
                        }
                    }
                    catch { }

                    break;
                }
            }
            catch { }
        }
Esempio n. 2
0
        public virtual void CreateForm(SAPbouiCOM.Application SboApp, string strXml, SAPbobsCOM.Company cmp, string frmId)
        {
            formId       = frmId;
            frmXml       = strXml;
            oCompany     = cmp;
            oApplication = SboApp;

            oApplication.ItemEvent       += new _IApplicationEvents_ItemEventEventHandler(oApplication_ItemEvent);
            oApplication.RightClickEvent += new _IApplicationEvents_RightClickEventEventHandler(oApplication_RightClickEvent);
            oApplication.AppEvent        += new _IApplicationEvents_AppEventEventHandler(oApplication_AppEvent);
            oApplication.MenuEvent       += new _IApplicationEvents_MenuEventEventHandler(oApplication_MenuEvent);

            UDClass clsudo = Program.objHrmsUI;

            setFilter();
            try
            {
                clsudo.AddXML(strXml);
                oForm = oApplication.Forms.Item(frmId);
            }
            catch (Exception ex)
            {
                try
                {
                    oForm = oApplication.Forms.Item(frmId);
                    oForm.Select();
                }
                catch (Exception ex1)
                {
                    oApplication.StatusBar.SetText(ex1.Message);
                }
            }
            oForm.EnableMenu("1282", true);  // Add New Record
            oForm.EnableMenu("1288", true);  // Next Record
            oForm.EnableMenu("1289", true);  // Pevious Record
            oForm.EnableMenu("1290", true);  // First Record
            oForm.EnableMenu("1291", true);  // Last record
            oForm.EnableMenu("1281", true);  // Find record

            string mnuId = frmId.Replace("frm", "mnu");

            //isFormReadOnly(mnuId);
        }
Esempio n. 3
0
        /// <summary>
        /// Muestra el formulario seleccionado.
        /// </summary>
        /// <param name="formID">Nombre o ID de la forma.</param>
        /// <returns>Nombre del Formulario</returns>
        public SAPbouiCOM.Form showForm(string formID)
        {
            SAPbouiCOM.Form fForm = null;
            try
            {
                try
                {
                    LoadFromXML(formID);
                }
                catch { }

                fForm = _Application.Forms.Item(formID);
                fForm.Select();
                return(fForm);
            }
            catch (Exception ex)
            {
                return(fForm);
            }
            finally
            {
            }
        }
Esempio n. 4
0
        private void LoadXmlForm(string pStrFrmName)
        {
            System.Xml.XmlDocument lObjXmlDoc = new System.Xml.XmlDocument();
            string lStrPath = PathUtilities.GetCurrent("ModalForms") + "\\" + pStrFrmName + ".xml";

            lObjXmlDoc.Load(lStrPath);

            SAPbouiCOM.FormCreationParams lObjCreationPackage =
                (SAPbouiCOM.FormCreationParams)SAPbouiCOM.Framework.Application.SBO_Application.CreateObject
                    (SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams);


            lObjCreationPackage.XmlData = lObjXmlDoc.InnerXml;

            if (pStrFrmName.Equals(pStrFrmName))
            {
                if (!lObjUtility.FormExists(pStrFrmName))
                {
                    lObjCreationPackage.UniqueID    = pStrFrmName;
                    lObjCreationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed;
                    lObjCreationPackage.Modality    = SAPbouiCOM.BoFormModality.fm_Modal;
                    lObjCreationPackage.FormType    = pStrFrmName;

                    mObjMFreights         = SAPbouiCOM.Framework.Application.SBO_Application.Forms.AddEx(lObjCreationPackage);
                    mObjMFreights.Title   = "Busqueda de rutas";
                    mObjMFreights.Left    = 400;
                    mObjMFreights.Top     = 100;
                    mObjMFreights.Mode    = SAPbouiCOM.BoFormMode.fm_OK_MODE;
                    mObjMFreights.Visible = true;
                    InitializeXmlForm();
                }
            }
            else
            {
                mObjMFreights.Select();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 선수금차감 화면로드
        /// </summary>
        /// <param name="oForm"></param>
        private void OpenPopup(SAPbouiCOM.Form oForm)
        {
            try
            {
                oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_SO0420T_HRD");

                string strChildFormID = oForm.DataSources.UserDataSources.Item("cFORMUID").Value;
                if (!FN.GetFormExistsChk(strChildFormID))
                {
                  
                    Dictionary<string, string> dicParam = new Dictionary<string, string>();
                    dicParam.Add("U_CENTCD", oDB_M.GetValue("U_CENTCD", 0).Trim());
                    dicParam.Add("U_CENTNM", oDB_M.GetValue("U_CENTNM", 0).Trim());

                    KIS_SO0312F_HRD SO0312F_HRD = new KIS_SO0312F_HRD();
                    SO0312F_HRD.A00_SubFormInit(oForm.UniqueID, dicParam);
                    SO0312F_HRD = null;
                }
                else
                {
                    pForm = pForm = B1Connections.theAppl.Forms.Item(strChildFormID);
                    pForm.Select();
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Id de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="BubbleEvent">Evento true/false</param>
        public override void eventos(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.BeforeAction == false && pVal.FormType == FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.EventType == BoEventTypes.et_FORM_RESIZE)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        OcultarControlesVentana(_oForm);
                        CrearCamposDeUsuario(_oForm);
                    }

                    if (pVal.EventType == BoEventTypes.et_FORM_CLOSE)
                    {
                        if (_oContadorFormas == 1)
                        {
                            _Application.ItemEvent      -= new _IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                            _Application.StatusBarEvent -= new SAPbouiCOM._IApplicationEvents_StatusBarEventEventHandler(SBO_Application_StatusBarEvent);
                            Dispose();
                            application            = null;
                            company                = null;
                            _oTransferenciaDeStock = false;
                            Addon.typeList.RemoveAll(p => p._forma == formID);
                            return;
                        }
                        else
                        {
                            _oContadorFormas -= 1;
                        }
                    }

                    if (pVal.EventType == BoEventTypes.et_FORM_ACTIVATE)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        CrearCamposDeUsuario(_oForm);
                    }
                }

                if (pVal.BeforeAction == true && pVal.FormType == FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.ItemUID == TXT_SERIE && pVal.CharPressed == CHAR_PRESS_ENTER && pVal.EventType == BoEventTypes.et_KEY_DOWN)
                    {
                        _oForm          = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        _oTxtSerie      = _oForm.Items.Item(TXT_SERIE).Specific;
                        _oAlmacenOrigen = _oForm.Items.Item(TXT_ALMACEN_ORIGEN).Specific;
                        _oForm.Select();
                        if (!string.IsNullOrEmpty(_oTxtSerie.Value.ToString()))
                        {
                            _oForm.Select();
                            AgregarArticulo(_oForm, _oTxtSerie.Value.ToString(), _oAlmacenOrigen.Value.ToString());
                            _oForm.Select();
                        }
                        else
                        {
                            _Application.MessageBox("Capture el número de serie");
                        }
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == GRID_ARTICULOS && pVal.ColUID == COLUMNA_SERIE_INICIO && pVal.CharPressed == CHAR_PRESS_ENTER)
                    {
                        bubbleEvent = false;
                        return;
                    }
                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == GRID_ARTICULOS && pVal.ColUID == COLUMNA_SERIE_FIN && pVal.CharPressed == CHAR_PRESS_ENTER)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == GRID_ARTICULOS && pVal.ColUID == COLUMNA_SERIE && pVal.CharPressed == CHAR_PRESS_ENTER)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == BTN_CREAR && pVal.InnerEvent == true)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == BTN_CREAR && pVal.InnerEvent == false)
                    {
                        _oForm       = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        oBtnCrearSAP = _oForm.Items.Item(BTN_CREAR).Specific;

                        if (oBtnCrearSAP.Caption == "Crear")
                        {
                            string msgError = ValidarStatusSolicitudGrid(_oForm);

                            if (!string.IsNullOrEmpty(msgError))
                            {
                                _Application.MessageBox(msgError);
                                bubbleEvent = false;
                                bubbleEvent = false;
                                return;
                            }
                        }
                    }
                }

                if (pVal.BeforeAction == true && pVal.FormType == -FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.EventType == BoEventTypes.et_COMBO_SELECT && pVal.ItemUID == TIPO_MOVIMIENTO)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        _oCmbTipoMovimiento = _oForm.Items.Item(TIPO_MOVIMIENTO).Specific;

                        if (!string.IsNullOrEmpty(_oCmbTipoMovimiento.Value.ToString()))
                        {
                            if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                            {
                                if (_Application.MessageBox("Estas seguro de cambiar el tipo de movimiento sin crear." + Environment.NewLine + "¿Desea continuar?", 2, "Si", "No") == 1)
                                {
                                    try
                                    {
                                        _oTxtPromotor.Value = "";
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                                else
                                {
                                    bubbleEvent = false;
                                }
                            }
                        }
                    }
                }



                if (pVal.BeforeAction == false && pVal.FormType == -FRM_TRANSFERENCIA_DE_STOCK)
                {
                    if (pVal.EventType == BoEventTypes.et_COMBO_SELECT && pVal.ItemUID == TIPO_MOVIMIENTO)
                    {
                        _oForm = _Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                        _oForm.Freeze(true);
                        SAPbouiCOM.Form F1 = _Application.Forms.GetFormByTypeAndCount(Convert.ToInt32(_oForm.TypeEx.TrimStart('-')), _oForm.TypeCount);
                        F1.Freeze(true);
                        _oTxtPromotor       = F1.Items.Item(TXT_PROMOTOR).Specific;
                        _oTxtNombrePromotor = F1.Items.Item(TXT_NOMBRE_PROMOTOR).Specific;
                        _oTxtSerie          = F1.Items.Item(TXT_SERIE).Specific;
                        _oCmbTipoMovimiento = _oForm.Items.Item(TIPO_MOVIMIENTO).Specific;


                        if (!string.IsNullOrEmpty(_oCmbTipoMovimiento.Value.ToString()))
                        {
                            F1.Items.Item(TXT_SERIE).Enabled = true;
                            TipoMovimiento            = _oCmbTipoMovimiento.Value.ToString().TrimEnd(' ');
                            _oTxtFechaContabilizacion = F1.Items.Item(TXT_FECHA_CONTABILIZACION).Specific;
                            _oTxtFechaDocumento       = F1.Items.Item(TXT_FECHA_DOCUMENTO).Specific;

                            if (TipoMovimiento != "PROMOTORES - OFICINAS" && TipoMovimiento != "OFICINAS - PROMOTORES")
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    _oTxtPromotor.Value       = Extensor.ObtenerSecretaria(_Company, "U_codigo_secretaria");
                                    _oTxtNombrePromotor.Value = Extensor.ObtenerSecretaria(_Company, "T0.U_nombre_secretaria");
                                }
                            }
                            else
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    _oTxtPromotor.Value       = "";
                                    _oTxtNombrePromotor.Value = "";
                                }
                            }

                            if (TipoMovimiento == "PROMOTORES - OFICINAS" || TipoMovimiento == "OFICINAS - PROMOTORES")
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    //if (Extensor.ValidarImpresionCorteSolicitudes(_Company))
                                    //{
                                    if (F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled == true)
                                    {
                                        _oTxtFechaContabilizacion.Value = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                        _oTxtFechaDocumento.Value       = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                        F1.Items.Item(TXT_FECHA_CONTABILIZACION).Enabled = false;
                                        F1.Items.Item(TXT_PROMOTOR).Click();
                                        F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled = false;
                                    }
                                    //}
                                    //else
                                    //{
                                    //    if (F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled == true)
                                    //    {
                                    //        DateTime hoy = DateTime.Now;
                                    //        DateTime mañana = hoy.AddDays(1);
                                    //        _oTxtFechaContabilizacion.Value = hoy.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString();
                                    //        _oTxtFechaDocumento.Value = mañana.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString();
                                    //        F1.Items.Item(TXT_FECHA_CONTABILIZACION).Enabled = false;
                                    //        F1.Items.Item(TXT_PROMOTOR).Click();
                                    //        F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled = false;
                                    //    }
                                    //}
                                }
                            }
                            else
                            {
                                if (_oForm.Mode == BoFormMode.fm_ADD_MODE)
                                {
                                    F1.Items.Item(TXT_PROMOTOR).Click();
                                    F1.Items.Item(TXT_FECHA_CONTABILIZACION).Enabled = true;
                                    _oTxtFechaContabilizacion.Value = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                    F1.Items.Item(TXT_PROMOTOR).Click();
                                    F1.Items.Item(TXT_FECHA_DOCUMENTO).Enabled = true;
                                    _oTxtFechaDocumento.Value = DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                }
                            }
                        }

                        _oForm.Freeze(false);
                        F1.Freeze(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en método 'eventos' *clsTransferenciaDeStock* : " + ex.Message);
            }
        }
Esempio n. 7
0
        /// <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_KEY_DOWN && (pVal.ItemUID == GRD_COMISIONES_COBRADORES))
                    {
                        _oBotonUpdate.Caption = "Actualizar";
                    }
                }

                if (pVal.FormUID == formID && pVal.BeforeAction == true)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE && pVal.Action_Success == false)
                    {
                        if (_oBotonUpdate.Caption == "Actualizar")
                        {
                            int opcion = _Application.MessageBox("¿Desea grabar las modificaciones?", 1, "Si", "No", "Cancelar");

                            if (opcion == 1)
                            {
                                ActualizarInformacion();
                                _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                                _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                                Dispose();
                                application            = null;
                                company                = null;
                                _oComisionesCobradores = false;
                                Addon.typeList.RemoveAll(p => p._forma == formID);
                                return;
                            }
                            else if (opcion == 2)
                            {
                                _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                                _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                                Dispose();
                                application            = null;
                                company                = null;
                                _oComisionesCobradores = false;
                                Addon.typeList.RemoveAll(p => p._forma == formID);
                                return;
                            }
                            else if (opcion == 3)
                            {
                                bubbleEvent = false;
                                return;
                            }
                        }
                        else
                        {
                            _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                            _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                            Dispose();
                            application            = null;
                            company                = null;
                            _oComisionesCobradores = false;
                            Addon.typeList.RemoveAll(p => p._forma == formID);
                            return;
                        }
                    }

                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTN_BUSCAR)
                        {
                            _oTxtCodeCobrador = _oForma.Items.Item(TXTCODCOB).Specific;
                            _oTxtNomCobrador  = _oForma.Items.Item(TXTNOMCOB).Specific;
                            if (!string.IsNullOrEmpty(_oTxtCodeCobrador.Value.ToString()) || !string.IsNullOrEmpty(_oTxtNomCobrador.Value.ToString()))
                            {
                                BuscarDatos(_oTxtCodeCobrador.Value, _oTxtNomCobrador.Value);
                            }
                            else
                            {
                                _Application.MessageBox("Capture el código o el nombre del cobrador");
                            }
                        }

                        if (pVal.ItemUID == BTN_CANCELAR)
                        {
                            if (_oBotonUpdate.Caption == "Actualizar")
                            {
                                int opcion = _Application.MessageBox("¿Desea grabar las modificaciones?", 1, "Si", "No", "Cancelar");

                                if (opcion == 1)
                                {
                                    ActualizarInformacion();
                                    _oBotonUpdate.Caption = "Ok";
                                    _oForma.Close();
                                }
                                else if (opcion == 2)
                                {
                                    _oBotonUpdate.Caption = "Ok";
                                    _oForma.Close();
                                }
                                else if (opcion == 3)
                                {
                                    _oForma.Select();
                                }
                            }
                            else
                            {
                                _oForma.Close();
                            }
                        }

                        if (pVal.ItemUID == BTN_UPDATE)
                        {
                            if (_oBotonUpdate.Caption == "Ok")
                            {
                                _oForma.Close();
                            }
                            else
                            {
                                ActualizarInformacion();
                                _oBotonUpdate.Caption = "Ok";
                            }
                        }

                        if (pVal.ItemUID == GRD_COMISIONES_COBRADORES && pVal.ColUID == COL_SUELDO_BASE)
                        {
                            _oBotonUpdate.Caption = "Actualizar";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsComisionCobradores* : " + ex.Message);
            }
        }