Word Client ve GOOOD

This commit is contained in:
Игорь Гордеев 2024-08-03 21:44:27 +04:00
parent 984f319387
commit 6ce5987034
6 changed files with 67 additions and 24 deletions

View File

@ -132,13 +132,10 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{
var document = _saveToWord.CreateDoc(new WordInfoClient {
Title = "Список оплат",
ListPaymeant = _paymeantstorage.GetFillteredList(new PaymeantSearchModel {
ClientID = model.ClientID,
DateFrom = model.DateFrom,
DateTo = model.DateTo,
}),
DateFrom = model.DateFrom,
DateTo = model.DateTo,
Products = GetProducts(model)
});
return document;
}

View File

@ -32,14 +32,60 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Both
}
});
List<int> PaymentsID = new List<int>();
foreach (var pr in info.Products)
{
int id = pr.PaymentID;
if (PaymentsID.Contains(id) == false)
{
PaymentsID.Add(id);
}
}
foreach (var pre in info.ListPaymeant)
foreach (int id in PaymentsID)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ ($"Номер заказа: {pre.OrderID.ToString()}; Номер оплаты: {pre.ID.ToString()}; Статус оплаты: {pre.PayOption.ToString()}",
new WordTextProperties { Size = "24", Bold=false})},
Texts = new List<(string, WordTextProperties)> { ($"Номер оплаты: {id}", new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ("Номер товара Товар Цена Количество Статья затрат", new WordTextProperties { Bold = false, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
double sum = 0;
foreach (var products in info.Products)
{
if (products.PaymentID == id)
{
sum += products.Price * products.count;
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ($"{products.ID.ToString()} {products.ProductName.ToString()} " +
$"{ (products.Price * products.count).ToString()} {products.count.ToString()} " +
$"{products.CostItemName.ToString()}", new WordTextProperties { Bold = false, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
}
}
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { ($"Итого: {sum}\t", new WordTextProperties { Bold = false, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",

View File

@ -11,6 +11,6 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels
public DateTime DateTo { get; set; }
public List<PaymeantViewModel> ListPaymeant { get; set; } = new();
public List<ReportProductsViewModel>? Products { get; set; } = new();
}
}

View File

@ -12,7 +12,7 @@ namespace ElectronicsShopDataBaseImplement
optionsBuilder)
{
if (optionsBuilder.IsConfigured == false) {
optionsBuilder.UseSqlServer(@"Data Source=WIN-4HUIDGH3G02\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=WIN-S7AOPVO8GAA\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}

View File

@ -26,9 +26,9 @@
<div class="row">
<div class="col-8">
<a class="btn btn-primary btn-sm" asp-action="CreateWordReport" asp-route-DateFrom="@Model.Item1"
asp-route-DateTo="@Model.Item2" style="background-color:#335a95;">Экспорт отчета в .xlsx</a>
asp-route-DateTo="@Model.Item2" style="background-color:#335a95;">Экспорт отчета в .docx</a>
<a class="btn btn-primary btn-sm" asp-action="CreateExcelReport" asp-route-DateFrom="@Model.Item1"
asp-route-DateTo="@Model.Item2" style="background-color:#04713A;">Экспорт отчета в .docx</a>
asp-route-DateTo="@Model.Item2" style="background-color:#04713A;">Экспорт отчета в .xlsx</a>
<a class="btn btn-primary btn-sm" asp-action="CreatePdfReport" asp-route-DateFrom="@Model.Item1"
asp-route-DateTo="@Model.Item2" style="background-color:#ad0d09;">отправить на Email отчет в .pdf</a>
</div>