private void Button0_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                string sql = "";
                if (EditText0.Value.Trim().Length > 0)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
                    if (CheckBox0.Checked)
                    {
                        sql = @"select Project as 'Proyecto', DocNum as 'Numero Pedido', CardName as 'Cliente Final', CreateDate as 'Fecha Creacion'
                                    from ORDR 
                                    where Series = 27 and ( DocNum = " + EditText0.Value.Trim() + " or Project = '" + EditText0.Value.Trim() + @"')  
                                    order by Project, CreateDate";
                    }
                    else
                    {
                        sql = @"select Project as 'Proyecto', DocNum as 'Numero Pedido', CardName as 'Cliente Final', CreateDate as 'Fecha Creacion'
                                    from ORDR 
                                    where Series = 27 and SlpCode = " + oUDS.ValueEx + " and ( DocNum = " + EditText0.Value.Trim() + " or Project = '" + EditText0.Value.Trim() + @"')  
                                    order by Project, CreateDate";
                    }

                    DT_SQL.ExecuteQuery(sql);
                    DT_PCV.CopyFrom(DT_SQL);

                    Grid0.Columns.Item(2).Width = 200;

                    Ultima_Busqueda = EditText0.Value.Trim();
                }
                else
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
                    if (CheckBox0.Checked)
                    {
                        sql = @"select Project as 'Proyecto', DocNum as 'Numero Pedido', CardName as 'Cliente Final', CreateDate as 'Fecha Creacion'
                                    from ORDR 
                                    where Series = 27 
                                    order by Project, CreateDate";
                    }
                    else
                    {
                        sql = @"select Project as 'Proyecto', DocNum as 'Numero Pedido', CardName as 'Cliente Final', CreateDate as 'Fecha Creacion'
                                    from ORDR 
                                    where Series = 27 and SlpCode = " + oUDS.ValueEx + @"
                                    order by Project, CreateDate";
                    }

                    DT_SQL.ExecuteQuery(sql);
                    DT_PCV.CopyFrom(DT_SQL);

                    Grid0.Columns.Item(2).Width = 200;

                    Ultima_Busqueda = "°#TODOS LOS REGISTROS#°";
                }
            }
            catch (Exception)
            {
            }
        }
        private void Form_ResizeAfter(SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
                string sql = @"select Project as 'Proyecto', DocNum as 'Numero Pedido', CardName as 'Cliente Final', CreateDate as 'Fecha Creacion'
                                from ORDR 
                                where Series = 27 and SlpCode = " + oUDS.ValueEx + @"
                                order by Project, CreateDate";

                DT_SQL.ExecuteQuery(sql);
                DT_PCV.CopyFrom(DT_SQL);

                Grid0.Columns.Item(2).Width = 200;

                oUDS = oForm.DataSources.UserDataSources.Item("UD_2");
                StaticText1.Caption = "VENDEDOR: " + oUDS.ValueEx;
            }
            catch (Exception)
            {
            }
        }