コード例 #1
0
ファイル: Calculations.cs プロジェクト: radtek/UGRS_Full
        public bool VerifyWeightSecuence(string pStrWeight, string pStrSource, SAPbouiCOM.IMatrix pObjMatrix, string pStrTypeTicket)
        {
            double lFloWeight = 0;

            try
            {
                if (!string.IsNullOrEmpty(pStrWeight))
                {
                    lFloWeight = Convert.ToDouble(pStrWeight);
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("[VerifyWeightSecuence]: " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessage("Error al capturar datos" + ex.Message);
            }


            if ((pStrSource == "RDR1" || pStrTypeTicket == "Traslado - Salida") && pStrTypeTicket != "Venta de pesaje")
            {
                if (lFloWeight > getLargeNumber(pObjMatrix))
                {
                    return(true);
                }
            }
            else
            {
                if ((pStrSource == "POR1" || pStrTypeTicket == "Traslado - Entrada") && pStrTypeTicket != "Venta de pesaje")
                {
                    if (lFloWeight == 0)
                    {
                        return(true);
                    }
                    else
                    {
                        double lFloSmall = getSmallerNumber(pObjMatrix);
                        if (lFloSmall == 0 || lFloWeight < lFloSmall)
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }

            if (pStrTypeTicket == "Pesaje")
            {
                return(true);
            }

            UIApplication.ShowError("Favor verifique la secuencia del pesaje");
            return(false);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            try
            {
                Application oApp = null;
                if (args.Length < 1)
                {
                    oApp = new Application();
                }
                else
                {
                    oApp = new Application(args[0]);
                }
                LogService.Filename("Addon_Permissions");
                //Using Utilities DIApplication..
                DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany());
                Menu MyMenu = new Menu();
                MyMenu.AddMenuItems();
                oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent);


                PermissionsFactory lObjPermissionsFactorty = new PermissionsFactory();
                lObjPermissionsFactorty.GetSetupService().InitializeTables();

                EarringsRanks pObjEarringsRanks = new EarringsRanks();

                Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
                LogService.WriteSuccess("Addon_Permissions 0.0.11 cargado con exito");
                oApp.Run();

                UIApplication.ShowMessage("Addon Permissions 0.0.11 agregado con exito");
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        public int AttachFile(string pStrFile)
        {
            int lIntAttEntry = -1;

            SAPbobsCOM.Attachments2 lObjAttachment = (SAPbobsCOM.Attachments2)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oAttachments2);
            try
            {
                string lStrFileName = pStrFile;
                lObjAttachment.Lines.Add();
                lObjAttachment.Lines.FileName      = System.IO.Path.GetFileNameWithoutExtension(lStrFileName);
                lObjAttachment.Lines.FileExtension = System.IO.Path.GetExtension(lStrFileName).Substring(1);
                lObjAttachment.Lines.SourcePath    = System.IO.Path.GetDirectoryName(lStrFileName);
                lObjAttachment.Lines.Override      = SAPbobsCOM.BoYesNoEnum.tYES;

                if (lObjAttachment.Add() == 0)
                {
                    lIntAttEntry = int.Parse(DIApplication.Company.GetNewObjectKey());
                }
                else
                {
                    UIApplication.ShowMessageBox(DIApplication.Company.GetLastErrorDescription());
                    LogService.WriteError("AttachmentDI (AttachFile) " + DIApplication.Company.GetLastErrorDescription());
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowMessage(ex.Message);
                LogService.WriteError("AttachmentDI (AttachFile) " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjAttachment);
            }
            return(lIntAttEntry);
        }
コード例 #4
0
        private void SaveChecks()
        {
            try
            {
                string mStrReturnedChecksAcct = mObjQueryManager.GetValue("U_VALUE", "Name", "FZ_ACCTCHEQUE", Constants.STR_CONFIG_TABLE);
                string mStrItemCode           = mObjQueryManager.GetValue("U_VALUE", "Name", "FZ_ITEMCHEQDELV", Constants.STR_CONFIG_TABLE);
                for (int i = 0; i < mDtChecks.Rows.Count; i++)
                {
                    if (mDtChecks.GetCellValue <string>("C_Selected", i) == "Y")
                    {
                        string lStrCheckAcct = mDtChecks.GetCellValue <string>("C_BankAcc", i);
                        // If the check is not deposited, a deposit is generated first
                        if (mDtChecks.GetCellValue <string>("C_Status", i) == "Ventanilla")
                        {
                            lStrCheckAcct = mStrReturnedChecksAcct;
                            SAPbobsCOM.CompanyService  lObjService        = DIApplication.Company.GetCompanyService();
                            SAPbobsCOM.DepositsService lObjDepositService = lObjService.GetBusinessService(SAPbobsCOM.ServiceTypes.DepositsService) as SAPbobsCOM.DepositsService;
                            SAPbobsCOM.Deposit         lObjDeposit        = lObjDepositService.GetDataInterface(SAPbobsCOM.DepositsServiceDataInterfaces.dsDeposit) as SAPbobsCOM.Deposit;

                            lObjDeposit.DepositType        = SAPbobsCOM.BoDepositTypeEnum.dtChecks;
                            lObjDeposit.DepositAccountType = SAPbobsCOM.BoDepositAccountTypeEnum.datBankAccount;
                            //lObjDeposit.TotalLC = mDtChecks.GetCellValue<double>("C_CheckSum", i);
                            lObjDeposit.ReconcileAfterDeposit = SAPbobsCOM.BoYesNoEnum.tYES;
                            lObjDeposit.DepositAccount        = mStrReturnedChecksAcct;

                            SAPbobsCOM.CheckLine lObjCheckLine = lObjDeposit.Checks.Add();
                            lObjCheckLine.CheckKey = mDtChecks.GetCellValue <int>("C_CheckKey", i);

                            SAPbobsCOM.DepositParams lObjDepositParams = lObjDepositService.AddDeposit(lObjDeposit);
                        }

                        SAPbobsCOM.Documents lObjDebitNote = DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices) as SAPbobsCOM.Documents;
                        lObjDebitNote.DocObjectCode   = SAPbobsCOM.BoObjectTypes.oInvoices;
                        lObjDebitNote.DocumentSubType = SAPbobsCOM.BoDocumentSubType.bod_DebitMemo;
                        lObjDebitNote.DocType         = SAPbobsCOM.BoDocumentTypes.dDocument_Items;
                        lObjDebitNote.DocDate         = DateTime.Now;
                        lObjDebitNote.CardCode        = mDtChecks.GetCellValue <string>("C_CardCode", i);
                        lObjDebitNote.NumAtCard       = mDtChecks.GetCellValue <string>("C_CheckKey", i);

                        lObjDebitNote.Lines.ItemCode    = mStrItemCode;
                        lObjDebitNote.Lines.Quantity    = 1;
                        lObjDebitNote.Lines.UnitPrice   = mDtChecks.GetCellValue <double>("C_CheckSum", i);
                        lObjDebitNote.Lines.TaxCode     = "VE";
                        lObjDebitNote.Lines.AccountCode = mStrReturnedChecksAcct;
                        lObjDebitNote.Lines.Add();

                        lObjDebitNote.EDocGenerationType = SAPbobsCOM.EDocGenerationTypeEnum.edocNotRelevant;

                        int    lLongErr = lObjDebitNote.Add();
                        string lStrErrMsg;
                        if (lLongErr != 0)
                        {
                            DIApplication.Company.GetLastError(out lLongErr, out lStrErrMsg);
                            UIApplication.ShowError(lStrErrMsg);
                        }
                        else
                        {
                            UIApplication.ShowMessage("Success");
                        }
                        SearchChecks();
                    }
                }
            }
            catch (Exception pObjException)
            {
                LogUtility.WriteError(string.Format("[BouncedChecks - SaveChecks] Error al guardar cheque: {0}", pObjException.Message));
                UIApplication.ShowMessageBox(string.Format("Error al guardar cheque: {0}", pObjException.Message));
            }
        }