Esempio n. 1
0
        public static Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry GetInvoiceByInvoiceNumberAndSupplierPrimaryKey(string id, string invoicenumber)
        {
            Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry result = null;
            if (application != null)
            {
                try
                {
                    // PURCHASE INVOICES
                    Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntries invoices = Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntriesFactory.Factory.CreateNew();
                    Sage.ObjectStore.Query query = new Sage.ObjectStore.Query();

                    Sage.ObjectStore.Filter filter = new Sage.ObjectStore.Filter(Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry.FIELD_ENTRYTYPE, Sage.Accounting.TradingAccountEntryTypeEnum.TradingAccountEntryTypeInvoice);
                    query.Filters.Add(filter);

                    Sage.ObjectStore.Filter filter1 = new Sage.ObjectStore.Filter(Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry.FIELD_INSTRUMENTNO, invoicenumber);
                    query.Filters.Add(filter1);

                    Sage.Common.Data.DbKey  key     = new Sage.Common.Data.DbKey(Convert.ToInt32(id));
                    Sage.ObjectStore.Filter filter2 = new Sage.ObjectStore.Filter(Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry.FIELD_SUPPLIERACCOUNTDBKEY, key);
                    query.Filters.Add(filter2);

                    invoices.Find(query);

                    result = invoices.First;
                }
                catch (Exception ex)
                {
                    result = null;
                    Logger.WriteLog(ex);
                }
            }

            return(result);
        }
Esempio n. 2
0
        public static Supplier GetSupplierByPrimaryKey(string key)
        {
            Supplier supplier = null;

            if (application != null)
            {
                Sage.Common.Data.DbKey dbkey = new Sage.Common.Data.DbKey(Convert.ToInt32(key));
                supplier = Sage.Accounting.PurchaseLedger.SupplierFactory.Factory.Fetch(dbkey);
            }
            return(supplier);
        }
Esempio n. 3
0
        public static Sage.Accounting.PurchaseLedger.PurchaseBankPaymentPosting GetPaymentByPrimaryKey(string id)
        {
            Sage.Accounting.PurchaseLedger.PurchaseBankPaymentPosting payment = null;
            if (application != null)
            {
                Sage.Common.Data.DbKey key = new Sage.Common.Data.DbKey(Convert.ToInt32(id));
                payment = Sage.Accounting.PurchaseLedger.PurchaseBankPaymentPostingFactory.Factory.Fetch(key);
            }

            return(payment);
        }
Esempio n. 4
0
        public static Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry GetInvoiceByPrimaryKey(string id)
        {
            Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntry entry = null;
            if (application != null)
            {
                Sage.Common.Data.DbKey key = new Sage.Common.Data.DbKey(Convert.ToInt32(id));
                entry = Sage.Accounting.PurchaseLedger.PostedPurchaseAccountEntryFactory.Factory.Fetch(key);
            }

            return(entry);
        }
Esempio n. 5
0
        public static Department GetDepartmentByPrimaryKey(string key)
        {
            Department department = null;

            if (application != null)
            {
                Sage.Common.Data.DbKey dbkey = new Sage.Common.Data.DbKey(Convert.ToInt32(key));
                department = Sage.Accounting.SystemManager.DepartmentFactory.Factory.Fetch(dbkey);
            }
            return(department);
        }
Esempio n. 6
0
        public static Bank GetBankByPrimaryKey(string key)
        {
            Bank bank = null;

            if (application != null)
            {
                Sage.Common.Data.DbKey dbkey = new Sage.Common.Data.DbKey(Convert.ToInt32(key));
                bank = Sage.Accounting.CashBook.BankFactory.Factory.Fetch(dbkey);
            }
            return(bank);
        }
Esempio n. 7
0
        public static TaxCode GetVatRateByPrimaryKey(string key)
        {
            TaxCode taxcode = null;

            if (application != null)
            {
                Sage.Common.Data.DbKey dbkey = new Sage.Common.Data.DbKey(Convert.ToInt32(key));
                taxcode = Sage.Accounting.TaxModule.TaxCodeFactory.Factory.Fetch(dbkey);
            }

            return(taxcode);
        }
Esempio n. 8
0
        public static POPOrder GetPurchaseOrderByPrimaryKey(string key)
        {
            POPOrder poporder = null;

            if (application != null)
            {
                Sage.Common.Data.DbKey dbkey = new Sage.Common.Data.DbKey(Convert.ToInt32(key));
                poporder = Sage.Accounting.POP.POPOrder.Fetch(key);
            }

            return(poporder);
        }
Esempio n. 9
0
        public static NominalCode GetNominalCodeByPrimaryKey(string key)
        {
            NominalCode nominalcode = null;

            if (application != null)
            {
                Sage.Common.Data.DbKey dbkey = new Sage.Common.Data.DbKey(Convert.ToInt32(key));
                nominalcode = Sage.Accounting.NominalLedger.NominalCodeFactory.Factory.Fetch(dbkey);
            }

            return(nominalcode);
        }