Esempio n. 1
0
        public async Task <BudgetActualsView> GetActualsView(BudgetRangeView budgetRangeView)
        {
            try
            {
                UDC udcActuals = await GetUdc("GENERALLEDGERTYPE", "AA");

                UDC udcHours = await GetUdc("GENERALLEDGERTYPE", "HA");



                BudgetActualsView budgetActualsView = applicationViewFactory.MapBudgetRangeToBudgetActuals(budgetRangeView);


                //query actual amounts
                decimal actualAmount = (from e in _dbContext.GeneralLedgers
                                        where e.AccountId == budgetRangeView.AccountId &&
                                        e.GLDate >= budgetRangeView.StartDate &&
                                        e.GLDate <= budgetRangeView.EndDate &&
                                        e.LedgerType == udcActuals.KeyCode
                                        select e.Amount
                                        ).Sum();
                budgetActualsView.ActualAmount = actualAmount;
                //query actual hours
                decimal?actualHours = (from e in _dbContext.GeneralLedgers
                                       where e.AccountId == budgetRangeView.AccountId &&
                                       e.GLDate >= budgetRangeView.StartDate &&
                                       e.GLDate <= budgetRangeView.EndDate &&
                                       e.LedgerType == udcHours.KeyCode
                                       select e.Units
                                       ).Sum();
                budgetActualsView.ActualHours = actualHours ?? 0;
                return(budgetActualsView);
            }
            catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); }
        }
Esempio n. 2
0
        public async Task <CreateProcessStatus> CreateAcctRecFromInvoice(InvoiceView invoiceView)
        {
            try
            {
                Invoice invoice = await(from e in _dbContext.Invoices
                                        where e.InvoiceNumber == invoiceView.InvoiceNumber
                                        select e).FirstOrDefaultAsync <Invoice>();

                if (invoice != null)
                {
                    long?invoiceId = invoice.InvoiceId;

                    var query = await(from a in _dbContext.AcctRecs
                                      where a.InvoiceId == invoice.InvoiceId
                                      select a).FirstOrDefaultAsync <AcctRec>();

                    if (query == null)
                    {
                        UDC udc = await base.GetUdc("ACCTRECDOCTYPE", "INV");

                        NextNumber nextNumber = await base.GetNextNumber("DocNumber");

                        ChartOfAcct chartOfAcct = await base.GetChartofAccount("1000", "1200", "120", "");

                        AcctRec acctRec = new AcctRec();
                        acctRec.InvoiceId       = invoice.InvoiceId;
                        acctRec.DiscountDueDate = invoice.DiscountDueDate;
                        acctRec.GLDate          = DateTime.Now.Date;
                        acctRec.CreateDate      = DateTime.Now.Date;
                        acctRec.DocNumber       = nextNumber.NextNumberValue;
                        acctRec.Remarks         = invoice.Description;
                        acctRec.PaymentTerms    = invoice.PaymentTerms;
                        acctRec.CustomerId      = invoice.CustomerId;
                        //PurchaseOrderId
                        acctRec.Description          = invoice.Description;
                        acctRec.AcctRecDocTypeXRefId = udc.XRefId;
                        acctRec.AccountId            = chartOfAcct.AccountId;
                        acctRec.Amount       = invoice.Amount;
                        acctRec.OpenAmount   = invoice.Amount;
                        acctRec.DebitAmount  = 0;
                        acctRec.CreditAmount = invoice.Amount;

                        AddObject(acctRec);
                        return(CreateProcessStatus.Insert);
                    }
                }

                return(CreateProcessStatus.AlreadyExists);
            }
            catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); }
        }
Esempio n. 3
0
        public async Task <UDC> GetUdc(string productCode, string keyCode)
        {
            try
            {
                Entities _dbEntities = (Entities)_dbContext;

                UDC udc = await(from e in _dbEntities.UDCs
                                where e.ProductCode == productCode &&
                                e.KeyCode == keyCode
                                select e).FirstOrDefaultAsync <UDC>();

                return(udc);
            }
            catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); }
        }
        public void AfterCreateChildControls()
        {
            //可扩展枚举引用
            UDC.Refresh(this, this.lblPrefix133, this.Prefix133);
            UDC.Refresh(this, this.lblCenter121, this.Center121);

            PDFormMessage.ShowConfirmDialog(this.Page, "83ea257d-3da0-455e-a7a7-414b5d76466b", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);

            //处理个性化
            UFIDA.U9.UI.PDHelper.PersonalizationHelper.SetPersonalizationEnable((UFSoft.UBF.UI.FormProcess.BaseWebForm) this, true);
            //取得提示信息资源:是否删除当前记录
            string message = PDResource.GetDeleteConfirmInfo();

            //绑定注册弹出对话框到删除按钮
            PDFormMessage.ShowConfirmDialog(this.Page, message, "", this.BtnDelete);
        }
        public UDC GetUdcById(long?id)
        {
            UDC udc = null;

            try
            {
                using (var db = new Entities())
                {
                    udc = (from p in db.UDCs
                           where p.XRefId == id
                           select p).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
            }
            return(udc);
        }
        public async Task <CreateProcessStatus> CreateLocationUsingCustomer(CustomerView customerView)
        {
            try
            {
                foreach (LocationAddressView item in customerView.LocationAddress)
                {
                    var query = await(from e in _dbContext.LocationAddresses
                                      where e.AddressId == customerView.AddressId
                                      &&
                                      e.Address_Line_1 == item.Address_Line1
                                      &&
                                      e.City == item.City
                                      &&
                                      e.State == item.State
                                      &&
                                      e.Country == item.Country

                                      select e
                                      ).FirstOrDefaultAsync <LocationAddress>();

                    if (query == null)
                    {
                        LocationAddress locationAddress = new LocationAddress();
                        UDC             typeUDC         = await base.GetUdc("LOCATIONADDRESS_TYPE", item.Type);

                        item.TypeXRefId = typeUDC.XRefId;
                        item.AddressId  = customerView.AddressId;
                        applicationViewFactory.MapLocationAddressEntity(ref locationAddress, item);
                        AddObject(locationAddress);
                        return(CreateProcessStatus.Insert);
                    }
                }
                return(CreateProcessStatus.AlreadyExists);
            }
            catch (Exception ex)
            { throw new Exception(GetMyMethodName(), ex); }
        }
Esempio n. 7
0
        public async Task <SupplierView> CreateSupplierByAddressBook(AddressBook addressBook, LocationAddress locationAddress, Email email)
        {
            SupplierView supplierView = null;

            try
            {
                UDC udc = await base.GetUdc("AB_Type", "Supplier");

                if (udc != null)
                {
                    addressBook.PeopleXrefId = udc.XRefId;
                }

                UDC udcLocationAddressType = await base.GetUdc("LOCATIONADDRESS_TYPE", "BillTo");

                if (udcLocationAddressType != null)
                {
                    locationAddress.TypeXRefId = udcLocationAddressType.XRefId;
                }

                AddressBook query = await(from e in _dbContext.AddressBooks
                                          join f in _dbContext.Emails
                                          on e.AddressId equals f.AddressId
                                          where f.Email1 == email.Email1
                                          select e).FirstOrDefaultAsync <AddressBook>();

                if (query == null)
                {
                    _dbContext.Set <AddressBook>().Add(addressBook);
                    _dbContext.SaveChanges();
                    locationAddress.AddressId = addressBook.AddressId;
                    _dbContext.Set <LocationAddress>().Add(locationAddress);
                    _dbContext.SaveChanges();
                    email.AddressId = addressBook.AddressId;
                    _dbContext.Set <Email>().Add(email);
                    _dbContext.SaveChanges();
                }
                else
                {
                    addressBook.AddressId = query.AddressId;
                }
                Supplier supplier = await(from e in _dbContext.Suppliers
                                          where e.AddressId == addressBook.AddressId
                                          select e).FirstOrDefaultAsync <Supplier>();
                if (supplier == null)
                {
                    Supplier newSupplier = new Supplier();
                    newSupplier.AddressId      = addressBook.AddressId;
                    newSupplier.Identification = email.Email1;

                    _dbContext.Set <Supplier>().Add(newSupplier);
                    _dbContext.SaveChanges();

                    supplierView = applicationViewFactory.MapSupplierView(newSupplier);
                }
                else
                {
                    supplierView = applicationViewFactory.MapSupplierView(supplier);
                }
                return(supplierView);
            }
            catch (Exception ex)
            { throw new Exception(GetMyMethodName(), ex); }
        }
Esempio n. 8
0
        public async Task TestCreatePurchaseOrder()
        {
            UnitOfWork unitOfWork = new UnitOfWork();

            ItemMaster itemMaster = new ItemMaster();

            itemMaster.ItemNumber    = "P2001Test";
            itemMaster.Description   = "Highlighter - 3 Color";
            itemMaster.UnitOfMeasure = "Sets";
            itemMaster.UnitPrice     = 6M;

            bool result = await unitOfWork.itemMasterRepository.CreateItemMaster(itemMaster);

            if (result)
            {
                unitOfWork.CommitChanges();
            }
            AddressBook addressBook = new AddressBook();

            addressBook.CompanyName = "Sample Company Part Ltd";
            addressBook.Name        = "";
            addressBook.FirstName   = "";
            addressBook.LastName    = "";

            LocationAddress locationAddress = new LocationAddress();

            locationAddress.Address_Line_1 = "204 Collins Street";
            locationAddress.City           = "Melbourne";
            locationAddress.Zipcode        = "3000";
            locationAddress.Country        = "Australia";

            Email email = new Email();

            email.Email1     = "*****@*****.**";
            email.LoginEmail = true;
            email.Password   = "******";


            SupplierView supplierView = await unitOfWork.supplierRepository.CreateSupplierByAddressBook(addressBook, locationAddress, email);

            ChartOfAcct coa = await unitOfWork.supplierRepository.GetChartofAccount("1000", "1200", "240", "");

            Company company = await unitOfWork.supplierRepository.GetCompany();

            ItemMaster[] itemMasterLookup = new ItemMaster[5];

            itemMasterLookup[0] = await unitOfWork.itemMasterRepository.GetObjectAsync(5);

            itemMasterLookup[1] = await unitOfWork.itemMasterRepository.GetObjectAsync(6);

            itemMasterLookup[2] = await unitOfWork.itemMasterRepository.GetObjectAsync(7);

            itemMasterLookup[3] = await unitOfWork.itemMasterRepository.GetObjectAsync(8);

            itemMasterLookup[4] = await unitOfWork.itemMasterRepository.GetObjectAsync(9);

            UDC udcAcctPayDocType = await unitOfWork.accountPayableRepository.GetUdc("AcctPayDocType", "STD");

            string json = @"{
            ""DocType"" : """ + udcAcctPayDocType.KeyCode + @""",
            ""PaymentTerms"" : ""Net 30"",
            ""GLDate"" : """ + DateTime.Parse("7/30/2018") + @""",
            ""AccountId"" :" + coa.AccountId + @",
            ""SupplierId"" :" + (supplierView.SupplierId ?? 0).ToString() + @",
            ""SupplierName"" :""" + supplierView.CompanyName + @""",
            ""Description"" :""Back to School Inventory"",
            ""PONumber"" :""PO-2"",
            ""TakenBy"" : ""David Nishimoto"",
            ""BuyerId"" :" + company.CompanyId + @",
            ""TaxCode1"" :""" + company.TaxCode1 + @""",
            ""TaxCode2"" :""" + company.TaxCode2 + @""",
            ""ShippedToName"" :""" + company.CompanyName + @""",
            ""ShippedToAddress1"" :""" + company.CompanyStreet + @""",
            ""ShippedToCity"" :""" + company.CompanyCity + @""",
            ""ShippedToState"" :""" + company.CompanyState + @""",
            ""ShippedToZipcode"" :""" + company.CompanyZipcode + @""",
            ""RequestedDate"" :""" + DateTime.Parse("7/24/2018") + @""",
            ""PromisedDeliveredDate"" :""" + DateTime.Parse("8/2/2018") + @""",
            ""TransactionDate"" :""" + DateTime.Parse("7/30/2018") + @""", 

            ""PurchaseOrderDetailViews"":[
                    {
                    ""ItemId"": 5,
                    ""OrderDate"":""" + DateTime.Parse("7 / 30 / 2018") + @""",
                    ""OrderedQuantity"": 5,
                    ""UnitPrice"" : " + itemMasterLookup[0].UnitPrice + @",
                    ""UnitOfMeasure"" : """ + itemMasterLookup[0].UnitOfMeasure + @""",
                    ""Amount"" : " + itemMasterLookup[0].UnitPrice * 5 + @",
                    ""Description"": """ + itemMasterLookup[0].Description + @""",
                    ""ExpectedDeliveryDate"" :""" + DateTime.Parse("8/2/2018") + @""",
                    ""ReceivedQuantity"":0,
                    ""RemainingQuantity"":5
                    },
                    {
                    ""ItemId"": 6,
                    ""OrderDate"":""" + DateTime.Parse("7 / 30 / 2018") + @""",
                    ""OrderedQuantity"": 4,
                    ""UnitPrice"" : " + itemMasterLookup[1].UnitPrice + @",
                    ""UnitOfMeasure"" : """ + itemMasterLookup[1].UnitOfMeasure + @""",
                    ""Amount"" : " + itemMasterLookup[1].UnitPrice * 4 + @",
                    ""Description"": """ + itemMasterLookup[1].Description + @""",
                    ""ExpectedDeliveryDate"" :""" + DateTime.Parse("8/2/2018") + @""",
                    ""ReceivedQuantity"":0,
                    ""RemainingQuantity"":4
                    },
                    {
                    ""ItemId"": 7,
                    ""OrderDate"":""" + DateTime.Parse("7 / 30 / 2018") + @""",
                    ""OrderedQuantity"": 10,
                    ""UnitPrice"" : " + itemMasterLookup[2].UnitPrice + @",
                    ""UnitOfMeasure"" : """ + itemMasterLookup[2].UnitOfMeasure + @""",
                    ""Amount"" : " + itemMasterLookup[2].UnitPrice * 10 + @",
                    ""Description"": """ + itemMasterLookup[2].Description + @""",
                    ""ExpectedDeliveryDate"" :""" + DateTime.Parse("8/2/2018") + @""",
                    ""ReceivedQuantity"":0,
                    ""RemainingQuantity"":10
                    },
                    {
                    ""ItemId"": 8,
                    ""OrderDate"":""" + DateTime.Parse("7 / 30 / 2018") + @""",
                    ""OrderedQuantity"": 15,
                    ""UnitPrice"" : " + itemMasterLookup[3].UnitPrice + @",
                    ""UnitOfMeasure"" : """ + itemMasterLookup[3].UnitOfMeasure + @""",
                    ""Amount"" : " + itemMasterLookup[3].UnitPrice * 15 + @",
                    ""Description"": """ + itemMasterLookup[3].Description + @""",
                    ""ExpectedDeliveryDate"" :""" + DateTime.Parse("8/2/2018") + @""",
                    ""ReceivedQuantity"":0,
                    ""RemainingQuantity"":15
                    },
                    {
                    ""ItemId"": 9,
                    ""OrderDate"":""" + DateTime.Parse("7 / 30 / 2018") + @""",
                    ""OrderedQuantity"": 10,
                    ""UnitPrice"" : " + itemMasterLookup[4].UnitPrice + @",
                    ""UnitOfMeasure"" : """ + itemMasterLookup[3].UnitOfMeasure + @""",
                    ""Amount"" : " + itemMasterLookup[4].UnitPrice * 10 + @",
                    ""Description"": """ + itemMasterLookup[4].Description + @""",
                    ""ExpectedDeliveryDate"" :""" + DateTime.Parse("8/2/2018") + @""",
                    ""ReceivedQuantity"":0,
                    ""RemainingQuantity"":10
                    }
                ]
    }";


            PurchaseOrderView purchaseOrderView = JsonConvert.DeserializeObject <PurchaseOrderView>(json);


            AccountsPayableModule apMod = new AccountsPayableModule();


            //TODO Create the Purchase Order

            apMod
            .PurchaseOrder
            .CreatePurchaseOrder(purchaseOrderView)
            .Apply()
            .CreatePurchaseOrderDetails(purchaseOrderView)
            .Apply()
            .CreateAcctPayByPurchaseOrderNumber(purchaseOrderView)
            .Apply();



            Assert.True(true);
        }
Esempio n. 9
0
        public async Task TestCreateInboundPackingSlip()
        {
            long supplierId = 3;

            try
            {
                UnitOfWork unitOfWork = new UnitOfWork();

                SupplierView supplierView = await unitOfWork.supplierRepository.GetSupplierViewBySupplierId(supplierId);

                UDC slipTypeUDC = await unitOfWork.supplierRepository.GetUdc("PACKINGSLIP_TYPE", "INBOUND");



                string json = @"{
            ""SupplierId"" : " + supplierView.SupplierId + @",
            ""ReceivedDate"" : """ + DateTime.Parse("8/16/2018") + @""",
            ""SlipDocument"" : ""SLIP-1"",
            ""PONumber"" :""PO-2"",
            ""SlipType"" : """ + slipTypeUDC.KeyCode + @""",

            ""PackingSlipDetailViews"":[
                    {
                    ""ItemId"": 5,
                    ""Quantity"": 5,
                    ""UnitPrice"" : " + 10 + @",
                    ""ExtendedCost"" : " + 50 + @",
                    ""UnitOfMeasure"" : """ + "Dozen" + @""",
                    ""Description"": """ + "Pencil HB" + @"""
                    },
                    {
                    ""ItemId"": 6,
                    ""Quantity"": 4,
                    ""UnitPrice"" : " + 10 + @",
                    ""ExtendedCost"" : " + 40 + @",
                    ""UnitOfMeasure"" : """ + "Dozen" + @""",
                    ""Description"": """ + "Pencils 2B" + @"""
                    },
                    {
                    ""ItemId"": 7,
                    ""Quantity"": 10,
                    ""UnitPrice"" : " + 3 + @",
                    ""ExtendedCost"" : " + 30 + @",
                    ""UnitOfMeasure"" : """ + "Ream" + @""",
                    ""Description"": """ + "Paper - A4, Photo coper, 70 grams" + @"""
                    },
                    {
                    ""ItemId"": 8,
                    ""Quantity"": 15,
                    ""UnitPrice"" : " + 3.20 + @",
                    ""ExtendedCost"" : " + 48 + @",
                    ""UnitOfMeasure"" : """ + "Ream" + @""",
                    ""Description"": """ + "NPaper - A4, Photo Copier, 80 gramULL" + @"""
                    },
                    {
                    ""ItemId"": 9,
                    ""Quantity"": 5,
                    ""UnitPrice"" : " + 10 + @",
                    ""ExtendedCost"" : " + 100 + @",
                    ""UnitOfMeasure"" : """ + "Ream" + @""",
                    ""Description"": """ + "Pens - Ball Point, Blue" + @"""
                    }
                ]

            }";

                PackingSlipView packingSlipView = JsonConvert.DeserializeObject <PackingSlipView>(json);

                AccountsPayableModule apMod = new AccountsPayableModule();

                apMod
                .PackingSlip.CreatePackingSlip(packingSlipView).Apply()
                .CreatePackingSlipDetails(packingSlipView)
                .Apply()
                .CreateInventoryByPackingSlip(packingSlipView)
                .Apply();


                Assert.True(true);
            }
            catch (Exception ex) { }
        }
Esempio n. 10
0
        public async Task TestCreateIncomeRevenue()
        {
            int        addressId            = 1;
            decimal    income               = 2800M;
            long       incomeDocumentNumber = 20; //manually extracted
            UnitOfWork unitOfWork           = new UnitOfWork();

            GeneralLedgerModule ledgerMod = new GeneralLedgerModule();

            ChartOfAcct coa = await unitOfWork.generalLedgerRepository.GetChartofAccount("1000", "1200", "300", "");

            UDC udcLedgerType = await unitOfWork.generalLedgerRepository.GetUdc("GENERALLEDGERTYPE", "AA");

            UDC udcDocType = await unitOfWork.generalLedgerRepository.GetUdc("DOCTYPE", "PV");

            AddressBook addressBook = await unitOfWork.addressBookRepository.GetAddressBookByAddressId(addressId);

            GeneralLedgerView glView = new GeneralLedgerView();

            glView.DocNumber    = incomeDocumentNumber;
            glView.DocType      = udcDocType.KeyCode;
            glView.AccountId    = coa.AccountId;
            glView.Amount       = income;
            glView.LedgerType   = udcLedgerType.KeyCode;
            glView.GLDate       = DateTime.Parse("9/20/2018");
            glView.CreatedDate  = DateTime.Parse("9/20/2018");
            glView.AddressId    = addressBook.AddressId;
            glView.Comment      = "Week end 8/31/2018";
            glView.DebitAmount  = income;
            glView.CreditAmount = 0;
            glView.FiscalPeriod = 9;
            glView.FiscalYear   = 2018;

            ledgerMod.GeneralLedger.CreateGeneralLedger(glView).Apply();
            ledgerMod.GeneralLedger.UpdateAccountBalances(glView);

            ChartOfAcct coa2 = await unitOfWork.generalLedgerRepository.GetChartofAccount("1000", "1200", "101", "");

            long cashDocumentNumber   = 21;
            GeneralLedgerView glView2 = new GeneralLedgerView();

            glView2.DocNumber    = cashDocumentNumber;
            glView2.DocType      = udcDocType.KeyCode;
            glView2.AccountId    = coa2.AccountId;
            glView2.Amount       = income;
            glView2.LedgerType   = udcLedgerType.KeyCode;
            glView2.GLDate       = DateTime.Parse("9/20/2018");
            glView2.CreatedDate  = DateTime.Parse("9/20/2018");
            glView2.AddressId    = addressBook.AddressId;
            glView2.Comment      = "Week end 8/31/2018";
            glView2.DebitAmount  = income;
            glView2.CreditAmount = 0;
            glView2.FiscalPeriod = 9;
            glView2.FiscalYear   = 2018;

            ledgerMod.GeneralLedger.CreateGeneralLedger(glView2).Apply();

            ledgerMod.GeneralLedger.UpdateAccountBalances(glView2);


            GeneralLedgerView glViewLookup =
                ledgerMod.GeneralLedger.Query().GetGeneralLedgerView(glView2.DocNumber, glView2.DocType);

            Assert.True(glViewLookup != null);
        }
Esempio n. 11
0
        public async Task TestCreatePersonalExpenseAndPayment()
        {
            //ToDo
            UnitOfWork  unitOfWork            = new UnitOfWork();
            long        addressId             = 1;
            long        expenseDocumentNumber = 19;
            decimal     expense = 768M;
            ChartOfAcct coa     = await unitOfWork.generalLedgerRepository.GetChartofAccount("1000", "1200", "502", "01");

            UDC udcLedgerType = await unitOfWork.generalLedgerRepository.GetUdc("GENERALLEDGERTYPE", "AA");

            UDC udcDocType = await unitOfWork.generalLedgerRepository.GetUdc("DOCTYPE", "PV");

            AddressBook addressBook = await unitOfWork.addressBookRepository.GetAddressBookByAddressId(addressId);

            GeneralLedgerView   glView    = new GeneralLedgerView();
            GeneralLedgerModule ledgerMod = new GeneralLedgerModule();

            glView.DocNumber    = expenseDocumentNumber;
            glView.DocType      = udcDocType.KeyCode;
            glView.AccountId    = coa.AccountId;
            glView.Amount       = expense * -1;
            glView.LedgerType   = udcLedgerType.KeyCode;
            glView.GLDate       = DateTime.Parse("9/19/2018");
            glView.CreatedDate  = DateTime.Parse("9/19/2018");
            glView.AddressId    = addressBook.AddressId;
            glView.Comment      = "Mortgage Payment";
            glView.DebitAmount  = 0;
            glView.CreditAmount = expense;
            glView.FiscalPeriod = 9;
            glView.FiscalYear   = 2018;

            ledgerMod.GeneralLedger.CreateGeneralLedger(glView).Apply();
            ledgerMod.GeneralLedger.UpdateAccountBalances(glView);

            GeneralLedgerView glViewLookup =
                ledgerMod.GeneralLedger.Query().GetGeneralLedgerView(glView.DocNumber, glView.DocType);

            ChartOfAcct coaCash = await unitOfWork.generalLedgerRepository.GetChartofAccount("1000", "1200", "101", "");

            GeneralLedgerView glCashView = new GeneralLedgerView();

            long cashDocumentNumber = 22;

            glCashView.DocNumber    = cashDocumentNumber;
            glCashView.DocType      = udcDocType.KeyCode;
            glCashView.AccountId    = coaCash.AccountId;
            glCashView.Amount       = expense * -1;
            glCashView.LedgerType   = udcLedgerType.KeyCode;
            glCashView.GLDate       = DateTime.Parse("9/20/2018");
            glCashView.CreatedDate  = DateTime.Parse("9/20/2018");
            glCashView.AddressId    = addressBook.AddressId;
            glCashView.Comment      = "Mortgage Payment";
            glCashView.DebitAmount  = 0;
            glCashView.CreditAmount = expense;
            glCashView.FiscalPeriod = 9;
            glCashView.FiscalYear   = 2018;

            ledgerMod.GeneralLedger.CreateGeneralLedger(glCashView).Apply();
            ledgerMod.GeneralLedger.UpdateAccountBalances(glCashView);

            GeneralLedgerView glCashViewLookup =
                ledgerMod.GeneralLedger.Query().GetGeneralLedgerView(glCashView.DocNumber, glCashView.DocType);

            Assert.True(glCashViewLookup != null);
        }