private void OnCustomInitialize()
        {
            //conexion  actual
            oApp     = (SAPbouiCOM.Application)Application.SBO_Application;
            oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();


            CleanComboBox(ComboBox0);
            string SqlCad = ("SELECT U_CodigoSS AS 'Código',U_NombreSS AS 'Nombre' FROM  [@SUPRASECCIONESCOL]");

            // oApp.SetStatusBarMessage("El dato es " + SqlCad );
            LoadComboQueryRecordset(SqlCad, ComboBox0, "Código", "Nombre", oCompany);



            //activamos el form para poder dar formato de moenda al campo precio
            oForm = oApp.Forms.Item("creasecc");
            //  Muestra el formulario
            oForm.Visible = true;
            //EditText2.Value = "0,00";
            //creamos un userdatasources , con estilo precio, luego se lo asignamos al campo precio (txtprsec)
            oForm.DataSources.UserDataSources.Add("VALORPRE", SAPbouiCOM.BoDataType.dt_PRICE, 0);
            SAPbouiCOM.EditText oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("txtprsec").Specific;
            oEdit.DataBind.SetBound(true, "", "VALORPRE");
            //'Asignar Valor a EditText por Medio del UDS '
            SAPbouiCOM.UserDataSource oUserDataSource = oForm.DataSources.UserDataSources.Item("VALORPRE");
            oUserDataSource.ValueEx = "0.00";
        }
Beispiel #2
0
        public void instanciarObjetosUI()
        {
            udsEstadoConfiguracion = mForm.DataSources.UserDataSources.Item(UDS_ESTADO_CONFIGURACION);
            udsEstadoSociedad      = mForm.DataSources.UserDataSources.Item(UDS_ESTADO_SOCIEDAD);
            udsCondicionSociedad   = mForm.DataSources.UserDataSources.Item(UDS_CONDICION_SOCIEDAD);
            udsEstadoOrden         = mForm.DataSources.UserDataSources.Item(UDS_EST_ORDR);
            udsEstadoPago          = mForm.DataSources.UserDataSources.Item(UDS_EST_ORCT);
            udsCondicionSociedad   = mForm.DataSources.UserDataSources.Item(UDS_CONDICION_SOCIEDAD);
            udsMotivoTraslado      = mForm.DataSources.UserDataSources.Item(UDS_MOTIVO_TRASLADO);
            edtSociedad            = mForm.Items.Item(EDT_SOCIEDAD).Specific;
            edtDescripcion         = mForm.Items.Item(EDT_DESCRIPCION).Specific;
            edtUsuario             = mForm.Items.Item(EDT_USUARIO).Specific;
            edtPassword            = mForm.Items.Item(EDT_PASSWORD).Specific;
            edtIdInterno           = mForm.Items.Item(EDT_IDINTERNO).Specific;
            edtMaxLineasOrdn       = mForm.Items.Item(EDT_MAXLINEAS).Specific;
            edtMotivoTraslado      = mForm.Items.Item(EDT_MOT_TRASLADO).Specific;
            cboEstado      = mForm.Items.Item(CBO_ESTADO).Specific;
            cboCondicion   = mForm.Items.Item(CBO_CONDICION).Specific;
            cboEstOrden    = mForm.Items.Item(CBO_EST_ORDR).Specific;
            cboEstPago     = mForm.Items.Item(CBO_EST_ORCT).Specific;
            btnRegistrar   = mForm.Items.Item(BTN_REGISTRAR).Specific;
            btnP1Siguiente = mForm.Items.Item(BTN_P1NEXT).Specific;

            edtCodigoMenu = mForm.Items.Item(EDT_CODIGO_MENU).Specific;
            edtDescrpMenu = mForm.Items.Item(EDT_DESCRIPCION_MENU).Specific;
            gridListaMenu = mForm.Items.Item(GRID_LISTA_MENU).Specific;
        }
        private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            if (Grid0.Rows.SelectedRows.Count > 0)
            {
                oUDS = oForm.DataSources.UserDataSources.Item("UD_0");
                int      nRow  = Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder);
                string[] sVend = new string[2];
                sVend[0] = Convert.ToString(Grid0.DataTable.GetValue(0, nRow));
                sVend[1] = "(" + Convert.ToString(Grid0.DataTable.GetValue(1, nRow)) + ") - "
                           + Convert.ToString(Grid0.DataTable.GetValue(2, nRow));
                SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                oForm.Close();

                switch (sOrigf)
                {
                case "Pagos":
                    Comisiones.Asigna_Vendedor_Grid_Pagos(sVend[0]);
                    break;

                case "Premios":
                    Comisiones.Asigna_Vendedor_Grid_Premios(sVend[0]);
                    break;

                case "ComisionesA":
                case "ComisionesR":
                    Comisiones.Agregar_Vendedor_Comisiones_Periodo(sVend);
                    break;
                }
            }
        }
        public TabOrder()
        {
            AppHelper.SetApplication(ref this.oApplication);

            string strTmp = "TabOrder.srf";

            UIHelper.LoadFromXML(oApplication, ref strTmp);

            oForm  = oApplication.Forms.Item("frmTab");
            userDS = UserDataSourceHelper.AddUserDataSource(oForm, "OpBtnDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);


            oItem         = oForm.Items.Item("optHor");
            oOptionBtnHor = ((SAPbouiCOM.OptionBtn)(oItem.Specific));
            oOptionBtnHor.GroupWith("optVer");
            oOptionBtnHor.DataBind.SetBound(true, "", "OpBtnDS");

            oItem = oForm.Items.Item("optVer");

            oOptionBtnVer = ((SAPbouiCOM.OptionBtn)(oItem.Specific));
            oOptionBtnVer.GroupWith("optHor");
            oOptionBtnVer.DataBind.SetBound(true, "", "OpBtnDS");

            oOptionBtnHor.Selected = true;
            SetTabHorizontal();



            oForm.Visible = true;

            oApplication.ItemEvent += OApplication_ItemEvent;
        }
        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 Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                if (CheckBox0.Checked)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_0X");

                    SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                    oForm.Close();

                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_2").Specific).String  = "AJUSTE";
                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_10").Specific).String = "AJUSTE";
                }
                else
                if (Grid0.Rows.SelectedRows.Count > 0)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_0X");
                    string sRut    = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));
                    string sNombre = Convert.ToString(Grid0.DataTable.GetValue(1, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));

                    SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                    oForm.Close();

                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_2").Specific).String  = sRut;
                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_10").Specific).String = sNombre;
                }
            }
            catch (Exception)
            {
            }
        }
 public static bool UserDataSourceExists(SAPbouiCOM.Form oForm, string ItemUid)
 {
     try
     {
         SAPbouiCOM.UserDataSource oUDataSource = oForm.DataSources.UserDataSources.Item(ItemUid);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Beispiel #8
0
        public void AddDataSourceToForm()
        {
            //****************************************************************
            // every item must be binded to a Data Source
            // prior of binding the data we must add Data sources to the form
            //****************************************************************

            // Add user data sources to the "International Phone" column in the matrix
            oUserDataSource = oForm.DataSources.UserDataSources.Add("CÓDIGO", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);

            // Add DB data sources for the DB bound columns in the matrix
            oDBDataSource = oForm.DataSources.DBDataSources.Add("@EDICIONESCOL");
        }
Beispiel #9
0
        private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                FrmEmpleados activeForm = new FrmEmpleados();

                SAPbouiCOM.UserDataSource oUDS = activeForm.UIAPIRawForm.DataSources.UserDataSources.Item("UD_0");
                oUDS.ValueEx = oForm.UniqueID;

                activeForm.Show();
            }
            catch { }
        }
        private void Form_ResizeAfter(SAPbouiCOM.SBOItemEventArg pVal)
        {
            oUDS   = oForm.DataSources.UserDataSources.Item("UD_1");
            sOrigf = oUDS.ValueEx;
            string sql;

            switch (sOrigf)
            {
            case "ComisionesA":
                oForm.Title = "Agregar Vendedor a Comisiones";
                sql         = @"SELECT 
	                            SlpCode as 'Codigo'
	                            ,Memo  as 'Inicial' 
	                            ,SlpName as 'Nombre'
                            FROM 
	                            OSLP 
                            WHERE 
	                            Active = 'Y'
	                            AND SlpCode != -1
                                AND SlpCode NOT IN ( SELECT DISTINCT V.SlpCode 
                                                        FROM OSLP V join [@Z_COMI_VEND] P ON V.SlpCode = P.[Id Vend]
                                                        WHERE V.Active  = 'Y' 
                                                            AND V.SlpCode != -1  
                                                            AND Periodo = '" + NPeriodo.NombrePeriodo + @"') 
                            ORDER BY
	                            1"    ;
                DT_SQL.ExecuteQuery(sql);
                break;

            case "ComisionesR":
                oForm.Title = "Agregar Vendedor a Comisiones";
                sql         = @"SELECT 
	                            SlpCode as 'Codigo'
	                            ,Memo  as 'Inicial' 
	                            ,SlpName as 'Nombre'
                            FROM 
	                            OSLP 
                            WHERE 
	                            Active = 'Y'
	                            AND SlpCode != -1
                                AND SlpCode NOT IN ( SELECT DISTINCT V.SlpCode 
                                                        FROM OSLP V join ORDR P ON V.SlpCode = P.SlpCode
                                                        WHERE V.Active  = 'Y' AND V.SlpCode != -1 AND series = 27
                                                        AND P.CreateDate BETWEEN  '" + NPeriodo.FechaInicio.ToString("MM-dd-yyyy") +
                              @"' AND '" + NPeriodo.FechaFin.ToString("MM-dd-yyyy") + @"') 
                            ORDER BY
	                            1"    ;
                DT_SQL.ExecuteQuery(sql);
                break;
            }
        }
        private void Form_ResizeAfter(SAPbouiCOM.SBOItemEventArg pVal)
        {
            oUDS   = oForm.DataSources.UserDataSources.Item("UD_1");
            sOrigf = oUDS.ValueEx;

            if (sOrigf == "Pagos")
            {
                CheckBox0.Item.Visible = true;
            }
            else
            {
                CheckBox0.Item.Visible = false;
            }
        }
Beispiel #12
0
 private void Form_CloseAfter(SAPbouiCOM.SBOItemEventArg pVal)
 {
     try
     {
         SAPbouiCOM.UserDataSource oUDS  = oForm.DataSources.UserDataSources.Item("UD_R");
         SAPbouiCOM.UserDataSource oUDSR = oForm.DataSources.UserDataSources.Item("UD_Z");
         if (oUDS.ValueEx.Trim().Length > 0 && oUDSR.ValueEx.Trim() == "Y")
         {
             SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx.Trim());
             ((SAPbouiCOM.Button)oFormP.Items.Item("Item_68").Specific).Item.Click();
         }
     }
     catch (Exception) { }
 }
 public static void OrdenCompra_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     // Boton CREAR Y BUSCAR
     if ((pVal.MenuUID == "1281" || pVal.MenuUID == "1282") && pVal.BeforeAction == false)
     {
         try
         {
             oUserDataSource         = oForm.DataSources.UserDataSources.Item("UD_TP");
             oUserDataSource.ValueEx = "";
             oUserDataSource         = oForm.DataSources.UserDataSources.Item("UD_SP");
             oUserDataSource.ValueEx = "";
         }
         catch {}
     }
 }
        private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                if (CheckBox0.Checked)
                {
                    oForm.Close();
                    Comisiones.Agregar_Proyecto_Grid_Pagos("");
                }

                if (Grid0.Rows.SelectedRows.Count > 0 && CheckBox0.Checked == false)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
                    string sOrig = oUDS.ValueEx;

                    oUDS = oForm.DataSources.UserDataSources.Item("UD_0");
                    string sProyecto = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));

                    SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                    oForm.Close();

                    switch (sOrigf)
                    {
                    case "Consultas":
                        ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_23").Specific).String = sProyecto;
                        break;

                    case "Pagos":
                        Comisiones.Agregar_Proyecto_Grid_Pagos(sProyecto);
                        break;

                    case "Premios":
                        Comisiones.Agregar_Proyecto_Grid_Premios(sProyecto);
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
 private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     try
     {
         if (Grid0.Rows.SelectedRows.Count > 0)
         {
             oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
             string sPedido       = Convert.ToString(Grid0.DataTable.GetValue(1, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));
             int    TipoOperacion = OptionBtn0.Selected ? 1 : -1;
             int    Vend          = CheckBox0.Checked ?  Convert.ToInt32(oUDS.ValueEx) : 0;//Si muestra todos los vendedores se pasa la info con el vendedor consultado.
             Comisiones.Agregar_Documento_Grid_Comisiones(sPedido, ref TipoOperacion, Vend);
             if (TipoOperacion != 0)
             {
                 oForm.Close();
             }
         }
     }
     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)
            {
            }
        }
Beispiel #17
0
        private void AddItemsToForm()
        {
            oForm.DataSources.UserDataSources.Add("OpBtnDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
            oForm.DataSources.UserDataSources.Add("CheckDS1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
            oForm.DataSources.UserDataSources.Add("CheckDS2", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
            oForm.DataSources.UserDataSources.Add("CheckDS3", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
            oForm.DataSources.UserDataSources.Add("FolderDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
            oForm.DataSources.UserDataSources.Add("EditSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
            oForm.DataSources.UserDataSources.Add("CombSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);

            oUserDataSource = oForm.DataSources.UserDataSources.Add("dt", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
            AddChooseFromList();
            AddChooseFromList2();
        }
Beispiel #18
0
        public MeuFormGrid()
        {
            AppHelper.SetApplication(ref this.oApplication);

            this.oForm = UIHelper.CriarForm(this.oApplication, SAPbouiCOM.BoFormBorderStyle.fbs_Sizable, "SAMPLE", "frmGrid", 0, 0, true, 0, "Exemplo de Grid UIAPI", 305, 650);
            this.oForm.Freeze(true);


            this.oStaticHeader = UIHelper.AddStaticTextAoFormulario(this.oForm, "StatHeader"
                                                                    , 20, 500, 20, 0, "Em um novo grid você pode definir que os dados sejam agrupados e tenham uma árvore de colapso ");

            this.oStaticHead = UIHelper.AddStaticTextAoFormulario(this.oForm, "StatHead"
                                                                  , 20, 500, 40, 0, "Neste grid você poderá ver todas as notas fiscias de venda Cadastradas");

            this.oBtnCo  = UIHelper.AddBotaoAoFormulario(this.oForm, "btnCol", 480, 0, 80, 0, "Collapse", false);
            this.oBtnExp = UIHelper.AddBotaoAoFormulario(this.oForm, "btnExp", 480, 0, 110, 0, "Expand", false);

            this.oStaticGroup = UIHelper.AddStaticTextAoFormulario(this.oForm, "StatGroup"
                                                                   , 470, 80, 140, 0, "Agrupado ");

            userDS = UserDataSourceHelper.AddUserDataSource(this.oForm, "OpBtnDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);

            this.oOptNoGroup = UIHelper.AddOptionButtonAoFormulario(
                this.oForm
                , "optNo"
                , 480
                , 120
                , 160
                , 0
                , "Sem Agrupamento"
                , ""
                , true
                , 0
                , 0
                );

            this.oOptNoGroup.DataBind.SetBound(true, "", "OpBtnDS");

            this.oOptCardCode = UIHelper.AddOptionButtonAoFormulario(
                this.oForm
                , "optCode"
                , 480
                , 120
                , 180
                , 0
                , "Código do Cliente"
                , "optNo"
                , true
                , 0
                , 0
                );

            this.oOptCardCode.DataBind.SetBound(true, "", "OpBtnDS");

            this.oOptDocDate = UIHelper.AddOptionButtonAoFormulario(
                this.oForm
                , "optDate"
                , 480
                , 120
                , 200
                , 0
                , " Data do Documento"
                , "optNo"
                , true
                , 0
                , 0
                );

            this.oOptDocDate.DataBind.SetBound(true, "", "OpBtnDS");


            this.oOptDocStatus = UIHelper.AddOptionButtonAoFormulario(
                this.oForm
                , "optStatus"
                , 480
                , 120
                , 220
                , 0
                , " Status do Documento"
                , "optNo"
                , true
                , 0
                , 0
                );

            this.oOptDocStatus.DataBind.SetBound(true, "", "OpBtnDS");
            oItem        = oForm.Items.Add("MyGrid", SAPbouiCOM.BoFormItemTypes.it_GRID);
            oItem.Left   = 20;
            oItem.Top    = 60;
            oItem.Width  = 430;
            oItem.Height = 200;

            oGrid = ((SAPbouiCOM.Grid)(oItem.Specific));

            oForm.DataSources.DataTables.Add("MyDataTable");
            oForm.DataSources.DataTables.Item(0).ExecuteQuery("select CardCode, DocDate, DocNum, DocTotal, DocStatus from OINV");
            oGrid.DataTable = oForm.DataSources.DataTables.Item("MyDataTable");

            oGrid.Columns.Item(0).Width = 50;
            oGrid.Columns.Item(1).Width = 60;
            oGrid.Columns.Item(2).Width = 130;
            for (int i = 0; i < oGrid.Columns.Count; i++)
            {
                oGrid.Columns.Item(1).Editable = false;
            }

            AtualizarTiposColunas();

            ColorirLinhas();

            this.oForm.Visible = true;

            this.oApplication.ItemEvent += OApplication_ItemEvent;
            this.oForm.Freeze(false);
        }
Beispiel #19
0
        //private void OApplication_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        //{
        //    BubbleEvent = true;
        //    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ALL_EVENTS_CLICK)
        //    {

        //    }
        //}

        private void button1_Click(object sender, EventArgs e)
        {
            this.oDBDataSource   = this.oForm.DataSources.DBDataSources.Add("OITM");
            this.oUserDataSource = this.oForm.DataSources.UserDataSources.Add("user1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);

            this.oItem        = this.oForm.Items.Add("matrix1", SAPbouiCOM.BoFormItemTypes.it_MATRIX);
            this.oItem.Height = Convert.ToInt32(this.oForm.Height * 0.7);
            this.oItem.Width  = Convert.ToInt32(this.oForm.Width * 0.9);
            this.oItem.Top    = 10;
            this.oMatrix      = (SAPbouiCOM.Matrix)oItem.Specific;

            this.oMatrix.Layout        = SAPbouiCOM.BoMatrixLayoutType.mlt_Normal;
            this.oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Auto;
            //col1
            this.oColumn                     = this.oMatrix.Columns.Add("col0", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            this.oColumn.Editable            = false;
            this.oColumn.TitleObject.Caption = "#";
            //col2
            this.oColumn                     = this.oMatrix.Columns.Add("Picture", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX);
            this.oColumn.Width               = 60;
            this.oColumn.Description         = "Col1";
            this.oColumn.TitleObject.Caption = "Picture";
            this.oColumn.DisplayDesc         = false;
            this.oColumn.DataBind.SetBound(true, "", "user1");

            SAPbouiCOM.ColumnSetting       cs = this.oColumn.ColumnSetting;
            SAPbouiCOM.BoColumnDisplayType dt = cs.DisplayType;
            cs.DisplayType = SAPbouiCOM.BoColumnDisplayType.cdt_Picture;
            dt             = cs.DisplayType;

            //col3

            this.oColumn                     = this.oMatrix.Columns.Add("mergecell", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            this.oColumn.Width               = 60;
            this.oColumn.Description         = "Mer";
            this.oColumn.TitleObject.Caption = "MergeCell";
            this.oColumn.DataBind.SetBound(true, "OITM", "U_string");
            this.oColumn.Editable = false;

            //col4

            this.oColumn                     = this.oMatrix.Columns.Add("ItemName", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            this.oColumn.Width               = 60;
            this.oColumn.Description         = "col2";
            this.oColumn.TitleObject.Caption = "OITM - ItemName";
            this.oColumn.DataBind.SetBound(true, "OITM", "ItemName");
            this.oColumn.Editable = false;

            //col5

            this.oColumn                     = this.oMatrix.Columns.Add("ItemCode", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            this.oColumn.Width               = 60;
            this.oColumn.Description         = "col3";
            this.oColumn.TitleObject.Caption = "OITM - ItemCode";
            this.oColumn.DisplayDesc         = false;
            this.oColumn.DataBind.SetBound(true, "OITM", "ItemCode");
            this.oColumn.Editable = false;

            //col6

            this.oColumn                     = this.oMatrix.Columns.Add("U_total", SAPbouiCOM.BoFormItemTypes.it_EDIT);
            this.oColumn.Width               = 60;
            this.oColumn.Description         = "col4";
            this.oColumn.TitleObject.Caption = "Total";
            this.oColumn.DataBind.SetBound(true, "OITM", "U_total");
            this.oColumn.Editable = false;



            this.oMatrix.Clear();
            this.oMatrix.AutoResizeColumns();
            this.oDBDataSource.Query(null);
            this.oMatrix.LoadFromDataSource();

            this.oColumn = this.oMatrix.Columns.Item("Picture");
            this.oCombo  = (SAPbouiCOM.ComboBox) this.oColumn.Cells.Item(1).Specific;
            string sPathImage = "C:\\BitMap\\Smile.bmp";

            this.oCombo.ValidValues.Add(sPathImage, "");
            this.oCombo.ValidValues.Add("T", "Text");
            this.oCombo.ValidValues.Add("A", "Alternative");
            this.oCombo.ValidValues.Add("S", "SubTotal");
        }
        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
            {
            }
        }
Beispiel #21
0
        private void Form_ResizeAfter(SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                SAPbouiCOM.EditTextColumn oEditCol;
                string sDocEntry = oForm.DataSources.UserDataSources.Item("UD_ENTRY").ValueEx;
                switch (oForm.DataSources.UserDataSources.Item("UD_DOC").ValueEx)
                {
                case  "FACTUB":
                    DT_DOC   = NConsultaDocumentos.ConsultarFacturas(DT_DOC, sDocEntry, "B");
                    oEditCol = (SAPbouiCOM.EditTextColumn)Grid0.Columns.Item(0);
                    oEditCol.LinkedObjectType = "18";
                    break;

                case "FACTUD":
                    DT_DOC   = NConsultaDocumentos.ConsultarFacturas(DT_DOC, sDocEntry, "D");
                    oEditCol = (SAPbouiCOM.EditTextColumn)Grid0.Columns.Item(0);
                    oEditCol.LinkedObjectType = "18";
                    break;

                case "RECEPB":
                    DT_DOC   = NConsultaDocumentos.ConsultarRecepciones(DT_DOC, sDocEntry, "B");
                    oEditCol = (SAPbouiCOM.EditTextColumn)Grid0.Columns.Item(0);
                    oEditCol.LinkedObjectType = "20";
                    break;

                case "RECEPD":
                    DT_DOC   = NConsultaDocumentos.ConsultarRecepciones(DT_DOC, sDocEntry, "D");
                    oEditCol = (SAPbouiCOM.EditTextColumn)Grid0.Columns.Item(0);
                    oEditCol.LinkedObjectType = "20";
                    break;

                case "ORDENB":
                    DT_DOC   = NConsultaDocumentos.ConsultarOrdenes(DT_DOC, sDocEntry, "B");
                    oEditCol = (SAPbouiCOM.EditTextColumn)Grid0.Columns.Item(0);
                    oEditCol.LinkedObjectType = "22";
                    break;

                case "ORDEND":
                    DT_DOC   = NConsultaDocumentos.ConsultarOrdenes(DT_DOC, sDocEntry, "D");
                    oEditCol = (SAPbouiCOM.EditTextColumn)Grid0.Columns.Item(0);
                    oEditCol.LinkedObjectType = "22";
                    break;
                }

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

                oUDS                = oForm.DataSources.UserDataSources.Item("UD_PAG");
                EditText0.Value     = oUDS.ValueEx;
                oUDS                = oForm.DataSources.UserDataSources.Item("UD_PRO");
                EditText2.Value     = oUDS.ValueEx;
                oUDS                = oForm.DataSources.UserDataSources.Item("UD_FEC");
                EditText1.Value     = oUDS.ValueEx;
                StaticText3.Caption = "Total Documentos : " + Grid0.DataTable.Rows.Count.ToString();

                Grid0.Columns.Item("Fecha Creacion").RightJustified = true;
                Grid0.Columns.Item("Total").RightJustified          = true;

                for (int iCols = 0; iCols <= Grid0.Columns.Count - 1; iCols++)
                {
                    Grid0.Columns.Item(iCols).BackColor = Funciones.Color_RGB_SAP(250, 255, 255);
                    if (iCols % 2 == 0)
                    {
                        Grid0.Columns.Item(iCols).BackColor = Funciones.Color_RGB_SAP(250, 250, 210);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #22
0
        public static void Agregar_Items_Desde_Solicitud_Interna(int nDocOrd, int nOrden, string sSerie)
        {
            Recordset businessObject = (Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
            Items     oItems         = (SAPbobsCOM.Items)oCompany.GetBusinessObject(BoObjectTypes.oItems);

            SAPbouiCOM.Matrix   oMatrix   = null;
            SAPbouiCOM.ComboBox oComboBox = null;

            string itemCode = "";

            try
            {
                oForm.Freeze(true);

                SAPbouiCOM.DBDataSource source = oForm.DataSources.DBDataSources.Item("IGE1");

                Documents oPurchaseRequest = (Documents)oCompany.GetBusinessObject(BoObjectTypes.oPurchaseRequest);
                double    nCantArt         = 0;
                int       iSal             = 0;

                if (oPurchaseRequest.GetByKey(nDocOrd))
                {
                    oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("13").Specific;
                    for (int i = 0; i < oPurchaseRequest.Lines.Count; i++)
                    {
                        oPurchaseRequest.Lines.SetCurrentLine(i);
                        itemCode = oPurchaseRequest.Lines.ItemCode;
                        if (oItems.GetByKey(itemCode) && oPurchaseRequest.Lines.RemainingOpenQuantity > 0)
                        {
                            oEdit        = (SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(iSal + 1).Specific;
                            oEdit.String = oPurchaseRequest.Lines.ItemCode;

                            oEdit        = (SAPbouiCOM.EditText)oMatrix.Columns.Item("9").Cells.Item(iSal + 1).Specific;
                            oEdit.String = Convert.ToString(oPurchaseRequest.Lines.RemainingOpenQuantity);

                            oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item("231000074").Cells.Item(iSal + 1).Specific;
                            oEdit.Active       = true;
                            oEdit.Item.Enabled = true;
                            oEdit.String       = Convert.ToString(nOrden);

                            oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item("24").Cells.Item(iSal + 1).Specific;
                            oEdit.Active       = true;
                            oEdit.Item.Enabled = true;
                            oEdit.String       = Convert.ToString(oPurchaseRequest.Lines.LineNum);

                            nCantArt += oPurchaseRequest.Lines.Quantity;
                            iSal     += 1;
                        }
                    }


                    //Agregar como Referencia Numero de SCI
                    oEdit        = (SAPbouiCOM.EditText)oForm.Items.Item("Item_0").Specific;
                    oEdit.String = sSerie.Trim() + "-" + Convert.ToString(nOrden);
                    oComboBox    = (SAPbouiCOM.ComboBox)oForm.Items.Item("30").Specific;
                    oComboBox.Select("SI", SAPbouiCOM.BoSearchKey.psk_ByDescription);

                    SAPbouiCOM.UserDataSource oUds = oForm.DataSources.UserDataSources.Item("UD_SCI");
                    oUds.ValueEx = nDocOrd.ToString();
                    oUds         = oForm.DataSources.UserDataSources.Item("UD_CANT");
                    oUds.ValueEx = nCantArt.ToString();

                    oPurchaseRequest.Lines.SetCurrentLine(iSal - 1);
                    itemCode           = oPurchaseRequest.Lines.ItemCode;
                    oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item("U_FAS_Kilos_Unitario").Cells.Item(iSal).Specific;
                    oEdit.Active       = true;
                    oEdit.Item.Enabled = true;
                    oEdit.Item.Click();

                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oPurchaseRequest);
                    oPurchaseRequest = null;
                    GC.Collect();
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                oForm.Freeze(false);
                Application.SBO_Application.SendKeys("{TAB}");
            }
        }