Exemplo n.º 1
0
        //Grid Approve
        private void Load_Grid_Period()
        {
            //Load Grid
            DataTable  result = new DataTable();
            SqlCommand cmd    = null;

            try
            {
                cmd             = new SqlCommand("PR_Get_List_Approve", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@UserName", oCompany.UserName);
                conn.Open();
                SqlDataReader rd = cmd.ExecuteReader();
                result.Load(rd);
                this.UIAPIRawForm.Freeze(true);
                Grid0.DataTable = Convert_SAP_DataTable(result);

                Grid0.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                oApp.MessageBox(ex.Message);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
                conn.Close();
                cmd.Dispose();
            }
        }
Exemplo n.º 2
0
        //Grid Document Details
        private void Load_Grid_Details()
        {
            //Load Grid
            DataTable  result = new DataTable();
            SqlCommand cmd    = null;

            try
            {
                cmd             = new SqlCommand("PR_Get_Document_Details", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@DocEntry_ODRF", DocEntry_ODRF);
                conn.Open();
                SqlDataReader rd = cmd.ExecuteReader();
                result.Load(rd);
                this.UIAPIRawForm.Freeze(true);
                Grid2.DataTable = Convert_SAP_DataTable_Details(result);
                Grid2.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                oApp.MessageBox(ex.Message);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
                conn.Close();
                cmd.Dispose();
            }
        }
Exemplo n.º 3
0
        public void instanciarObjetosUI()
        {
            try
            {
                mGrid = mForm.Items.Item(GRID_PRINCIPAL).Specific;
                EmpresaBean empresa = EmpresaDAO.obtenerEmpresa(Conexion.company.CompanyDB);
                mGrid.DataTable.ExecuteQuery(LogDAO.getQForListBDM(empresa.id, empresa.base_datos));
                ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(1)).LinkedObjectType = Constantes.OBJ_TYPE_EMPLEADO_VENTAS;

                mGrid.Columns.Item(4).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(4)).ValidValues.Add("01", "ERROR");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(4)).ValidValues.Add("02", "CORRECTO");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(4)).DisplayType = SAPbouiCOM.BoComboDisplayType.cdt_Description;

                mGrid.Columns.Item(7).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(7)).ValidValues.Add("01", "APP MOBILE > BASE INTERMEDIA");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(7)).ValidValues.Add("02", "BASE INTERMEDIA > SAP");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(7)).DisplayType = SAPbouiCOM.BoComboDisplayType.cdt_Description;

                mGrid.Columns.Item(8).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(8)).ValidValues.Add("00", "SOCIO DE NEGOCIO");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(8)).ValidValues.Add("01", "ORDEN DE VENTA");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(8)).ValidValues.Add("02", "PAGO RECIBIDO");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(8)).ValidValues.Add("03", "INCIDENCIA");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(8)).ValidValues.Add("04", "NOTA DE CREDITO");
                ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(8)).DisplayType = SAPbouiCOM.BoComboDisplayType.cdt_Description;


                mGrid.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                StatusMessageError("instanciarObjetosUI() > " + ex.Message);
            }
        }
Exemplo n.º 4
0
 private void populateGrid()
 {
     try
     {
         _grid_Inv = _oForm.Items.Item("grid_Inv").Specific as SAPbouiCOM.Grid;
         String strQuery = String.Format(TWM_KDS_AddOn.Src.Resource.Queries.TWM_GET_INV, _oForm.DataSources.UserDataSources.Item("txtDocEn").ValueEx.ToString());
         _dt_grid_Inv.ExecuteQuery(strQuery);
         // if no results from query delete first row which is empty
         if (_grid_Inv.DataTable.GetValue("Doc No.", 0).ToString().Length < 1)
         {
             _grid_Inv.DataTable.Rows.Remove(0);
         }
         _grid_Inv.Columns.Item("DocEntry").Visible        = false;
         _grid_Inv.Columns.Item("LineNum").Visible         = false;
         _grid_Inv.Columns.Item("Doc No.").Editable        = false;
         _grid_Inv.Columns.Item("Item Code").Editable      = false;
         _grid_Inv.Columns.Item("BP Catalog No.").Editable = false;
         _grid_Inv.Columns.Item("Description").Editable    = false;
         _grid_Inv.Columns.Item("Cust.PO No.").Editable    = false;
         _grid_Inv.Columns.Item("Part No.").Editable       = false;
         _grid_Inv.AutoResizeColumns();
         // link button for itemNo
         SAPbouiCOM.EditTextColumn oEditColItemNo;
         oEditColItemNo = ((SAPbouiCOM.EditTextColumn)(_grid_Inv.Columns.Item("Item Code")));
         oEditColItemNo.LinkedObjectType = "4";
     }
     catch (Exception Ex) { eCommon.SBO_Application.StatusBar.SetText(Ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); }
 }
Exemplo n.º 5
0
        public void iniciarValoresPorDefecto()
        {
            EmpresaBean empresa = EmpresaDAO.obtenerEmpresa(Conexion.company.CompanyDB);

            mGrid.DataTable.ExecuteQuery(ClienteDAO.getQForListBDM(empresa.id, empresa.base_datos));

            mGrid.Columns.Item(1).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(1)).ValidValues.Add("TPJ", "Persona jurídica");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(1)).ValidValues.Add("TPN", "Persona natural");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(1)).DisplayType = SAPbouiCOM.BoComboDisplayType.cdt_Description;

            mGrid.Columns.Item(2).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(2)).ValidValues.Add("0", "Otros tipos de documento");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(2)).ValidValues.Add("1", "Documento nacional de identidad");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(2)).ValidValues.Add("4", "Carnet de extranjería");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(2)).ValidValues.Add("6", "Registro único de contribuyentes");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(2)).ValidValues.Add("7", "Pasaporte");
            ((SAPbouiCOM.ComboBoxColumn)mGrid.Columns.Item(2)).DisplayType = SAPbouiCOM.BoComboDisplayType.cdt_Description;

            mGrid.Columns.Item(18).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
            mGrid.Columns.Item(19).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
            mGrid.Columns.Item(0).TitleObject.Sortable = true;
            mGrid.Columns.Item(3).TitleObject.Sortable = true;
            mGrid.Columns.Item(4).TitleObject.Sortable = true;
            mGrid.Columns.Item(5).TitleObject.Sortable = true;
            mGrid.Columns.Item(6).TitleObject.Sortable = true;
            mGrid.Columns.Item(7).TitleObject.Sortable = true;
            mGrid.Columns.Item(8).TitleObject.Sortable = true;
            mGrid.Columns.Item(9).TitleObject.Sortable = true;
            mGrid.AutoResizeColumns();
        }
Exemplo n.º 6
0
        public void iniciarValoresPorDefecto()
        {
            try
            {
                EmpresaBean empresa = EmpresaDAO.obtenerEmpresa(Conexion.company.CompanyDB);
                mGrid.DataTable.ExecuteQuery(OrdenVentaDAO.getQForListDetailBDM(claveDocumento, empresa.base_datos));
                ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(0)).LinkedObjectType = Constantes.OBJ_TYPE_ITEM;
                ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(3)).LinkedObjectType = Constantes.OBJ_TYPE_WAREHOUSE;
                ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(8)).LinkedObjectType = Constantes.OBJ_TYPE_TAXES;
                mGrid.Columns.Item(0).TitleObject.Sortable = true;
                mGrid.Columns.Item(1).TitleObject.Sortable = true;
                mGrid.Columns.Item(2).TitleObject.Sortable = true;
                mGrid.Columns.Item(3).TitleObject.Sortable = true;
                mGrid.Columns.Item(4).TitleObject.Sortable = true;
                mGrid.Columns.Item(5).TitleObject.Sortable = true;
                mGrid.Columns.Item(6).TitleObject.Sortable = true;
                mGrid.AutoResizeColumns();

                mForm.Title = "Detalles del documento " + claveDocumento;
            }
            catch (Exception ex)
            {
                StatusMessageError("iniciarValoresPorDefecto() > " + ex.Message);
            }
        }
Exemplo n.º 7
0
        public void iniciarValoresPorDefecto()
        {
            oMatrix.DataTable.ExecuteQuery(MenuAppDAO.QUERY_LIST_MENU);
            oMatrix.AutoResizeColumns();

            edtCodigo.Value      = MenuAppDAO.obtenerUltimoId().ToString("D2");
            edtDescripcion.Value = string.Empty;
        }
Exemplo n.º 8
0
 private void ComboBox0_ComboSelectAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     //throw new System.NotImplementedException();
     Grid0.DataTable.ExecuteQuery(string.Format("SELECT 'N' as 'Checked',AbsEntry,NAME FROM OPMG T0 WHERE T0.[FIPROJECT] = '{0}'and T0.[STATUS] <> 'T' ORDER BY AbsEntry", ComboBox0.Selected.Value));
     Grid0.Columns.Item(1).Editable     = false;
     Grid0.Columns.Item(2).Editable     = false;
     Grid0.Columns.Item("Checked").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
     Grid0.AutoResizeColumns();
 }
Exemplo n.º 9
0
        private void initGrid()
        {
            lLstEarRnksT = new List <EarringRanksT>();

            lObjRanksGrid.DataTable = lObjRanksForm.DataSources.DataTables.Item("DtRanks");
            lObjRanksGrid.Columns.Item("Code").Visible   = false;
            lObjRanksGrid.Columns.Item("Desde").Editable = false;
            lObjRanksGrid.Columns.Item("Hasta").Editable = false;
            lObjRanksGrid.AutoResizeColumns();
        }
Exemplo n.º 10
0
        public BatchNumberSelection(TransferItems transferItems, List <BatchRow> issBatchesList, List <BatchRow> recBatchesList)
        {
            fldrIssueItems.Select();
            gvBatches.AutoResizeColumns();
            gvRecDocuments.AutoResizeColumns();
            gvRecBatches.AutoResizeColumns();
            transferItemsForm = transferItems;

            PopulateDocumentsDatatable(issBatchesList, dtDocuments);
            PopulateDocumentsDatatable(recBatchesList, dtRecDocuments);

            PopulateDocumentsGrid(gvRecDocuments);
            PopulateDocumentsGrid(gvDocuments);
        }
Exemplo n.º 11
0
        private void cargarMenus()
        {
            try
            {
                gridListaMenu.DataTable.ExecuteQuery(MenuAppDAO.QUERY_LIST_MENU);
                gridListaMenu.AutoResizeColumns();

                edtCodigoMenu.Value = MenuAppDAO.obtenerUltimoId().ToString("D2");
                edtDescrpMenu.Value = string.Empty;
            }
            catch (Exception ex)
            {
                StatusMessageError("cargarMenus() > " + ex.Message);
            }
        }
Exemplo n.º 12
0
        public void iniciarValoresPorDefecto()
        {
            EmpresaBean empresa = EmpresaDAO.obtenerEmpresa(Conexion.company.CompanyDB);

            mGrid.DataTable.ExecuteQuery(OrdenVentaDAO.getQForListBDM(empresa.id, empresa.base_datos));
            ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(1)).LinkedObjectType  = Constantes.OBJ_TYPE_SOCIOS_NEGOCIO;
            ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(9)).LinkedObjectType  = Constantes.OBJ_TYPE_EMPLEADO_VENTAS;
            ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(15)).LinkedObjectType = Constantes.OBJ_TYPE_ORDEN_VENTA;
            mGrid.Columns.Item(14).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
            mGrid.Columns.Item(0).TitleObject.Sortable = true;
            mGrid.Columns.Item(1).TitleObject.Sortable = true;
            mGrid.Columns.Item(2).TitleObject.Sortable = true;
            mGrid.Columns.Item(6).TitleObject.Sortable = true;
            mGrid.Columns.Item(7).TitleObject.Sortable = true;
            mGrid.AutoResizeColumns();
        }
Exemplo n.º 13
0
        private void initGrid()
        {
            mLstEarRnksT = new List <EarringRanksT>();

            mObjRanksGrid.DataTable = mObjRanksForm.DataSources.DataTables.Item("DtRanks");



            mObjRanksGrid.Columns.Item("Code").Visible   = false;
            mObjRanksGrid.Columns.Item("Desde").Editable = true;
            mObjRanksGrid.Columns.Item("Hasta").Editable = true;
            mObjRanksGrid.Columns.Item("Prefi").Visible  = false;
            mObjRanksGrid.Columns.Item("EFrom").Visible  = false;
            mObjRanksGrid.Columns.Item("ETo").Visible    = false;
            mObjRanksGrid.AutoResizeColumns();
        }
Exemplo n.º 14
0
        public void iniciarValoresPorDefecto()
        {
            //var mListPermisos = PermisoDAO.listarCabecera();

            //foreach (var item in mListPermisos)
            //{
            //    mtxCab.DataTable.Rows.Add();
            //    mtxCab.DataTable.SetValue("Código", mtxCab.DataTable.Rows.Count - 1, item.codigo);
            //    mtxCab.DataTable.SetValue("Descripción", mtxCab.DataTable.Rows.Count - 1, item.descripcion);
            //}

            mtxCab.DataTable.ExecuteQuery(PermisoDAO.getQueryForList());
            mtxCab.AutoResizeColumns();

            lblText.Item.ForeColor = ColorTranslator.ToOle(Color.Blue);
            lblText.Item.FontSize  = 12;
        }
Exemplo n.º 15
0
        private void Load_Grid_Period(string pBP_Code, string pFProject)
        {
            //Load Grid
            DataTable  result = new DataTable();
            SqlCommand cmd    = null;

            try
            {
                cmd             = new SqlCommand("VPBILL_GETLIST", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@FProject", pFProject);
                cmd.Parameters.AddWithValue("@BP_Code", pBP_Code);
                conn.Open();
                SqlDataReader rd = cmd.ExecuteReader();
                result.Load(rd);
                this.UIAPIRawForm.Freeze(true);
                Grid0.DataTable = Convert_SAP_DataTable(result);
                this.UIAPIRawForm.Freeze(false);

                if (result.Rows.Count == 0)
                {
                    this.Button1.Item.Enabled = false;
                    this.Button2.Item.Enabled = false;
                }
                else
                {
                    this.Button1.Item.Enabled = true;
                    this.Button2.Item.Enabled = true;
                }

                Grid0.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                oApp.MessageBox(ex.Message);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
                conn.Close();
                cmd.Dispose();
            }
        }
Exemplo n.º 16
0
        public void iniciarValoresPorDefecto()
        {
            EmpresaBean empresa = EmpresaDAO.obtenerEmpresa(Conexion.company.CompanyDB);

            mGrid.DataTable.ExecuteQuery(DevolucionDAO.getQForListBDM(empresa.id, empresa.base_datos));
            ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(1)).LinkedObjectType  = Constantes.OBJ_TYPE_ENTREGA;
            ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(2)).LinkedObjectType  = Constantes.OBJ_TYPE_SOCIOS_NEGOCIO;
            ((SAPbouiCOM.EditTextColumn)mGrid.Columns.Item(16)).LinkedObjectType = Constantes.OBJ_TYPE_DEVOLUCION;
            mGrid.Columns.Item(15).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
            mGrid.Columns.Item(0).TitleObject.Sortable  = true;
            mGrid.Columns.Item(1).TitleObject.Sortable  = true;
            mGrid.Columns.Item(2).TitleObject.Sortable  = true;
            mGrid.Columns.Item(3).TitleObject.Sortable  = true;
            mGrid.Columns.Item(7).TitleObject.Sortable  = true;
            mGrid.Columns.Item(8).TitleObject.Sortable  = true;
            mGrid.Columns.Item(10).TitleObject.Sortable = true;
            mGrid.Columns.Item(11).TitleObject.Sortable = true;
            mGrid.AutoResizeColumns();
        }
Exemplo n.º 17
0
        private void initFormXml()
        {
            try
            {
                mObjRanksForm.Freeze(true);
                mObjRanksGrid   = ((SAPbouiCOM.Grid)mObjRanksForm.Items.Item("GrdRanks").Specific);
                mObjtxtFrom     = ((SAPbouiCOM.EditText)mObjRanksForm.Items.Item("TxtFrom").Specific);
                mObjtxtTo       = ((SAPbouiCOM.EditText)mObjRanksForm.Items.Item("TxtTo").Specific);
                mObjtxtTotal    = ((SAPbouiCOM.EditText)mObjRanksForm.Items.Item("txtTotal").Specific);
                mTxtCert        = ((SAPbouiCOM.EditText)mObjRanksForm.Items.Item("txtCert").Specific);
                mLstEarRnksT    = new List <EarringRanksT>();
                mLstDeletedRows = new List <EarringRanksT>();
                mLstRowCodes    = new List <int>();

                mIntHeadsInCertificate = mObjPermissionFactory.GetPermissionsService().GetTotalCertHeads(mIntDocEntry);
                if (!HasLines())
                {
                    //int lIntTotalCertHeads = lObjEaRanksDAO.GetTotalCertHeads(lStrDocEntry);

                    mObjtxtTotal.Value = "0";
                }
                else
                {
                    initGrid();
                    mObjtxtTotal.Value = GetTotal().ToString();
                }
                mObjRanksGrid.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                LogService.WriteError(ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                mObjRanksForm.Freeze(false);
            }
        }
Exemplo n.º 18
0
        // Load Grid All JV
        private void Load_Grid_Period_All()
        {
            //LoadGrid
            DataTable  result = new DataTable();
            SqlCommand cmd    = null;

            try
            {
                cmd             = new SqlCommand("SPJV_GetList_Current", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@UserName", oCompany.UserName);
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                result.Load(dr);
                this.UIAPIRawForm.Freeze(true);
                Grid0.DataTable = Convert_SAP_DataTable(result);

                Grid0.AutoResizeColumns();

                //Grid0.Columns.Item("POST_LVL").Visible = false;
                Grid0.Columns.Item("ProfitCode/BPCode").Visible = false;
                for (int i = 0; i < Grid0.Columns.Count; i++)
                {
                    Grid0.Columns.Item(i).Editable = false;
                }
            }
            catch (Exception ex)
            {
                oApp.MessageBox(ex.Message);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
                conn.Close();
                cmd.Dispose();
            }
        }
Exemplo n.º 19
0
        private void btnExtrae_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent   = true;
            mListObjLogin = new List <LoginDTO>();

            if (btnExtrae.Caption == "Nueva Captura")
            {
                NewSearch();
                return;
            }

            if (btnExtrae.Caption == "Buscar Nómina")
            {
                bool Result = Check_txts();

                if (Result)
                {
                    Enabled_txt(false, "btnCarga");
                    Enabled_btn(true, "btnCarga");

                    string lStrYear   = txtYear.Value;
                    string lStrPeriod = cmbPeriod.Value;
                    string lStrNo     = txtNo.Value;

                    try
                    {
                        this.UIAPIRawForm.Freeze(true);

                        LoginDTO lObjLogin = GetSetupLogin().FirstOrDefault(x => x.Code == int.Parse(cmbPeriod.Value));

                        if (lObjLogin != null)
                        {
                            Application.SBO_Application.StatusBar.SetText("Buscando información... Porfavor espere", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);

                            List <int>   lLstEmpId = new List <int>();
                            EmployeesDAO lObjEmp   = new EmployeesDAO();
                            btnExtrae.Caption = "Nueva Captura";

                            List <Nomina> lLstNomina  = new List <Nomina>();
                            AccountsDAO   lObjAccount = new AccountsDAO();
                            gLstNomina = new List <Nomina>();

                            gLstNomina = lObjAccount.GetAccounts(lStrYear, lStrPeriod, lStrNo, lObjLogin.NameServer, lObjLogin.NameDB, lObjLogin.Login, lObjLogin.Password); //lObjEmpItem

                            if (gLstNomina.Count > 0)
                            {
                                lLstNomina.AddRange(gLstNomina);
                            }
                            else
                            {
                                Application.SBO_Application.StatusBar.SetText("Sin registros para mostrar", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                            }

                            ConvertListIntoDataTable(lLstNomina);

                            Grid0.DataTable = this.UIAPIRawForm.DataSources.DataTables.Item("DT_0");
                            Grid0.AutoResizeColumns();
                        }
                        else
                        {
                            Application.SBO_Application.StatusBar.SetText("No se puedo establecer la conexión con el Servidor de Nómina", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                        }
                    }
                    catch (Exception ex)
                    {
                        Application.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                    }
                    finally
                    {
                        this.UIAPIRawForm.Freeze(false);
                    }
                }
                else
                {
                    Application.SBO_Application.StatusBar.SetText("No hay datos capturados para extraer. Favor de primero capturar datos", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                }
            }
        }
Exemplo n.º 20
0
 private void OnCustomInitialize()
 {
     gvDocuments.AutoResizeColumns();
     gvSelectedBatches.AutoResizeColumns();
 }
Exemplo n.º 21
0
        public bool HandleItemEvents(SAPbouiCOM.ItemEvent itemEvent)
        {
            var result = true;

            try
            {
                switch (itemEvent.ItemUID)
                {
                case MATRIZ_DET:
                    if (!itemEvent.BeforeAction)
                    {
                        if (itemEvent.ColUID.Equals("#") && itemEvent.Row == 0)
                        {
                            if (menu_counter < 6)
                            {
                                menu_counter++;
                            }
                            else if (menu_counter == 6)
                            {
                                StatusMessageInfo("Se mostrará el formulario de menús de la aplicación...");
                                menu_counter++;
                            }
                            else if (menu_counter == 7)
                            {
                                Conexion.application.Menus.Item(FormName.MAESTRO_MENUAPP).Enabled = true;
                                Conexion.application.Forms.GetFormByTypeAndCount(169, 1).Update();
                                Conexion.application.ActivateMenuItem(FormName.MAESTRO_MENUAPP);
                                Conexion.application.Menus.Item(FormName.MAESTRO_MENUAPP).Enabled = false;
                                Conexion.application.Forms.GetFormByTypeAndCount(169, 1).Update();
                                menu_counter = 1;
                            }
                            else
                            {
                                menu_counter = 1;
                            }
                        }
                        else
                        {
                            menu_counter = 1;
                        }
                    }
                    break;

                case MATRIZ_CAB:
                    if (!itemEvent.BeforeAction)
                    {
                        if (itemEvent.ColUID.Equals("RowsHeader") && itemEvent.Row >= 0)
                        {
                            if (itemEvent.Row - 1 < mtxCab.DataTable.Rows.Count)
                            {
                                mtxDet.DataTable.Rows.Clear();


                                string codigo      = mtxCab.DataTable.GetValue("Código", itemEvent.Row).Trim();
                                string descripcion = mtxCab.DataTable.GetValue("Descripción", itemEvent.Row).Trim();

                                if (!string.IsNullOrEmpty(codigo))
                                {
                                    //var detalles = PermisoDAO.listarDetalle(codigo.Trim());
                                    bool isActive = PermisoDAO.verificarEstadoTU(codigo);

                                    //foreach (var item in detalles)
                                    //{
                                    //    mtxDet.DataTable.Rows.Add();
                                    //    mtxDet.DataTable.SetValue("Código", mtxDet.DataTable.Rows.Count - 1, item.codigoMenu);
                                    //    mtxDet.DataTable.SetValue("Descripción", mtxDet.DataTable.Rows.Count - 1, item.descripcionMenu);
                                    //    mtxDet.DataTable.SetValue("Accesa", mtxDet.DataTable.Rows.Count - 1, item.accesa);
                                    //    mtxDet.DataTable.SetValue("Crea", mtxDet.DataTable.Rows.Count - 1, item.crea);
                                    //    mtxDet.DataTable.SetValue("Edita", mtxDet.DataTable.Rows.Count - 1, item.edita);
                                    //    mtxDet.DataTable.SetValue("Aprueba", mtxDet.DataTable.Rows.Count - 1, item.aprueba);
                                    //    mtxDet.DataTable.SetValue("Rechaza", mtxDet.DataTable.Rows.Count - 1, item.rechaza);
                                    //    mtxDet.DataTable.SetValue("Sel. Lista precio", mtxDet.DataTable.Rows.Count - 1, item.escogePrecio);
                                    //}

                                    mtxDet.DataTable.ExecuteQuery(PermisoDAO.getQueryForListDetail(codigo));
                                    mtxDet.Columns.Item(2).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
                                    mtxDet.Columns.Item(3).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
                                    mtxDet.Columns.Item(4).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
                                    mtxDet.Columns.Item(5).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
                                    mtxDet.Columns.Item(6).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
                                    mtxDet.Columns.Item(7).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
                                    mtxDet.AutoResizeColumns();

                                    if (!isActive)
                                    {
                                        string caption = "El tipo de usuario " + descripcion + ", se encuentra deshabilitado.";
                                        lblText.Caption        = caption;
                                        lblText.Item.ForeColor = ColorTranslator.ToOle(Color.Red);
                                        cambiarHabilitacionCeldas(false);
                                    }
                                    else
                                    {
                                        lblText.Caption        = "Mostrando permisos del tipo de usuario " + descripcion;
                                        lblText.Item.ForeColor = ColorTranslator.ToOle(Color.Blue);
                                        cambiarHabilitacionCeldas(true);
                                    }
                                }
                            }
                        }
                    }
                    break;

                case BUTTON_UPDATE:
                    if (itemEvent.BeforeAction && mForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        string selected = string.Empty;

                        for (int i = 0; i < mtxCab.DataTable.Rows.Count; i++)
                        {
                            if (mtxCab.Rows.IsSelected(i))
                            {
                                selected = mtxCab.DataTable.GetValue("Código", i);
                                break;
                            }
                        }

                        if (string.IsNullOrEmpty(selected))
                        {
                            StatusMessageInfo("Debe seleccionar una fila en la lista de Tipo de usuario para actualizar.");
                            result = false;
                        }
                        else
                        {
                            result = actualizarPermiso(selected.Trim());
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                StatusMessageError("HandleItemEvents() > " + ex.Message);
            }

            return(result);
        }
Exemplo n.º 22
0
        private void Button0_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                DateTime frdate = DateTime.Today;
                DateTime todate = DateTime.Today;
                if (string.IsNullOrEmpty(EditText0.Value))
                {
                    oApp.MessageBox("Please Enter From Date !");
                    return;
                }
                else
                {
                    frdate = DateTime.ParseExact(EditText0.Value, "yyyyMMdd", CultureInfo.InvariantCulture);
                }

                if (string.IsNullOrEmpty(EditText1.Value))
                {
                    oApp.MessageBox("Please Enter To Date !");
                    return;
                }
                else
                {
                    todate = DateTime.ParseExact(EditText1.Value, "yyyyMMdd", CultureInfo.InvariantCulture);
                }

                if (string.IsNullOrEmpty(EditText2.Value))
                {
                    oApp.MessageBox("Please Enter Level !");
                    return;
                }
                else
                {
                    int.TryParse(EditText2.Value.Trim(), out Level);
                }
                DataTable result = Get_Data(Level, frdate, todate);
                this.UIAPIRawForm.Freeze(true);
                Grid0.DataTable = Convert_SAP_DataTable(result);
                Grid0.AutoResizeColumns();
                for (int i = 0; i < Grid0.Columns.Count; i++)
                {
                    if (i >= 4)
                    {
                        Grid0.Columns.Item(i).RightJustified = true;
                    }
                }
                for (int i = 0; i < Grid0.Rows.Count; i++)
                {
                    int t_level = 0;
                    int.TryParse(Grid0.DataTable.GetValue("Cap", i).ToString(), out t_level);
                    if (t_level < Level)
                    {
                        //Dark Gray
                        Grid0.CommonSetting.SetRowBackColor(i + 1, 14277081);
                    }
                    else
                    {
                        //White Color
                        Grid0.CommonSetting.SetRowBackColor(i + 1, 16777215);
                    }
                }
                Grid0.Columns.Item(0).Visible = false;
                Grid0.Columns.Item(3).Visible = false;
                Grid0.AutoResizeColumns();
                oApp.SetStatusBarMessage("Load Data Completed !", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
            catch (Exception ex)
            {
                oApp.MessageBox(ex.Message);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
        void __app_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            #region "Main Menu"
            if (pVal.BeforeAction == false)
            {
                if (pVal.MenuUID == "MDC_MNU_GRP")
                {
                    XmlDocument oXMLDoc  = new XmlDocument();
                    string      MenuPath = Application.StartupPath + "\\SrfFiles\\AGR.srf";
                    oXMLDoc.Load(MenuPath);
                    __app.LoadBatchActions(oXMLDoc.InnerXml);
                    string UName = __app.Company.UserName.ToString();


                    oRs1 = (SAPbobsCOM.Recordset)____bobCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    oRs2 = (SAPbobsCOM.Recordset)____bobCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    oRs3 = (SAPbobsCOM.Recordset)____bobCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                    try
                    {
                        Manual = false;
                        __Form = __app.Forms.GetForm("AGR", 0);
                        oGrid  = __Form.Items.Item("grid").Specific;

                        __Form = __app.Forms.ActiveForm;
                        __Form.EnableMenu("4870", true);

                        __Form.Mode  = SAPbouiCOM.BoFormMode.fm_ADD_MODE;
                        __Form.State = SAPbouiCOM.BoFormStateEnum.fs_Maximized;


                        string SqlDoc = "";
                        SqlDoc = "CALL AGING_REPORT (NULL)";
                        oRs2.DoQuery(SqlDoc);


                        DT = null;

                        if (oRs2.RecordCount > 0)
                        {
                            if (DT == null)
                            {
                                DT = __Form.DataSources.DataTables.Add("DT1" + DateTime.Now.Second);
                            }

                            DT.ExecuteQuery(SqlDoc);

                            oGrid.DataTable = DT;
                            oGrid.AutoResizeColumns();

                            oGrid.Columns.Item("Customer Code").Editable = false;
                            oGrid.Columns.Item("Customer Name").Editable = false;

                            oGrid.Columns.Item("Customer Name").Editable = false;
                            oGrid.Columns.Item("Type").Editable          = false;
                            SAPbouiCOM.EditTextColumn Typcol = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("DocEntry");
                            Typcol.LinkedObjectType = "13";
                            oGrid.Columns.Item("TransType").Visible = false;
                            oGrid.Columns.Item("DocEntry").Editable = false;

                            oGrid.Columns.Item("Document No.").Editable      = false;
                            oGrid.Columns.Item("Customer Ref. No.").Editable = false;
                            oGrid.Columns.Item("Posting Date").Editable      = false;
                            oGrid.Columns.Item("Due Date").Editable          = false;
                            oGrid.Columns.Item("Future").Editable            = false;
                            oGrid.Columns.Item("0-30 Days").Editable         = false;
                            oGrid.Columns.Item("31-60 Days").Editable        = false;
                            oGrid.Columns.Item("61-90 Days").Editable        = false;
                            oGrid.Columns.Item("91-120 Days").Editable       = false;
                            oGrid.Columns.Item("121+ Days").Editable         = false;
                            oGrid.Columns.Item("Balance Due").Editable       = false;

                            SAPbouiCOM.EditTextColumn col = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("AWDocEntry");
                            col.LinkedObjectType = "UDOB1CZHDR";
                            col.Width            = 15;

                            oGrid.Columns.Item("DocEntry").Editable = false;
                            oGrid.Columns.Item("Previous Collection Notes").Editable = false;

                            oGrid.CollapseLevel = 1;
                            DataColumn column;


                            // Create new DataColumn, set DataType, ColumnName and add to DataTable.
                            column = new DataColumn();
                            if (Htable.Columns.Contains("DocEntry"))
                            {
                                Htable.Columns.Remove("DocEntry");
                            }
                            column.DataType   = System.Type.GetType("System.Int32");
                            column.ColumnName = "DocEntry";
                            Htable.Columns.Add(column);

                            // Create second column.
                            column = new DataColumn();

                            if (Htable.Columns.Contains("Collection Notes"))
                            {
                                Htable.Columns.Remove("Collection Notes");
                            }
                            column.DataType   = Type.GetType("System.String");
                            column.ColumnName = "Collection Notes";
                            Htable.Columns.Add(column);
                        }
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message.ToString());
                        BubbleEvent = false;
                    }
                }
            }
            #endregion

            //#region "Navigate Menu"

            //if (pVal.BeforeAction == true)
            //{
            //    if (pVal.MenuUID == "1281")
            //    {
            //        //__XForm = __app.Forms.ActiveForm;
            //        //__XForm.Items.Item("Item_1").Enabled = true;
            //    }
            //}
            //#endregion
        }