/// <summary> /// Crea los Menús de acuerdo al archivo XML /// </summary> public void AddMenus() { System.Xml.XmlDocument oXMLDoc = new System.Xml.XmlDocument(); string FileName = "MenuSAP.xml"; string OONE_FldMenus = System.IO.Directory.GetCurrentDirectory() + "\\XMLConfig\\"; try { if (!System.IO.File.Exists(OONE_FldMenus + FileName)) { SBO_Application.MessageBox("File Not Found: " + OONE_FldMenus + FileName); salirAddon(); } oForm = SBO_Application.Forms.GetFormByTypeAndCount(169, 1); oForm.Freeze(true); oXMLDoc.Load(OONE_FldMenus + FileName); SBO_Application.LoadBatchActions(oXMLDoc.InnerXml); } catch (Exception ex) { SBO_Application.MessageBox("Addon término de forma inesperada:" + ex.Message); } finally { oForm.Freeze(false); oForm.Update(); oXMLDoc = null; } }
private void OApplication_ItemEvent(string FormUID, ref ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (FormUID.Equals("frmComplex")) { oForm = oApplication.Forms.Item(FormUID); switch (pVal.EventType) { case BoEventTypes.et_ITEM_PRESSED: if (pVal.ItemUID.Equals("Folder1")) { oForm.PaneLevel = 1; } else if (pVal.ItemUID.Equals("Folder2")) { oForm.PaneLevel = 2; } else if (pVal.ItemUID.Equals("Folder3")) { oForm.PaneLevel = 3; } break; case BoEventTypes.et_FORM_RESIZE: oForm.Freeze(true); ReorganizarItensNaTela(); oForm.Freeze(false); oForm.Update(); break; case BoEventTypes.et_FORM_CLOSE: System.Windows.Forms.Application.Exit(); break; } } }
/// <summary> /// Busca la información de acuerdo a los filtros capturados /// </summary> /// <param name="efiscal"></param> /// <param name="codigo"></param> /// <param name="descripcion"></param> /// <param name="combos"></param> public void BuscarDatos(string codeCobrador, string nameCobrador) { try { _oForma.Freeze(true); string qryCobrador = null; qryCobrador = " and REPLACE(LOWER( " + "REPLACE(LOWER( " + "REPLACE(LOWER( " + "REPLACE(LOWER( " + "REPLACE(LOWER( " + "U_Cobrador),'á','a') ), " + "'é','e') ), " + "'í','i') ), " + "'ó','o') ), " + "'ú','u') LIKE '%" + nameCobrador.ToLower().Replace('á', 'a'). Replace('é', 'e'). Replace('í', 'i'). Replace('ó', 'o'). Replace('ú', 'u') + "%' "; _oGridComisionesCobradores = _oForma.Items.Item(GRD_COMISIONES_COBRADORES).Specific; _oGridComisionesCobradores.DataTable = _oForma.DataSources.DataTables.Item(DT_COMISIONES_COBRADORES); _oGridComisionesCobradores.DataTable.ExecuteQuery(@"SELECT T1.empID AS CodigoID, T0.U_Codigo_Cobrador AS CodCobrador, T0.U_Cobrador AS NomCobrador, T0.U_Serie_Programa AS SeriePrograma, --T0.U_Serie_Malba AS SerieMalba, T0.U_Serie_Cooperativa AS SerieCooperativa, T0.U_Serie_Panteon AS SeriePanteon, ISNULL(T0.U_Comision_Panteon, 0.00) AS ComisionPanteon, ISNULL(T0.U_Sueldo_Cooperativa, 0.00) AS SueldoCooperativa, ISNULL(T0.U_Sueldo_Apoyo, 0.00) AS SueldoApoyo, ISNULL(T0.U_Comision_Coop, 0.00) AS ComisionCooperativa, ISNULL(T0.U_Comision_Apoyo, 0.00) AS ComisionApoyo, ISNULL(T0.U_Efectividad, 0.00) AS Efectividad, T0.U_SueldoBase AS SueldoBase FROM dbo.[@COMISION_COBRADORES] T0 LEFT JOIN dbo.OHEM T1 ON T1.firstName = T0.U_Codigo_Cobrador --AND ( T1.middleName + ' ' + T1.lastName ) = T0.U_Cobrador WHERE --( T1.middleName + ' ' + T1.lastName ) = T0.U_Cobrador -- AND T0.U_Codigo_Cobrador LIKE '%" + codeCobrador + "%' " + qryCobrador + "ORDER BY T0.U_Codigo_Cobrador, " + "T1.empID ASC "); if (_oGridComisionesCobradores.DataTable.IsEmpty) { _Application.MessageBox("No se encontraron registros"); _oGridComisionesCobradores.DataTable.Clear(); _oForma.Update(); } else { //_oGridComisionesCobradores.AutoResizeColumns(); FormatoGrid(_oGridComisionesCobradores); _oGridComisionesCobradores.AutoResizeColumns(); } _oBotonUpdate.Caption = "Ok"; } catch (Exception ex) { throw new Exception("Error al buscar datos *BuscarDatos* : " + ex.Message); } finally { _oForma.Freeze(false); } }
/// <summary> /// Se le da el formato al grid para visualizarlo /// </summary> /// <param name="grid">Nombre del grid</param> public void FormatoGrid(Grid grid) { try { _oForma.Freeze(true); if (!grid.DataTable.IsEmpty) { grid.RowHeaders.TitleObject.Caption = "#"; for (int noLinea = 0; noLinea < grid.Rows.Count; noLinea++) { grid.RowHeaders.SetText(noLinea, (noLinea + 1).ToString()); } grid.Columns.Item("DocEntry").Editable = false; grid.Columns.Item("DocEntry").TitleObject.Caption = "DocEntry"; SAPbouiCOM.EditTextColumn oColTransferStock = grid.Columns.Item("DocEntry") as SAPbouiCOM.EditTextColumn; oColTransferStock.LinkedObjectType = LINK_TRANSFERENCIA_STOCK; grid.Columns.Item("DocEntry").Width = 60; grid.Columns.Item("Crear").Editable = true; grid.Columns.Item("Crear").TitleObject.Caption = "Crear"; grid.Columns.Item("Crear").Width = 90; if (!grid.DataTable.IsEmpty) { grid.Columns.Item("Crear").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox; } grid.Columns.Item("DocNum").Editable = false; grid.Columns.Item("DocNum").TitleObject.Caption = "Número traspaso"; grid.Columns.Item("DocNum").Width = 90; grid.Columns.Item("CodigoUsuario").Editable = false; grid.Columns.Item("CodigoUsuario").TitleObject.Caption = "Usuario"; grid.Columns.Item("Serie").Editable = false; grid.Columns.Item("Serie").TitleObject.Caption = "Solicitud"; grid.Columns.Item("CodigoPromotor").Editable = false; grid.Columns.Item("CodigoPromotor").TitleObject.Caption = "Código promotor"; grid.Columns.Item("NombrePromotor").Editable = false; grid.Columns.Item("NombrePromotor").TitleObject.Caption = "Nombre promotor"; grid.Columns.Item("CodigoPlan").Editable = false; grid.Columns.Item("CodigoPlan").TitleObject.Caption = "Código plan"; SAPbouiCOM.EditTextColumn oColPlan = grid.Columns.Item("CodigoPlan") as SAPbouiCOM.EditTextColumn; oColPlan.LinkedObjectType = LINK_ARTICULO; grid.Columns.Item("NombrePlan").Editable = false; grid.Columns.Item("NombrePlan").TitleObject.Caption = "Nombre plan"; grid.Columns.Item("NombrePlan").Width = 120; grid.Columns.Item("FormaDePago").Editable = false; grid.Columns.Item("FormaDePago").TitleObject.Caption = "Forma de pago"; grid.Columns.Item("FormaDePago").Width = 90; grid.Columns.Item("OrigenSolicitud").Editable = false; grid.Columns.Item("OrigenSolicitud").TitleObject.Caption = "Origen de solicitud"; grid.Columns.Item("OrigenSolicitud").Width = 90; grid.Columns.Item("InversionInicial").Editable = false; grid.Columns.Item("InversionInicial").TitleObject.Caption = "Inversión inicial"; grid.Columns.Item("InversionInicial").Width = 80; grid.Columns.Item("Comision").Editable = false; grid.Columns.Item("Comision").TitleObject.Caption = "Comisión"; grid.Columns.Item("Comision").Width = 80; grid.Columns.Item("ImportePapeleria").Editable = false; grid.Columns.Item("ImportePapeleria").TitleObject.Caption = "Importe papelería"; grid.Columns.Item("ImportePapeleria").Width = 80; grid.Columns.Item("ImporteRecibido").Editable = false; grid.Columns.Item("ImporteRecibido").TitleObject.Caption = "Importe recibido"; grid.Columns.Item("ImporteRecibido").Width = 80; grid.Columns.Item("ExcedenteInvIni").Visible = false; grid.Columns.Item("ExcedenteInvIni").TitleObject.Caption = "Excedente individual. inicial"; grid.Columns.Item("ExcedenteInvIni").Width = 90; grid.Columns.Item("Bono").Visible = false; grid.Columns.Item("Bono").TitleObject.Caption = "Bono"; grid.Columns.Item("Bono").Width = 80; grid.CollapseLevel = 1; _oGridPrecontratos.AutoResizeColumns(); } else { _Application.MessageBox("No se encontraron registros"); grid.DataTable.Clear(); } } catch (Exception ex) { throw new Exception("Error al dar formato al grid *FormatoGrid* : " + ex.Message); } finally { _oForma.Freeze(false); _oForma.Update(); } }