public IHttpActionResult GetExportedFilePath([FromUri] int customerId, [FromUri] DateTime startDate, [FromUri] DateTime closeDate, [FromUri] bool ifShowUnclosed) { var templatePath = @"D:\Template\FBA-InvoiceReport-Template.xls"; var excelGenerator = new FBAInvoiceHelper(templatePath); var warehouseLocationsInDb = _context.WarehouseLocations.Select(x => x.WarehouseCode).ToArray(); //如果customerId等于0说明是要所有客户的记录,包括没有关闭的订单 if (customerId == 0) { var info = excelGenerator.GetAllFBACustomerChargingReportFromDate(startDate, closeDate, warehouseLocationsInDb); var path = excelGenerator.GenerateExcelFileForAllCustomerAndReturnPath(info); return(Ok(path)); } else if (ifShowUnclosed) { var info = excelGenerator.GetAllChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate, warehouseLocationsInDb); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } else // 仅仅生成已关闭的订单 { var info = excelGenerator.GetClosedChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate, warehouseLocationsInDb); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } }
// GET /api/fba/fbamasterorder/?customerCode={foo}&startDate={bar}&endDate={foo} public IHttpActionResult GetContianerReport([FromUri] string customerCode, [FromUri] DateTime startDate, [FromUri] DateTime endDate) { endDate = endDate.AddDays(1); var helper = new FBAInvoiceHelper(); return(Ok(helper.GetContainerFeeSummary(customerCode, startDate, endDate))); }
public IHttpActionResult DownloadChargingReportFormOrder([FromUri] string reference, [FromUri] string invoiceType) { var templatePath = @"D:\Template\FBA-InvoiceReport-Template.xls"; var excelGenerator = new FBAInvoiceHelper(templatePath); var info = excelGenerator.GetChargingReportFormOrder(reference, invoiceType); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); }
public IHttpActionResult GetExportedInvoiceFilePath([FromUri] string operation, [FromBody] ExpenseQueryData data) { if (operation != "GetInvoice") { throw new Exception("Invailed operation code: " + operation); } var templatePath = @"D:\Template\FBA-InvoiceReport-Template.xls"; var excelGenerator = new FBAInvoiceHelper(templatePath); var startDate = new DateTime(data.StartDate.Year, data.StartDate.Month, data.StartDate.Day); var closeDate = new DateTime(data.CloseDate.Year, data.CloseDate.Month, data.CloseDate.Day).AddDays(1); var warehouseLocationsInDb = _context.WarehouseLocations.Select(x => x.WarehouseCode).ToArray(); var warehouseLocations = data.WarehouseLocation.Length > 0 ? data.WarehouseLocation : warehouseLocationsInDb; var customerId = 0; if (data.CustomerCode != "ALL") { customerId = _context.UpperVendors.SingleOrDefault(x => x.CustomerCode == data.CustomerCode).Id; } //如果customerId等于0说明是要所有客户的记录,包括没有关闭的订单 if (customerId == 0) { var info = excelGenerator.GetAllFBACustomerChargingReportFromDate(startDate, closeDate, warehouseLocations); var path = excelGenerator.GenerateExcelFileForAllCustomerAndReturnPath(info); return(Ok(path)); } else if (data.IfShowUnclosed) { var info = excelGenerator.GetAllChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate, warehouseLocations); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } else // 仅仅生成已关闭的订单 { var info = excelGenerator.GetClosedChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate, warehouseLocations); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } }
public IHttpActionResult GetExportedFilePathByCustomerCode([FromUri] string customerCode, [FromUri] DateTime startDate, [FromUri] DateTime closeDate, [FromUri] bool ifShowUnclosed) { var templatePath = @"D:\Template\FBA-InvoiceReport-Template.xls"; var excelGenerator = new FBAInvoiceHelper(templatePath); startDate = new DateTime(startDate.Year, startDate.Month, startDate.Day); closeDate = new DateTime(closeDate.Year, closeDate.Month, closeDate.Day).AddDays(1); var customerId = 0; if (customerCode != "ALL") { customerId = _context.UpperVendors.SingleOrDefault(x => x.CustomerCode == customerCode).Id; } var warehouseLocationsInDb = _context.WarehouseLocations.Select(x => x.WarehouseCode).ToArray(); //如果customerId等于0说明是要所有客户的记录 if (customerId == 0) { var info = excelGenerator.GetAllFBACustomerChargingReportFromDate(startDate, closeDate, warehouseLocationsInDb); var path = excelGenerator.GenerateExcelFileForAllCustomerAndReturnPath(info); return(Ok(path)); } else if (ifShowUnclosed) { var info = excelGenerator.GetAllChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate, warehouseLocationsInDb); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } else { var info = excelGenerator.GetClosedChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate, warehouseLocationsInDb); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } }
public IHttpActionResult GetExportedFilePath([FromUri] int customerId, [FromUri] DateTime startDate, [FromUri] DateTime closeDate) { var templatePath = @"D:\Template\FBA-InvoiceReport-Template.xls"; var excelGenerator = new FBAInvoiceHelper(templatePath); //如果customerId等于0说明是要所有客户的记录 if (customerId == 0) { var info = excelGenerator.GetAllFBACustomerChargingReportFromDate(startDate, closeDate); var path = excelGenerator.GenerateExcelFileForAllCustomerAndReturnPath(info); return(Ok(path)); } else { var info = excelGenerator.GetChargingReportFormDateRangeAndCustomerId(customerId, startDate, closeDate); var path = excelGenerator.GenerateExcelFileAndReturnPath(info); return(Ok(path)); } }
public IHttpActionResult DownloadPdf([FromUri] string operation, [FromBody] USPrimeOrderDto order) { var customerInDb = _context.UpperVendors.SingleOrDefault(x => x.CustomerCode == order.customerCode); order.customerName = customerInDb.Name; order.address_1 = customerInDb.FirstAddressLine; order.address_2 = customerInDb.SecondAddressLine; var templatePath = @"D:\Template\PRIME-DN-TEMPLATE.xlsx"; var g = new FBAInvoiceHelper(templatePath); var path = g.GenerateSingleDN(order); if (operation == "EMAIL") { var destMail = customerInDb.EmailAddress; //var mailService = new MailServiceManager(); //mailService.SendMail(destMail, null, order.cc, path, "USPRIME-DN"); var mailService = new MailServiceManager("*****@*****.**", "#lxX.Py#h,9s"); mailService.SendMailFromUSPRIME(destMail, null, order.cc, path, $"USPRIME-DN-{order.hblNumber.Substring(6)}"); } return(Ok(path)); }