Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
b525d939c8
@ -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<ReportCashierViewModel>? GetDebitings(ReportBindingModel model)
|
||||
public List<DebitingViewModel>? GetDebitings(ReportBindingModel model)
|
||||
{
|
||||
return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel { ClientId = model.ClientId, DateFrom = model.DateFrom, DateTo = model.DateTo })
|
||||
.Select(x => new ReportCashierViewModel
|
||||
List<int> CardIdList = new();
|
||||
|
||||
var list = _cardStorage.GetFilteredList(new CardSearchModel
|
||||
{
|
||||
OperationId = x.Id,
|
||||
DateComplite = x.DateOperation,
|
||||
AccountPayeeNumber = x.AccountPayeeNumber,
|
||||
AccountSenderNumber = x.AccountSenderNumber,
|
||||
SumOperation = x.Sum
|
||||
})
|
||||
.ToList();
|
||||
AccountId = model.AccountId
|
||||
});
|
||||
|
||||
foreach(var index in list)
|
||||
{
|
||||
CardIdList.Add(index.Id);
|
||||
}
|
||||
|
||||
List<DebitingViewModel> totalList = new();
|
||||
|
||||
foreach(var index in CardIdList)
|
||||
{
|
||||
var result = _debitingStorage.GetFilteredList(new DebitingSearchModel
|
||||
{
|
||||
CardId = index
|
||||
});
|
||||
|
||||
totalList.AddRange(result);
|
||||
}
|
||||
|
||||
return totalList;
|
||||
}
|
||||
|
||||
//формирование полного имени клиента для отчёта
|
||||
@ -113,7 +136,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
Title = "Заявки на счёт",
|
||||
|
||||
Debiting = null
|
||||
Debiting = GetDebitings(model)
|
||||
}, ExcelOperationEnum.Для_кассира);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
});
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Перевод меджу счетами</h2>
|
||||
<h2 class="display-4">Перевод между счетами</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
|
@ -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<int>? CardList { get; set; }
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
{
|
||||
_reportCashierLogic.SaveAccountsToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по переводам.xls",
|
||||
FileName = "Отчёт по зявкам на снятие.xls",
|
||||
AccountId = model.AccountId
|
||||
});
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user