Esempio n. 1
0
        private void RunAutoMigration()
        {
            var migrationTypes = AppDomain.CurrentDomain.GetAssemblies()
                                 .SelectMany(s => s.GetTypes()
                                             .Where(t => t.IsClass && !t.IsAbstract && typeof(IDataMigration).IsAssignableFrom(t))
                                             );

            try {
                foreach (var m in migrationTypes)
                {
                    var migration = (IDataMigration)Activator.CreateInstance(m);
                    migration.CreateOrUpgrade();
                }
            }
            catch (Exception ex) {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Não foi possível atualizar o addon da provider.");
                sb.AppendLine("Recomendamos que remova todos os objetos vinculados ao AddOn e tente novamente.");
                sb.AppendLine("Caso o erro persista, entre em contato com a Provider");
#if DEBUG
                sb.AppendLine();
                sb.AppendLine();
                sb.Append(ex.ToString());
#endif

                SBOApplication.MessageBox(sb.ToString());
                Exit();
            }
        }
Esempio n. 2
0
        public override void initApp()
        {
            String XlsFile;
            String s;

            base.initApp();
            String  Local;
            Boolean bCargar = false;

            try
            {
                // compilacion SQL HANA
                GlobalSettings.SBO_f   = SBOFunctions;
                GlobalSettings.SBOMeta = SBOMetaData;
                //


                //oLog.LogFile = "C:\\Visualk\\xxx.log";
                oLog.LogFile = System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\VD.log";
                SAPbobsCOM.Recordset oRecordSet;
                oRecordSet = (SAPbobsCOM.Recordset)(SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
                try
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "SELECT SUPERUSER FROM OUSR WHERE USER_CODE = '{0}'";
                    }
                    else
                    {
                        s = @"SELECT ""SUPERUSER"" FROM ""OUSR"" WHERE ""USER_CODE"" = '{0}'";
                    }
                    s = String.Format(s, SBOCompany.UserName.Trim());
                    oRecordSet.DoQuery(s);
                    if (((System.String)oRecordSet.Fields.Item("SUPERUSER").Value).Trim() == "Y")
                    {
                        bCargar = true;
                    }
                }
                catch
                {
                    if (bCargar == false)
                    {
                        SBOApplication.MessageBox("El addon se esta iniciando por primera vez, debe inicar con un super usuario");
                    }
                }
                finally
                {
                    SBOFunctions._ReleaseCOMObject(oRecordSet);
                    oRecordSet = null;
                }


                //if (SBOCompany.UserName == "manager")
                if (bCargar)
                {
                    XlsFile = System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Docs\\UDFFELEC.xls";
                    if (!SBOFunctions.ValidEstructSHA1(XlsFile))
                    {
                        oLog.OutLog("InitApp: Estructura de datos 1 - Facturación Electronica");
                        SBOApplication.StatusBar.SetText("Inicializando AddOn Factura Electronica(1).", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                        if (!SBOMetaData.SyncTablasUdos("1.1", XlsFile))
                        {
                            SBOFunctions.DeleteSHA1FromTable("EDAG.xls");
                            oLog.OutLog("InitApp: sincronización de Estructura de datos fallo");
                            CloseSplash();
                            SBOApplication.MessageBox("Estructura de datos con problemas, consulte a soporte...", 1, "Ok", "", "");
                            Halt(0);
                        }
                    }

                    XlsFile = System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Docs\\UDFFELECCL.xls";
                    if (!SBOFunctions.ValidEstructSHA1(XlsFile))
                    {
                        oLog.OutLog("InitApp: Estructura de datos 2 - Facturación Electronica CL");
                        SBOApplication.StatusBar.SetText("Inicializando AddOn Factura Electronica(2).", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                        if (!SBOMetaData.SyncTablasUdos("1.1", XlsFile))
                        {
                            SBOFunctions.DeleteSHA1FromTable("UDFFELECCL.xls");
                            oLog.OutLog("InitApp: sincronización de Estructura de datos fallo");
                            SBOApplication.MessageBox("Estructura de datos con problemas, consulte a soporte...", 1, "Ok", "", "");
                        }
                    }


                    XlsFile = System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Docs\\UDFSAP.xls";
                    if (!SBOFunctions.ValidEstructSHA1(XlsFile))
                    {
                        oLog.OutLog("InitApp: Estructura de datos 3 - Facturación Electronica CL");
                        SBOApplication.StatusBar.SetText("Inicializando AddOn Factura Electronica(3).", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                        if (!SBOMetaData.SyncTablasUdos("1.1", XlsFile))
                        {
                            SBOFunctions.DeleteSHA1FromTable("UDFSAP.xls");
                            oLog.OutLog("InitApp: sincronización de Estructura de datos fallo");
                            SBOApplication.MessageBox("Estructura de datos con problemas, consulte a soporte...", 1, "Ok", "", "");
                        }
                    }
                }

                oLog.DebugLvl             = 20;
                MainObj[0].GlobalSettings = GlobalSettings;
                MainObj[0].SBOApplication = SBOApplication;
                MainObj[0].SBOCompany     = SBOCompany;
                MainObj[0].oLog           = oLog;
                MainObj[0].SBOFunctions   = SBOFunctions;


                //SetFiltros();


                MainObj[0].AddMenus();

                InitOK = true;
                oLog.OutLog("App SBO in C# - Init!");
                SBOApplication.StatusBar.SetText("Aplicación Inicializada.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);


                if (1 == 1) //(SBOFunctions.AccessStr.Substring(10,1) = 'P') then
                {
                    GlobalSettings.SBO_f      = SBOFunctions;
                    MainObj[0].GlobalSettings = GlobalSettings;
                    MainObj[0].SBOApplication = SBOApplication;
                    MainObj[0].SBOCompany     = SBOCompany;
                    MainObj[0].oLog           = oLog;
                    MainObj[0].SBOFunctions   = SBOFunctions;
                }

                SetFiltros();

                if (1 == 1) // (SBOFunctions.AccessStr.Substring(10,1) = 'P') then
                {
                    //MainObj[0].AddMenus();
                    SAPbouiCOM.Menus    oMenus    = null;
                    SAPbouiCOM.MenuItem oMenuItem = null;


                    System.Xml.XmlDocument oXmlDoc = null;
                    oXmlDoc = new System.Xml.XmlDocument();

                    oXmlDoc.Load(System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Menus\\RemoveMenu.xml");


                    string sXML = oXmlDoc.InnerXml.ToString();
                    SBOApplication.LoadBatchActions(ref sXML);

                    oXmlDoc.Load(System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Menus\\Menu.xml");

                    sXML = oXmlDoc.InnerXml.ToString();
                    SBOApplication.LoadBatchActions(ref sXML);

                    //GlobalSettings.AddMenusRepAux(False);
                    //GlobalSettings.AddMenusRepAux(True);
                }

                InitOK = true;
                oLog.OutLog("C# - Shine your crazy diamond!");
                SBOApplication.StatusBar.SetText("Aplicación Inicializada.", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
            }
            catch (Exception ex)
            {
                oLog.OutLog("Error iniApp, " + ex.Message + ", TRACE " + ex.StackTrace);
            }
            finally
            {
                CloseSplash();
            }
        }
        } //fin AddMenus

        public override void MenuEventExt(List <object> oForms, ref MenuEvent pVal, ref Boolean BubbleEvent)
        {
            IvkFormInterface oForm;

            base.MenuEventExt(oForms, ref pVal, ref BubbleEvent);
            try
            {
                //Inherited MenuEventExt(oForms,var pVal,var BubbleEvent);
                oForm = null;
                if (!pVal.BeforeAction)
                {
                    switch (pVal.MenuUID)
                    {
                    case "VID_FERImpFE":
                    {
                        oForm = (IvkFormInterface)(new TReImprimir());
                        //(TReImprimir)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEConf":
                    {
                        oForm = (IvkFormInterface)(new TConfigFE());
                        //(TConfigFE)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEMonitor":     //Menu para Monitor
                    {
                        oForm = (IvkFormInterface)(new TMonitor());
                        //(TMonitor)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEDardeBaja":     //Menu para dar de baja
                    {
                        oForm = (IvkFormInterface)(new TDardeBaja());
                        break;
                    }

                    case "VID_FEPROCED":     //Menu para Procedimiento FE
                    {
                        oForm = (IvkFormInterface)(new TProcedimientosFE());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEPEIVA":     //Menu para Configuracion de Impuestos PE
                    {
                        oForm = (IvkFormInterface)(new TConfiguracionImpuestoPE());
                        break;
                    }

                    case "VID_FEPENOTES":     //Menu para Tipo de Notas
                    {
                        oForm = (IvkFormInterface)(new TTipoNotasPE());
                        break;
                    }

                    case "VID_FEPEUMISO":     //Menu para Unidad de medida ISO
                    {
                        oForm = (IvkFormInterface)(new TUnidadMedidasISOPE());
                        break;
                    }

                    case "VID_RHSQL":
                    {
                        //oForm                       := IvkFormInterface(New TCredencialesBD);
                        //TCredencialesBD(oForm).ooForms :=oForms;
                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            oForm = (IvkFormInterface)(new TMenuConfFr());
                        }
                        else
                        {
                            oForm = (IvkFormInterface)(new TMenuConfiguracionHANA());
                        }
                        //oForm1 := SBOApplication.Forms.ActiveForm;
                        //EditText(oForm1.Items.Item("Pw").Specific).IsPassword := true;
                        break;
                    }
                    }

                    if (oForm != null)
                    {
                        SAPbouiCOM.Application             App   = SBOApplication;
                        SAPbobsCOM.Company                 Cmpny = SBOCompany;
                        VisualD.SBOFunctions.CSBOFunctions SboF  = SBOFunctions;
                        VisualD.GlobalVid.TGlobalVid       Glob  = GlobalSettings;

                        if (oForm.InitForm(SBOFunctions.generateFormId(GlobalSettings.SBOSpaceName, GlobalSettings), "forms\\", ref App, ref Cmpny, ref SboF, ref Glob))
                        {
                            oForms.Add(oForm);
                        }
                        else
                        {
                            SBOApplication.Forms.Item(oForm.getFormId()).Close();
                            oForm = null;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SBOApplication.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");  // Captura errores no manejados
                oLog.OutLog("MenuEventExt: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        } //MenuEventExt
        } //MenuEventExt

        public override IvkFormInterface ItemEventExt(IvkFormInterface oIvkForm, List <object> oForms, String LstFrmUID, String FormUID, ref ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.Form  oForm;
            SAPbouiCOM.Form  oFormParent;
            IvkFormInterface result = null;

            result = base.ItemEventExt(oIvkForm, oForms, LstFrmUID, FormUID, ref pVal, ref BubbleEvent);
            try
            {
                //inherited ItemEventExt(oIvkForm,oForms,LstFrmUID, FormUID, var pVal, var BubbleEvent);

                result = base.ItemEventExt(oIvkForm, oForms, LstFrmUID, FormUID, ref pVal, ref BubbleEvent);

                if (result != null)
                {
                    return(result);
                }
                else
                {
                    if (oIvkForm != null)
                    {
                        return(oIvkForm);
                    }
                }

                // CFL Extendido (Enmascara el CFL estandar)
                if ((pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_FORM_LOAD) && (!string.IsNullOrEmpty(LstFrmUID)))
                {
                    try
                    {
                        oForm = SBOApplication.Forms.Item(LstFrmUID);
                    }
                    catch
                    {
                        oForm = null;
                    }
                }


                if ((!pVal.BeforeAction) && (pVal.FormTypeEx == "0"))
                {
                    if ((oIvkForm == null) && (GlobalSettings.UsrFldsFormActive) && (GlobalSettings.UsrFldsFormUid != "") && (pVal.EventType == BoEventTypes.et_FORM_LOAD))
                    {
                        oForm       = SBOApplication.Forms.Item(pVal.FormUID);
                        oFormParent = SBOApplication.Forms.Item(GlobalSettings.UsrFldsFormUid);
                        try
                        {
                            //SBO_App.StatusBar.SetText(oFormParent.Title,BoMessageTime.bmt_Short,BoStatusBarMessageType.smt_Warning);
                            SBOFunctions.FillListUserFieldForm(GlobalSettings.ListFormsUserField, oFormParent, oForm);
                        }
                        finally
                        {
                            GlobalSettings.UsrFldsFormUid    = "";
                            GlobalSettings.UsrFldsFormActive = false;
                        }
                    }
                    else
                    {
                        if ((pVal.EventType == BoEventTypes.et_FORM_ACTIVATE) || (pVal.EventType == BoEventTypes.et_COMBO_SELECT) || (pVal.EventType == BoEventTypes.et_FORM_RESIZE))
                        {
                            oForm = SBOApplication.Forms.Item(pVal.FormUID);
                            SBOFunctions.DisableListUserFieldsForm(GlobalSettings.ListFormsUserField, oForm);
                        }
                    }
                }


                if ((!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_FORM_LOAD) && (oIvkForm == null))
                {
                    switch (pVal.FormTypeEx)
                    {
                    case "133":     //Factura
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "--";
                        TInvoice.bFolderAdd = false;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "65307":     //Factura Exportacion
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "IX";
                        TInvoice.bFolderAdd = true;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "60090":     //Factura + pago venta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "--";
                        TInvoice.bFolderAdd = false;
                        TInvoice.ReservaExp = false;
                        TInvoice.ObjType    = "13";
                        break;
                    }

                    case "60091":     //Factura Reserva
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "--";
                        TInvoice.bFolderAdd = true;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = true;
                        break;
                    }

                    case "65302":     //Factura exenta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "IE";
                        TInvoice.bFolderAdd = false;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "65300":     //Factura Anticipo
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "--";
                        TInvoice.bFolderAdd = false;
                        TInvoice.ObjType    = "203";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "65304":     //Boleta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "IB";
                        TInvoice.bFolderAdd = true;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "65305":     //Boleta Exenta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "EB";
                        TInvoice.bFolderAdd = true;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "65303":     //Nota de debito
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType = "DN";
                        TInvoice.bFolderAdd = true;
                        TInvoice.ObjType    = "13";
                        TInvoice.ReservaExp = false;
                        break;
                    }

                    case "179":     //Nota de Credito
                    {
                        result = (IvkFormInterface)(new TCreditNotes());
                        //(TCreditNotes)(result).ooForms = oForms;
                        TCreditNotes.DocSubType = "--";
                        TCreditNotes.bFolderAdd = true;
                        TCreditNotes.ObjType    = "14";
                        break;
                    }

                    case "426":     //Pago efectuado
                    {
                        result = (IvkFormInterface)(new TPagoEfectuado());
                        //(TCreditNotes)(result).ooForms = oForms;
                        TPagoEfectuado.bFolderAdd = true;
                        TPagoEfectuado.ObjType    = "46";
                        break;
                    }

                    case "140":     //Entrega
                    {
                        result = (IvkFormInterface)(new TDeliveryNote());
                        //(TDeliveryNote)(result).ooForms = oForms;
                        TDeliveryNote.Transferencia = false;
                        TDeliveryNote.bFolderAdd    = true;
                        TDeliveryNote.Devolucion    = false;
                        TDeliveryNote.ObjType       = "15";
                        break;
                    }

                    case "940":     //Transferencia Stock
                    {
                        result = (IvkFormInterface)(new TDeliveryNote());
                        //(TDeliveryNote)(result).ooForms = oForms;
                        TDeliveryNote.Transferencia = true;
                        TDeliveryNote.bFolderAdd    = true;
                        TDeliveryNote.Devolucion    = false;
                        TDeliveryNote.ObjType       = "67";
                        break;
                    }

                    case "182":     //Devolucion mercancia compra
                    {
                        result = (IvkFormInterface)(new TDeliveryNote());
                        //(TDeliveryNote)(result).ooForms = oForms;
                        TDeliveryNote.Transferencia = false;
                        TDeliveryNote.bFolderAdd    = true;
                        TDeliveryNote.Devolucion    = true;
                        TDeliveryNote.ObjType       = "21";
                        break;
                    }
                    } //fin  switch
                }


                if (result != null)
                {
                    SAPbouiCOM.Application             App   = SBOApplication;
                    SAPbobsCOM.Company                 Cmpny = SBOCompany;
                    VisualD.SBOFunctions.CSBOFunctions SboF  = SBOFunctions;
                    VisualD.GlobalVid.TGlobalVid       Glob  = GlobalSettings;
                    if (result.InitForm(pVal.FormUID, @"forms\\", ref App, ref Cmpny, ref SboF, ref Glob))
                    {
                        oForms.Add(result);
                    }
                    else
                    {
                        SBOApplication.Forms.Item(result.getFormId()).Close();
                        result = null;
                    }
                }

                return(result);
            }// fin try
            catch (Exception e)
            {
                return(null);

                oLog.OutLog("ItemEventExt: " + e.Message + " ** Trace: " + e.StackTrace);
                SBOApplication.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");  // Captura errores no manejados
            }
        } //fin ItemEventExt
Esempio n. 5
0
        } //fin AddMenus

        public override void MenuEventExt(List <object> oForms, ref MenuEvent pVal, ref Boolean BubbleEvent)
        {
            IvkFormInterface oForm;

            base.MenuEventExt(oForms, ref pVal, ref BubbleEvent);
            try
            {
                //Inherited MenuEventExt(oForms,var pVal,var BubbleEvent);
                oForm = null;
                if (!pVal.BeforeAction)
                {
                    switch (pVal.MenuUID)
                    {
                    case "VID_FERImpFE":
                    {
                        oForm = (IvkFormInterface)(new TReImprimir());
                        //(TReImprimir)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEConf":
                    {
                        oForm = (IvkFormInterface)(new TConfigFE());
                        //(TConfigFE)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEImptoAd":
                    {
                        oForm = (IvkFormInterface)(new TImptoAdicional());
                        //(TImptoAdicional)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEIndSII":     //Menu para ingresar mapeo indicadores para los libros
                    {
                        oForm = (IvkFormInterface)(new TIndicadoresSII());
                        //(TIndicadoresSII)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FeImptoSII":     //Menu para ingresar mapeo de los impuestos para los libros
                    {
                        oForm = (IvkFormInterface)(new TImpuestos());
                        //(TImpuestos)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEMonitor":     //Menu para Monitor
                    {
                        oForm = (IvkFormInterface)(new TMonitor());
                        //(TMonitor)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEMonDTE":     //monitor de DTE
                    {
                        oForm = (IvkFormInterface)(new TMonitorDTE());
                        break;
                    }

                    case "VID_FEEnvDTE":
                    {
                        oForm = (IvkFormInterface)(new TEnviarEstadoDTE());
                        break;
                    }

                    case "VID_FESUC":     //Menu para Sucursal factura electronica
                    {
                        oForm = (IvkFormInterface)(new TSucursal());
                        //(TSucursal)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FECAF":     //Menu para regsitrar CAF
                    {
                        oForm = (IvkFormInterface)(new TRegistrarCAF());
                        //(TRegistrarCAF)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEDIST":     //Menu para Distribucion Folios
                    {
                        oForm = (IvkFormInterface)(new TDistribucionFolios());
                        //(TDistribucionFolios)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEASIGFOL":     //Menu para Distribuir Folios
                    {
                        oForm = (IvkFormInterface)(new TAsignarFolios());
                        //(TAsignarFolios)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FERESFOL":     //Menu para Resumen Estado de Folios
                    {
                        oForm = (IvkFormInterface)(new TResumenFolios());
                        //(TResumenFolios)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEMULTISOC":     //Menu para Multiples bases FE
                    {
                        oForm = (IvkFormInterface)(new TMultiplesBases());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEPROCED":     //Menu para Procedimiento FE
                    {
                        oForm = (IvkFormInterface)(new TProcedimientosFE());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FELISTABL":     //Menu para Lista Blanca
                    {
                        oForm = (IvkFormInterface)(new TListaBlanca());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FELISTANE":     //Menu para Lista Negra
                    {
                        oForm = (IvkFormInterface)(new TListaNegra());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEGLibro":     //Menu para generacion Libro Ventas y Compra
                    {
                        oForm = (IvkFormInterface)(new TGLibro());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEGELibro":     //Menu para Generacion y envioLibro Ventas y Compras
                    {
                        oForm = (IvkFormInterface)(new TGELibro());
                        //(TMultiplesBases)(oForm).ooForms = oForms;
                        break;
                    }

                    case "VID_FEFOLIAR":     //Menu para Foliar Documento Electronica
                    {
                        oForm = (IvkFormInterface)(new TFoliarDocumento());
                        break;
                    }

                    case "VID_FEREUTFOL":     //Menu para Reutilizar folio rechazado
                    {
                        oForm = (IvkFormInterface)(new TReutilizarFolio());
                        break;
                    }

                    case "VID_FEPLANCTA":    //Menu para Plan de cuenta SII
                    {
                        oForm = (IvkFormInterface)(new TPlanCuentaSII());
                        break;
                    }

                    case "VID_RHSQL":
                    {
                        //oForm                       := IvkFormInterface(New TCredencialesBD);
                        //TCredencialesBD(oForm).ooForms :=oForms;
                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            oForm = (IvkFormInterface)(new TMenuConfFr());
                        }
                        else
                        {
                            oForm = (IvkFormInterface)(new TMenuConfiguracionHANA());
                        }
                        //oForm1 := SBOApplication.Forms.ActiveForm;
                        //EditText(oForm1.Items.Item("Pw").Specific).IsPassword := true;
                        break;
                    }

                    case "VID_FELibroDiario":
                    {
                        oForm = (IvkFormInterface)(new TLibrosElectronicos());
                        TLibrosElectronicos.TipoLibro = "D";
                        break;
                    }

                    case "VID_FELibroMayor":
                    {
                        oForm = (IvkFormInterface)(new TLibrosElectronicos());
                        TLibrosElectronicos.TipoLibro = "M";
                        break;
                    }

                    case "VID_FEBalance":
                    {
                        oForm = (IvkFormInterface)(new TLibrosElectronicos());
                        TLibrosElectronicos.TipoLibro = "B";
                        break;
                    }

                    case "VID_FEDiccionario":
                    {
                        oForm = (IvkFormInterface)(new TLibrosElectronicos());
                        TLibrosElectronicos.TipoLibro = "C";
                        break;
                    }
                    }

                    if (oForm != null)
                    {
                        SAPbouiCOM.Application             App   = SBOApplication;
                        SAPbobsCOM.Company                 Cmpny = SBOCompany;
                        VisualD.SBOFunctions.CSBOFunctions SboF  = SBOFunctions;
                        VisualD.GlobalVid.TGlobalVid       Glob  = GlobalSettings;

                        if (oForm.InitForm(SBOFunctions.generateFormId(GlobalSettings.SBOSpaceName, GlobalSettings), "forms\\", ref App, ref Cmpny, ref SboF, ref Glob))
                        {
                            oForms.Add(oForm);
                        }
                        else
                        {
                            SBOApplication.Forms.Item(oForm.getFormId()).Close();
                            oForm = null;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SBOApplication.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");  // Captura errores no manejados
                oLog.OutLog("MenuEventExt: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        } //MenuEventExt
Esempio n. 6
0
        } //MenuEventExt

        public override IvkFormInterface ItemEventExt(IvkFormInterface oIvkForm, List <object> oForms, String LstFrmUID, String FormUID, ref ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.Form  oForm;
            SAPbouiCOM.Form  oFormParent;
            IvkFormInterface result = null;

            result = base.ItemEventExt(oIvkForm, oForms, LstFrmUID, FormUID, ref pVal, ref BubbleEvent);

            try
            {
                //inherited ItemEventExt(oIvkForm,oForms,LstFrmUID, FormUID, var pVal, var BubbleEvent);


                result = base.ItemEventExt(oIvkForm, oForms, LstFrmUID, FormUID, ref pVal, ref BubbleEvent);

                if (result != null)
                {
                    return(result);
                }
                else
                {
                    if (oIvkForm != null)
                    {
                        return(oIvkForm);
                    }
                }

                // CFL Extendido (Enmascara el CFL estandar)
                if ((pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_FORM_LOAD) && (!string.IsNullOrEmpty(LstFrmUID)))
                {
                    try
                    {
                        oForm = SBOApplication.Forms.Item(LstFrmUID);
                    }
                    catch
                    {
                        oForm = null;
                    }
                }


                if ((!pVal.BeforeAction) && (pVal.FormTypeEx == "0"))
                {
                    if ((oIvkForm == null) && (GlobalSettings.UsrFldsFormActive) && (GlobalSettings.UsrFldsFormUid != "") && (pVal.EventType == BoEventTypes.et_FORM_LOAD))
                    {
                        oForm       = SBOApplication.Forms.Item(pVal.FormUID);
                        oFormParent = SBOApplication.Forms.Item(GlobalSettings.UsrFldsFormUid);
                        try
                        {
                            //SBO_App.StatusBar.SetText(oFormParent.Title,BoMessageTime.bmt_Short,BoStatusBarMessageType.smt_Warning);
                            SBOFunctions.FillListUserFieldForm(GlobalSettings.ListFormsUserField, oFormParent, oForm);
                        }
                        finally
                        {
                            GlobalSettings.UsrFldsFormUid    = "";
                            GlobalSettings.UsrFldsFormActive = false;
                        }
                    }
                    else
                    {
                        if ((pVal.EventType == BoEventTypes.et_FORM_ACTIVATE) || (pVal.EventType == BoEventTypes.et_COMBO_SELECT) || (pVal.EventType == BoEventTypes.et_FORM_RESIZE))
                        {
                            oForm = SBOApplication.Forms.Item(pVal.FormUID);
                            SBOFunctions.DisableListUserFieldsForm(GlobalSettings.ListFormsUserField, oForm);
                        }
                    }
                }


                if ((!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_FORM_LOAD) && (oIvkForm == null))
                {
                    switch (pVal.FormTypeEx)
                    {
                    case "65080":     //primera ventana confirmacion folio
                    {
                        result = (IvkFormInterface)(new TPConfirmacionFolio());
                        //(TPConfirmacionFolio)(result).ooForms = oForms;
                        break;
                    }

                    case "65081":     //segunda ventana confirmacion folio
                    {
                        result = (IvkFormInterface)(new TConfirmacionFolio());
                        //(TConfirmacionFolio)(result).ooForms = oForms;
                        break;
                    }

                    case "65082":     //Impresion Masiva
                    {
                        result = (IvkFormInterface)(new TImpresionMasiva());
                        //(TImpresionMasiva)(result).ooForms = oForms;
                        break;
                    }

                    case "184":     //Criterios para impresion masiva
                    {
                        result = (IvkFormInterface)(new TCriterioImpMasiva());
                        //(TCriterioImpMasiva)(result).ooForms = oForms;
                        break;
                    }

                    case "191":     //Seleccionar Documentos para impresion masiva
                    {
                        result = (IvkFormInterface)(new TSelDocImpMasivo());
                        //(TSelDocImpMasivo)(result).ooForms = oForms;
                        break;
                    }

                    case "133":     //Factura
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "--";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = true;
                        break;
                    }

                    case "65307":     //Factura Exportacion
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "IX";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "60090":     //Factura + pago venta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "--";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ReservaExp  = false;
                        TInvoice.ObjType     = "13";
                        TInvoice.Liquidacion = true;
                        break;
                    }

                    case "60091":     //Factura Reserva
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "--";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = true;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "65302":     //Factura exenta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "IE";
                        TInvoice.bFolderAdd  = false;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "65300":     //Factura Anticipo
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "--";
                        TInvoice.bFolderAdd  = false;
                        TInvoice.ObjType     = "203";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "65304":     //Boleta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "IB";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "65305":     //Boleta Exenta
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "EB";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "65303":     //Nota de debito
                    {
                        result = (IvkFormInterface)(new TInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TInvoice.DocSubType  = "DN";
                        TInvoice.bFolderAdd  = true;
                        TInvoice.ObjType     = "13";
                        TInvoice.ReservaExp  = false;
                        TInvoice.Liquidacion = false;
                        break;
                    }

                    case "179":     //Nota de Credito
                    {
                        result = (IvkFormInterface)(new TCreditNotes());
                        //(TCreditNotes)(result).ooForms = oForms;
                        TCreditNotes.DocSubType = "--";
                        TCreditNotes.bFolderAdd = true;
                        TCreditNotes.ObjType    = "14";
                        break;
                    }

                    case "140":     //Entrega
                    {
                        result = (IvkFormInterface)(new TDeliveryNote());
                        //(TDeliveryNote)(result).ooForms = oForms;
                        TDeliveryNote.Transferencia = false;
                        TDeliveryNote.bFolderAdd    = true;
                        TDeliveryNote.Devolucion    = false;
                        break;
                    }

                    case "182":     //Devolucion mercancia Compra
                    {
                        result = (IvkFormInterface)(new TDeliveryNote());
                        //(TDeliveryNote)(result).ooForms = oForms;
                        TDeliveryNote.Transferencia = false;
                        TDeliveryNote.bFolderAdd    = true;
                        TDeliveryNote.Devolucion    = true;
                        break;
                    }

                    case "940":     //Transferencia Stock
                    {
                        result = (IvkFormInterface)(new TDeliveryNote());
                        //(TDeliveryNote)(result).ooForms = oForms;
                        TDeliveryNote.Transferencia     = true;
                        TDeliveryNote.bFolderAdd        = true;
                        TDeliveryNote.Devolucion        = false;
                        TDeliveryNote.SolicitudTraslado = false;
                        break;
                    }

                    case "1250000940":    // Solicitud de traslado de Mercancias
                    {
                        oRecordSet = (SAPbobsCOM.Recordset)(SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            s = @"Select isnull(U_DteSolTras,'N') dtesoltras from [@VID_FEPARAM]";
                        }
                        else
                        {
                            s = @"Select IFNULL(""U_DteSolTras"",'N') dtesoltras ""@VID_FEPARAM"" ";
                        }

                        oRecordSet.DoQuery(s);

                        if ((System.String)(oRecordSet.Fields.Item("dtesoltras").Value) == "Y")
                        {
                            result = (IvkFormInterface)(new TDeliveryNote());
                            TDeliveryNote.Transferencia     = true;
                            TDeliveryNote.bFolderAdd        = true;
                            TDeliveryNote.Devolucion        = false;
                            TDeliveryNote.SolicitudTraslado = true;
                            break;
                        }
                        break;
                    }

                    case "141":     //Factura de compra a terceros
                    {
                        result = (IvkFormInterface)(new TPurchaseInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TPurchaseInvoice.DocSubType = "--";
                        TPurchaseInvoice.bFolderAdd = false;
                        TPurchaseInvoice.ObjType    = "18";
                        break;
                    }

                    case "65301":     //Factura Anticipo de compra a terceros
                    {
                        result = (IvkFormInterface)(new TPurchaseInvoice());
                        //(TInvoice)(result).ooForms = oForms;
                        TPurchaseInvoice.DocSubType = "--";
                        TPurchaseInvoice.bFolderAdd = false;
                        TPurchaseInvoice.ObjType    = "204";
                        break;
                    }

                    case "181":     //Nota de Credito Compra
                    {
                        result = (IvkFormInterface)(new TCreditNotes());
                        //(TCreditNotes)(result).ooForms = oForms;
                        TCreditNotes.DocSubType = "--";
                        TCreditNotes.bFolderAdd = true;
                        TCreditNotes.ObjType    = "19";
                        break;
                    }
                    } //fi  switch
                }


                if (result != null)
                {
                    SAPbouiCOM.Application             App   = SBOApplication;
                    SAPbobsCOM.Company                 Cmpny = SBOCompany;
                    VisualD.SBOFunctions.CSBOFunctions SboF  = SBOFunctions;
                    VisualD.GlobalVid.TGlobalVid       Glob  = GlobalSettings;
                    if (result.InitForm(pVal.FormUID, @"forms\\", ref App, ref Cmpny, ref SboF, ref Glob))
                    {
                        oForms.Add(result);
                    }
                    else
                    {
                        SBOApplication.Forms.Item(result.getFormId()).Close();
                        result = null;
                    }
                }

                return(result);
            }// fin try
            catch (Exception e)
            {
                return(null);

                oLog.OutLog("ItemEventExt: " + e.Message + " ** Trace: " + e.StackTrace);
                SBOApplication.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");  // Captura errores no manejados
            }
        } //fin ItemEventExt