Exemplo n.º 1
0
        public IActionResult Quotation(int id)
        {
            var quote = _salesService.GetSalesQuotationById(id);

            var quoteDto = new Dto.Sales.SalesQuotation()
            {
                Id            = quote.Id,
                CustomerId    = quote.CustomerId,
                CustomerName  = quote.Customer.Party.Name,
                QuotationDate = quote.Date,
                PaymentTermId = quote.PaymentTermId,
                ReferenceNo   = quote.ReferenceNo
            };


            foreach (var line in quote.SalesQuoteLines)
            {
                var lineDto = new Dto.Sales.SalesQuotationLine()
                {
                    Id            = line.Id,
                    ItemId        = line.ItemId,
                    MeasurementId = line.MeasurementId,
                    Quantity      = line.Quantity,
                    Amount        = line.Amount,
                    Discount      = line.Discount
                };
                quoteDto.SalesQuotationLines.Add(lineDto);
            }

            return(new ObjectResult(quoteDto));
        }
Exemplo n.º 2
0
        public IActionResult Quotations()
        {
            var quotes = _salesService.GetSalesQuotes();

            var quoteDtos = new List <Dto.Sales.SalesQuotation>();

            foreach (var quote in quotes)
            {
                var quoteDto = new Dto.Sales.SalesQuotation()
                {
                    Id            = quote.Id,
                    No            = quote.No,
                    CustomerId    = quote.CustomerId,
                    CustomerName  = quote.Customer.Party.Name,
                    PaymentTermId = quote.PaymentTermId,
                    QuotationDate = quote.Date,
                    ReferenceNo   = quote.ReferenceNo
                };

                foreach (var line in quote.SalesQuoteLines)
                {
                    var lineDto = new Dto.Sales.SalesQuotationLine()
                    {
                        ItemId        = line.ItemId,
                        MeasurementId = line.MeasurementId,
                        Quantity      = line.Quantity,
                        Amount        = line.Amount,
                        Discount      = line.Discount
                    };
                    quoteDto.SalesQuotationLines.Add(lineDto);
                }

                quoteDtos.Add(quoteDto);
            }

            return(new ObjectResult(quoteDtos.OrderBy(q => q.Id).Reverse()));
        }