Ejemplo n.º 1
0
        public FileContentResult UnloadingInvoiceExcel(Guid invoiceId, Boolean mockData = false)
        {
            var invoiceReportModel = invoiceReportService
                                     .GetOrCreateReport(invoiceId, InvoiceFormatType.Unloading)
                                     as UnloadingInvoiceModel;

            invoiceReportModel.AllWorkOrdersInfo = invoiceRepository.FindById(invoiceId).InvoiceLineItem.Select(i => unloadingWorkOrderQueries.FindOverviewById(i.WorkOrder.Id)).OrderBy(i => i.Start.Value);

            var excelGenerator = new ExportInvoiceReportToExcel();

            var fileBytes = excelGenerator.GenerateUnloadingInvoiceReport(invoiceReportModel);

            var reportFileName = String.Format("UnloadingInvoiceReport.xlsx");

            return(File(fileBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", reportFileName));
        }
Ejemplo n.º 2
0
        public async Task Checkout(int id, DateTime checkoutDate)
        {
            var invoice = await _repository.FindById(id);

            await ThrowExceptionIfInvoiceItemsAreNotUpForSale(invoice);

            var totalPrice = await _repository.GetTotalPrice(invoice);

            invoice.CheckoutDate = checkoutDate;

            AddAccountingDocument(invoice, totalPrice);
            DecreaseWarehouseItemsStock(invoice);

            await _unitOfWork.CompleteAsync();
        }