...
This commit is contained in:
@@ -4,6 +4,7 @@ using Shared.DTOs.Warehouse;
|
||||
using Net.Pkcs11Interop.Common;
|
||||
using Back.Services;
|
||||
using Back.Data.Models;
|
||||
using Back.Common;
|
||||
|
||||
namespace Back.Validations.Warehouse.Receipt
|
||||
{
|
||||
@@ -33,6 +34,21 @@ namespace Back.Validations.Warehouse.Receipt
|
||||
context.AddFailure("توضیحی برای رسید در نظر بگیرید");
|
||||
});
|
||||
|
||||
|
||||
RuleFor(r => r.Item1.Date)
|
||||
.Custom((InvoiceDate, context) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(InvoiceDate))
|
||||
context.AddFailure("تاریخ نمی تواند خالی باشد");
|
||||
|
||||
else if (InvoiceDate.Length != 8)
|
||||
context.AddFailure("تاریخ صحیح نمی باشد");
|
||||
|
||||
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
|
||||
context.AddFailure("تاریخ از امروز جلوتر باشد");
|
||||
});
|
||||
|
||||
|
||||
RuleFor(r => r.Item2)
|
||||
.Custom((CompanyID, context) =>
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Common;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Services;
|
||||
using Back.Services.Warehouse;
|
||||
using FluentValidation;
|
||||
@@ -13,6 +14,18 @@ namespace Back.Validations.Warehouse.Receipt
|
||||
public UpdateValidation(IAsyncRepository<Back.Data.Models.Warehouse.Receipt> _ReceiptRepo, ServCOD servCOD, WarehouseService warehouseService)
|
||||
{
|
||||
CascadeMode = CascadeMode.Stop;
|
||||
RuleFor(r => r.Item1.Date)
|
||||
.Custom((InvoiceDate, context) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(InvoiceDate))
|
||||
context.AddFailure("تاریخ نمی تواند خالی باشد");
|
||||
|
||||
else if (InvoiceDate.Length != 8)
|
||||
context.AddFailure("تاریخ صحیح نمی باشد");
|
||||
|
||||
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
|
||||
context.AddFailure("تاریخ از امروز جلوتر باشد");
|
||||
});
|
||||
RuleFor(model => model)
|
||||
.Custom((model, context) =>
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Services;
|
||||
using Back.Common;
|
||||
using Back.Services;
|
||||
using Back.Services.Warehouse;
|
||||
using FluentValidation;
|
||||
using Shared.DTOs.Warehouse;
|
||||
@@ -11,6 +12,19 @@ namespace Back.Validations.Warehouse.Remittance
|
||||
{
|
||||
CascadeMode = CascadeMode.Stop;
|
||||
|
||||
RuleFor(r => r.Item1.Date)
|
||||
.Custom((InvoiceDate, context) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(InvoiceDate))
|
||||
context.AddFailure("تاریخ نمی تواند خالی باشد");
|
||||
|
||||
else if (InvoiceDate.Length != 8)
|
||||
context.AddFailure("تاریخ صحیح نمی باشد");
|
||||
|
||||
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
|
||||
context.AddFailure("تاریخ از امروز جلوتر باشد");
|
||||
});
|
||||
|
||||
RuleFor(model => model)
|
||||
.Custom((model, context) =>
|
||||
{
|
||||
|
@@ -4,6 +4,7 @@ using Back.Services;
|
||||
using FluentValidation;
|
||||
using Shared.DTOs.Warehouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Back.Common;
|
||||
|
||||
namespace Back.Validations.Warehouse.Remittance
|
||||
{
|
||||
@@ -12,6 +13,20 @@ namespace Back.Validations.Warehouse.Remittance
|
||||
public UpdateValidation(IAsyncRepository<Back.Data.Models.Warehouse.Remittance> _Repo, ServCOD servCOD, WarehouseService warehouseService)
|
||||
{
|
||||
CascadeMode = CascadeMode.Stop;
|
||||
RuleFor(r => r.Item1.Date)
|
||||
.Custom((InvoiceDate, context) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(InvoiceDate))
|
||||
context.AddFailure("تاریخ نمی تواند خالی باشد");
|
||||
|
||||
else if (InvoiceDate.Length != 8)
|
||||
context.AddFailure("تاریخ صحیح نمی باشد");
|
||||
|
||||
else if (InvoiceDate.Trim().ToMiladi() > DateTime.Now)
|
||||
context.AddFailure("تاریخ از امروز جلوتر باشد");
|
||||
});
|
||||
|
||||
|
||||
RuleFor(model => model)
|
||||
.Custom((model, context) => {
|
||||
var ORGitem = _Repo.Get(w => w.ID == model.Item1.ID && !w.Deleted).Include(i => i.cODItem).FirstOrDefault();
|
||||
|
@@ -118,6 +118,24 @@
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
if (Selected.promotionDetails.Any(w => w.PermissionID == 18))
|
||||
{
|
||||
<tr>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 18).Select(s => s.PermissionTitle).FirstOrDefault()</td>
|
||||
<td>@Selected.promotionDetails.Where(w => w.PermissionID == 18).Select(s => s.APrice).FirstOrDefault().ToString("N0") ريال</td>
|
||||
<td>
|
||||
@if (Selected.ID < 0)
|
||||
{
|
||||
<InputNumber @bind-Value="values[4]" @bind-Value:after="OnInput" type="text" class="form-control" id="inputax" style="text-align:center;" placeholder="تعداد" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input value="@Selected.promotionDetails.Where(w => w.PermissionID == 18).Select(s => s.CreditAmount).FirstOrDefault()" style="text-align:center;" class="form-control" type="text" readonly>
|
||||
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
}
|
||||
</tbody>
|
||||
@@ -154,7 +172,7 @@
|
||||
public List<PromotionDto> Promotions { get; set; } = new();
|
||||
public PromotionDto? Selected { get; set; } = null;
|
||||
// invoice cod cus tax
|
||||
int[] values = { 0,0,0,0};
|
||||
int[] values = { 0,0,0,0,0};
|
||||
decimal TotalPrice = 0;
|
||||
}
|
||||
@functions {
|
||||
@@ -176,7 +194,7 @@
|
||||
{
|
||||
orderSelectName = "نوع سفارش";
|
||||
Selected = null;
|
||||
values =new int[] { 0,0,0,0};
|
||||
values =new int[] { 0,0,0,0,0};
|
||||
TotalPrice = 0;
|
||||
Promotions = await fv.GetPromotion();
|
||||
orderstype = new List<IdName<int>>();
|
||||
@@ -220,6 +238,10 @@
|
||||
if (itemtax != null)
|
||||
itemtax.CreditAmount = values[3];
|
||||
|
||||
var itemwarehouse = Selected.promotionDetails.Where(w => w.PermissionID == 18).FirstOrDefault();
|
||||
if (itemwarehouse != null)
|
||||
itemwarehouse.CreditAmount = values[4];
|
||||
|
||||
TotalPrice = Selected.TotalPrice;
|
||||
}
|
||||
|
||||
@@ -230,8 +252,8 @@
|
||||
SpinnerVisible = true;
|
||||
if (Selected != null)
|
||||
{
|
||||
if (Selected.ID < 0 && (values[0] < 0 || values[1] < 0 || values[2] < 0 || values[3] < 0)) return;
|
||||
if (Selected.ID < 0 && values[0] == 0 && values[1] == 0 && values[2] == 0 && values[3] == 0) return;
|
||||
if (Selected.ID < 0 && (values[0] < 0 || values[1] < 0 || values[2] < 0 || values[3] < 0 || values[4] < 0)) return;
|
||||
if (Selected.ID < 0 && values[0] == 0 && values[1] == 0 && values[2] == 0 && values[3] == 0 && values[4] == 0) return;
|
||||
|
||||
//---------
|
||||
var itemFac = Selected.promotionDetails.Where(w => w.PermissionID == 3).FirstOrDefault();
|
||||
@@ -249,6 +271,10 @@
|
||||
var itemtax = Selected.promotionDetails.Where(w => w.PermissionID == 16).FirstOrDefault();
|
||||
if (itemtax != null)
|
||||
itemtax.CreditAmount = values[3];
|
||||
|
||||
var itemwarehouse = Selected.promotionDetails.Where(w => w.PermissionID == 18).FirstOrDefault();
|
||||
if (itemwarehouse != null)
|
||||
itemwarehouse.CreditAmount = values[4];
|
||||
//---------
|
||||
var rsp = await hc.Post<PromotionDto>($"Orders/AddOrder", Selected);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
|
@@ -12,7 +12,7 @@
|
||||
@* search *@
|
||||
<div class="row">
|
||||
<h4 class="fw-bold py-3 mb-4">
|
||||
<span class="text-muted fw-light">سرویس ها /</span> مشتری
|
||||
<span class="text-muted fw-light">سرویس ها /</span> انبارداری
|
||||
</h4>
|
||||
<div class="col-md-12">
|
||||
<div class="card mb-2">
|
||||
|
Reference in New Issue
Block a user