Пример #1
0
        public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            base.etAfterCfl(ref pVal, ref BubbleEvent);
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.DataTable            dtSel      = oCFLEvento.SelectedObjects;

            if (pVal.ItemUID == "txCode")
            {
                string CardCode = "";
                string CardName = "";
                if (dtSel != null && dtSel.Rows.Count > 0)
                {
                    for (int i = 0; i < dtSel.Rows.Count; i++)
                    {
                        CardCode = dtSel.GetValue("CardCode", i).ToString();
                        CardName = dtSel.GetValue("CardName", i).ToString();
                    }
                    // mtCus.SetLineData(pVal.Row);
                    dtHead.Rows.Remove(0);
                    dtHead.Rows.Add(1);

                    dtHead.SetValue("CardCode", 0, CardCode);
                    dtHead.SetValue("CardName", 0, CardName);

                    AddNewCardSche(CardCode);
                    getSchedule();
                }
            }
            if (pVal.ItemUID == "txICode")
            {
                if (dtSel != null && dtSel.Rows.Count > 0)
                {
                    string ItemCode = "", ItemName = "";
                    for (int i = 0; i < dtSel.Rows.Count; i++)
                    {
                        ItemCode = dtSel.GetValue("ItemCode", i).ToString();
                        ItemName = dtSel.GetValue("ItemName", i).ToString();
                    }
                    // mtCus.SetLineData(pVal.Row);
                    dtHead.SetValue("ItemCode", 0, ItemCode);
                    dtHead.SetValue("ItemName", 0, ItemName);
                }
            }

            if (pVal.ItemUID == "txOICODE")
            {
                if (dtSel != null && dtSel.Rows.Count > 0)
                {
                    string ItemCode = "", ItemName = "";
                    for (int i = 0; i < dtSel.Rows.Count; i++)
                    {
                        ItemCode = dtSel.GetValue("ItemCode", i).ToString();
                        ItemName = dtSel.GetValue("ItemName", i).ToString();
                    }
                    // mtCus.SetLineData(pVal.Row);
                    dtHead.SetValue("OSCNCode", 0, ItemCode);
                    dtHead.SetValue("OSCNName", 0, ItemName);
                }
            }
        }
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.ItemUID == "btnBuscar") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (Validar())
                    {
                        CargarGrid();
                    }
                }

                if ((pVal.ItemUID == "btnExp") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    Exportar();
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #3
0
 public override void etAfterCfl(ref ItemEvent pVal, ref bool BubbleEvent)
 {
     base.etAfterCfl(ref pVal, ref BubbleEvent);
     SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
     SAPbouiCOM.DataTable            dtSel      = oCFLEvento.SelectedObjects;
     if (pVal.ItemUID == txCode.Item.UniqueID)
     {
         if (dtSel.Rows.Count > 0)
         {
             string strCode = "";
             string strName = "";
             if (oCFLEvento.ChooseFromListUID == "cflCode")
             {
                 strCode = dtSel.GetValue("ItemCode", 0).ToString();
                 strName = dtSel.GetValue("ItemName", 0).ToString();
             }
             if (oCFLEvento.ChooseFromListUID == "cflGroup")
             {
                 strCode = dtSel.GetValue("ItmsGrpCod", 0).ToString();
                 strName = dtSel.GetValue("ItmsGrpNam", 0).ToString();
             }
             dtHead.SetValue("Code", 0, strCode);
             dtHead.SetValue("Name", 0, strName);
         }
     }
 }
Пример #4
0
        private void ChooseFromListAfterEvent(ItemEvent pObjValEvent)
        {
            try
            {
                if (pObjValEvent.Action_Success)
                {
                    SAPbouiCOM.IChooseFromListEvent lObjCFLEvent = (SAPbouiCOM.IChooseFromListEvent)pObjValEvent;
                    if (lObjCFLEvent.SelectedObjects != null)
                    {
                        SAPbouiCOM.DataTable lObjDataTable = lObjCFLEvent.SelectedObjects;

                        if (lObjDataTable != null)
                        {
                            this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0));

                            switch (lObjDataTable.UniqueID)
                            {
                            case "CFL_Area":
                                //txtArea.Value = lObjDataTable.GetValue(0, 0).ToString();
                                this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Area").ValueEx = lObjDataTable.GetValue(0, 0).ToString();
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("(ChooseFromListAfterEvent): " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Пример #5
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.ItemUID == "87") && (pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (pVal.BeforeAction))
                {
                    oComboBox     = (ComboBox)(oForm.Items.Item("87").Specific);
                    SerieAnterior = (System.String)(oComboBox.Value);
                }

                if ((pVal.ItemUID == "87") && (pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction))
                {
                    oComboBox = (ComboBox)(oForm.Items.Item("87").Specific);
                    var sSeries = (System.String)(oComboBox.Value);

                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"select LEFT(ISNULL(UPPER(BeginStr),''),1) 'Valor', DocSubType, SUBSTRING(ISNULL(UPPER(BeginStr),''),2,LEN(ISNULL(UPPER(BeginStr),''))) 'Doc', ObjectCode, SeriesName
                                from NNM1 where Series = {0} --AND ObjectCode = '{1}' ";
                    }
                    else
                    {
                        s = @"select LEFT(IFNULL(UPPER(""BeginStr""),''),1) ""Valor"", ""DocSubType"", SUBSTRING(IFNULL(UPPER(""BeginStr""),''),2,LENGTH(IFNULL(UPPER(""BeginStr""),''))) ""Doc"", ""ObjectCode"", ""SeriesName""
                                from ""NNM1"" where ""Series"" = {0} --AND ""ObjectCode"" = '{1}' ";
                    }
                    s = String.Format(s, sSeries, oForm.BusinessObject.Type);
                    oRecordSet.DoQuery(s);
                    if (oRecordSet.RecordCount > 0)
                    {
                        if ((System.String)(oRecordSet.Fields.Item("Valor").Value) == "E")
                        {
                            oForm.Items.Item("VID_Estado").Visible = true;
                            oForm.Items.Item("lblEstado").Visible  = true;
                            oForm.Items.Item("VID_FEDCTO").Visible = true;
                        }
                        else
                        {
                            oForm.Items.Item("VID_Estado").Visible = false;
                            oForm.Items.Item("lblEstado").Visible  = false;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin InitForm

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

            SAPbouiCOM.DataTable oDataTable;
            String sValue, sValue1;

            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                    {
                        //BubbleEvent := ValidarDatosFE();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    if (pVal.ColUID == "V_0")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = (System.String)(oDataTable.GetValue("Code", 0));
                            sValue1 = (System.String)(oDataTable.GetValue("Name", 0));

                            oMtx.FlushToDataSource();
                            oDBDSD.SetValue("U_Indicato", pVal.Row - 1, sValue);
                            oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1);
                            if (pVal.Row == oMtx.RowCount)
                            {
                                oDBDSD.InsertRecord(pVal.Row);
                            }
                            oMtx.LoadFromDataSource();
                            oMtx.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            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
Пример #7
0
        private void ChooseFromListAfterEvent(SAPbouiCOM.ItemEvent pObjValEvent)
        {
            if (pObjValEvent.Action_Success)
            {
                SAPbouiCOM.IChooseFromListEvent lObjCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pObjValEvent;
                SAPbouiCOM.DataTable            lObjDataTable = lObjCFLEvento.SelectedObjects;
                if (lObjCFLEvento.SelectedObjects == null)
                {
                    return;
                }

                this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Client").ValueEx = Convert.ToString(lObjDataTable.GetValue(0, 0));
            }
        }
Пример #8
0
        public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            base.etAfterCfl(ref pVal, ref BubbleEvent);
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.DataTable            dtSel      = oCFLEvento.SelectedObjects;
            if (pVal.ItemUID == txDfltExp.Item.UniqueID)
            {
                if (dtSel != null && dtSel.Rows.Count > 0)
                {
                    string strCode = dtSel.GetValue("AcctCode", 0).ToString();
                    string strName = dtSel.GetValue("AcctName", 0).ToString();
                    dtSetting.SetValue("dfltExp", 0, strCode);

                    oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                }
            }
        }
Пример #9
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.ItemUID == "Buscar") && (!pVal.BeforeAction))
                {
                    var      DateD            = DateTime.ParseExact(((EditText)oForm.Items.Item("FechaD").Specific).Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                    var      DateH            = DateTime.ParseExact(((EditText)oForm.Items.Item("FechaH").Specific).Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                    TimeSpan ts               = DateH - DateD;
                    var      differenceInDays = ts.Days + 1;
                    if (differenceInDays > 31)
                    {
                        FSBOApp.StatusBar.SetText("El intervalo de fechas no puede ser superior a 30 dias", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                    }
                    else
                    {
                        BuscarDatos();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_DOUBLE_CLICK) && (!pVal.BeforeAction) && (pVal.ColUID == "Folio"))
                {
                    var TipoDTE = ((System.String)((ComboBox)oForm.Items.Item("TipoDTE").Specific).Selected.Value).Trim();
                    if (TipoDTE == "C")
                    {
                        MostrarPDF(pVal.Row);
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #11
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.BeforeAction)
                {
                    if (pVal.ItemUID == "1" && oForm.Mode == BoFormMode.fm_ADD_MODE)
                    {
                        BubbleEvent = false;
                        if (Validar(true))
                        {
                            GuardarRegistros();
                        }
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (pVal.ItemUID == "btnBuscar" && oForm.Mode == BoFormMode.fm_ADD_MODE)
                    {
                        if (Validar(false))
                        {
                            BuscarRegistros();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #12
0
        private void ChooseFromListAfterEvent(ItemEvent pObjValEvent)
        {
            try
            {
                if (pObjValEvent.Action_Success)
                {
                    SAPbouiCOM.IChooseFromListEvent lObjCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pObjValEvent;
                    if (lObjCFLEvento.SelectedObjects != null)
                    {
                        SAPbouiCOM.DataTable lObjDataTable = lObjCFLEvento.SelectedObjects;

                        if (lObjDataTable != null)
                        {
                            this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0));

                            switch (lObjDataTable.UniqueID)
                            {
                            case "CFL_Area":
                                string lStrArea = lObjDataTable.GetValue(0, 0).ToString();
                                this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Area").ValueEx   = lStrArea;
                                this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Employ").ValueEx = "";
                                AddConditionChoseFromListEmployee(mObjCFLEmployee, mObjPurchasesServiceFactory.GetPurchaseService().GetDepartment(lStrArea));
                                break;

                            case "CFL_Employ":
                                this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Employ").ValueEx = lObjDataTable.GetValue(2, 0).ToString() + " " + lObjDataTable.GetValue(3, 0).ToString() + lObjDataTable.GetValue(1, 0).ToString();
                                mStrEmployeId = lObjDataTable.GetValue(0, 0).ToString();
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (ChooseFromListAfterEvent) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Пример #13
0
        public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            base.etAfterCfl(ref pVal, ref BubbleEvent);
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal;
            SAPbouiCOM.DataTable            dtSel      = oCFLEvento.SelectedObjects;
            try
            {
                if (pVal.ItemUID == txSupplier.Item.UniqueID)
                {
                    if (dtSel != null && dtSel.Rows.Count > 0)
                    {
                        string strCode = dtSel.GetValue("CardCode", 0).ToString();
                        string strName = dtSel.GetValue("CardName", 0).ToString();
                        oForm.DataSources.UserDataSources.Item("txSupplier").ValueEx = strCode;
                        oForm.DataSources.UserDataSources.Item("txPD").ValueEx       = DateTime.Now.Date.ToString("yyyyMMdd");

                        // oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                    }
                }
            }
            catch { }
        }
Пример #14
0
        private void ChooseFromListAfterEvent(SAPbouiCOM.ItemEvent pObjValEvent)
        {
            if (pObjValEvent.Action_Success)
            {
                SAPbouiCOM.IChooseFromListEvent lObjCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pObjValEvent;
                SAPbouiCOM.DataTable            lObjDataTable = lObjCFLEvento.SelectedObjects;
                if (lObjCFLEvento.SelectedObjects == null)
                {
                    return;
                }

                if (lObjDataTable.UniqueID == "CFL_Item")
                {
                    txtCode.Value = Convert.ToString(lObjDataTable.GetValue(0, 0));
                    this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Item").ValueEx = Convert.ToString(lObjDataTable.GetValue(1, 0));
                    requireBagsField = lObjDistributionDAO.GetIsBagRequired(txtCode.Value);
                }
                else if (lObjDataTable.UniqueID == "CFL_Whs")
                {
                    this.UIAPIRawForm.DataSources.UserDataSources.Item("CFL_Whs").ValueEx = Convert.ToString(lObjDataTable.GetValue(0, 0));
                }
            }
        }
Пример #15
0
        }//fin InitForm

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

            SAPbouiCOM.DataTable oDataTable;
            String sValue, sValue1;

            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                    {
                        //BubbleEvent := ValidarDatosFE();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction) && (pVal.ItemUID == "mtx"))
                {
                    if (pVal.ColUID == "V_0")
                    {
                        oMtx.FlushToDataSource();
                        sValue = ((System.String)oDBDSD.GetValue("U_CodeImp", pVal.Row - 1)).Trim();
                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            s = @"select Code, Name from OSTA where Code = '{0}'
                                  UNION ALL
                                  select WTCode 'Code', WTName 'Name' from OWHT where Inactive = 'N' and WTCode = '{0}'";
                        }
                        else
                        {
                            s = @"select ""Code"", ""Name"" from ""OSTA"" where ""Code"" = '{0}'
                                  UNION ALL
                                  select ""WTCode"" ""Code"", ""WTName"" ""Name"" from ""OWHT"" where ""Inactive"" = 'N' and ""WTCode"" = '{0}' ";
                        }
                        s = String.Format(s, sValue);
                        oRecordSet.DoQuery(s);

                        if (oRecordSet.RecordCount == 0)
                        {
                            FSBOApp.StatusBar.SetText("No se encuentra Impuesto o Retención: " + sValue, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else
                        {
                            sValue1 = ((System.String)oRecordSet.Fields.Item("Name").Value).Trim();


                            oDBDSD.SetValue("U_CodeImp", pVal.Row - 1, sValue);
                            oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1);
                            if (pVal.Row == oMtx.RowCount)
                            {
                                oDBDSD.InsertRecord(pVal.Row);
                            }
                            oMtx.LoadFromDataSource();
                            oMtx.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            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
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            String sValue;
            String sValue2;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED)
                {
                    if (pVal.BeforeAction == true)
                    {
                        if (((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE)) && (pVal.ItemUID == "1"))
                        {
                            BubbleEvent = false;
                            if (Validar())
                            {
                                Guardar_Registros();
                            }
                        }
                    }

                    if ((pVal.BeforeAction == false) && (pVal.ItemUID == "btn_Borrar"))
                    {
                        BorrarLinea();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    oForm.Freeze(true);
                    if (pVal.ColUID == "U_CardCode")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = ((System.String)oDataTable.GetValue("CardCode", 0)).Trim();
                            sValue2 = ((System.String)oDataTable.GetValue("CardName", 0)).Trim();
                            for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++)
                            {
                                if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Length > 0)
                                {
                                    var CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1));
                                    if (CardCode == sValue)
                                    {
                                        FSBOApp.StatusBar.SetText("Proveedor ya se encuentra en la lista Negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                        return;
                                    }
                                }
                            }

                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"SELECT COUNT(*) 'count' FROM [@VID_FELISTABL] WHERE U_CardCode = '{0}'";
                            }
                            else
                            {
                                s = @"SELECT COUNT(*) ""count"" FROM ""@VID_FELISTABL"" WHERE ""U_CardCode"" = '{0}'";
                            }
                            s = String.Format(s, sValue);
                            oRecordSet.DoQuery(s);
                            if (((System.Int32)oRecordSet.Fields.Item("count").Value) > 0)
                            {
                                FSBOApp.StatusBar.SetText("Codigo Proveedor se encuentra en la lista blanca, no se puede seleccionar -> Codigo " + sValue, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                return;
                            }

                            odt.SetValue("U_CardCode", pVal.Row, sValue);
                            odt.SetValue("U_CardName", pVal.Row, sValue2);
                            odt.SetValue("U_Activado", pVal.Row, "Y");

                            if ((odt.Rows.Count - 1 == pVal.Row) && (sValue != ""))
                            {
                                odt.Rows.Add(1);
                            }
                            ogrid.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                if (oForm != null)
                {
                    oForm.Freeze(false);
                }
            }
        }//fin FormEvent
Пример #17
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            String sValue;
            String sValue2;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.ItemUID == "1") && (pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    if ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE))
                    {
                        BubbleEvent = false;
                        if (ValidarDatos())
                        {
                            GuardarDatos();
                        }
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    oForm.Freeze(true);
                    if (pVal.ColUID == "U_CtaSAP")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = ((System.String)oDataTable.GetValue("FormatCode", 0)).Trim();
                            sValue2 = ((System.String)oDataTable.GetValue("AcctName", 0)).Trim();

                            if (ValidarDataTable(sValue))
                            {
                                odt.SetValue("U_CtaSAP", pVal.Row, sValue);
                                odt.SetValue("U_DescSAP", pVal.Row, sValue2);

                                if ((odt.Rows.Count - 1 == pVal.Row) && (sValue != ""))
                                {
                                    odt.Rows.Add(1);
                                }
                                oGrid.AutoResizeColumns();
                                if (oForm.Mode == BoFormMode.fm_OK_MODE)
                                {
                                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }//fin FormEvent