This commit is contained in:
abazov73 2023-05-20 04:35:54 +04:00
commit 8dbebb5ebd
7 changed files with 128 additions and 17 deletions

View File

@ -128,7 +128,7 @@ namespace BankBusinessLogic.BusinessLogics
{ {
CurrencyId = currency.Id, CurrencyId = currency.Id,
CurrencyName = currency.Name, CurrencyName = currency.Name,
Transfers = new List<(int TransferId, float Amount)>(), Transfers = new List<TransferViewModel>(),
}; };
var paymentsId = new List<int>(); var paymentsId = new List<int>();
foreach(var payment in payments) foreach(var payment in payments)
@ -141,7 +141,7 @@ namespace BankBusinessLogic.BusinessLogics
{ {
if (paymentId == transfer.PaymentId) if (paymentId == transfer.PaymentId)
{ {
record.Transfers.Add(new(transfer.Id, transfer.Amount)); record.Transfers.Add(transfer);
} }
} }
} }
@ -160,6 +160,7 @@ namespace BankBusinessLogic.BusinessLogics
{ {
CurrencyPurchaseId = purchase.Id, CurrencyPurchaseId = purchase.Id,
PurchaseDate = purchase.PurchaseDate, PurchaseDate = purchase.PurchaseDate,
CurrencyName = purchase.CurrencyName,
Payments = new List<(int PaymentId, string PaymentDate)>(), Payments = new List<(int PaymentId, string PaymentDate)>(),
}; };
var paymentsId = new List<int>(); var paymentsId = new List<int>();

View File

@ -69,21 +69,74 @@ namespace BankBusinessLogic.OfficePackage
rowIndex++; rowIndex++;
} }
rowIndex++;
}
//InsertCellInWorksheet(new ExcelCellParameters return SaveExcel();
//{ }
// ColumnName = "A",
// RowIndex = rowIndex, public MemoryStream CreateBankOperatorReport(ExcelInfo info)
// Text = "Итого", {
// StyleInfo = ExcelStyleInfoType.Text if (info.Currencies == null)
//}); {
//InsertCellInWorksheet(new ExcelCellParameters throw new ArgumentNullException("Данные для отчета не найдены!",
//{ nameof(info.Currencies));
// ColumnName = "C", }
// RowIndex = rowIndex,
// Text = pc.TotalCount.ToString(), CreateExcel();
// StyleInfo = ExcelStyleInfoType.Text
//}); InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = 1,
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
uint rowIndex = 2;
foreach (var currency in info.Currencies)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Валюта № " + currency.CurrencyId,
StyleInfo = ExcelStyleInfoType.Text
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = currency.CurrencyName,
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
foreach (var transfer in currency.Transfers)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = "Зачисление № " + transfer.Id,
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "D",
RowIndex = rowIndex,
Text = transfer.Amount.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
}
rowIndex++; rowIndex++;
} }

View File

@ -52,6 +52,60 @@ namespace BankBusinessLogic.OfficePackage
} }
return SaveWord(info); return SaveWord(info);
} }
public MemoryStream CreateBankOperatorDoc(WordInfo info)
{
if (info.Currencies == null)
{
throw new ArgumentNullException("Данные для отчета не найдены!",
nameof(info.Currencies));
}
CreateWord();
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var currency in info.Currencies)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ ("Зачисление по валюте: " + currency.CurrencyName+ ". ",
new WordTextProperties { Size = "24", Bold = true })},
TextProperties = new WordTextProperties
{
Size = "18",
JustificationType = WordJustificationType.Both
}
});
foreach (var transfer in currency.Transfers)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ ("Зачисление №" + transfer.Id + ". ",
new WordTextProperties { Size = "18", Bold = true }),
("Дата: " + transfer.TransferDateTime.ToString(),
new WordTextProperties { Size = "18", }),
("Сумма: " + transfer.Amount.ToString(),
new WordTextProperties
{ Size = "18", }) },
TextProperties = new WordTextProperties
{
Size = "18",
JustificationType = WordJustificationType.Both
}
});
}
}
return SaveWord(info);
}
/// <summary> /// <summary>
/// Создание doc-файла /// Создание doc-файла
/// </summary> /// </summary>

View File

@ -12,5 +12,6 @@ namespace BankBusinessLogic.OfficePackage.HelperModels
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ReportPaymentCurrencyPurchaseViewModel>? Payments { get; set; } public List<ReportPaymentCurrencyPurchaseViewModel>? Payments { get; set; }
public List<ReportCurrencyTransferViewModel>? Currencies { get; set; }
} }
} }

View File

@ -12,5 +12,6 @@ namespace BankBusinessLogic.OfficePackage.HelperModels
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ReportPaymentCurrencyPurchaseViewModel>? Payments { get; set; } public List<ReportPaymentCurrencyPurchaseViewModel>? Payments { get; set; }
public List<ReportCurrencyTransferViewModel>? Currencies { get; set; }
} }
} }

View File

@ -10,6 +10,7 @@ namespace BankContracts.ViewModels
{ {
public int CurrencyPurchaseId { get; set; } public int CurrencyPurchaseId { get; set; }
public DateTime PurchaseDate { get; set; } public DateTime PurchaseDate { get; set; }
public string CurrencyName { get; set; }
public List<(int PaymentId, string PaymentDate)> Payments { get; set; } = new(); public List<(int PaymentId, string PaymentDate)> Payments { get; set; } = new();
} }
} }

View File

@ -10,6 +10,6 @@ namespace BankContracts.ViewModels
{ {
public int CurrencyId { get; set; } public int CurrencyId { get; set; }
public string CurrencyName { get; set; } = string.Empty; public string CurrencyName { get; set; } = string.Empty;
public List<(int TransferId, float Amount)> Transfers { get; set; } = new(); public List<TransferViewModel> Transfers { get; set; } = new();
} }
} }