Пример #1
0
        private void btnSearch_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            try
            {
                mObjFrmFolios = new frmCFLFolios(FoliosFormModeEnum.StockTransfer);
                mObjFrmFolios.Show();
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(string.Format("[frmStockTransfer - btnSearch_ClickBefore] Error: {0}", lObjException.Message));

                if (lObjException.Message.Contains("Failed to create form. Please check the form attributes"))
                {
                    if (Application.SBO_Application.MessageBox("La pantalla de folios ya se encuentra abierta, ¿desea cerrar la actual?", 1, "Aceptar", "Cancelar", "") == 1)
                    {
                        UIApplication.GetApplication().Forms.Item("frmFolios").Close();

                        mObjFrmFolios = new frmCFLFolios(FoliosFormModeEnum.StockTransfer);
                        mObjFrmFolios.Show();
                    }
                }
                else
                {
                    UIApplication.ShowMessageBox(string.Format("Error al abrir la pantalla de folios: {0}", lObjException.Message));
                }
            }
        }
Пример #2
0
        private void initSysMatrix()
        {
            UIApplication.GetApplication().ActivateMenuItem("2053");

            SAPbouiCOM.Form lObjForm = UIApplication.GetApplication().Forms.GetFormByTypeAndCount(133, -1);
            mtxItems = (SAPbouiCOM.Matrix)lObjForm.Items.Item("38").Specific;
        }
Пример #3
0
        private void SBO_Application_ItemEvent(string FormUID, ref ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                if (FormUID.Equals(this.UIAPIRawForm.UniqueID))
                {
                    if (pVal.EventType == BoEventTypes.et_FORM_CLOSE)
                    {
                        UIApplication.GetApplication().ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(this.SBO_Application_ItemEvent);
                    }

                    if (!pVal.BeforeAction)
                    {
                        switch (pVal.EventType)
                        {
                        case BoEventTypes.et_CHOOSE_FROM_LIST:
                            ChooseFromListAfterEvent(pVal);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowError(string.Format("ItemEventException: {0}", ex.Message));
                LogService.WriteError("frmSearchRefunds (SBO_Application_ItemEvent) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Пример #4
0
        public void ProcessPendingOrders()
        {
            ProgressBarManager oProgressBar = null;
            var timer = Stopwatch.StartNew();

            try {
                if (pendingOrders != null && pendingOrders.Length > 0)
                {
                    SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Procesando Ordenes de Venta", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    oProgressBar = new ProgressBarManager(UIApplication.GetApplication(), "Processing Sales Orders, please wait...", pendingOrders.Length);
                    foreach (var request in pendingOrders)
                    {
                        var result = new PermissionRequestService().CreateSaleOrder(request.ID);
                        LogService.WriteInfo(String.Format("Orden {3}-{0}-{1}: Resultado: {2}", request.ID, request.Type, result, request.Folio));
                        oProgressBar.NextPosition();
                    }

                    UIApplication.ShowMessageBox(String.Format("Se procesaron un total de {0} ordenes de venta \n Tiempo Transcurrido {1}", pendingOrders.Length, timer.Elapsed));
                }
                else
                {
                    UIApplication.ShowMessageBox("No hay ordenes de venta pendientes o las ordenes aun no se han terminado cargar");
                }
            }
            catch (Exception ex) {
                PendingSalesOrdersDAO.HandleException(ex, "ProcessPendingOrders");
            }
            finally {
                oProgressBar.Stop();
                btnProcess.Item.Enabled = false;
            }
        }
Пример #5
0
        private void LoadFreight()
        {
            try
            {
                Form lObjSOForm = UIApplication.GetApplication().Forms.ActiveForm;//SAPbouiCOM.Framework.Application.SBO_Application.Forms.GetFormByTypeAndCount(mIntFormType = pFrmActive.Type;, pVal.FormTypeCount);
                SetFormSettings(lObjSOForm);
                //lObjMtxSO = UIApplication.GetApplication().Forms.ActiveForm;

                //5897
                if (EmptyOrder())
                {
                    OpenFreightsForm();
                }
                else
                {
                    LoadFreightsForm();
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("(LoadCombobox): " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(ex.Message);
            }
        }
Пример #6
0
        public void SBO_Application_MenuEvent_GoodIssue(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            try
            {
                if (pVal.MenuUID == "1293" && pVal.BeforeAction == true && UIApplication.GetApplication().Forms.ActiveForm.UniqueID == "frmGI") //Borrar
                {
                    if (SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("¿Desea elimiar el registro seleccionado?", 2, "Si", "No", "") == 1)
                    {
                        if (mStrMatrixSelected == mtxGoodIssues.Item.UniqueID) //matrix empleados
                        {
                            dtGoodIssues.Rows.Remove(mIntMatrixRowSelected - 1);
                        }
                    }
                    else
                    {
                        BubbleEvent = false;
                    }
                }
            }
            catch (Exception ex)
            {
                if (!ex.Message.Contains("Form - Invalid Form"))
                {
                    SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(ex.Message);
                }
            }
        }
Пример #7
0
 /// <summary>
 /// Loads a form from an XML file.
 /// </summary>
 private void LoadModal()
 {
     mFrmDialog         = Application.SBO_Application.Forms.AddEx(XmlLoader.LoadFromXml("fmCrdCom"));
     mFrmDialog.Title   = "Agregar comisión";
     mFrmDialog.Top     = (UIApplication.GetApplication().Desktop.Height - mFrmDialog.Height) / 2;
     mFrmDialog.Left    = (UIApplication.GetApplication().Desktop.Width - mFrmDialog.Width) / 2;
     mFrmDialog.Visible = true;
 }
Пример #8
0
 /// <summary>
 /// Loads and open the modal from the XML file
 /// </summary>
 private void LoadModal()
 {
     mFrmDialog         = Application.SBO_Application.Forms.AddEx(XmlLoader.LoadFromXml("fmBonus"));
     mFrmDialog.Title   = "Bonificación/Devolución";
     mFrmDialog.Top     = (UIApplication.GetApplication().Desktop.Height - mFrmDialog.Height) / 2;
     mFrmDialog.Left    = (UIApplication.GetApplication().Desktop.Width - mFrmDialog.Width) / 2;
     mFrmDialog.Visible = true;
 }
Пример #9
0
        private void mtxRise_LinkPressedBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            if (pVal.ColUID == "ColRiseF")
            {
                string lStrRiseId = string.Empty;

                try
                {
                    this.UIAPIRawForm.Freeze(true);
                    //Application.SBO_Application.Forms.Item(this.UIAPIRawForm.UniqueID).Freeze(true);

                    lStrRiseId = dtRise.GetValue("DocNmRise", pVal.Row - 1).ToString();

                    if (string.IsNullOrEmpty(lStrRiseId))
                    {
                        return;
                    }

                    //UIApplication.GetApplication().OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_Order, "", lStrDocEntry);
                    MachineryForm lObjMachinery = new MachineryForm(int.Parse(lStrRiseId));
                    lObjMachinery.Show();
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("Failed to create form. Please check the form attributes"))
                    {
                        if (Application.SBO_Application.MessageBox("La pantalla de subidas ya se encuentra abierta, ¿desea cerrar la actual?", 1, "Aceptar", "Cancelar", "") == 1)
                        {
                            UIApplication.GetApplication().Forms.Item("frmRise").Close();

                            if (string.IsNullOrEmpty(lStrRiseId))
                            {
                                return;
                            }

                            MachineryForm lObjMachinery = new MachineryForm(int.Parse(lStrRiseId));
                            lObjMachinery.Show();
                        }
                    }
                    else
                    {
                        UIApplication.ShowMessageBox(string.Format("Error al abrir la pantalla de la subida: {0}", ex.Message));
                    }
                }
                finally
                {
                    this.UIAPIRawForm.Freeze(false);
                    //Application.SBO_Application.Forms.Item(this.UIAPIRawForm.UniqueID).Freeze(true);
                }
            }
        }
Пример #10
0
        private void initOutgoingPayments()
        {
            UIApplication.GetApplication().ActivateMenuItem("2818");                              //Open Outgoing Payments Form

            mObjPayRForm   = UIApplication.GetApplication().Forms.GetFormByTypeAndCount(426, 1);  //Set Form
            mObjPayRFormUF = UIApplication.GetApplication().Forms.GetFormByTypeAndCount(-426, 1); // Set UserFields Form

            //Set Controls
            mObjtxtCardCode = (SAPbouiCOM.EditText)mObjPayRForm.Items.Item("5").Specific;
            mObjOptB        = (SAPbouiCOM.OptionBtn)mObjPayRForm.Items.Item("56").Specific;
            mObjcbAuxType   = (SAPbouiCOM.ComboBox)mObjPayRFormUF.Items.Item("U_FZ_AuxiliarType").Specific;
            mObjtxtAuctNum  = (SAPbouiCOM.EditText)mObjPayRFormUF.Items.Item("U_FZ_FolioAuction").Specific;
        }
Пример #11
0
        private void mtxContracts_LinkPressedBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            if (pVal.ColUID == "ColCont")
            {
                string lStrDocEntry = dtContracts.GetValue("DocECont", pVal.Row - 1).ToString();

                if (string.IsNullOrEmpty(lStrDocEntry))
                {
                    return;
                }

                UIApplication.GetApplication().OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_Order, "", lStrDocEntry);
            }
        }
Пример #12
0
 private void EnableButton()
 {
     if (mObjUtility.ItemExist("btnFrgh", mObjSOForm))
     {
         SAPbouiCOM.Item lObjItm;
         lObjItm = mObjSOForm.Items.Item("btnFrgh");
         Form lObjSOForm = UIApplication.GetApplication().Forms.ActiveForm;
         SetFormSettings(lObjSOForm);
         if (!string.IsNullOrEmpty(mObjTxtCardCode.Value) && !mObjCboDoc.Item.Description.Equals("Cerrado"))
         {
             (lObjItm.Specific as SAPbouiCOM.Button).Item.Enabled = true;
         }
         else
         {
             (lObjItm.Specific as SAPbouiCOM.Button).Item.Enabled = false;
         }
     }
 }
Пример #13
0
        /// <summary>
        /// Initialize choose from list by the given id
        /// </summary>
        /// <param name="isMultiSelection"></param>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <param name="frm"></param>
        /// <returns></returns>
        public static ChooseFromList Init(bool isMultiSelection, string type, string id, FormBase frm)
        {
            ChooseFromList lObjoCFL = null;

            try {
                ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(BoCreatableObjectType.cot_ChooseFromListCreationParams);
                oCFLCreationParams.MultiSelection = isMultiSelection;
                oCFLCreationParams.ObjectType     = type;
                oCFLCreationParams.UniqueID       = id;

                lObjoCFL = frm.UIAPIRawForm.ChooseFromLists.Add(oCFLCreationParams);
                frm.UIAPIRawForm.DataSources.UserDataSources.Add(id, BoDataType.dt_SHORT_TEXT, 254);
            }
            catch (Exception ex) {
                UIApplication.ShowMessageBox(String.Format("InitCustomerChooseFromListException: {0}", ex.Message));
            }
            return(lObjoCFL);
        }
Пример #14
0
        private void LoadInitialsControls()
        {
            try
            {
                this.UIAPIRawForm.Freeze(true);

                CreateItemsDatatable();

                txtDate.Value = DateTime.Now.ToString("dd/MM/yyy");
            }
            catch (Exception lObjException)
            {
                UIApplication.GetApplication().SetStatusBarMessage(lObjException.Message, SAPbouiCOM.BoMessageTime.bmt_Short, true);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Пример #15
0
        private void Button0_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            try {
                if (UIApplication.GetApplication().MessageBox("¿Desea procesar los preliminares y convertirlos a facturas?", 2, "Si", "No", "") != 1)
                {
                    return;
                }

                string lStrInvoiceProcessorPath = new QueryManager().GetValue("U_VALUE", "Name", "GLO_InvoiceProcessorAppPath", "[@UG_Config]");
                if (string.IsNullOrEmpty(lStrInvoiceProcessorPath))
                {
                    UIApplication.ShowError("Agregue un valor en la configuración para el campo GLO_InvoiceProcessorAppPath");
                    return;
                }

                if (!System.IO.File.Exists(lStrInvoiceProcessorPath))
                {
                    UIApplication.ShowError("No existe la ruta de la aplicación asignada en la configuración en el campo GLO_InvoiceProcessorAppPath");
                    return;
                }

                UIApplication.GetApplication().Forms.ActiveForm.Freeze(true);

                using (var lObjProcess = new Process()) {
                    lObjProcess.StartInfo.FileName  = lStrInvoiceProcessorPath;
                    lObjProcess.StartInfo.Arguments = "-v -s -a";
                    lObjProcess.Start();
                    lObjProcess.WaitForExit();
                    //proc.Close();
                }

                UIApplication.ShowSuccess("La aplicación se estará ejecutando en paralelo, quede atento a la consola o al log");
            }
            catch (Exception ex) {
                UIApplication.ShowMessageBox(string.Format("Error al procesar los preliminares: {0}", ex.Message));
            }
            finally {
                UIApplication.GetApplication().Forms.ActiveForm.Freeze(false);
            }
        }
Пример #16
0
        public SAPbouiCOM.ChooseFromList InitChooseFromLists(bool pbol, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) //
        {
            SAPbouiCOM.ChooseFromList lObjoCFL = null;
            try {
                SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);

                oCFLCreationParams.MultiSelection = pbol;
                oCFLCreationParams.ObjectType     = pStrType;
                oCFLCreationParams.UniqueID       = pStrID;

                lObjoCFL = pObjCFLs.Add(oCFLCreationParams);

                this.UIAPIRawForm.DataSources.UserDataSources.Add(pStrID, SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
            }
            catch (Exception ex) {
                HandleException(ex, "InitCustomerChooseFromListException");
            }
            return(lObjoCFL);
        }
        private SAPbouiCOM.ChooseFromList InitChooseFromLists(bool pbol, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) //
        {
            SAPbouiCOM.ChooseFromList lObjoCFL = null;
            try
            {
                SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);

                oCFLCreationParams.MultiSelection = pbol;
                oCFLCreationParams.ObjectType     = pStrType;
                oCFLCreationParams.UniqueID       = pStrID;

                lObjoCFL = pObjCFLs.Add(oCFLCreationParams);

                this.UIAPIRawForm.DataSources.UserDataSources.Add(pStrID, SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
            }
            catch (Exception ex)
            {
                UIApplication.ShowMessageBox(string.Format("Error al inicializar el choose from list: {0} {1}", pStrID, ex.Message));
            }
            return(lObjoCFL);
        }
Пример #18
0
        ///<summary>    Initializes the choose from lists. </summary>
        ///<remarks>    Amartinez, 08/05/2017. </remarks>
        ///<param name="pbol">      True to pbol. </param>
        ///<param name="pStrType">  Type of the string. </param>
        ///<param name="pStrID">    Identifier for the string. </param>
        ///<returns>    A ChooseFromList. </returns>
        public ChooseFromList initChooseFromLists(bool pbol, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) //
        {
            SAPbouiCOM.ChooseFromList lObjoCFL = null;
            try
            {
                SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);

                //  Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = pbol;
                oCFLCreationParams.ObjectType     = pStrType;
                oCFLCreationParams.UniqueID       = pStrID;

                lObjoCFL = pObjCFLs.Add(oCFLCreationParams);
            }
            catch (Exception ex)
            {
                LogService.WriteError("[RemoveTicketDetail]: " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message));
            }
            return(lObjoCFL);
        }
Пример #19
0
        public ChooseFromList InitChooseFromLists(bool pbolMultiselecction, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) //
        {
            SAPbouiCOM.ChooseFromList lObjoCFL = null;
            try
            {
                SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);

                oCFLCreationParams.MultiSelection = pbolMultiselecction;
                oCFLCreationParams.ObjectType     = pStrType;
                oCFLCreationParams.UniqueID       = pStrID;

                lObjoCFL = pObjCFLs.Add(oCFLCreationParams);

                this.UIAPIRawForm.DataSources.UserDataSources.Add(pStrID, SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
            }
            catch (Exception ex)
            {
                UIApplication.ShowMessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message));
                LogService.WriteError("frmSearchRefunds (InitChooseFromLists) " + ex.Message);
                LogService.WriteError(ex);
            }
            return(lObjoCFL);
        }
Пример #20
0
 private void UnLoadEvents()
 {
     UIApplication.GetApplication().ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
 }
Пример #21
0
        public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            try
            {
                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.MachineryForm")
                {
                    MachineryForm lObjMachineryForm = new MachineryForm();
                    lObjMachineryForm.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRiseSearch")
                {
                    frmRiseSearch lObjFrmRiseSearch = new frmRiseSearch();
                    lObjFrmRiseSearch.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRisesCommissions")
                {
                    frmRisesCommissions lObjfrmRisesCommissions = new frmRisesCommissions();
                    lObjfrmRisesCommissions.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmStockTransfer")
                {
                    frmStockTransfer lObjfrmStockTransfer = new frmStockTransfer();
                    lObjfrmStockTransfer.Show();
                }

                if (pVal.BeforeAction && pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmContracts")
                {
                    frmContracts lObjFrmContracts = new frmContracts();
                    lObjFrmContracts.Show();
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError(string.Format("[Menu - SBO_Application_MenuEvent: {0}]", ex.Message));

                if (ex.Message.Contains("Failed to create form. Please check the form attributes"))
                {
                    if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.MachineryForm")
                    {
                        UIApplication.GetApplication().Forms.Item("frmRise").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRiseSearch")
                    {
                        UIApplication.GetApplication().Forms.Item("frmRSch").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmRisesCommissions")
                    {
                        UIApplication.GetApplication().Forms.Item("frmRCom").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmStockTransfer")
                    {
                        UIApplication.GetApplication().Forms.Item("frmStkTrn").Close();
                    }
                    else if (pVal.MenuUID == "UGRS.AddOn.Machinery.Forms.frmContracts")
                    {
                        UIApplication.GetApplication().Forms.Item("frmCont").Close();
                    }
                }
                else
                {
                    Application.SBO_Application.MessageBox(ex.ToString(), 1, "Ok", "", "");
                }
            }
        }
Пример #22
0
        private void DoPayment()
        {
            try
            {
                if (ValidateEmptyControls())
                {
                    Application.SBO_Application.SetStatusBarMessage("Verificar campos vacíos", SAPbouiCOM.BoMessageTime.bmt_Short, true);
                    return;
                }

                if (dtTravelExp.Rows.Count <= 0)
                {
                    Application.SBO_Application.SetStatusBarMessage("No puede crear un pago sin líneas", SAPbouiCOM.BoMessageTime.bmt_Short, true);
                    return;
                }

                if (string.IsNullOrEmpty(mStrExpDayAcct) || string.IsNullOrEmpty(mStrMinorPurchAcct) || string.IsNullOrEmpty(mStrViaticExpAcct) || string.IsNullOrEmpty(mStrViaticPaymAcct))
                {
                    Application.SBO_Application.SetStatusBarMessage("Alguna de las cuentas de configuración no tiene valor, favor de verificar", SAPbouiCOM.BoMessageTime.bmt_Short, true);
                    return;
                }

                this.UIAPIRawForm.Freeze(true);

                Application.SBO_Application.ActivateMenuItem("2818");

                if (!Application.SBO_Application.Menus.Item("6913").Checked)
                {
                    Application.SBO_Application.ActivateMenuItem("6913");//2050
                }

                SAPbouiCOM.EditText txtDocDate = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("10").Specific);
                txtDocDate.Value = DateTime.Now.ToString("yyyyMMdd");

                SAPbouiCOM.OptionBtn optionBtnAccount = ((SAPbouiCOM.OptionBtn)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("58").Specific);
                optionBtnAccount.Selected = true;

                SAPbouiCOM.ComboBox cboPymtType = ((SAPbouiCOM.ComboBox)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_PaymentType").Specific);
                cboPymtType.Select(PaymentsTypesEnum.TravelExpenses.Value, SAPbouiCOM.BoSearchKey.psk_ByValue);

                SAPbouiCOM.EditText txtCodeMov = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_CodeMov").Specific);
                txtCodeMov.Value = txtFolio.Value;

                //SAPbouiCOM.EditText txtCostCenter = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_CostCenter").Specific);
                //txtCostCenter.Value = "MQ_MAQUI";

                SAPbouiCOM.ComboBox cboCostCenter = ((SAPbouiCOM.ComboBox)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_CostCenter").Specific);
                cboCostCenter.Select("MQ_MAQUI", SAPbouiCOM.BoSearchKey.psk_ByValue);

                SAPbouiCOM.ComboBox cboAuxiliarType = ((SAPbouiCOM.ComboBox)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_FZ_AuxiliarType").Specific);
                cboAuxiliarType.Select(((int)AuxiliaryTypeEnum.Employees).ToString(), SAPbouiCOM.BoSearchKey.psk_ByValue);

                SAPbouiCOM.EditText txtAuxiliar = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_FZ_Auxiliar").Specific);
                txtAuxiliar.Value = mStrSupervisorCode;

                SAPbouiCOM.EditText txtFolioOri = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_FolioOri").Specific);
                txtFolioOri.Value = txtRiseFolio.Value;

                SAPbouiCOM.EditText txtObjType = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("-426", -1).Items.Item("U_GLO_ObjType").Specific);
                txtObjType.Value = this.UIAPIRawForm.UniqueID;

                SAPbouiCOM.Button btnBank = ((SAPbouiCOM.Button)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("234000001").Specific);
                btnBank.Item.Click();

                SAPbouiCOM.Folder folderCash = ((SAPbouiCOM.Folder)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("6").Specific);
                folderCash.Item.Click();

                SAPbouiCOM.EditText txtAccount = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("32").Specific);
                txtAccount.Value = mStrViaticPaymAcct;

                SAPbouiCOM.EditText txtImport = ((SAPbouiCOM.EditText)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("38").Specific);
                txtImport.Value = txtTotal.Value;

                SAPbouiCOM.Button btnOk = ((SAPbouiCOM.Button)UIApplication.GetApplication().Forms.GetForm("196", -1).Items.Item("1").Specific);
                btnOk.Item.Click();

                SAPbouiCOM.Matrix mtxPayment = ((SAPbouiCOM.Matrix)UIApplication.GetApplication().Forms.GetForm("426", -1).Items.Item("71").Specific);
                for (int i = 0; i < dtTravelExp.Rows.Count; i++)
                {
                    mtxPayment.AddRow();

                    string lStrMovTypeCode  = dtTravelExp.GetValue(9, i).ToString();
                    double lDblLineImport   = double.Parse(dtTravelExp.GetValue(8, i).ToString());
                    string lStrEmployeeType = dtTravelExp.GetValue(10, i).ToString();
                    string lStrEmployeeCode = dtTravelExp.GetValue(5, i).ToString();
                    double lDblDayPrice     = double.Parse(dtTravelExp.GetValue(7, i).ToString());

                    if (lDblDayPrice > 0)
                    {
                        ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("5").Cells.Item(i + 1).Specific).Value = lDblLineImport.ToString();
                        ((SAPbouiCOM.ComboBox)mtxPayment.Columns.Item("U_GLO_TypeViatic").Cells.Item(i + 1).Specific).Select(lStrMovTypeCode.ToString(), SAPbouiCOM.BoSearchKey.psk_ByDescription);
                        ((SAPbouiCOM.ComboBox)mtxPayment.Columns.Item("U_MQ_TypeEmp").Cells.Item(i + 1).Specific).Select(lStrEmployeeType, SAPbouiCOM.BoSearchKey.psk_ByValue);
                        ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("U_MQ_Aux").Cells.Item(i + 1).Specific).Value      = lStrEmployeeCode;
                        ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("U_MQ_DayPrice").Cells.Item(i + 1).Specific).Value = lDblDayPrice.ToString();

                        TravelExpMovTypesEnum lTravExpTypeEnum = TravelExpMovTypesEnum.GetEnum(lStrMovTypeCode);
                        if (TravelExpMovTypesEnum.IsTravelExpensesType(lTravExpTypeEnum))
                        {
                            ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(i + 1).Specific).Value = mStrViaticExpAcct; //cuenta de mayor
                        }
                        else if (TravelExpMovTypesEnum.IsDayExpensesType(lTravExpTypeEnum))
                        {
                            ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(i + 1).Specific).Value = mStrExpDayAcct; //cuenta de mayor
                        }
                        else if (TravelExpMovTypesEnum.IsMinorExpensesType(lTravExpTypeEnum))
                        {
                            ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(i + 1).Specific).Value = mStrMinorPurchAcct; //cuenta de mayor
                        }
                    }
                }

                this.UIAPIRawForm.Close();

                #region Payment

                /*SAPbobsCOM.Payments lObjOutgoingPayment = (SAPbobsCOM.Payments)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPaymentsDrafts);
                 * lObjOutgoingPayment.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_OutgoingPayments;
                 * lObjOutgoingPayment.DocDate = DateTime.Now;
                 * lObjOutgoingPayment.DocType = SAPbobsCOM.BoRcptTypes.rAccount;
                 * lObjOutgoingPayment.CashAccount = mStrViaticPaymAcct;
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_PaymentType").Value = PaymentsTypesEnum.TravelExpenses.Value;
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_CodeMov").Value = txtFolio.Value; //folio de solicitud de viáticos
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_CostCenter").Value = "MQ_MAQUI"; //centro de costo
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_FZ_AuxiliarType").Value = ((int)AuxiliaryTypeEnum.Employees).ToString(); //tipo de auxiliar
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_FZ_Auxiliar").Value = mStrSupervisorCode; //auxiliar
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_FolioOri").Value = txtRiseFolio.Value;
                 * lObjOutgoingPayment.UserFields.Fields.Item("U_GLO_ObjType").Value = this.UIAPIRawForm.UniqueID;
                 * lObjOutgoingPayment.CashSum = double.Parse(txtTotal.Value);
                 *
                 * for (int i = 0; i < dtTravelExp.Rows.Count; i++)
                 * {
                 *  string lStrMovTypeCode = dtTravelExp.GetValue(9, i).ToString();
                 *  double lDblLineImport = double.Parse(dtTravelExp.GetValue(8, i).ToString());
                 *  string lStrEmployeeType = dtTravelExp.GetValue(10, i).ToString();
                 *  string lStrEmployeeCode = dtTravelExp.GetValue(5, i).ToString();
                 *  double lDblDayPrice = double.Parse(dtTravelExp.GetValue(7, i).ToString());
                 *
                 *  if (lDblDayPrice > 0)
                 *  {
                 *      lObjOutgoingPayment.AccountPayments.SetCurrentLine(i);
                 *      lObjOutgoingPayment.AccountPayments.SumPaid = lDblLineImport;
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_GLO_TypeViatic").Value = lStrMovTypeCode.ToString();
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_MQ_TypeEmp").Value = lStrEmployeeType;
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_MQ_Aux").Value = lStrEmployeeCode; //code empleado
                 *      lObjOutgoingPayment.AccountPayments.UserFields.Fields.Item("U_MQ_DayPrice").Value = lDblDayPrice;
                 *
                 *      TravelExpMovTypesEnum lTravExpTypeEnum = TravelExpMovTypesEnum.GetEnum(lStrMovTypeCode);
                 *      if (TravelExpMovTypesEnum.IsTravelExpensesType(lTravExpTypeEnum))
                 *      {
                 *          lObjOutgoingPayment.AccountPayments.AccountCode = mStrViaticExpAcct;
                 *      }
                 *      else if (TravelExpMovTypesEnum.IsDayExpensesType(lTravExpTypeEnum))
                 *      {
                 *          lObjOutgoingPayment.AccountPayments.AccountCode = mStrExpDayAcct;
                 *      }
                 *      else if (TravelExpMovTypesEnum.IsMinorExpensesType(lTravExpTypeEnum))
                 *      {
                 *          lObjOutgoingPayment.AccountPayments.AccountCode = mStrMinorPurchAcct;
                 *      }
                 *
                 *      lObjOutgoingPayment.AccountPayments.Add();
                 *  }
                 * }
                 *
                 * if (lObjOutgoingPayment.Add() != 0)
                 * {
                 *  string lStrLastError = DIApplication.Company.GetLastErrorDescription();
                 *  UIApplication.ShowMessageBox(string.Format("Error al generar el pago: {0}", DIApplication.Company.GetLastErrorDescription()));
                 * }
                 * else
                 * {
                 *  int lIntDocEntry = int.Parse(DIApplication.Company.GetNewObjectKey());
                 *
                 *  mObjTravelExpensesDTO = mObjMachinerySeviceFactory.GetTravelExpensesService().GetDraftPayment(lIntDocEntry);
                 *
                 *  UIApplication.GetApplication().OpenForm((SAPbouiCOM.BoFormObjectEnum)140, "", lIntDocEntry.ToString());
                 *
                 *  this.UIAPIRawForm.Close();
                 * }*/
                #endregion
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(string.Format("[frmTravelExpenses - DoPayment] Error al realizar el pago efectuado: {0}", lObjException.Message));
                Application.SBO_Application.MessageBox(string.Format("Error al realizar el pago efectuado: {0}", lObjException.Message));
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Пример #23
0
        public bool CreateNewJournal(List <DTO.JournalLineDTO> pLstJournalLines, string pStrInternal, string pStrTransactionCode, string pStrMemo, DateTime pDtmDate)
        {
            SAPbobsCOM.JournalEntries lObjJournalEntry = null;
            int lIntResult;

            try
            {
                //Pupulate header
                lObjJournalEntry                 = (SAPbobsCOM.JournalEntries)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries);
                lObjJournalEntry.DueDate         = pDtmDate;
                lObjJournalEntry.TaxDate         = pDtmDate;
                lObjJournalEntry.ReferenceDate   = pDtmDate;
                lObjJournalEntry.AutoVAT         = SAPbobsCOM.BoYesNoEnum.tYES;
                lObjJournalEntry.TransactionCode = pStrTransactionCode; //"TR/F";
                lObjJournalEntry.Reference       = pStrInternal;
                //lObjJournalEntry.Series = GetJournalEntrySeries();
                lObjJournalEntry.Memo = pStrMemo; // "Flete interno" + DateTime.Now.ToShortDateString();

                //Add lines
                if (pLstJournalLines != null && pLstJournalLines.Count > 0)
                {
                    var Debit  = pLstJournalLines.Sum(x => x.Debit);
                    var Credit = pLstJournalLines.Sum(x => x.Credit);
                    foreach (var lObjLine in pLstJournalLines)
                    {
                        lObjJournalEntry.Lines.AccountCode   = lObjLine.AccountCode;
                        lObjJournalEntry.Lines.ContraAccount = lObjLine.ContraAccount;
                        lObjJournalEntry.Lines.CostingCode   = lObjLine.CostingCode;
                        lObjJournalEntry.Lines.CostingCode2  = lObjLine.CostingCode2;
                        lObjJournalEntry.Lines.Credit        = lObjLine.Credit;
                        lObjJournalEntry.Lines.Debit         = lObjLine.Debit;
                        lObjJournalEntry.Lines.Reference1    = string.IsNullOrEmpty(lObjLine.Ref1) ? "" : lObjLine.Ref1;
                        lObjJournalEntry.Lines.Reference2    = string.IsNullOrEmpty(lObjLine.Ref2) ? "" : lObjLine.Ref2;
                        lObjJournalEntry.Lines.UserFields.Fields.Item("U_GLO_Auxiliar").Value = string.IsNullOrEmpty(lObjLine.Auxiliar) ? "" : lObjLine.Auxiliar;
                        lObjJournalEntry.Lines.UserFields.Fields.Item("U_GLO_TypeAux").Value  = string.IsNullOrEmpty(lObjLine.TypeAux) ? "" : lObjLine.TypeAux;
                        //lObjJournalEntry.Lines.UserFields.Fields.Item("U_SU_Folio").Value = pObjJournalEntry.Auction.Folio;
                        lObjJournalEntry.Lines.UserFields.Fields.Item("U_GLO_CodeMov").Value = string.IsNullOrEmpty(lObjLine.CodeMov) ? "" : lObjLine.CodeMov;
                        lObjJournalEntry.Lines.UserFields.Fields.Item("U_TR_Paths").Value    = string.IsNullOrEmpty(lObjLine.Paths) ? "" : lObjLine.Paths;
                        lObjJournalEntry.Lines.UserFields.Fields.Item("U_GLO_Coments").Value = string.IsNullOrEmpty(lObjLine.Comment) ? "" : lObjLine.Comment;
                        lObjJournalEntry.Lines.Add();
                    }
                }

                //Handle operation
                lIntResult = lObjJournalEntry.Add();
                if (lIntResult != 0)
                {
                    throw new SapBoException(string.Format("Error code: {0} \nError message: {1}", lIntResult, DIApplication.Company.GetLastErrorDescription()));
                }
            }
            catch (Exception lObjException)
            {
                UIApplication.GetApplication().Forms.ActiveForm.Freeze(false);
                LogService.WriteError("JournalService (CreateAction): " + lObjException.Message);
                LogService.WriteError(lObjException);
                UIApplication.ShowMessageBox(string.Format("CreateAction: {0}", lObjException.Message));
                return(false);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjJournalEntry);
            }
            return(lIntResult == 0 ? true : false);
        }
Пример #24
0
 public void UnloadApplicationEvents()
 {
     UIApplication.GetApplication().ItemEvent -= new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
 }
Пример #25
0
        static void Main(string[] pArrStrArgs)
        {
            try
            {
                LogService.Filename("FoodProduction");
                LogService.WriteInfo("Inicio del addon 1.2.56");

                Application lObjApplication = null;

                if (pArrStrArgs.Length < 1)
                {
                    lObjApplication = new Application();
                }
                else
                {
                    lObjApplication = new Application(pArrStrArgs[0]);
                }


                //Prepare menu
                MenuManager lObjMenuManager = new MenuManager();
                lObjMenuManager.Initialize();

                //Prepare filters
                EventManager lObjEventManager = new EventManager();
                UIApplication.GetApplication().SetFilter(lObjEventManager.GetItemEventFiltersByMenu(lObjMenuManager.Menu));
                UIApplication.ShowSuccess(string.Format("Menu manager"));

                //Add menu events
                lObjApplication.RegisterMenuEventHandler(lObjMenuManager.GetApplicationMenuEvent);
                LogService.WriteSuccess("Registro del menú");
                UIApplication.ShowSuccess(string.Format("Registro del menu"));


                //Add application events
                UIApplication.GetApplication().AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(GetApplicationAppEvent);
                DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany());
                UIApplication.ShowSuccess(string.Format("DI Connect"));
                //Bascula
                ConnectRemoteAccess();


                //Initialize Tables
                UIApplication.ShowSuccess(string.Format("Inicializar las tablas"));
                SetupService mObjSetupService;
                mObjSetupService = new SetupService();
                mObjSetupService.InitializeTables();


                UIApplication.ShowSuccess(string.Format("Addon Iniciado correctamente"));
                LogService.WriteSuccess("[AddOn FoodProduction 1.2.55 STARTED]");
                //Ticket instance = (Ticket)Activator.CreateInstance(typeof(Ticket));

                //Init application
                lObjApplication.Run();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                LogService.WriteError("[ERROR]" + ex.Message);
            }
        }
Пример #26
0
        public void GetApplicationMenuEvent(ref SAPbouiCOM.MenuEvent pObjMenuEvent, out bool pObjBubbleEvent)
        {
            pObjBubbleEvent = true;

            try
            {
                if (pObjMenuEvent.BeforeAction)
                {
                    //Get menu unique id
                    //string lStrMenuUID  =  pObjMenuEvent.MenuUID;

                    //If is a section
                    //if(Menu.SelectMany(m=> m.Sections).Where(s=> s.UniqueID == lStrMenuUID).Count() > 0)
                    //{
                    //    //Get section
                    //    Section lObjSection = Menu.SelectMany(m=> m.Sections).FirstOrDefault(s=> s.UniqueID == lStrMenuUID);

                    //    //Is valid form
                    //    if(lObjSection.Form != null)
                    //    {
                    //        lObjSection.Form.
                    //    }
                    //}

                    switch (pObjMenuEvent.MenuUID)
                    {
                    case "TicketForm":

                        bool             lBolIsOpen = false;
                        SAPbouiCOM.Forms lObjForms  = UIApplication.GetApplication().Forms;

                        foreach (Form lObjForm in lObjForms)
                        {
                            if (lObjForm.TypeEx == "UGRS.PlantaAlimentos.Forms.TicketForm" && lObjForm.Visible)
                            {
                                lBolIsOpen = true;
                            }
                        }
                        if (!lBolIsOpen)
                        {
                            TicketForm lObjTicketForm = new TicketForm();
                            lObjTicketForm.UIAPIRawForm.Left = GetLeftMargin(lObjTicketForm.UIAPIRawForm);
                            lObjTicketForm.UIAPIRawForm.Top  = GetTopMargin(lObjTicketForm.UIAPIRawForm);
                            lObjTicketForm.Show();
                        }
                        else
                        {
                            UIApplication.ShowMessageBox("Ya se tiene abierta una ventana de tickets");
                        }

                        break;

                    case "TicketsListForm":

                        TicketsListForm lObjTicketsListFrm = new TicketsListForm();
                        lObjTicketsListFrm.UIAPIRawForm.Left = GetLeftMargin(lObjTicketsListFrm.UIAPIRawForm);
                        lObjTicketsListFrm.UIAPIRawForm.Top  = GetTopMargin(lObjTicketsListFrm.UIAPIRawForm);
                        lObjTicketsListFrm.Show();

                        break;
                        //case "ReceptionForm":

                        //    ReceptionForm lObjReceptionFrm = new ReceptionForm();
                        //    lObjReceptionFrm.UIAPIRawForm.Left = GetLeftMargin(lObjReceptionFrm.UIAPIRawForm);
                        //    lObjReceptionFrm.UIAPIRawForm.Top = GetTopMargin(lObjReceptionFrm.UIAPIRawForm);
                        //    lObjReceptionFrm.Show();

                        //DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany());
                        //Application.SBO_Application.Company
                        //ReceptionForm lObjReceptionFrm = new ReceptionForm(UI.UIApplication.Company);

                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError(ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowError(string.Format("MenuException: {0}", ex.Message));
                UIApplication.ShowMessageBox(ex.Message);
            }
        }
Пример #27
0
        private void btnPayments_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            Form lObjPaymentForm    = null;
            Form lObjPaymentFormUDF = null;
            Form lObjAccountForm    = null;

            try
            {
                if (mIntRowSelected > 0)
                {
                    StatusEnum lEnmStatus      = (StatusEnum)int.Parse(DtMatrix.GetValue("C_Status", mIntRowSelected - 1).ToString());
                    string     lStrFolio       = DtMatrix.GetValue("C_Folio", mIntRowSelected - 1).ToString();
                    string     lStrEmpCode     = DtMatrix.GetValue("C_Employe", mIntRowSelected - 1).ToString();
                    string     lStrArea        = DtMatrix.GetValue("C_Area", mIntRowSelected - 1).ToString();
                    double     lDblImport      = double.Parse(DtMatrix.GetValue("C_Amount", mIntRowSelected - 1).ToString());
                    string     lStrEmpName     = mObjPurchasesServiceFactory.GetPurchaseService().GetEmpName(lStrEmpCode);
                    string     lStrLineAccount = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetAccountRefund(lStrArea);
                    //string lStrChkAcct = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetAccountInConfig("GLO_CTAREEMBCHEQ");
                    string lStrChkAcct = cbAccount.Value;
                    // Dictionary<string, string> lStrBankInfo = mObjPurchasesServiceFactory.GetPurchaseReceiptsService().GetBankInfo(lStrChkAcct);
                    Dictionary <string, string> lStrBankInfo = new Dictionary <string, string>();
                    lStrBankInfo.Add(cbAccount.Value, cbBank.Selected.Description);

                    if (lEnmStatus != StatusEnum.Authorized_Ope_Admon)
                    {
                        UIApplication.ShowError("El reembolso seleccionado no está autorizado");
                        return;
                    }

                    string lStrValidation = ValidatePaymentsFields(lStrFolio, lStrEmpCode, lStrArea, lDblImport, lStrChkAcct, lStrBankInfo, lStrLineAccount);
                    if (!string.IsNullOrEmpty(lStrValidation))
                    {
                        UIApplication.ShowMessageBox(lStrValidation);
                        return;
                    }
                    if (mObjPurchasesServiceFactory.GetPurchaseReceiptsService().ExistsPayment(lStrEmpCode, lStrFolio, lStrArea))

                    /*string lStrDocEntry = DtMatrix.GetValue("C_DocEntry", mIntRowSelected - 1).ToString();
                     * if (mObjPurchasesServiceFactory.GetPurchaseReceiptsService().ExistsPayment(lStrDocEntry))*/
                    {
                        UIApplication.ShowError("Ya existe un pago para el reembolso seleccionado");
                        return;
                    }
                    this.UIAPIRawForm.Freeze(true);
                    UIApplication.GetApplication().ActivateMenuItem("2818");
                    if (!UIApplication.GetApplication().Menus.Item("6913").Checked)
                    {
                        UIApplication.GetApplication().ActivateMenuItem("6913");//2050
                    }

                    lObjPaymentForm    = UIApplication.GetApplication().Forms.GetForm("426", -1);
                    lObjPaymentFormUDF = UIApplication.GetApplication().Forms.GetForm("-426", -1);

                    lObjPaymentForm.Freeze(true);
                    lObjPaymentFormUDF.Freeze(true);
                    SAPbouiCOM.EditText txtDocDate = ((SAPbouiCOM.EditText)lObjPaymentForm.Items.Item("10").Specific);
                    txtDocDate.Value = DateTime.Now.ToString("yyyyMMdd");

                    SAPbouiCOM.OptionBtn optionBtnAccount = ((SAPbouiCOM.OptionBtn)lObjPaymentForm.Items.Item("58").Specific);
                    optionBtnAccount.Selected = true;

                    SAPbouiCOM.ComboBox cboPymtType = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_GLO_PaymentType").Specific);
                    cboPymtType.Select("GLREM", SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.EditText txtCodeMov = ((SAPbouiCOM.EditText)lObjPaymentFormUDF.Items.Item("U_GLO_CodeMov").Specific);
                    txtCodeMov.Value = lStrFolio;

                    SAPbouiCOM.ComboBox txtCostCenter = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_GLO_CostCenter").Specific);
                    txtCostCenter.Select(lStrArea, SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.ComboBox cboAuxiliarType = ((SAPbouiCOM.ComboBox)lObjPaymentFormUDF.Items.Item("U_FZ_AuxiliarType").Specific);
                    cboAuxiliarType.Select("2", SAPbouiCOM.BoSearchKey.psk_ByValue);

                    SAPbouiCOM.EditText txtName = ((SAPbouiCOM.EditText)lObjPaymentForm.Items.Item("10000166").Specific);
                    txtName.Value = lStrEmpName;

                    SAPbouiCOM.EditText txtAuxiliar = ((SAPbouiCOM.EditText)lObjPaymentFormUDF.Items.Item("U_FZ_Auxiliar").Specific);
                    txtAuxiliar.Value = lStrEmpCode;


                    SAPbouiCOM.Button btnBank = ((SAPbouiCOM.Button)lObjPaymentForm.Items.Item("234000001").Specific);
                    btnBank.Item.Click();

                    lObjAccountForm = UIApplication.GetApplication().Forms.GetForm("196", -1);
                    lObjAccountForm.Freeze(true);
                    SAPbouiCOM.Folder folderCheck = ((SAPbouiCOM.Folder)lObjAccountForm.Items.Item("3").Specific);
                    folderCheck.Item.Click();

                    SAPbouiCOM.Matrix mtxCheck = ((SAPbouiCOM.Matrix)lObjAccountForm.Items.Item("28").Specific);
                    ((SAPbouiCOM.EditText)mtxCheck.Columns.Item("7").Cells.Item(1).Specific).Value = lDblImport.ToString();

                    ComboBox cb = ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("2").Cells.Item(1).Specific);

                    string ss = lStrBankInfo[lStrBankInfo.Keys.ElementAt(0)]; //lStrBankInfo.ElementAt(0);


                    ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("2").Cells.Item(1).Specific).Select(lStrBankInfo[lStrBankInfo.Keys.ElementAt(0)], SAPbouiCOM.BoSearchKey.psk_ByValue); //Banco
                    ((SAPbouiCOM.ComboBox)mtxCheck.Columns.Item("4").Cells.Item(1).Specific).Select(lStrBankInfo.Keys.ElementAt(0), SAPbouiCOM.BoSearchKey.psk_ByValue);               //Cuenta?

                    SAPbouiCOM.Button btnOk = ((SAPbouiCOM.Button)lObjAccountForm.Items.Item("1").Specific);
                    btnOk.Item.Click();

                    SAPbouiCOM.Matrix mtxPayment = ((SAPbouiCOM.Matrix)lObjPaymentForm.Items.Item("71").Specific);
                    mtxPayment.AddRow();
                    ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("5").Cells.Item(1).Specific).Value = lDblImport.ToString();
                    ((SAPbouiCOM.EditText)mtxPayment.Columns.Item("8").Cells.Item(1).Specific).Value = lStrLineAccount; //cuenta de mayor
                }
                else
                {
                    UIApplication.ShowMessageBox("Favor de seleccionar un registro");
                }



                lObjPaymentFormUDF.Freeze(false);
                this.UIAPIRawForm.Freeze(false);



                if (lObjPaymentForm != null)
                {
                    lObjPaymentForm.Freeze(false);
                }
                if (lObjAccountForm != null)
                {
                    lObjPaymentFormUDF.Freeze(false);
                }
                if (this.UIAPIRawForm != null)
                {
                    this.UIAPIRawForm.Freeze(false);
                }
                // if (lObjAccountForm. ==) lObjAccountForm.Freeze(false);
                UIApplication.ShowSuccess("Carga de pago terminada");
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (btnPayments_ClickBefore) " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(string.Format("Error al abrir pantalla de pagos: {0}", ex.Message));
            }
            finally
            {
                if (lObjPaymentFormUDF != null)
                {
                    lObjPaymentFormUDF.Freeze(false);
                }
                this.UIAPIRawForm.Freeze(false);
            }
        }