Exemplo n.º 1
0
        }//fin FormEvent

        public new void FormDataEvent(ref BusinessObjectInfo BusinessObjectInfo, ref Boolean BubbleEvent)
        {
            base.FormDataEvent(ref BusinessObjectInfo, ref BubbleEvent);
            String TipoDocElec;
            String sDocEntry;
            String Canceled;

            try
            {
                if ((BusinessObjectInfo.BeforeAction == false) && (BusinessObjectInfo.EventType == BoEventTypes.et_FORM_DATA_ADD) && (BusinessObjectInfo.ActionSuccess))
                {
                    //sDocEntry = FSBOf.GetDocEntryBusinessObjectInfo(BusinessObjectInfo.ObjectKey);
                    var _xmlDocument = new XmlDocument();
                    _xmlDocument.LoadXml(BusinessObjectInfo.ObjectKey);
                    var N = _xmlDocument.SelectSingleNode("PaymentParams");
                    sDocEntry = ((System.String)N.InnerText).Trim();

                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @" SELECT SUBSTRING(UPPER(T2.BeginStr), 1, 1) 'Tipo'
                                 , ISNULL(T0.U_BPP_PTSC,'') BPP_PTSC
                                 , ISNULL(T0.U_BPP_PTCC,'') BPP_PTCC
                                 , T0.CANCELED
                                 , ISNULL(T0.U_BPP_MDTD,'') BPP_MDTD
                                 , ISNULL(T0.U_BPP_MDSD,'') BPP_MDSD
                                 , ISNULL(T0.U_BPP_MDCD,'') BPP_MDCD
                                 FROM OVPM T0 WITH (NOLOCK)
                                 JOIN NNM1 T2 WITH (NOLOCK) ON T0.Series = T2.Series 
                                 WHERE T0.DocEntry = {0}";
                    }
                    else
                    {
                        s = @" SELECT SUBSTRING(UPPER(T2.""BeginStr""), 1, 1) ""Tipo""
                                , IFNULL(T0.""U_BPP_PTSC"",'') ""BPP_PTSC""
                                , IFNULL(T0.""U_BPP_PTCC"",'') ""BPP_PTCC""
                                , T0.""CANCELED""
                                , IFNULL(T0.""U_BPP_MDTD"",'') ""BPP_MDTD""
                                , IFNULL(T0.""U_BPP_MDSD"",'') ""BPP_MDSD""
                                , IFNULL(T0.""U_BPP_MDCD"",'') ""BPP_MDCD""
                                FROM ""OVPM"" T0
                                JOIN ""NNM1"" T2 ON T0.""Series"" = T2.""Series""
                                WHERE T0.""DocEntry"" = {0} ";
                    }
                    s = String.Format(s, sDocEntry);
                    oRecordSet.DoQuery(s);
                    Canceled = (System.String)(oRecordSet.Fields.Item("CANCELED").Value);

                    if (Canceled == "N")
                    {
                        if (((System.String)oRecordSet.Fields.Item("BPP_MDTD").Value).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("No se encuentra ingresado tipo de documento", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else if (((System.String)oRecordSet.Fields.Item("BPP_MDSD").Value).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("No se encuentra ingresado serie del documento", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else if (((System.String)oRecordSet.Fields.Item("BPP_MDCD").Value).Trim() == "")
                        {
                            FSBOApp.StatusBar.SetText("No se encuentra ingresado correlativo del documento", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else
                        {
                            SBO_f       = FSBOf;
                            TipoDocElec = "20";
                            EnviarFE_PE_ED(sDocEntry, GlobalSettings.RunningUnderSQLServer, ((System.String)oRecordSet.Fields.Item("BPP_PTSC").Value).Trim(), ((System.String)oRecordSet.Fields.Item("BPP_PTCC").Value).Trim(), TipoDocElec, oForm.BusinessObject.Type, RUC);
                        }
                    }
                    //--
                }
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText("FormDataEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormDataEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormDataEvent
        } //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
Exemplo n.º 3
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
        } //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
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