Ejemplo n.º 1
0
 //metodo para generar el Stream que necesita el XML para crear el formulario
 private System.IO.Stream getStream(String frmResource)
 {
     Funciones.Comunes oFunc = new Funciones.Comunes();
     try
     {
         System.IO.Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(frmResource);
         return(stream);
     }
     catch (Exception e)
     {
         oFunc.sendErrorMessage(sboapp, e);
         return(null);
     }
 }
Ejemplo n.º 2
0
        public void showForm(String menu)
        {
            Funciones.Comunes oFunc = new Funciones.Comunes();
            try
            {
                String frmResource1 = "";
                switch (menu)
                {
                case "BO_ConfPresup":
                    //Llamar metodo crear formulario por SRF
                    frmResource1 = $"{Assembly.GetExecutingAssembly().GetName().Name}.Formularios.ConfPresup.srf";
                    break;

                case "BO_PerfilPresup":
                    //Llamar metodo crear formulario por SRF
                    frmResource1 = $"{Assembly.GetExecutingAssembly().GetName().Name}.Formularios.PerfilPresup.srf";
                    break;

                case "BO_PresupCuenta":     //presupuesto por cuenta
                    //Llamar metodo crear formulario por SRF
                    frmResource1 = $"{Assembly.GetExecutingAssembly().GetName().Name}.Formularios.PresupCuenta.srf";
                    menu         = "BOPC";
                    break;

                default:
                    break;
                }
                oFunc.crearFormPorXML(sboapp, getStream(frmResource1));
                var oForm = sboapp.Forms.Item(menu);
                // Mostrar formulario centrado
                oForm.Left    = (sboapp.Desktop.Width - oForm.Width) / 2;
                oForm.Top     = (sboapp.Desktop.Height - oForm.Height) / 4;
                oForm.Visible = true;
            }
            catch (Exception e)
            {
                oFunc.sendErrorMessage(sboapp, e);
            }
        }
Ejemplo n.º 3
0
        public void creaTablasPresup(SAPbobsCOM.Company oCompany, SAPbouiCOM.Application sboapp)
        {
            Funciones.Comunes oFunc = new Funciones.Comunes();
            SAPbouiCOM.Form   oForm = null;
            oForm = sboapp.Forms.Item("BO_ConfPresup");

            oForm = sboapp.Forms.ActiveForm;
            EditText   oEditTxt = (EditText)oForm.Items.Item("BO_Txt1").Specific;
            StaticText oLbl     = (StaticText)oForm.Items.Item("BO_Lbl1").Specific;

            try
            {
                sboapp.MetadataAutoRefresh = false;
                oLbl.Caption = "Creando Tablas";
                //Crear Tablas de Usuario Presupuesto por Cuenta
                oEditTxt.Value = "BO_PresupCuentaEnc";
                oFunc.crearTabla(oCompany, sboapp, "BO_PresupCuentaEnc", "BO Presupuesto Cuenta Enc", SAPbobsCOM.BoUTBTableType.bott_Document);
                oEditTxt.Value = "BO_PresupCuentaDet1";
                oFunc.crearTabla(oCompany, sboapp, "BO_PresupCuentaDet1", "BO Presupuesto Cuenta Det1", SAPbobsCOM.BoUTBTableType.bott_DocumentLines);
                oEditTxt.Value = "BO_PresupCuentaDet2";
                oFunc.crearTabla(oCompany, sboapp, "BO_PresupCuentaDet2", "BO Presupuesto Cuenta Det2", SAPbobsCOM.BoUTBTableType.bott_DocumentLines);
                oEditTxt.Value = "BO_PresupCuentaDet3";
                oFunc.crearTabla(oCompany, sboapp, "BO_PresupCuentaDet3", "BO Presupuesto Cuenta Det3", SAPbobsCOM.BoUTBTableType.bott_DocumentLines);

                //Crear Campos de Usuario Presupuesto por Cuenta Encabezado
                int n = 19;
                oLbl.Caption   = "Campos de usuario Enc...";
                oEditTxt.Value = $"1/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 25, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Usuario", "Usuario");
                oEditTxt.Value = $"2/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Date, BoFldSubTypes.st_None, 10, "", BoYesNoEnum.tYES, null, "BO_PresupCuentaEnc", "BO_FechaCrea", "Fecha Creación");
                oEditTxt.Value = $"3/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Numeric, BoFldSubTypes.st_None, 4, "", BoYesNoEnum.tYES, null, "BO_PresupCuentaEnc", "BO_Ano", "Año Vigencia");
                String[] oValidValues = { "Y", "Y", "N", "N" };
                oEditTxt.Value = $"4/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaEnc", "BO_ProyectoSN", "ProyectoSN");
                oEditTxt.Value = $"5/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 20, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Proyecto", "Proyecto");
                oEditTxt.Value = $"6/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaEnc", "BO_Dimension1SN", "Dimension1SN");
                oEditTxt.Value = $"7/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 8, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Dimension1", "Dimension1");
                oEditTxt.Value = $"8/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaEnc", "BO_Dimension2SN", "Dimension1SN");
                oEditTxt.Value = $"9/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 8, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Dimension2", "Dimension2");
                oEditTxt.Value = $"10/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaEnc", "BO_Dimension3SN", "Dimension3SN");
                oEditTxt.Value = $"11/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 8, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Dimension3", "Dimension3");
                oEditTxt.Value = $"12/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaEnc", "BO_Dimension4SN", "Dimension4SN");
                oEditTxt.Value = $"13/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 8, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Dimension4", "Dimension4");
                oEditTxt.Value = $"14/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaEnc", "BO_Dimension5SN", "Dimension5SN");
                oEditTxt.Value = $"15/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 8, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Dimension5", "Dimension5");
                oEditTxt.Value = $"16/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Memo, BoFldSubTypes.st_None, 255, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_Nombre", "Nombre");
                oEditTxt.Value = $"17/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "Y", BoYesNoEnum.tYES, oValidValues, "BO_PresupCuentaEnc", "BO_Activo", "Activo");
                String[] oValidValuesStatus = { "B", "Borrador", "L", "Liberado", "A", "Aprobado" };
                oEditTxt.Value = $"18/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 15, "B", BoYesNoEnum.tYES, oValidValuesStatus, "BO_PresupCuentaEnc", "BO_Status", "Status");
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 5, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaEnc", "BO_UsrId", "Id");
                oEditTxt.Value = $"19/{n}";

                //Crear campos Presupuesto Cuenta Detalle1
                oLbl.Caption   = "Campos de usuario Det1...";
                oEditTxt.Value = $"1/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 15, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet1", "BO_Cuenta", "Cuenta");
                String[] oValid1 = { "D", "Débito", "C", "Crédito" };
                oEditTxt.Value = $"2/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "D", BoYesNoEnum.tNO, oValid1
                                    , "BO_PresupCuentaDet1", "BO_Naturaleza", "Naturaleza");
                oEditTxt.Value = $"3/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Enero", "Enero");
                oEditTxt.Value = $"4/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Febrero", "Febrero");
                oEditTxt.Value = $"5/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Marzo", "Marzo");
                oEditTxt.Value = $"6/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Abril", "Abril");
                oEditTxt.Value = $"7/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Mayo", "Mayo");
                oEditTxt.Value = $"8/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Junio", "Junio");
                oEditTxt.Value = $"9/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Julio", "Julio");
                oEditTxt.Value = $"10/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Agosto", "Agosto");
                oEditTxt.Value = $"11/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Septiembre", "Septiembre");
                oEditTxt.Value = $"12/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Octubre", "Octubre");
                oEditTxt.Value = $"13/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Noviembre", "Noviembre");
                oEditTxt.Value = $"14/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Diciembre", "Diciembre");
                oEditTxt.Value = $"15/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet1", "BO_Total", "Total");
                oEditTxt.Value = $"16/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Memo, BoFldSubTypes.st_None, 255, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet1", "BO_Comentario", "Comentario");
                oEditTxt.Value = $"17/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaDet1", "BO_Activo", "Activo");

                //Crear campos Presupuesto Cuenta Detalle2
                oLbl.Caption   = "Campos de usuario Det2...";
                oEditTxt.Value = $"1/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 15, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet2", "BO_Cuenta", "Cuenta");
                oEditTxt.Value = $"2/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "D", BoYesNoEnum.tNO, oValid1
                                    , "BO_PresupCuentaDet2", "BO_Naturaleza", "Naturaleza");
                oEditTxt.Value = $"3/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Enero", "Enero");
                oEditTxt.Value = $"4/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Febrero", "Febrero");
                oEditTxt.Value = $"5/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Marzo", "Marzo");
                oEditTxt.Value = $"6/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Abril", "Abril");
                oEditTxt.Value = $"7/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Mayo", "Mayo");
                oEditTxt.Value = $"8/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Junio", "Junio");
                oEditTxt.Value = $"9/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Julio", "Julio");
                oEditTxt.Value = $"10/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Agosto", "Agosto");
                oEditTxt.Value = $"11/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Septiembre", "Septiembre");
                oEditTxt.Value = $"12/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Octubre", "Octubre");
                oEditTxt.Value = $"13/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Noviembre", "Noviembre");
                oEditTxt.Value = $"14/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Diciembre", "Diciembre");
                oEditTxt.Value = $"15/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 11, "0.0", BoYesNoEnum.tNO, null
                                    , "BO_PresupCuentaDet2", "BO_Total", "Total");
                oEditTxt.Value = $"16/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Memo, BoFldSubTypes.st_None, 0, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet2", "BO_Comentario", "Comentario");
                oEditTxt.Value = $"17/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Alpha, BoFldSubTypes.st_None, 1, "", BoYesNoEnum.tNO, oValidValues, "BO_PresupCuentaDet2", "BO_Activo", "Activo");

                //Crear campos Presupuesto Cuenta Detalle3
                oLbl.Caption   = "Campos de usuario Det3...";
                n              = 3;
                oEditTxt.Value = $"1/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Memo, BoFldSubTypes.st_Link, 0, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet3", "BO_Anexo", "Anexo");
                oEditTxt.Value = $"2/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Memo, BoFldSubTypes.st_None, 0, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet3", "BO_Comentario", "Comentario");
                oEditTxt.Value = $"3/{n}";
                oFunc.CreaCamposUsr(oCompany, sboapp, BoFieldTypes.db_Date, BoFldSubTypes.st_None, 10, "", BoYesNoEnum.tNO, null, "BO_PresupCuentaDet3", "BO_Fecha", "Fecha");

                //Crear UDO
                oLbl.Caption   = "Creando UDO PresupCuenta";
                oEditTxt.Value = "UDO PresupCuenta";
                string[] T1 = { "BO_PresupCuentaEnc", "BO_PresupCuentaDet1", "BO_PresupCuentaDet2", "BO_PresupCuentaDet3" };
                string[] F1 = { "DocEntry", "U_BO_Nombre", "U_BO_Usuario", "U_BO_Ano", "U_BO_Proyecto", "U_BO_Dimension1", "U_BO_Dimension2", "U_BO_Dimension3", "U_BO_Dimension4", "U_BO_Dimension5", "U_BO_Activo", "U_BO_Status" };
                oFunc.CrearUDO(oCompany, sboapp, "BOPC", "Presupuesto por Cuenta", BoUDOObjType.boud_Document, T1, BoYesNoEnum.tNO, BoYesNoEnum.tYES, F1, BoYesNoEnum.tNO, BoYesNoEnum.tNO, BoYesNoEnum.tNO, BoYesNoEnum.tNO, BoYesNoEnum.tNO, BoYesNoEnum.tNO, BoYesNoEnum.tNO, BoYesNoEnum.tNO, 0, 1, BoYesNoEnum.tYES, "BO_PresCuLog");

                oEditTxt.Value             = "Finalizando proceso...";
                sboapp.MetadataAutoRefresh = true;
                //System.Threading.Thread.Sleep(2000);
            }
            catch (Exception e)
            {
                oFunc.sendErrorMessage(sboapp, e);
            }
            finally
            {
                // oForm.Close();
                oFunc.sendMessageBox(sboapp, "Proceso finalizado con éxito", 2);
            }
        }