Пример #1
0
        public async Task <IActionResult> DeletePOQuote([FromBody] POQuoteView view)
        {
            POQuoteModule invMod  = new POQuoteModule();
            Poquote       poQuote = await invMod.POQuote.Query().MapToEntity(view);

            invMod.POQuote.DeletePOQuote(poQuote).Apply();

            return(Ok(view));
        }
Пример #2
0
        public async Task TestAddUpdatDelete()
        {
            AddressBook   customerAddress = null;
            AddressBook   supplierAddress = null;
            POQuoteModule POQuoteMod      = new POQuoteModule();
            PurchaseOrder purchaseOrder   = await POQuoteMod.PurchaseOrder.Query().GetEntityById(2);

            Customer customer = await POQuoteMod.Customer.Query().GetEntityById(1);

            Supplier supplier = await POQuoteMod.Supplier.Query().GetEntityById(3);

            customerAddress = await POQuoteMod.AddressBook.Query().GetEntityById(customer.AddressId);

            supplierAddress = await POQuoteMod.AddressBook.Query().GetEntityById(supplier.AddressId);


            POQuoteView view = new POQuoteView()
            {
                QuoteAmount     = 1234M,
                SubmittedDate   = DateTime.Parse("12/7/2019"),
                PurchaseOrderId = purchaseOrder.PurchaseOrderId,
                Remarks         = "Remarks",
                Sku             = "sku123",
                Description     = "description 123",
                SupplierId      = supplier.SupplierId,
                SupplierName    = supplierAddress?.Name,
                CustomerId      = customer.CustomerId,
                CustomerName    = customerAddress?.Name
            };
            NextNumber nnNextNumber = await POQuoteMod.POQuote.Query().GetNextNumber();

            view.PoquoteNumber = nnNextNumber.NextNumberValue;

            Poquote poQuote = await POQuoteMod.POQuote.Query().MapToEntity(view);

            POQuoteMod.POQuote.AddPOQuote(poQuote).Apply();

            Poquote newPOQuote = await POQuoteMod.POQuote.Query().GetEntityByNumber(view.PoquoteNumber);

            Assert.NotNull(newPOQuote);

            newPOQuote.Remarks = "Remarks Update";

            POQuoteMod.POQuote.UpdatePOQuote(newPOQuote).Apply();

            POQuoteView updateView = await POQuoteMod.POQuote.Query().GetViewById(newPOQuote.PoquoteId);

            Assert.Same(updateView.Remarks, "Remarks Update");
            POQuoteMod.POQuote.DeletePOQuote(newPOQuote).Apply();
            Poquote lookupPOQuote = await POQuoteMod.POQuote.Query().GetEntityById(view.PoquoteId);

            Assert.Null(lookupPOQuote);
        }
Пример #3
0
        public async Task <IActionResult> UpdatePOQuote([FromBody] POQuoteView view)
        {
            POQuoteModule invMod = new POQuoteModule();

            Poquote poQuote = await invMod.POQuote.Query().MapToEntity(view);


            invMod.POQuote.UpdatePOQuote(poQuote).Apply();

            POQuoteView retView = await invMod.POQuote.Query().GetViewById(poQuote.PoquoteId);


            return(Ok(retView));
        }
Пример #4
0
        public async Task <IActionResult> AddPOQuote([FromBody] POQuoteView view)
        {
            POQuoteModule invMod = new POQuoteModule();

            NextNumber nnPOQuote = await invMod.POQuote.Query().GetNextNumber();

            view.PoquoteNumber = nnPOQuote.NextNumberValue;

            Poquote poQuote = await invMod.POQuote.Query().MapToEntity(view);

            invMod.POQuote.AddPOQuote(poQuote).Apply();

            POQuoteView newView = await invMod.POQuote.Query().GetViewByNumber(view.PoquoteNumber);


            return(Ok(newView));
        }
Пример #5
0
        async Task TestCreateAccountReceivableFromPO()
        {
            AddressBook         addressBook      = null;
            AddressBook         buyerAddressBook = null;
            PurchaseOrderModule PurchaseOrderMod = new PurchaseOrderModule();
            ChartOfAccount      account          = await PurchaseOrderMod.ChartOfAccount.Query().GetEntityById(17);

            Supplier supplier = await PurchaseOrderMod.Supplier.Query().GetEntityById(3);

            if (supplier != null)
            {
                addressBook = await PurchaseOrderMod.AddressBook.Query().GetEntityById(supplier.AddressId);
            }
            Contract contract = await PurchaseOrderMod.Contract.Query().GetEntityById(1);

            Poquote poquote = await PurchaseOrderMod.POQuote.Query().GetEntityById(2);

            Buyer buyer = await PurchaseOrderMod.Buyer.Query().GetEntityById(1);

            if (buyer != null)
            {
                buyerAddressBook = await PurchaseOrderMod.AddressBook.Query().GetEntityById(buyer.AddressId);
            }
            TaxRatesByCode taxRatesByCode = await PurchaseOrderMod.TaxRatesByCode.Query().GetEntityById(1);

            PurchaseOrderView view = new PurchaseOrderView()
            {
                DocType               = "STD",
                PaymentTerms          = "Net 30",
                Amount                = 286.11M,
                AmountPaid            = 0,
                Remark                = "PO Remark",
                Gldate                = DateTime.Parse("11/29/2019"),
                AccountId             = account.AccountId,
                Location              = account.Location,
                BusUnit               = account.BusUnit,
                Subsidiary            = account.Subsidiary,
                SubSub                = account.SubSub,
                Account               = account.Account,
                AccountDescription    = account.Description,
                SupplierId            = supplier.SupplierId,
                CustomerId            = contract?.CustomerId,
                SupplierName          = addressBook.Name,
                ContractId            = contract?.ContractId,
                PoquoteId             = poquote?.PoquoteId,
                QuoteAmount           = poquote?.QuoteAmount,
                Description           = "PO Description",
                Ponumber              = "PO-123",
                TakenBy               = "David Nishimoto",
                ShippedToName         = " shipped name",
                ShippedToAddress1     = "shipped to address1",
                ShippedToAddress2     = "shipped to address2",
                ShippedToCity         = "shipped city",
                ShippedToState        = "ID",
                ShippedToZipcode      = "83709",
                BuyerId               = buyer.BuyerId,
                BuyerName             = buyerAddressBook?.Name,
                RequestedDate         = DateTime.Parse("11/29/2019"),
                PromisedDeliveredDate = DateTime.Parse("11/29/2019"),
                Tax                 = 0M,
                TransactionDate     = DateTime.Parse("11/29/2019"),
                TaxCode1            = taxRatesByCode.TaxCode,
                TaxCode2            = "",
                TaxRate             = taxRatesByCode.TaxRate ?? 0,
                PurchaseOrderNumber = (await PurchaseOrderMod.PurchaseOrder.Query().GetNextNumber()).NextNumberValue
            };

            PurchaseOrder purchaseOrder = await PurchaseOrderMod.PurchaseOrder.Query().MapToEntity(view);

            PurchaseOrderMod.PurchaseOrder.AddPurchaseOrder(purchaseOrder).Apply();

            Udc udcAccountReceivableType = await PurchaseOrderMod.Udc.Query().GetEntityById(66);

            ChartOfAccount coaAccountReceivable = await PurchaseOrderMod.ChartOfAccount.Query().GetEntityById(4);

            AccountReceivable accountReceivable = await PurchaseOrderMod.AccountReceivable.Query().MapEntityFromPurchaseOrder(purchaseOrder, udcAccountReceivableType, coaAccountReceivable);

            PurchaseOrderMod.AccountReceivable.AddAccountReceivable(accountReceivable).Apply();
        }
Пример #6
0
 public IFluentPOQuote DeletePOQuote(Poquote deleteObject)
 {
     unitOfWork.poQuoteRepository.DeleteObject(deleteObject);
     this.processStatus = CreateProcessStatus.Delete;
     return(this as IFluentPOQuote);
 }
Пример #7
0
 public IFluentPOQuote UpdatePOQuote(Poquote updateObject)
 {
     unitOfWork.poQuoteRepository.UpdateObject(updateObject);
     this.processStatus = CreateProcessStatus.Update;
     return(this as IFluentPOQuote);
 }
Пример #8
0
 public IFluentPOQuote AddPOQuote(Poquote newObject)
 {
     unitOfWork.poQuoteRepository.AddObject(newObject);
     this.processStatus = CreateProcessStatus.Insert;
     return(this as IFluentPOQuote);
 }