From b4933ae46a290dd0303de3bf57c6e57fd12d390e Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Fri, 19 May 2023 21:05:26 +0400 Subject: [PATCH 1/2] . --- .../BusinessLogics/ReportCashierLogic.cs | 47 +++++++++++++----- .../OfficePackage/AbstractSaveToExcel.cs | 46 +++++++++++++---- .../ReportSupportBindingModel.cs | 8 +-- .../Implements/CardStorage.cs | 9 ++++ .../Implements/DebitingStorage.cs | 1 - .../Отчёт по переводам.xls | Bin 3160 -> 3483 bytes 6 files changed, 83 insertions(+), 28 deletions(-) diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportCashierLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportCashierLogic.cs index 6dbf8c7..9b66f74 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportCashierLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportCashierLogic.cs @@ -5,6 +5,7 @@ using BankYouBankruptContracts.BusinessLogicsContracts; using BankYouBankruptContracts.SearchModels; using BankYouBankruptContracts.StoragesContracts; using BankYouBankruptContracts.ViewModels; +using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptDataModels.Enums; using System; using System.Collections.Generic; @@ -22,6 +23,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics private readonly IClientStorage _clientStorage; + private readonly IDebitingStorage _debitingStorage; + + private readonly ICardStorage _cardStorage; + private readonly AbstractSaveToExcel _saveToExcel; private readonly AbstractSaveToWordCashier _saveToWord; @@ -31,7 +36,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics //инициализируем поля класса через контейнер public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage, IClientStorage clientStorage, AbstractSaveToExcel saveToExcel, - AbstractSaveToWordCashier saveToWord, AbstractSaveToPdf saveToPdf) + AbstractSaveToWordCashier saveToWord, AbstractSaveToPdf saveToPdf, + IDebitingStorage debitingStorage, ICardStorage cardStorage) { _moneyTransferStorage = moneyTransferStorage; _cashWithdrawalStorage = cashWithdrawalStorage; @@ -40,6 +46,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics _saveToWord = saveToWord; _saveToPdf = saveToPdf; _clientStorage = clientStorage; + _debitingStorage = debitingStorage; + _cardStorage = cardStorage; } //формирование списка переводов между счетами за период @@ -73,18 +81,33 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics } //формирование списка выдаци наличных со счёта за период - public List? GetDebitings(ReportBindingModel model) + public List? GetDebitings(ReportBindingModel model) { - return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel { ClientId = model.ClientId, DateFrom = model.DateFrom, DateTo = model.DateTo }) - .Select(x => new ReportCashierViewModel + List CardIdList = new(); + + var list = _cardStorage.GetFilteredList(new CardSearchModel + { + AccountId = model.AccountId + }); + + foreach(var index in list) + { + CardIdList.Add(index.Id); + } + + List totalList = new(); + + foreach(var index in CardIdList) + { + var result = _debitingStorage.GetFilteredList(new DebitingSearchModel { - OperationId = x.Id, - DateComplite = x.DateOperation, - AccountPayeeNumber = x.AccountPayeeNumber, - AccountSenderNumber = x.AccountSenderNumber, - SumOperation = x.Sum - }) - .ToList(); + CardId = index + }); + + totalList.AddRange(result); + } + + return totalList; } //формирование полного имени клиента для отчёта @@ -113,7 +136,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics Title = "Заявки на счёт", - Debiting = null + Debiting = GetDebitings(model) }, ExcelOperationEnum.Для_кассира); } diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 77e765a..30c4179 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -397,27 +397,27 @@ namespace BankYouBankruptBusinessLogic.OfficePackage { ColumnName = "A", RowIndex = rowIndex, - Text = "Снятие №" + cr.Id, + Text = "Заявка №" + cr.Id, StyleInfo = ExcelStyleInfoType.Text }); rowIndex++; - //строчка с номером счёта отправителя + //строчка с номером счёта получателя InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "B", RowIndex = rowIndex, - Text = "Номер карты: ", + Text = "Сумма заявки: ", StyleInfo = ExcelStyleInfoType.TextWithBorder }); - //вставка номера отправителя + //вставка суммы заявки InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "C", RowIndex = rowIndex, - Text = cr.CardNumber, + Text = cr.Sum.ToString(), StyleInfo = ExcelStyleInfoType.TextWithBorder }); @@ -428,7 +428,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage { ColumnName = "B", RowIndex = rowIndex, - Text = "Сумма снятия: ", + Text = "Статус: ", StyleInfo = ExcelStyleInfoType.TextWithBorder }); @@ -437,7 +437,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage { ColumnName = "C", RowIndex = rowIndex, - Text = cr.Sum.ToString(), + Text = cr.Status.ToString(), StyleInfo = ExcelStyleInfoType.TextWithBorder }); @@ -450,21 +450,45 @@ namespace BankYouBankruptBusinessLogic.OfficePackage { ColumnName = "A", RowIndex = rowIndex, - Text = "Суммарный объём снятий: ", + Text = "Суммарный объём открытых заявок на снятие: ", StyleInfo = ExcelStyleInfoType.Text }); MergeCells(new ExcelMergeParameters { CellFromName = "A" + rowIndex.ToString(), - CellToName = "B" + rowIndex.ToString() + CellToName = "C" + rowIndex.ToString() }); InsertCellInWorksheet(new ExcelCellParameters { - ColumnName = "C", + ColumnName = "D", RowIndex = rowIndex, - Text = info.Crediting.Sum(x => x.Sum).ToString(), + Text = info.Debiting.Where(x => x.Status == StatusEnum.Открыта).Sum(x => x.Sum).ToString(), + StyleInfo = ExcelStyleInfoType.Text + }); + + rowIndex += 2; + + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = "Суммарный объём закртытых заявок на снятие: ", + StyleInfo = ExcelStyleInfoType.Text + }); + + MergeCells(new ExcelMergeParameters + { + CellFromName = "A" + rowIndex.ToString(), + CellToName = "C" + rowIndex.ToString() + }); + + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "D", + RowIndex = rowIndex, + Text = info.Debiting.Where(x => x.Status == StatusEnum.Закрыта).Sum(x => x.Sum).ToString(), StyleInfo = ExcelStyleInfoType.Text }); diff --git a/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs b/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs index 744c0f1..693079c 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs @@ -10,13 +10,13 @@ namespace BankYouBankruptContracts.BindingModels //вспомогательная модель для передачи DateTime при формировании отчёта public class ReportSupportBindingModel { - public int ClientId { get; set; } + public int? ClientId { get; set; } - public int AccountId { get; set; } + public int? AccountId { get; set; } - public DateTime DateFrom { get; set; } + public DateTime? DateFrom { get; set; } - public DateTime DateTo { get; set; } + public DateTime? DateTo { get; set; } //для Excel отчёта клиента public List? CardList { get; set; } diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs index 2333ddd..4bea9a8 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CardStorage.cs @@ -65,6 +65,15 @@ namespace BankYouBankruptDatabaseImplement.Implements .ToList(); } + if (model.AccountId.HasValue) + { + return context.Cards + .Include(x => x.Client) + .Where(x => x.AccountId == model.AccountId) + .Select(x => x.GetViewModel) + .ToList(); + } + return context.Cards .Include(x => x.Client) .Select(x => x.GetViewModel) diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs index 13e5b94..e46230c 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs @@ -32,7 +32,6 @@ namespace BankYouBankruptDatabaseImplement.Implements var result = context.Debitings.Include(x => x.Card).ToList(); - //для получения всех заявок на стнятие со статусом "Открыта" if (model.Status.HasValue) result = result.Where(x => x.Status == model.Status).ToList(); diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по переводам.xls b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по переводам.xls index 2180e12a857793cb8fd7c42318d6285869b17907..5ca769e950ae34531443bc753a7c1285cb19c693 100644 GIT binary patch delta 1827 zcmZuy3pCVe8=o0w%-v9!7?>?;xJ1#X9Ap zptv0bg2O>s{2I@;*WXf}f~ZwHm&2n%{lmjU&EpvKYng6QEkv}VV7%`U ziBYKVivhinD#j3w8R__&2JCpEUeSD%1RLT1w?tMaEIFy!z4ml+npxE;;>JVgIA}$t zTlohbGPdtwH`O~gAhNKM!Ah&se|g2c1KEgAwRiqQ`(XPv&EArmx5iGp1`ImsK<;y` z+oqW-S+rmKO=cyVb6M~9A_N4_h(qW1)=$V3$FnMi?kehUw`%@2pkT6Q@-JMUH%y{SenO-4pxHgob}lJx8eGXFH7O?yrG{Ghkz9oSaJe#VpVRR z2a=CNfIt8(asr}5s8O`Qf5k*y2n&vuv+$BjIniQ^>l9Sa2y2g~56(w&Vd^3FKK&F- zW_*b2>%{rn;YOo{`M4@ba9#t%I8yzN&2B{+$8lI%*S#6M_)$!+|LTm;jz^jIT6Xuc zlHQ;Zb^f@`YSgt7cQnumYS%6n{eCIsddA&b5klG>Lt3Y$n|tV6(Y6MDtAl3fk;t** z%nV-fblXU2y84tw2=6=bp1j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 8f3fb80e9075d563efb786a3956a2787c8762fb3 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Fri, 19 May 2023 21:09:54 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=D0=93=D0=BE=D1=82=D0=BE=D0=B2=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=BE=D1=82=D1=87=D1=91=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=81=D1=81=D0=B8=D1=80=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankYouBankruptCashierApp/Views/Home/MoneyTransfers.cshtml | 2 +- .../BankYouBankruptRestAPI/Controllers/ReportController.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/MoneyTransfers.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/MoneyTransfers.cshtml index b4ccb2b..ba338e1 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/MoneyTransfers.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/MoneyTransfers.cshtml @@ -3,7 +3,7 @@ }
-

Перевод меджу счетами

+

Перевод между счетами

diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs index e1f641d..83b592b 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs @@ -160,7 +160,7 @@ namespace BankYouBankruptRestAPI.Controllers { _reportCashierLogic.SaveAccountsToExcelFile(new ReportBindingModel { - FileName = "Отчёт по переводам.xls", + FileName = "Отчёт по зявкам на снятие.xls", AccountId = model.AccountId }); }