From c754bcf4efa169efeaedbd1796e430a4d6127d59 Mon Sep 17 00:00:00 2001
From: Programmist73 <egor.eliseev.1986@mail.ru>
Date: Thu, 18 May 2023 13:29:34 +0400
Subject: [PATCH] Completed PDF report for Cashier.

---
 .../BusinessLogics/CashWithdrawalLogic.cs         | 15 +++++++--------
 .../Controllers/HomeController.cs                 |  2 +-
 .../BusinessLogicsContracts/IReportClientLogic.cs |  2 ++
 .../Implements/DebitingStorage.cs                 |  2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs
index 1a61cdd..85a64d4 100644
--- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs
+++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs
@@ -75,15 +75,15 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
 		{
 			CheckModel(model);
 
-			if (_cashWithdrawalStorage.Insert(model) == null)
-			{
-				_logger.LogWarning("Insert operation failed");
-
-				return false;
-			}
-
 			if (flag)
 			{
+				if (_cashWithdrawalStorage.Insert(model) == null)
+				{
+					_logger.LogWarning("Insert operation failed");
+
+					return false;
+				}
+
 				_debitingStorage.Update(new DebitingBindingModel
 				{
 					Id = model.DebitingId,
@@ -101,7 +101,6 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
 				});
 			}
 
-
 			return true;
 		}
 
diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs
index 27b5ced..d94550d 100644
--- a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs
+++ b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs
@@ -266,7 +266,7 @@ namespace BankYouBankruptClientApp.Controllers
                 DateTo = dateTo
             });
 
-			Response.Redirect("Index");
+			Response.Redirect("CreditingList");
 		}
 
         #endregion
diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs
index 1fd2e1f..03c7b09 100644
--- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs
+++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs
@@ -17,10 +17,12 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts
 
         //Сохранение отчёта по картам в файл-Word
         void SaveCreditingToWordFile(ReportBindingModel model);
+
         void SaveDebitingToWordFile(ReportBindingModel model);
 
         //Сохранение отчёта по картам в файл-Excel
         void SaveCreditingToExcelFile(ReportBindingModel model);
+
         void SaveDebitingToExcelFile(ReportBindingModel model);
 
         //Сохранение отчёта по картам в файл-Pdf
diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs
index 6b7a6fb..066112b 100644
--- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs
@@ -49,7 +49,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
 			{
 				return context.Debitings
 					.Include(x => x.Card)
-					.Where(x => x.DateOpen <= model.DateFrom && x.DateClose >= model.DateTo)
+					.Where(x => x.DateOpen <= model.DateFrom && x.DateClose >= model.DateTo && x.Status != StatusEnum.Отклонено)
 					.Select(x => x.GetViewModel)
 					.ToList();
 			}