/// <summary>
        /// Ejecución de eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Nombre o ID de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="bubbleEvent">Evento</param>
        public override void eventos(string FormUID, ref ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.FormUID == formID && pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)
                    {
                        _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                        _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                        Dispose();
                        application           = null;
                        company               = null;
                        _oRptCorteSolicitudes = false;
                        Addon.typeList.RemoveAll(p => p._forma == formID);
                        return;
                    }

                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTN_CANCELAR)
                        {
                            _oForma.Close();
                        }

                        if (pVal.ItemUID == BTN_IMPRIMIR)
                        {
                            _oTxtFechaInicial  = _oForma.Items.Item(TXT_FECHA_INICIAL).Specific;
                            _oTxtFechaFinal    = _oForma.Items.Item(TXT_FECHA_FINAL).Specific;
                            _oCmbOficinaVentas = _oForma.Items.Item(CMB_OFICINA_VENTAS).Specific;
                            //_oTxtUsuario = _oForma.Items.Item(TXT_USUARIO).Specific;

                            if (ValidarCampos())
                            {
                                if (Extensor.ValidarImpresionCorteSolicitudes(_Company, _oCmbOficinaVentas.Selected.Value.ToString()))
                                {
                                    if (_Application.MessageBox("¿Desea generar el corte de solicitudes?", 2, "Si", "No") == 1)
                                    {
                                        if (ImprimirReporteCorteSolicitudes())
                                        {
                                            _Application.StatusBar.SetText("Generar reporte terminado correctamente...", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                                        }
                                    }
                                }
                                else
                                {
                                    _Application.MessageBox("El reporte ya fue impreso");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsReporteOficinasContratos* : " + ex.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// Cierra la ventana activa.
 /// </summary>
 public void CerrarVenatana()
 {
     SAPbouiCOM.Form fForm = null;
     try
     {
         fForm = _Application.Forms.Item(formID);
         fForm.Close();
     }
     catch (Exception e)
     {
     }
 }
Пример #3
0
 public void CopiarPara(SAPbouiCOM.Form formDe)
 {
     try
     {
         Dialogs.Info("Aguarde...");
         formDe.Freeze(true);
         var botaoSelecao = (ComboBox)formDe.Items.Item("10000329").Specific;
         botaoSelecao.Select(0, BoSearchKey.psk_Index);
     }
     catch (Exception e)
     {
         Dialogs.PopupError("Erro interno. Erro ao copiar documento base para documento destino. Erro: " + e.Message);
     }
     finally
     {
         formDe.Freeze(false);
         formDe.Close();
     }
 }
Пример #4
0
        public virtual void ET_btnApply_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnApply").Specific));
            // ADD YOUR ACTION CODE HERE ...

            if (oForm.DataSources.UserDataSources.Item("sTYPE").ValueEx == "TRUE")
            {
                SetApplyDataToParentForm(oForm);
                CallBackEvent();
            }

            oForm.Close();
        }
Пример #5
0
 public virtual void ET_grd_AFDoubleClick(ItemEvent pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
     // ADD YOUR ACTION CODE HERE ...
     SetApplyDataToParentForm_2(oForm);
     oForm.Close();
 }
Пример #6
0
 public virtual void ET_btnAPPLY_AFItemPressed(ItemEvent pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnAPPLY").Specific));
     // ADD YOUR ACTION CODE HERE ...
     SetApplyDataToParentForm_2(oForm);
     oForm.Close();
 }
Пример #7
0
 public virtual void ET_1_AFItemPressed(ItemEvent pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));
     // ADD YOUR ACTION CODE HERE ...
     oForm.Close();
 }
Пример #8
0
        /// <summary>
        /// 광고수주오더에서 광고매출확정으로 관련 항목 데이터 복제시 사용합니다.
        /// </summary>
        /// <param name="KIS_SD0030_HRD_FormUid">광고수주오더 폼UID</param>
        public void SubFormCopy(string KIS_SD0030_HRD_FormUid)
        {
            this.LoadForm();
            //광고매출확정 폼
            oForm = B1Connections.theAppl.Forms.Item(formuid);
            //광고수주오더 폼
            SAPbouiCOM.Form oForm_KIS_SD0030_HRD = B1Connections.theAppl.Forms.Item(KIS_SD0030_HRD_FormUid);

            this.Act1_FormInit();

            try
            {
                SAPbouiCOM.DBDataSource oKIS_SD0030T_HRD = oForm_KIS_SD0030_HRD.DataSources.DBDataSources.Item("@KIS_SD0030T_HRD");
                SAPbouiCOM.DBDataSource oKIS_SD00301_HRD = oForm_KIS_SD0030_HRD.DataSources.DBDataSources.Item("@KIS_SD00301_HRD");

                SAPbouiCOM.DBDataSource oKIS_SD0050T_HRD = oForm.DataSources.DBDataSources.Item("@KIS_SD0050T_HRD");
                SAPbouiCOM.DBDataSource oKIS_SD00501_HRD = oForm.DataSources.DBDataSources.Item("@KIS_SD00501_HRD");


                SetDBDataSourceCopy_Header(oKIS_SD0030T_HRD, oKIS_SD0050T_HRD);

                SetDBDataSourceCopy_Line(oKIS_SD00301_HRD, oKIS_SD00501_HRD);

                oForm.Visible = true;
            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                oForm.Close();
            }


        }
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            Int32  nErr;
            String sErr;

            SAPbouiCOM.Form oFormAux;
            String          DocEntry;
            String          Tabla;
            XmlDocument     _xmlDocument;
            XmlNode         N;
            Boolean         FolioUnico;

            SAPbouiCOM.EditText oEditText;
            String[]            FE52 = { "15", "67", "21" };

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if (Localidad == "CL")
                    {
                        if (pVal.ItemUID == "4")
                        {
                            s        = GlobalSettings.PrevFormUID;
                            oFormAux = FSBOApp.Forms.Item(s);
                            //if (oFormAux.BusinessObject.Type in ['15','67'])
                            if (FE52.Contains(oFormAux.BusinessObject.Type))
                            {
                                if (GlobalSettings.RunningUnderSQLServer)
                                {
                                    s = @"select isnull(U_FolioGuia,'N') FolioUnico from [@VID_FEPARAM] where code = '1'";
                                }
                                else
                                {
                                    s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"" from ""@VID_FEPARAM"" where ""Code"" = '1' ";
                                }
                                oRecordSet.DoQuery(s);
                                if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y")
                                {
                                    FolioUnico = true;
                                }
                                else
                                {
                                    FolioUnico = false;
                                }

                                if (FolioUnico)
                                {
                                    if (oFormAux.BusinessObject.Type == "15")
                                    {
                                        Tabla = "ODLN";
                                    }
                                    else if (oFormAux.BusinessObject.Type == "21")
                                    {
                                        Tabla = "ORPD";
                                    }
                                    else
                                    {
                                        Tabla = "OWTR";
                                    }

                                    _xmlDocument = new XmlDocument();
                                    _xmlDocument.LoadXml(oFormAux.BusinessObject.Key);
                                    N        = _xmlDocument.SelectSingleNode("DocumentParams");
                                    DocEntry = N.InnerText;

                                    if (GlobalSettings.RunningUnderSQLServer)
                                    {
                                        s = @"SELECT Count(*) Cont
                                            FROM NNM1 T0
                                            JOIN {0} T1 ON T1.Series = T0.Series
                                           WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') 
                                             AND T1.DocEntry = {1}
                                             --AND T0.ObjectCode = '{2}'";
                                    }
                                    else
                                    {
                                        s = @"SELECT Count(*) ""Cont""
                                            FROM ""NNM1"" T0
                                            JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series""
                                           WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') 
                                             AND T1.""DocEntry"" = {1}
                                             --AND T0.""ObjectCode"" = '{2}'";
                                    }
                                    s = String.Format(s, Tabla, DocEntry, oFormAux.BusinessObject.Type);
                                    oRecordSet.DoQuery(s);
                                    if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                                    {
                                        BubbleEvent = false;
                                        oForm.Close();
                                    }
                                }
                            }
                        }
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_FORM_LOAD) && (!pVal.BeforeAction))
                {
                    s        = GlobalSettings.PrevFormUID;
                    oFormAux = FSBOApp.Forms.Item(s);
                    //if (oFormAux.BusinessObject.Type in ['15','67'])
                    if (Localidad == "CL")
                    {
                        if (FE52.Contains(oFormAux.BusinessObject.Type))
                        {
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"select isnull(U_FolioGuia,'N') FolioUnico from [@VID_FEPARAM] where code = '1'";
                            }
                            else
                            {
                                s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"" from ""@VID_FEPARAM"" where ""Code"" = '1'";
                            }

                            oRecordSet.DoQuery(s);
                            if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y")
                            {
                                FolioUnico = true;
                            }
                            else
                            {
                                FolioUnico = false;
                            }

                            if (FolioUnico)
                            {
                                if (oFormAux.BusinessObject.Type == "15")
                                {
                                    Tabla = "ODLN";
                                }
                                else if (oFormAux.BusinessObject.Type == "21")
                                {
                                    Tabla = "ORPD";
                                }
                                else
                                {
                                    Tabla = "OWTR";
                                }

                                _xmlDocument = new XmlDocument();
                                _xmlDocument.LoadXml(oFormAux.BusinessObject.Key);
                                N        = _xmlDocument.SelectSingleNode("DocumentParams");
                                DocEntry = N.InnerText;

                                if (GlobalSettings.RunningUnderSQLServer)
                                {
                                    s = @"SELECT Count(*) Cont
                                        FROM NNM1 T0
                                        JOIN {0} T1 ON T1.Series = T0.Series
                                       WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') 
                                         AND T1.DocEntry = {1}
                                         --AND T0.ObjectCode = '{2}'";
                                }
                                else
                                {
                                    s = @"SELECT Count(*) ""Cont""
                                        FROM ""NNM1"" T0
                                        JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series""
                                       WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') 
                                         AND T1.""DocEntry"" = {1}
                                         --AND T0.""ObjectCode"" = '{2}'";
                                }
                                s = String.Format(s, Tabla, DocEntry, oFormAux.BusinessObject.Type);
                                oRecordSet.DoQuery(s);
                                if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                                {
                                    if (GlobalSettings.RunningUnderSQLServer)
                                    {
                                        s = @"SELECT 'GE' BeginStr, NextNumber FROM NNM1 WHERE (ObjectCode = 'VD_FEEntreg')";
                                    }
                                    else
                                    {
                                        s = @"SELECT 'GE' ""BeginStr"", ""NextNumber"" FROM ""NNM1"" WHERE (""ObjectCode"" = 'VD_FEEntreg')";
                                    }
                                    oRecordSet.DoQuery(s);
                                    s               = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("NextNumber").Value));
                                    oEditText       = (EditText)(oForm.Items.Item("7").Specific);
                                    oEditText.Value = s;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #10
0
        /// <summary>
        /// Ejecución de eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Nombre o ID de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="bubbleEvent">Evento</param>
        public override void eventos(string FormUID, ref ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.FormUID == formID && pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)
                    {
                        _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                        _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                        Dispose();
                        application = null;
                        company     = null;
                        _oArqueos   = false;
                        Addon.typeList.RemoveAll(p => p._forma == formID);
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == TXT_CODIGO_ASOCIADO && pVal.CharPressed == CHAR_PRESS_TAB)
                    {
                        if (!string.IsNullOrEmpty(_oTxtCodigoAsociado.Value.ToString()))
                        {
                            ObtenerInformacionAsociado();
                            if (ValidarSiYaEscaneo())
                            {
                                LlenarGridArqueo("AND U_FechaArqueo IS NULL");
                            }
                            else if (ValidarSiYaCerroArqueo())
                            {
                                LlenarGridArqueo(" AND CONVERT(VARCHAR(10), U_FechaArqueo, 103) = CONVERT(VARCHAR(10), GETDATE(), 103)");
                                _oBtnImprimirArqueo.Item.Visible       = true;
                                _oTxtCodigoAsociado.Active             = true;
                                _oTxtCodigoSolicitud.Item.Enabled      = false;
                                _oForma.Items.Item(BTN_ARQUEO).Enabled = false;
                            }
                        }
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.ItemUID == TXT_CODIGO_SOLICITUD && pVal.CharPressed != CHAR_PRESS_TAB)
                    {
                        if (!string.IsNullOrEmpty(_oTxtCodigoAsociado.Value.ToString()))
                        {
                            ValidarEscaneoSerie();
                        }
                        else
                        {
                            _oTxtCodigoSolicitud.Value = "";
                            _Application.StatusBar.SetText("Capture el código del asociado", BoMessageTime.bmt_Medium, BoStatusBarMessageType.smt_Error);
                        }
                    }

                    if (pVal.EventType == BoEventTypes.et_KEY_DOWN && pVal.CharPressed == CHAR_PRESS_ENTER && pVal.ItemUID == TXT_CODIGO_SOLICITUD)
                    {
                        if (_oTxtCodigoSolicitud.Value.ToString().Length > 6)
                        {
                            AgregarSolicitud();
                            _oTxtCodigoSolicitud.Value = "";
                        }
                    }
                }

                if (pVal.FormUID == formID && pVal.BeforeAction == true)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTN_IMPRIMIR_ARQUEO)
                        {
                            CargarReporteArqueo();
                        }

                        if (pVal.ItemUID == BTN_CERRAR)
                        {
                            _oForma.Close();
                        }

                        if (pVal.ItemUID == BTN_ARQUEO)
                        {
                            if (!string.IsNullOrEmpty(_oTxtCodigoAsociado.Value.ToString()))
                            {
                                if (!_oGridArqueos.DataTable.IsEmpty)
                                {
                                    if (_Application.MessageBox("¿Desea cerrar el arqueo?", 2, "Si", "No") == 1)
                                    {
                                        CerrarAqueo();
                                    }
                                }
                                else
                                {
                                    if (_Application.MessageBox("¿Desea cerrar el arqueo sin solicitudes?", 2, "Si", "No") == 1)
                                    {
                                        CerrarAqueoSinSolicitudes();
                                    }
                                }
                            }
                            else
                            {
                                _Application.MessageBox("Capture el código del asociado");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsArqueos* : " + ex.Message);
            }
        }
Пример #11
0
        /// <summary>
        /// Ejecución de eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Nombre o ID de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="bubbleEvent">Evento</param>
        public override void eventos(string FormUID, ref ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.FormUID == formID && pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)
                    {
                        _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                        _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                        Dispose();
                        application    = null;
                        company        = null;
                        _oPrecontratos = false;
                        Addon.typeList.RemoveAll(p => p._forma == formID);
                        return;
                    }
                }

                if (pVal.FormUID == formID && pVal.BeforeAction == true)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTNBUSCAR)
                        {
                            BuscarDatos();
                            ContadorSeleccionados = 0;
                        }

                        if (pVal.ItemUID == BTNCOLLAP)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    _oGridPrecontratos.Rows.CollapseAll();
                                }
                            }
                        }

                        if (pVal.ItemUID == BTNEXPAN)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    _oGridPrecontratos.Rows.ExpandAll();
                                }
                            }
                        }

                        if (pVal.ItemUID == BTNCREAR)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    if (ContadorSeleccionados != 0)
                                    {
                                        CrearPreContratos();
                                        _oForma.Close();
                                        bubbleEvent = false;
                                    }
                                    else
                                    {
                                        _Application.MessageBox("No se ha seleccionado ningún Pre-contrato");
                                    }
                                }
                            }
                        }

                        if (pVal.ItemUID == BTN_SELECCION_AUTOMATICA)
                        {
                            if (_oGridPrecontratos != null)
                            {
                                if (!_oGridPrecontratos.DataTable.IsEmpty)
                                {
                                    SelecionAutomatica();
                                }
                            }
                        }
                    }

                    if (pVal.ItemUID == GRDPRECONTRATO && pVal.ColUID == "RowsHeader" && pVal.EventType == BoEventTypes.et_DOUBLE_CLICK)
                    {
                        bubbleEvent = false;
                        return;
                    }

                    if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == GRDPRECONTRATO && pVal.ColUID == "Crear")
                    {
                        int index = 0;
                        index = _oGridPrecontratos.GetDataTableRowIndex(pVal.Row);
                        _oGridPrecontratos = _oForma.Items.Item(GRDPRECONTRATO).Specific;
                        EstatusCrear       = _oGridPrecontratos.DataTable.GetValue("Crear", index).ToString();

                        if (EstatusCrear == "Y")
                        {
                            ContadorSeleccionados += 1;
                        }
                        else
                        {
                            ContadorSeleccionados -= 1;
                        }

                        if (ContadorSeleccionados > 10)
                        {
                            _oGridPrecontratos.DataTable.SetValue("Crear", index, "N");
                            _Application.MessageBox("Solo se pueden seleccionar hasta 10 Pre-contratos");
                            ContadorSeleccionados -= 1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsPreContratos* : " + ex.Message);
            }
        }
Пример #12
0
        public static void clsSalesOrder_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            oForm            = oSetupForm;
            oHDBDataSource   = oForm.DataSources.DBDataSources.Item("ORDR");
            oChildDataSource = oForm.DataSources.DBDataSources.Item("RDR1");
            oMatrix          = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

            if (pVal.BeforeAction)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == "38" && (pVal.ColUID == "U_Variance" || pVal.ColUID == "U_DiscExc"))
                    {
                        BubbleEvent = false;
                    }
                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE || oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        if (pVal.ItemUID == "U_DocType")
                        {
                            BubbleEvent = false;
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_PICKER_CLICKED:
                    if (pVal.ItemUID == "38" && pVal.ColUID == "U_Variance")
                    {
                        BubbleEvent = false;
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "btnSH")
                    {
                        if (((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() == "")
                        {
                            oApplication.StatusBar.SetText("Select the Customer....", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                            BubbleEvent = false;
                        }

                        if (oHDBDataSource.GetValue("DocStatus", oHDBDataSource.Offset).ToString().Trim() != "O")
                        {
                            BubbleEvent = false;
                        }
                        // strDocEntry = oHDBDataSource.GetValue("DocEntry", 0).Trim();
                        //strDocType = oHDBDataSource.GetValue("U_DocType", 0).Trim();
                    }
                    break;


                default:
                    break;
                }
            }
            else if (pVal.BeforeAction == false)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                    //Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("2").Left + oForm.Items.Item("2").Width + 6, oForm.Items.Item("2").Top, oForm.Items.Item("2").Width, oForm.Items.Item("2").Height, "Sales History", true, 0, "");
                    Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("46").Left, oForm.Items.Item("46").Top + 20, oForm.Items.Item("46").Width, oForm.Items.Item("2").Height, "Sales History", true, 0, "46");
                    ColsFromHistory = new List <string> {
                        "1", "11", "14", "1470002145"
                    };
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "1")
                    {
                        if (oForm.Mode != BoFormMode.fm_FIND_MODE)
                        {
                            if (pVal.ActionSuccess)
                            {
                                if (oWaitForm != null)
                                {
                                    try
                                    {
                                        oWaitForm.Close();
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                    oWaitForm = null;
                                }
                            }
                        }
                    }

                    if (pVal.ItemUID == "btnSH")
                    {
                        try
                        {
                            oWaitForm.Close();
                            oWaitForm = null;
                        }
                        catch
                        {
                        }
                        try
                        {
                            if (oWaitForm != null)
                            {
                                string strCardCode1 = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                                string strCardCode2 = ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value.Trim();

                                if (strCardCode1 != strCardCode2)
                                {
                                    try
                                    {
                                        oWaitForm.Close();
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                    oWaitForm = null;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            oWaitForm = null;
                        }

                        if (oWaitForm == null)
                        {
                            string strQry;
                            oWaitForm = clsSBO.LoadForm("EJ_OCSH.srf", "EJ_OCSH", oApplication);
                            try
                            {
                                oWaitForm.Settings.MatrixUID = "4";
                                oWaitForm.Settings.Enabled   = true;
                            }
                            catch { }

                            oWaitForm.State = BoFormStateEnum.fs_Maximized;

                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("8").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("54").Specific).Value.Trim();
                            oWaitForm.Freeze(true);
                            oWaitForm.DataSources.DataTables.Add("@dtTemp");
                            SAPbouiCOM.Grid oGrid;
                            oGrid = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;

                            oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);

                            strQry = "EXEC dbo.EJ_CustomerSalesHistory  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "','" + ((SAPbouiCOM.EditText)oForm.Items.Item("8").Specific).Value.Trim() + "'";
                            System.Data.DataTable dtHistory = clsSBO.getDataTable(strQry, "History", oCompany);
                            oWaitForm.DataSources.DataTables.Item(0).ExecuteQuery(strQry);


                            oGrid.DataTable = oWaitForm.DataSources.DataTables.Item(0);
                            string strCardCode = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            int    i           = 0;
                            //foreach (System.Data.DataRow dr in dtHistory.Rows)
                            //{
                            //    try
                            //    {
                            //        if (dr["ItemCode"].ToString() != "")
                            //        {
                            //            SAPbobsCOM.ItemPriceReturnParams itemPrice = clsSBO.getUnitPriceSys(oCompany,dr["ItemCode"].ToString().Trim(), strCardCode , 1, DateTime.Now.Date, dr["UoM"].ToString().Trim());
                            //            oGrid.DataTable.SetValue("Current Selling Price", i, itemPrice.Price);
                            //            i++;
                            //        }
                            //    }
                            //    catch { }

                            //}

                            oGrid.Columns.Item(0).Editable = true;
                            SAPbouiCOM.EditTextColumn oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(0));
                            oEditTxt.ChooseFromListUID     = "CFL_2";
                            oEditTxt.ChooseFromListAlias   = "ItemCode";
                            oGrid.Columns.Item(1).Editable = false;
                            string showName = clsSBO.getColVisibility("EJ_OCSH", "ItemName", oCompany.UserName, oCompany);
                            if (showName == "N")
                            {
                                oGrid.Columns.Item(1).Visible = false;
                            }

                            oGrid.Columns.Item(2).Editable = true;
                            oGrid.Columns.Item(3).Editable = true;
                            oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(3));
                            oEditTxt.ChooseFromListUID     = "CFL_3";
                            oEditTxt.ChooseFromListAlias   = "UomCode";
                            oGrid.Columns.Item(4).Editable = true;


                            for (int j = 5; j < oGrid.Columns.Count; j++)
                            {
                                oGrid.Columns.Item(j).Editable = false;
                            }
                            oGrid.Columns.Item(1).Editable = false;
                            oGrid.Columns.Item(0).Editable = true;

                            oGrid.AutoResizeColumns();
                            oGrid.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Auto;
                            oGrid.DataTable.Rows.Add(1);

                            clsCustomerSalesHistory.oForm        = oWaitForm;
                            clsCustomerSalesHistory.oSOForm      = oForm;
                            clsCustomerSalesHistory.ORDR         = oForm.DataSources.DBDataSources.Item("ORDR");
                            clsCustomerSalesHistory.cardCode     = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            clsCustomerSalesHistory.oCompany     = oCompany;
                            clsCustomerSalesHistory.oApplication = oApplication;
                            clsCustomerSalesHistory.isAdding     = oForm.Mode == BoFormMode.fm_ADD_MODE ? true : false;
                            clsCustomerSalesHistory.CallingForm  = "SO";
                            clsCustomerSalesHistory.myDocNum     = Convert.ToInt32(((SAPbouiCOM.EditText)oForm.Items.Item("8").Specific).Value.Trim());
                            oWaitForm.Freeze(false);
                        }
                        else
                        {
                            SAPbouiCOM.Grid oGrid;
                            oGrid = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;

                            try
                            {
                                for (int i = 1; i < oMatrix.RowCount; i++)
                                {
                                    bool boolAvailable = false;
                                    for (int j = 0; j < oGrid.Rows.Count; j++)
                                    {
                                        if (((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific).Value.Trim() == oGrid.DataTable.GetValue("ItemCode", j).ToString().Trim())
                                        {
                                            boolAvailable = true;
                                            oGrid.DataTable.SetValue("Order Qty", j, Convert.ToInt32(Convert.ToDouble(((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(i).Specific).Value.Trim())));
                                            break;
                                        }
                                    }
                                    if (boolAvailable == false)
                                    {
                                        int intGridRow = 0;
                                        if (oGrid.DataTable.GetValue("ItemCode", oGrid.Rows.Count - 2).ToString().Trim() == "")
                                        {
                                            intGridRow = oGrid.Rows.Count - 2;
                                        }
                                        else
                                        {
                                            intGridRow = oGrid.Rows.Count - 1;
                                        }

                                        oGrid.DataTable.SetValue("ItemCode", intGridRow, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific).Value.Trim());
                                        oGrid.DataTable.SetValue("ItemName", intGridRow, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("3").Cells.Item(i).Specific).Value.Trim());
                                        oGrid.DataTable.SetValue("Order Qty", intGridRow, Convert.ToInt32(Convert.ToDouble(((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(i).Specific).Value.Trim())));
                                        oGrid.DataTable.SetValue("UoM", intGridRow, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(i).Specific).Value.Trim());
                                        string input = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("14").Cells.Item(i).Specific).Value.Trim();
                                        SAPbobsCOM.ItemPriceReturnParams itemPrice = clsSBO.getUnitPriceSys(oCompany, oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim(), ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim(), 1, DateTime.Now.Date, ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(i).Specific).Value.Trim());
                                        oGrid.DataTable.SetValue("Current Selling Price", pVal.Row, itemPrice.Price);


                                        //oGrid.DataTable.SetValue("Current Selling Price", intGridRow, new string(input.Where(c => (Char.IsDigit(c) || c == '.' || c == ',')).ToArray()));

                                        oGrid.DataTable.Rows.Add();
                                    }
                                }
                            }
                            catch (Exception)
                            {
                            }


                            oWaitForm.Visible = true;
                        }
                    }
                    break;



                case SAPbouiCOM.BoEventTypes.et_LOST_FOCUS:
                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        if (pVal.ItemUID == "12")
                        {
                            //oForm.DefButton = "btnSH";
                            // oForm.ActiveItem = "btnSH";
                            ((SAPbouiCOM.Button)oForm.Items.Item("btnSH").Specific).Item.Click(BoCellClickType.ct_Regular);
                        }
                    }


                    break;



                case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
                    if (oWaitForm != null)
                    {
                        try
                        {
                            oWaitForm.Close();
                        }
                        catch (Exception)
                        {
                        }

                        try
                        {
                        }
                        catch (Exception)
                        {
                            oWaitForm = null;
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Пример #13
0
        public virtual void ET_btn1_AFItemPressed(ItemEvent pVal) {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btn1").Specific));
            // ADD YOUR ACTION CODE HERE ...
            try
            {
                oGrid = oForm.Items.Item("grd1").Specific;

                string DocEntry = string.Empty;

                if (oGrid.Rows.SelectedRows.Count > 0)
                {
                    int iRowindex = oGrid.Rows.SelectedRows.Item(0, BoOrderType.ot_RowOrder);
                    DocEntry = ((int)oGrid.DataTable.GetValue("DOCENTRY", iRowindex)).ToString();

                    LoadSubForm(oForm, "KIS_TR0031_HRD", DocEntry);
                }



            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                oForm.Close();
            }
        }
Пример #14
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            Int32 nErr = 0;

            //String sErr = "";
            SAPbouiCOM.Form oFormAux;
            String          DocEntry = "";
            String          Tabla    = "";
            String          ObjType  = "";
            XmlNode         N;
            Boolean         FolioUnico;
            Int32           i;
            Boolean         bMultiSoc;
            String          nMultiSoc;

            String[] FE52 = { "15", "67", "21" };
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if (pVal.ItemUID == "4")
                    {
                        s        = GlobalSettings.PrevFormUID;
                        oFormAux = FSBOApp.Forms.Item(s);

                        //if (oFormAux.BusinessObject.Type in ["15","67","21"])
                        if (FE52.Contains(oFormAux.BusinessObject.Type))
                        {
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = "select isnull(U_FolioGuia,'N') FolioUnico, ISNULL(U_Distrib,'N') 'Distribuido', ISNULL(U_MultiSoc,'N') MultiSoc from [@VID_FEPARAM] where code = '1'";
                            }
                            else
                            {
                                s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"", IFNULL(""U_Distrib"",'N') ""Distribuido"", IFNULL(""U_MultiSoc"",'N') ""MultiSoc"" from ""@VID_FEPARAM"" where ""Code"" = '1'";
                            }
                            oRecordSet.DoQuery(s);

                            if ((System.String)(oRecordSet.Fields.Item("Distribuido").Value) == "N")
                            {
                                if ((System.String)(oRecordSet.Fields.Item("MultiSoc").Value) == "Y")
                                {
                                    bMultiSoc = true;
                                }
                                else
                                {
                                    bMultiSoc = false;
                                }

                                if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y")
                                {
                                    FolioUnico = true;
                                }
                                else
                                {
                                    FolioUnico = false;
                                }

                                if (FolioUnico)
                                {
                                    if (oFormAux.BusinessObject.Type == "15")
                                    {
                                        Tabla = "ODLN";
                                    }
                                    else if (oFormAux.BusinessObject.Type == "21")
                                    {
                                        Tabla = "ORPD";
                                    }
                                    else
                                    {
                                        Tabla = "OWTR";
                                    }

                                    //DocEntry := N.InnerText;
                                    if (GlobalSettings.RunningUnderSQLServer)
                                    {
                                        s = @"SELECT Count(*) Cont, SUBSTRING(ISNULL(T0.BeginStr,''), 2, LEN(T0.BeginStr)) Inst
                                                FROM NNM1 T0
                                                JOIN {0} T1 ON T1.Series = T0.Series
                                               WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') 
                                                 AND T1.DocEntry = {1}
                                                 --AND T0.ObjectCode = '{2}'
                                              GROUP BY SUBSTRING(ISNULL(T0.BeginStr,''), 2, LEN(T0.BeginStr))";
                                    }
                                    else
                                    {
                                        s = @"SELECT Count(*) ""Cont"", SUBSTRING(IFNULL(T0.""BeginStr"",''), 2, LENGTH(T0.""BeginStr"")) ""Inst""
                                                FROM ""NNM1"" T0
                                                JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series""
                                               WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') 
                                                 AND T1.""DocEntry"" = {1}
                                                 --AND T0.""ObjectCode"" = '{2}'
                                              GROUP BY SUBSTRING(IFNULL(T0.""BeginStr"",''), 2, LENGTH(T0.""BeginStr""))";
                                    }
                                    s = String.Format(s, Tabla, DocEntry, oFormAux.BusinessObject.Type);
                                    oRecordSet.DoQuery(s);
                                    if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                                    {
                                        nMultiSoc = (System.String)(oRecordSet.Fields.Item("Inst").Value);
                                        if ((bMultiSoc == true) && (nMultiSoc == ""))
                                        {
                                            FSBOApp.StatusBar.SetText("Se encuentra parametrizado para Multiples Sociedades pero no se encuentra parametrizada la serie del documento", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                        }
                                        else
                                        {
                                            BubbleEvent = false;
                                            IngresarFolio(DocEntry, oFormAux.BusinessObject.Type);
                                            s = "--";
                                            var oDeliveryNote = new TDeliveryNote();
                                            oDeliveryNote.SBO_f = FSBOf;
                                            if (oFormAux.BusinessObject.Type == "15")
                                            {
                                                oDeliveryNote.EnviarFE_WebService(DocEntry, s, false, false, false, bMultiSoc, nMultiSoc, GlobalSettings.GLOB_EncryptSQL, GlobalSettings.RunningUnderSQLServer, "52", oFormAux.BusinessObject.Type, false);
                                            }
                                            else if (oFormAux.BusinessObject.Type == "21")
                                            {
                                                oDeliveryNote.EnviarFE_WebService(DocEntry, s, false, false, true, bMultiSoc, nMultiSoc, GlobalSettings.GLOB_EncryptSQL, GlobalSettings.RunningUnderSQLServer, "52D", oFormAux.BusinessObject.Type, false);
                                            }
                                            else if (oFormAux.BusinessObject.Type == "67")
                                            {
                                                oDeliveryNote.EnviarFE_WebService(DocEntry, s, true, false, false, bMultiSoc, nMultiSoc, GlobalSettings.GLOB_EncryptSQL, GlobalSettings.RunningUnderSQLServer, "52T", oFormAux.BusinessObject.Type, false);
                                            }
                                            oForm.Close();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_FORM_LOAD) && (!pVal.BeforeAction))
                {
                    //s := GlobalSettings.PrevFormUID;
                    //oFormAux := FSBOApp.Forms.Item(s);
                    i = 0;
                    while (i <= oForm.DataSources.DBDataSources.Count - 1)
                    {
                        Tabla = (System.String)(oForm.DataSources.DBDataSources.Item(i).TableName);
                        if ((Tabla == "ODLN") || (Tabla == "OWTR") || (Tabla == "ORPD"))
                        {
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"select isnull(U_FolioGuia,'N') FolioUnico from [@VID_FEPARAM] where code = '1'";
                            }
                            else
                            {
                                s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"" from ""@VID_FEPARAM"" where ""Code"" = '1'";
                            }
                            oRecordSet.DoQuery(s);
                            if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y")
                            {
                                FolioUnico = true;
                            }
                            else
                            {
                                FolioUnico = false;
                            }

                            if (FolioUnico)
                            {
                                if (Tabla == "ODLN")
                                {
                                    ObjType = "15";
                                }
                                else if (Tabla == "ORPD")
                                {
                                    ObjType = "21";
                                }
                                else
                                {
                                    ObjType = "67";
                                }

                                DocEntry = oForm.DataSources.DBDataSources.Item(i).GetValue("DocEntry", 0);

                                if (GlobalSettings.RunningUnderSQLServer)
                                {
                                    s = @"SELECT Count(*) Cont
                                            FROM NNM1 T0
                                            JOIN {0} T1 ON T1.Series = T0.Series
                                           WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') 
                                             AND T1.DocEntry = {1}
                                             --AND T0.ObjectCode = '{2}'";
                                }
                                else
                                {
                                    s = @"SELECT Count(*) ""Cont""
                                            FROM ""NNM1"" T0
                                            JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series""
                                           WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') 
                                             AND T1.""DocEntry"" = {1}
                                             --AND T0.""ObjectCode"" = '{2}'";
                                }
                                s = String.Format(s, Tabla, DocEntry, ObjType);
                                oRecordSet.DoQuery(s);
                                if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                                {
                                    if (GlobalSettings.RunningUnderSQLServer)
                                    {
                                        s = @"SELECT 'GE' BeginStr, NextNumber FROM NNM1 WHERE (ObjectCode = 'VD_FEEntreg')";
                                    }
                                    else
                                    {
                                        s = @"SELECT 'GE' ""BeginStr"", ""NextNumber"" FROM ""NNM1"" WHERE (""ObjectCode"" = 'VD_FEEntreg') ";
                                    }
                                    oRecordSet.DoQuery(s);
                                    s               = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("NextNumber").Value));
                                    oEditText       = (EditText)(oForm.Items.Item("39").Specific);
                                    oEditText.Value = s;
                                }
                            }
                            i = oForm.DataSources.DBDataSources.Count;
                        }
                        i++;
                    }
                }
            }
            catch (Exception e)
            {
            }
        }//fin FormEvent
Пример #15
0
 public virtual void ET_1_AFItemPressed(ItemEvent pVal)
 {
     oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
     oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("1").Specific));
     // ADD YOUR ACTION CODE HERE ...
     if (oForm.Mode == BoFormMode.fm_OK_MODE || oForm.Mode == BoFormMode.fm_ADD_MODE)
     {
         SetApplyDataToParent2(oForm);
     }
     oForm.Close();
 }
Пример #16
0
        public virtual void ET_grd_AFDoubleClick(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oGrid = ((SAPbouiCOM.Grid)(oForm.Items.Item("grd").Specific));
            // ADD YOUR ACTION CODE HERE ...
            string pformuid = oForm.DataSources.UserDataSources.Item("pformuid").ValueEx;
            SAPbouiCOM.Form pform = (SAPbouiCOM.Form)B1Connections.theAppl.Forms.Item(pformuid);

            if (PRow != -1)
            {
                pBtn = pVal.ItemUID;
                //pform.DataSources.UserDataSources.Item("edtFRDELCD").Value = oGrid.DataTable.GetValue("Code", PRow);
                pform.DataSources.UserDataSources.Item(pColNM).Value = oGrid.DataTable.GetValue("Code", PRow);
                oForm.Close();
            }

        }
Пример #17
0
        /// <summary>
        /// Ejecución de eventos de la forma activa
        /// </summary>
        /// <param name="FormUID">Nombre o ID de la forma</param>
        /// <param name="pVal">Propiedades de la forma</param>
        /// <param name="bubbleEvent">Evento</param>
        public override void eventos(string FormUID, ref ItemEvent pVal, out bool bubbleEvent)
        {
            bubbleEvent = true;
            try
            {
                if (pVal.FormUID == formID && pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_KEY_DOWN && (pVal.ItemUID == GRD_COMISIONES_COBRADORES))
                    {
                        _oBotonUpdate.Caption = "Actualizar";
                    }
                }

                if (pVal.FormUID == formID && pVal.BeforeAction == true)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE && pVal.Action_Success == false)
                    {
                        if (_oBotonUpdate.Caption == "Actualizar")
                        {
                            int opcion = _Application.MessageBox("¿Desea grabar las modificaciones?", 1, "Si", "No", "Cancelar");

                            if (opcion == 1)
                            {
                                ActualizarInformacion();
                                _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                                _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                                Dispose();
                                application            = null;
                                company                = null;
                                _oComisionesCobradores = false;
                                Addon.typeList.RemoveAll(p => p._forma == formID);
                                return;
                            }
                            else if (opcion == 2)
                            {
                                _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                                _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                                Dispose();
                                application            = null;
                                company                = null;
                                _oComisionesCobradores = false;
                                Addon.typeList.RemoveAll(p => p._forma == formID);
                                return;
                            }
                            else if (opcion == 3)
                            {
                                bubbleEvent = false;
                                return;
                            }
                        }
                        else
                        {
                            _Application.ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
                            _Application.MenuEvent -= new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                            Dispose();
                            application            = null;
                            company                = null;
                            _oComisionesCobradores = false;
                            Addon.typeList.RemoveAll(p => p._forma == formID);
                            return;
                        }
                    }

                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        if (pVal.ItemUID == BTN_BUSCAR)
                        {
                            _oTxtCodeCobrador = _oForma.Items.Item(TXTCODCOB).Specific;
                            _oTxtNomCobrador  = _oForma.Items.Item(TXTNOMCOB).Specific;
                            if (!string.IsNullOrEmpty(_oTxtCodeCobrador.Value.ToString()) || !string.IsNullOrEmpty(_oTxtNomCobrador.Value.ToString()))
                            {
                                BuscarDatos(_oTxtCodeCobrador.Value, _oTxtNomCobrador.Value);
                            }
                            else
                            {
                                _Application.MessageBox("Capture el código o el nombre del cobrador");
                            }
                        }

                        if (pVal.ItemUID == BTN_CANCELAR)
                        {
                            if (_oBotonUpdate.Caption == "Actualizar")
                            {
                                int opcion = _Application.MessageBox("¿Desea grabar las modificaciones?", 1, "Si", "No", "Cancelar");

                                if (opcion == 1)
                                {
                                    ActualizarInformacion();
                                    _oBotonUpdate.Caption = "Ok";
                                    _oForma.Close();
                                }
                                else if (opcion == 2)
                                {
                                    _oBotonUpdate.Caption = "Ok";
                                    _oForma.Close();
                                }
                                else if (opcion == 3)
                                {
                                    _oForma.Select();
                                }
                            }
                            else
                            {
                                _oForma.Close();
                            }
                        }

                        if (pVal.ItemUID == BTN_UPDATE)
                        {
                            if (_oBotonUpdate.Caption == "Ok")
                            {
                                _oForma.Close();
                            }
                            else
                            {
                                ActualizarInformacion();
                                _oBotonUpdate.Caption = "Ok";
                            }
                        }

                        if (pVal.ItemUID == GRD_COMISIONES_COBRADORES && pVal.ColUID == COL_SUELDO_BASE)
                        {
                            _oBotonUpdate.Caption = "Actualizar";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error en evento *clsComisionCobradores* : " + ex.Message);
            }
        }
Пример #18
0
        public static void clsAPCreditMemo_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            oForm            = oSetupForm;
            oHDBDataSource   = oForm.DataSources.DBDataSources.Item("ORPC");
            oChildDataSource = oForm.DataSources.DBDataSources.Item("RPC1");
            oMatrix          = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

            if (pVal.BeforeAction)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == "38" && (pVal.ColUID == "U_Variance" || pVal.ColUID == "U_DiscExc"))
                    {
                        BubbleEvent = false;
                    }
                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE || oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        if (pVal.ItemUID == "U_DocType")
                        {
                            BubbleEvent = false;
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_PICKER_CLICKED:
                    if (pVal.ItemUID == "38" && pVal.ColUID == "U_Variance")
                    {
                        BubbleEvent = false;
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "btnSH")
                    {
                        if (((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() == "")
                        {
                            oApplication.StatusBar.SetText("Select the Supplier....", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                            BubbleEvent = false;
                        }

                        if (oHDBDataSource.GetValue("DocStatus", oHDBDataSource.Offset).ToString().Trim() != "O")
                        {
                            BubbleEvent = false;
                        }

                        // strDocEntry = oHDBDataSource.GetValue("DocEntry", 0).Trim();
                        //strDocType = oHDBDataSource.GetValue("U_DocType", 0).Trim();
                    }
                    break;

                default:
                    break;
                }
            }

            else if (pVal.BeforeAction == false)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                    //Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("2").Left + oForm.Items.Item("2").Width + 6, oForm.Items.Item("2").Top, oForm.Items.Item("2").Width + 8, oForm.Items.Item("2").Height, "Purchase History", true, 0, "");
                    Utilities.UtilitiesCls.CreateButtonItem(oForm, "btnSH", oForm.Items.Item("46").Left, oForm.Items.Item("46").Top + 20, oForm.Items.Item("46").Width, oForm.Items.Item("2").Height, "Purchase History", true, 0, "46");
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    if (pVal.ItemUID == "1")
                    {
                        if (pVal.ActionSuccess)
                        {
                            if (oWaitForm != null)
                            {
                                oWaitForm.Close();
                                oWaitForm = null;
                            }
                        }
                    }

                    if (pVal.ItemUID == "btnSH")
                    {
                        try
                        {
                            if (oWaitForm != null)
                            {
                                string strCardCode1 = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                                string strCardCode2 = ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value.Trim();

                                if (strCardCode1 != strCardCode2)
                                {
                                    oWaitForm.Close();
                                    oWaitForm = null;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            oWaitForm = null;
                        }

                        if (oWaitForm == null)
                        {
                            string strQry;
                            oWaitForm = clsSBO.LoadForm("EJ_OSSH.srf", "EJ_OSSH", oApplication);

                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("6").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim();
                            ((SAPbouiCOM.EditText)oWaitForm.Items.Item("8").Specific).Value = ((SAPbouiCOM.EditText)oForm.Items.Item("54").Specific).Value.Trim();
                            oWaitForm.Freeze(true);
                            oWaitForm.DataSources.DataTables.Add("@dtTemp");
                            SAPbouiCOM.Grid oGrid;
                            oGrid      = (SAPbouiCOM.Grid)oWaitForm.Items.Item("4").Specific;
                            oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                            //  strQry = "Exec \"EJ_SupplierCMPurchaseHistory\"  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "'";
                            strQry = "Exec \"EJ_SupplierPurchaseHistory\"  '" + ((SAPbouiCOM.EditText)oForm.Items.Item("4").Specific).Value.Trim() + "'";

                            oWaitForm.DataSources.DataTables.Item(0).ExecuteQuery(strQry);
                            oGrid.DataTable = oWaitForm.DataSources.DataTables.Item(0);
                            oGrid.Columns.Item(0).Editable = true;
                            SAPbouiCOM.EditTextColumn oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(0));
                            oEditTxt.ChooseFromListUID     = "CFL_2";
                            oEditTxt.ChooseFromListAlias   = "ItemCode";
                            oGrid.Columns.Item(1).Editable = false;
                            oGrid.Columns.Item(2).Editable = true;
                            oGrid.Columns.Item(3).Editable = true;
                            oEditTxt = ((SAPbouiCOM.EditTextColumn)oGrid.Columns.Item(3));
                            oEditTxt.ChooseFromListUID     = "CFL_3";
                            oEditTxt.ChooseFromListAlias   = "UomCode";
                            oGrid.Columns.Item(4).Editable = true;
                            oGrid.Columns.Item(0).Editable = true;

                            for (int j = 5; j < oGrid.Columns.Count; j++)
                            {
                                oGrid.Columns.Item(j).Editable = false;
                            }

                            oGrid.AutoResizeColumns();
                            oGrid.DataTable.Rows.Add(1);

                            clsSupplierPurchaseHistory.oForm   = oWaitForm;
                            clsSupplierPurchaseHistory.oSOForm = oForm;
                            oWaitForm.Freeze(false);
                        }
                        else
                        {
                            oWaitForm.Visible = true;
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_LOST_FOCUS:
                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || oForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                    {
                        if (pVal.ItemUID == "12")
                        {
                            //oForm.DefButton = "btnSH";
                            // oForm.ActiveItem = "btnSH";
                            ((SAPbouiCOM.Button)oForm.Items.Item("btnSH").Specific).Item.Click(BoCellClickType.ct_Regular);
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
                    if (oWaitForm != null)
                    {
                        oWaitForm.Close();
                        oWaitForm = null;
                    }
                    break;

                default:
                    break;
                }
            }
        }
Пример #19
0
        public virtual void ET_btnSAVE_AFItemPressed(ItemEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oButton = ((SAPbouiCOM.Button)(oForm.Items.Item("btnSAVE").Specific));
            oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("grd").Specific;
            // ADD YOUR ACTION CODE HERE ...

            if (oGrid.DataTable.Rows.Count != 0)
            {
                SetApplyDataToMatrix(oForm);
                oForm.Close();
            }
            else
            {
                B1Connections.theAppl.StatusBar.SetText("추가할 데이터가 없습니다", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }