static void SBO_Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BOInfo, out bool BubbleEvent) { BubbleEvent = true; SAPbouiCOM.Form oForm = Application.SBO_Application.Forms.Item(BOInfo.FormUID); try { if ((BOInfo.FormTypeEx == "142")) { OrdenCompra.OrdenCompra_FormDataEvent(ref BOInfo, out BubbleEvent); } if ((BOInfo.FormTypeEx == "141")) { FacturaProveedores.FacturaProveedores_FormDataEvent(ref BOInfo, out BubbleEvent); } int ObjN = Convert.ToInt32(BOInfo.Type); //Bloquear o Habilitar Campos de Fechas en la ventanas de UDF en los documentos de Marketing segun iFormularios if ((BOInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD) && BOInfo.BeforeAction && Array.Exists(iFormularios, element => element == ObjN)) { string[] U_Campos = { "U_MIN_FechaVenta", "U_MIN_FinMontaje", "U_MIN_FinDesarr", "U_MIN_FinProduccion", "U_MIN_IniDespacho", "U_MIN_IniMontaje", "U_MIN_FinMontaje", "U_MIN_FechaMulta" }; try { oForm = Application.SBO_Application.Forms.GetForm("-" + BOInfo.FormTypeEx, 1);// Item(BOInfo.FormUID); SAPbouiCOM.EditText oEdit; if (Funciones.ConsultaUsuario == false) { SAPbouiCOM.DataTable oDataTable = null; if (!Funciones.DataTableExists(oForm, "DT_SQL")) { oForm.DataSources.DataTables.Add("DT_SQL"); } oDataTable = oForm.DataSources.DataTables.Item("DT_SQL"); Funciones.IdentificarAccesoUsuario(oDataTable); } foreach (string element in U_Campos) { if (Funciones.ItemExists(oForm, element)) { oEdit = (SAPbouiCOM.EditText)oForm.Items.Item(element).Specific; if (oEdit.Item.Enabled == Funciones.Habilitado) // Verifica si ya estan condicionados los campos para no volver a ejecutar el proceso en la pantalla activa { break; } oEdit.Item.Enabled = Funciones.Habilitado; } } } catch (Exception) { } } } catch (Exception) { } }
static void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; SAPbouiCOM.Form oForm = null; SAPbouiCOM.EditText oEdit = null; SAPbouiCOM.DataTable oDataTable = null; try { // ------------------------------------------------------------------------------------------------------------------------------------------------ // ESTOS EVENTO MANEJA LA CONDICION MODAL DE LAS PANTALLAS DONDE ReportType = "Modal" // ------------------------------------------------------------------------------------------------------------------------------------------------ if (((pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_VISIBLE) && (pVal.BeforeAction == false))) { try { oForm = Application.SBO_Application.Forms.Item(pVal.FormUID); if ((oForm.ReportType == "Modal")) { NModal.esPantallaModal = true; NModal.IDPantallaModal = pVal.FormUID; } } catch (Exception) { } } if (NModal.esPantallaModal && pVal.FormUID != NModal.IDPantallaModal && NModal.IDPantallaModal.Trim().Length > 0 && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE || pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED || pVal.EventType == SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED || pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS || pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_RESIZE || pVal.EventType == SAPbouiCOM.BoEventTypes.et_VALIDATE || pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK)) { try { // Selecciona la pantalla modal BubbleEvent = false; oForm = Application.SBO_Application.Forms.Item(NModal.IDPantallaModal); oForm.Select(); } catch (Exception) { } } // If the modal from is closed... if (((FormUID == NModal.IDPantallaModal) && ((pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE) && NModal.esPantallaModal))) { NModal.esPantallaModal = false; NModal.IDPantallaModal = ""; } // ------------------------------------------------------------------------------------------------------------------------------------------------ //Ordenes de Compra if (pVal.FormTypeEx == "142") { OrdenCompra.OrdenCompra_ItemEvent(FormUID, ref pVal, out BubbleEvent); } //Enviar Solicitud de Compra Interna a Salida de Mercancias (Exportar Lineas y datos del Documento Base) if (pVal.FormTypeEx == "1470000200" && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) && (pVal.ItemUID == "10000329")) { SolicitudCompra.SolicitudCompra_ItemEvent(FormUID, ref pVal, out BubbleEvent); } int ObjN = Math.Abs(Convert.ToInt32(pVal.FormTypeEx)); //Bloquear o Habilitar Campos de Fechas en la ventanas de UDF en los documentos de Marketing if ((pVal.FormTypeEx.Substring(0, 1) == "-") && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD) && pVal.BeforeAction == false) { string[] U_Campos = { "U_MIN_FechaVenta", "U_MIN_FinMontaje", "U_MIN_FinDesarr", "U_MIN_FinProduccion", "U_MIN_IniDespacho", "U_MIN_IniMontaje", "U_MIN_FinMontaje", "U_MIN_FechaMulta" }; try { oForm = Application.SBO_Application.Forms.Item(pVal.FormUID); if (Funciones.ConsultaUsuario == false) { oDataTable = null; try { oDataTable = oForm.DataSources.DataTables.Item("DT_SQL"); } catch { oDataTable = oForm.DataSources.DataTables.Add("DT_SQL"); } Funciones.IdentificarAccesoUsuario(oDataTable); } foreach (string element in U_Campos) { if (Funciones.ItemExists(oForm, element)) { oEdit = (SAPbouiCOM.EditText)oForm.Items.Item(element).Specific; oEdit.Item.Enabled = Funciones.Habilitado; } } } catch (Exception) { // throw; } } } catch (Exception) { } }