some done
This commit is contained in:
parent
b00571a4ac
commit
8c7437f666
@ -1,4 +1,5 @@
|
||||
using FurnitureAssembly_WorkerContracts.BindingModels;
|
||||
using FurnitureAssembly_WorkerBusinessLogic.OfficePackage.HelperModels;
|
||||
using FurnitureAssembly_WorkerContracts.BindingModels;
|
||||
using FurnitureAssembly_WorkerContracts.BusinessLogicContracts;
|
||||
using FurnitureAssembly_WorkerContracts.SearchModels;
|
||||
using FurnitureAssembly_WorkerContracts.StorageContracts;
|
||||
@ -67,16 +68,40 @@ namespace FurnitureAssembly_WorkerBusinessLogic.BusinessLogics
|
||||
/// <returns></returns>
|
||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||
{
|
||||
return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
|
||||
.Select(x => new ReportOrdersViewModel
|
||||
{
|
||||
Id = x.Id,
|
||||
DateCreate = x.DateCreate,
|
||||
SetName = x.SetName,
|
||||
Sum = x.Sum,
|
||||
var orders = _orderStorage
|
||||
.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo });
|
||||
var sets = _setStorage.GetFullList();
|
||||
var furnitureModules = _furnitureModuleStorage.GetFullList();
|
||||
var list = new List<ReportOrdersViewModel>();
|
||||
|
||||
})
|
||||
.ToList();
|
||||
foreach (var order in orders)
|
||||
{
|
||||
var record = new ReportOrdersViewModel
|
||||
{
|
||||
Id = order.Id,
|
||||
SetName = order.SetName,
|
||||
DateCreate = order.DateCreate,
|
||||
FurnitureModules = new List<(string, double)>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var set in sets)
|
||||
{
|
||||
if (set.Id == order.SetId)
|
||||
{
|
||||
foreach (var furnitureModule in furnitureModules)
|
||||
{
|
||||
if (set.SetFurnitureModules.ContainsKey(furnitureModule.Id))
|
||||
{
|
||||
record.FurnitureModules.Add(new(furnitureModule.Name, furnitureModule.Cost));
|
||||
record.TotalCount += set.SetFurnitureModules[furnitureModule.Id].Item2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение компонент в файл-Word
|
||||
|
@ -35,35 +35,18 @@ namespace FurnitureAssembly_WorkerBusinessLogic.OfficePackage
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
||||
CreateTable(new List<string> { "2cm", "3cm", "3cm", "3cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Мебельный модуль", "Сумма" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
foreach (var furnitureModule in order.)
|
||||
foreach (var furnitureModule in order.FurnitureModules)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SetName, order.Sum.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
}
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
foreach (var order in info.Orders)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SetName, order.Sum.ToString() },
|
||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), furnitureModule.Name, furnitureModule.Cost.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
@ -74,6 +57,7 @@ namespace FurnitureAssembly_WorkerBusinessLogic.OfficePackage
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
||||
});
|
||||
}
|
||||
SavePdf(info);
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FurnitureAssembly_WorkerBusinessLogic.OfficePackage.HelperModels;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.Rendering;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using FurnitureAssembly_WorkerDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -11,7 +12,8 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public DateTime DateCreate { get; set; }
|
||||
public string SetName { get; set; } = string.Empty;
|
||||
public List<(string FurnitureModule, int Count)> FurnitureModules { get; set; } = new();
|
||||
public List<(string Name, double Cost)> FurnitureModules { get; set; } = new();
|
||||
public int TotalCount { get; set; }
|
||||
public double Sum { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user