示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }