コード例 #1
0
        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) { }
        }
コード例 #2
0
        public static void OrdenCompra_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool bBubbleEvent)
        {
            bBubbleEvent = true;
            try
            {
                switch (pVal.BeforeAction)
                {
                case true:
                    //Al momento de crear la Orden de Compra, compara las lineas del documento con el documento base para verificar que estas sean identicas
                    if ((pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) && (pVal.ItemUID == "1"))
                    {
                        try
                        {
                            oButton = (SAPbouiCOM.Button)oForm.Items.Item(pVal.ItemUID).Specific;
                            if (!Funciones.DataTableExists(oForm, "DT_SQL"))
                            {
                                oForm.DataSources.DataTables.Add("DT_SQL");
                            }
                            oDataTable = oForm.DataSources.DataTables.Item("DT_SQL");

                            if (oButton.Caption == "Crear")
                            {
                                OrdenCompra.Comparar_Lineas_Solicitud(pVal.FormUID);
                            }
                        }
                        catch (Exception) { }
                    }
                    break;

                case false:
                    //Muestra en las Ordenes de Compra (Pedidos Compras) los saldos correspondientes a los pagos relacionados realizados.
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE)
                    {
                        if (Funciones.ItemExists(oForm, "Item_0") == true)
                        {
                            oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("Item_0").Specific;
                            if (oEdit.Value.Trim().Length == 0)
                            {
                                Funciones.CargarDatosPagos(oForm);
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception) { }
        }
コード例 #3
0
        public static void CargarDatosPagos(SAPbouiCOM.Form oForm)
        {
            try
            {
                SAPbouiCOM.EditText  oEdit      = (SAPbouiCOM.EditText)oForm.Items.Item("8").Specific;
                SAPbouiCOM.DataTable oDataTable = null;
                try
                {
                    oDataTable = oForm.DataSources.DataTables.Item("DT_SQL");
                }
                catch
                {
                    oDataTable = oForm.DataSources.DataTables.Add("DT_SQL");
                }


                string nDoc = oEdit.Value;

                string BD = Convert.ToString(oCompany.CompanyDB);

                string sql = BD + ".[dbo].[SP_Saldo_Pediente_Orden_Compra] " + nDoc;

                //            string sql = @"SELECT   SC.DocNum as 'N° Pedido'
                //		                            ,SC.CardCode as 'Codigo Proveedor'
                //		                            ,SC.CardName as 'Proveedor'
                //		                            ,SC.TaxDate as 'Emision Pedido'
                //		                            ,SC.DocTotal as 'Total Pedido'
                //		                            ,'$ ' + REPLACE(REPLACE(CONVERT(NVARCHAR, convert(money, SUM(ISNULL(PC.SumApplied,0))), 1),'.00',''),',','.')  as 'Total Cancelado'
                //		                            ,'$ ' + REPLACE(REPLACE(CONVERT(NVARCHAR, convert(money, (SC.DocTotal - SUM(ISNULL(PC.SumApplied,0)))), 1),'.00',''),',','.') as 'Saldo Pendiente'
                //                            FROM OPOR SC LEFT JOIN OPCH FC ON SC.DocNum = FC.U_MIN_Pedido AND FC.CANCELED != 'Y'
                //                            LEFT JOIN VPM2 PC ON FC.DocEntry = PC.DocEntry
                //                            LEFT JOIN OVPM CPC ON PC.DocNum = CPC.DocNum
                //                            WHERE SC.DocNum = " + nDoc + @" AND  ISNULL(CPC.Canceled,'N') != 'Y'
                //                            GROUP BY SC.DocNum
                //		                                ,SC.CardCode
                //		                                ,SC.CardName
                //		                                ,SC.TaxDate
                //		                                ,SC.DocTotal
                //                            --HAVING SC.DocTotal > SUM(ISNULL(PC.SumApplied,0))
                //                            ORDER BY SC.DocNum";

                oDataTable.ExecuteQuery(sql);

                if (oDataTable.IsEmpty == false)
                {
                    if (Funciones.ItemExists(oForm, "Item_0") == true)
                    {
                        oUserDataSource         = oForm.DataSources.UserDataSources.Item("UD_TP");
                        oUserDataSource.ValueEx = oDataTable.GetValue(5, 0).ToString();
                        oUserDataSource         = oForm.DataSources.UserDataSources.Item("UD_SP");
                        oUserDataSource.ValueEx = oDataTable.GetValue(6, 0).ToString();

                        //oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("Item_0").Specific;
                        //sql = (string)oDataTable.GetValue(5, 0);
                        //oEdit.String = sql;
                        //oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("Item_1").Specific;
                        //sql = (string)oDataTable.GetValue(6, 0);
                        //oEdit.String = sql;
                    }
                }
                else
                {
                    oUserDataSource         = oForm.DataSources.UserDataSources.Item("UD_TP");
                    oUserDataSource.ValueEx = "";
                    oUserDataSource         = oForm.DataSources.UserDataSources.Item("UD_SP");
                    oUserDataSource.ValueEx = "";

                    //oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("Item_0").Specific;
                    //oEdit.String = "";
                    //oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("Item_1").Specific;
                    //oEdit.String = "";
                }
            }
            catch
            {
            }
        }
コード例 #4
0
        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) { }
        }