Exemplo n.º 1
0
        private void LoadSchemeCodes()
        {
            SAPbouiCOM.Form oForm = default(SAPbouiCOM.Form);
            try
            {
                oForm = this.CurrentForm;
                oForm.Freeze(true);
                SAPbobsCOM.Recordset oRs  = SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                string sql_GetSchemeCodes = @"select * from ""@AVA_FM_OCRS"" where ""U_Active"" = N'Y' ";
                oRs.DoQuery(sql_GetSchemeCodes);
                SAPbouiCOM.ComboBox cbxSchemes = oForm.Items.Item(CBX_SCHEMECODE).Specific;
                while (cbxSchemes.ValidValues.Count > 0)
                {
                    cbxSchemes.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                }
                for (int iRSRowCounter = 0; iRSRowCounter < oRs.RecordCount; iRSRowCounter++)
                {
                    cbxSchemes.ValidValues.Add(oRs.Fields.Item("Code").Value, oRs.Fields.Item("Name").Value);
                    oRs.MoveNext();
                }
                if (cbxSchemes.ValidValues.Count > 0)
                {
                    cbxSchemes.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);
                    LoadScheme(cbxSchemes.Selected.Value);
                }
            }
            catch (Exception ex) { throw ex; }
            finally { oForm.Freeze(false); }

            #endregion
        }
Exemplo n.º 2
0
 private void LoadScheme(string SchemeCode)
 {
     SAPbouiCOM.Form oForm = default(SAPbouiCOM.Form);
     try
     {
         oForm = this.CurrentForm;
         oForm.Freeze(true);
         SAPbouiCOM.Grid oGrid = oForm.Items.Item(GRID_SCHEME).Specific;
         oGrid.DataTable.Clear();
         SAPbobsCOM.Recordset oRs = SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
         string sql_GetScheme     = @"select * from ""@AVA_FM_CRS1"" where ""Code"" = N'{0}'";
         sql_GetScheme = string.Format(sql_GetScheme, SchemeCode);
         oRs.DoQuery(sql_GetScheme);
         if (oRs.RecordCount > 0)
         {
             IList <Scheme> schemes = new List <Scheme>();
             Scheme         temp    = default(Scheme);
             for (int iRSRowCounter = 0; iRSRowCounter < oRs.RecordCount; iRSRowCounter++)
             {
                 temp = new Scheme(oRs.Fields.Item("U_RuleSchmsID").Value,
                                   oRs.Fields.Item("U_RuleSchmsDesc").Value,
                                   oRs.Fields.Item("U_RuleSchmsType").Value,
                                   oRs.Fields.Item("U_RuleSchmsLen").Value,
                                   oRs.Fields.Item("U_RuleSchmsDefault").Value,
                                   oRs.Fields.Item("U_Padding").Value == "Y" ? true : false,
                                   oRs.Fields.Item("U_PadString").Value);
                 oGrid.DataTable.Columns.Add(oRs.Fields.Item("U_RuleSchmsID").Value,
                                             oRs.Fields.Item("U_RuleSchmsType").Value == "I" ? SAPbouiCOM.BoFieldsType.ft_Integer : SAPbouiCOM.BoFieldsType.ft_AlphaNumeric,
                                             oRs.Fields.Item("U_RuleSchmsLen").Value);
                 oGrid.Columns.Item(oRs.Fields.Item("U_RuleSchmsID").Value).TitleObject.Caption = oRs.Fields.Item("U_RuleSchmsDesc").Value;
                 schemes.Add(temp);
                 oRs.MoveNext();
             }
             Scheme = schemes;
             oGrid.DataTable.Rows.Add();
             foreach (var item in schemes)
             {
                 if (string.IsNullOrEmpty(item.RuleSchmsDefault))
                 {
                     continue;
                 }
                 else if (item.RuleSchmsDefault.ToUpper().Equals("NULL"))
                 {
                     continue;
                 }
                 oGrid.DataTable.SetValue(item.RuleSchmsID, oGrid.DataTable.Rows.Offset, item.RuleSchmsDefault);
             }
             oGrid.RowHeaders.Width = 20;
         }
     }
     catch (Exception ex) { throw ex; }
     finally { oForm.Freeze(false); }
 }
Exemplo n.º 3
0
 private void Save()
 {
     SAPbobsCOM.Recordset oRs = default(SAPbobsCOM.Recordset);
     try
     {
         this.CurrentForm.Freeze(true);
         SBOApp.StatusBar.SetText("正在保存,请稍后...", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
         SAPbouiCOM.Grid grid_list = this.CurrentForm.Items.Item(GRID_LIST).Specific;
         if (grid_list.DataTable.Rows.Count > 0)
         {
             oRs = SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
             var offset       = default(int);
             var trans_id     = default(int);
             var voucher_code = default(string);
             var sql_save     = default(string);
             var count        = grid_list.Rows.Count;
             while (offset < grid_list.DataTable.Rows.Count)
             {
                 grid_list.DataTable.Rows.Offset = offset;
                 trans_id     = grid_list.DataTable.GetValue("TransId", grid_list.DataTable.Rows.Offset);
                 voucher_code = grid_list.DataTable.GetValue("VoucherCode", grid_list.DataTable.Rows.Offset);
                 sql_save     = @"exec ""AVA_FM_SP_SAVE_JOURNAL_ENTRY_DATA"" {0},'{1}' ";
                 sql_save     = string.Format(sql_save, trans_id, voucher_code);
                 oRs.DoQuery(sql_save);
                 if (oRs.Fields.Item(0).Value != 0)
                 {
                     throw new Exception(oRs.Fields.Item(1).Value);
                 }
                 else
                 {
                     grid_list.DataTable.Rows.Remove(grid_list.DataTable.Rows.Offset);
                     SBOApp.StatusBar.SetText(string.Format("保存完成{0}/{1}!", count - grid_list.Rows.Count, count),
                                              SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                 }
             }
         }
         SBOApp.StatusBar.SetText("保存完成!", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
     }
     catch (Exception ex) { SBOApp.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short); }
     finally
     {
         if (oRs != null)
         {
             System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oRs);
         }
         this.CurrentForm.Freeze(false);
     }
 }
Exemplo n.º 4
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();
            }
        }
Exemplo n.º 5
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