diff --git a/Back/Validations/AUInvoicePayValidation.cs b/Back/Validations/AUInvoicePayValidation.cs
index f9be89b..707f41a 100644
--- a/Back/Validations/AUInvoicePayValidation.cs
+++ b/Back/Validations/AUInvoicePayValidation.cs
@@ -27,19 +27,24 @@ namespace Back.Validations
RuleFor(r => r)
.Custom((model, context) =>
{
- if (model.Item2 != null && model.Item2 > 0)
- {
- var invoice = servInvoice.GetInvoiceByInvoiceID(model.Item1, model.Item2).Result;
- if (invoice == null)
- context.AddFailure("صورتحساب یافت نشد");
-
-
- else
+ if (model.Item2 != null && model.Item2 > 0)
{
- if (model.Item4 == eActionValidation.update || model.Item4 == eActionValidation.add)
+ var invoice = servInvoice.GetInvoiceByInvoiceID(model.Item1, model.Item2).Result;
+ if (invoice == null)
+ context.AddFailure("صورتحساب یافت نشد");
+
+
+ else
{
- var totalpay = invoice.payments.Sum(s => s.pv).GetValueOrDefault() + model.Item3.pv;
- if (totalpay > invoice.tbill) context.AddFailure("مجموع مبلغ پرداختی نمی تواند از مجموع صورتحساب بیشتر باشد.");
+ if (model.Item4 == eActionValidation.update || model.Item4 == eActionValidation.add)
+ {
+ if (model.Item3.pv <= 0)
+ {
+ context.AddFailure("مبلغ پرداختی باید بیشتر از صفر باشد.");
+ }
+
+ var totalpay = invoice.payments.Sum(s => s.pv).GetValueOrDefault() + model.Item3.pv;
+ if (totalpay > invoice.tbill) context.AddFailure("مجموع مبلغ پرداختی نمی تواند از مجموع صورتحساب بیشتر باشد.");
else
{
if (model.Item3.pmt.HasValue && model.Item3.pmt.Value > 0 && model.Item3.pmt.Value < 9)
@@ -50,13 +55,23 @@ namespace Back.Validations
}
else
{
+ var today = Convert.ToInt32(DateTime.Now.ConvertMiladiToShamsi());
string paydate = model.Item3.PaymentDateTime.Replace("/", "");
+
if (paydate.Length == 8 && int.TryParse(paydate, out int _paydate))
{
- if (Convert.ToInt32(invoice.InvoiceDate) > _paydate)
+ if (today >= _paydate)
{
- context.AddFailure("تاریخ پرداخت نمیتواند از تاریخ صورتحساب عقبتر باشد");
+ if (Convert.ToInt32(invoice.InvoiceDate) > _paydate)
+ {
+ context.AddFailure("تاریخ پرداخت نمیتواند از تاریخ صورتحساب عقبتر باشد");
+ }
}
+ else
+ {
+ context.AddFailure("تاریخ پرداخت نمی تواند از امروز جلوتر باشد");
+ }
+
}
else context.AddFailure("تاریخ صحیح نمی باشد");
@@ -67,7 +82,7 @@ namespace Back.Validations
}
- }
+ }
if (servTaxPayer.ExistSuccessfulorSendorpendingInvoice(invoice).Result)
context.AddFailure("این صورتحساب به سازمان ارسال شده" + '\n' +
diff --git a/Shared/DTOs/InvoiceDtos.cs b/Shared/DTOs/InvoiceDtos.cs
index cd28c63..49e2e35 100644
--- a/Shared/DTOs/InvoiceDtos.cs
+++ b/Shared/DTOs/InvoiceDtos.cs
@@ -120,31 +120,31 @@ namespace Shared.DTOs
public class InvoicePaymentDTO
{
public int? ID { get; set; }
- [MaxLength(9)]
+ //[MaxLength(9)]
public string? iinn { get; set; }
//شماره پذیرنده فروشگاهی
- [MaxLength(14)]
+ //[MaxLength(14)]
public string? acn { get; set; }
//شماره پایانه
- [MaxLength(8)]
+ //[MaxLength(8)]
public string? trmn { get; set; }
//روش پرداخت
- [MaxLength(2)]
+ //[MaxLength(2)]
public int? pmt { get; set; }
public string? paymentMethod { get; set; }
//شماره پیگیری/شماره مرجع
- [MaxLength(14)]
+ //[MaxLength(14)]
public string? trn { get; set; }
//شماره کارت پرداخت کننده صورتحساب
- [MaxLength(16)]
+ //[MaxLength(16)]
public string? pcn { get; set; }
//شماره/شناسه ملی/کد فراگیر اتباع غیر ایرانی پرداخت کننده صورتحساب
[MaxLength(12)]
public string? pid { get; set; }
//تاریخ و زمان پرداخت
- public string? PaymentDateTime { get; set; }
+ public string? PaymentDateTime { get; set; } = DateTime.Now.ConvertMiladiToShamsiinFront().ShamciToFormatShamciinFront();
//مبلغ پرداختی
- [MaxLength(18)]
+ //[MaxLength(18)]
public long? pv { get; set; }
}
diff --git a/TaxPayerFull/CUSComponent/InvoicePays.razor b/TaxPayerFull/CUSComponent/InvoicePays.razor
index 944f406..bf2fe6e 100644
--- a/TaxPayerFull/CUSComponent/InvoicePays.razor
+++ b/TaxPayerFull/CUSComponent/InvoicePays.razor
@@ -1,4 +1,5 @@
@using Front.Services
+@using Shared
@using Shared.DTOs
@inject Fixedvalues fv;
@inject HttpClientController hc;
@@ -7,7 +8,8 @@
TItem="InvoicePaymentDTO"
Class="table table-hover table-bordered table-striped mt-3"
Data="invoice.payments"
- OnRowClick="OnRowClick">
+ OnRowClick="OnRowClick"
+ Responsive="true">