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