} //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
예제 #2
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