diff --git a/Back/Common/ExtentionMethods.cs b/Back/Common/ExtentionMethods.cs index 849ee31..ece7b26 100644 --- a/Back/Common/ExtentionMethods.cs +++ b/Back/Common/ExtentionMethods.cs @@ -95,6 +95,21 @@ namespace Back.Common return new PagingDto(rowCount, PageCount, await values.Skip(skip).Take(take).ToListAsync()); } + } + public static async Task> Paging(this IEnumerable values, int pageId, int take) + { + if (/*values.Count()<1000 && */pageId == 0 && take == 0) + { + return new PagingDto(values.Count(), 1, values.ToList()); + } + else + { + int skip = (pageId - 1) * take; + int rowCount = values.Count(); + int PageCount = rowCount % take == 0 ? rowCount / take : rowCount / take + 1; + return new PagingDto(rowCount, PageCount, values.Skip(skip).Take(take).ToList()); + } + } public static System.Linq.Expressions.Expression> GetFunc(string Fild, string Value) { diff --git a/Back/Services/Warehouse/ReceiptService.cs b/Back/Services/Warehouse/ReceiptService.cs index 6512c38..eca8207 100644 --- a/Back/Services/Warehouse/ReceiptService.cs +++ b/Back/Services/Warehouse/ReceiptService.cs @@ -27,7 +27,7 @@ namespace Back.Services.Warehouse { var model = new Receipt() { - Date = item.Date, + Date = item.Date.Replace("/",""), CODID = item.CODID, Count = item.Count, ForSale = item.ForSale, @@ -60,7 +60,7 @@ namespace Back.Services.Warehouse public async Task Update(ReceiptDto item) { var model= await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync(); - model.Date= item.Date; + model.Date= item.Date.Replace("/", ""); model.CODID= item.CODID; model.Count= item.Count; model.ForSale= item.ForSale; diff --git a/Back/Services/Warehouse/RemittanceService.cs b/Back/Services/Warehouse/RemittanceService.cs index 51dbb52..bdbfa50 100644 --- a/Back/Services/Warehouse/RemittanceService.cs +++ b/Back/Services/Warehouse/RemittanceService.cs @@ -19,7 +19,7 @@ namespace Back.Services.Warehouse { var model = new Remittance() { - Date = item.Date, + Date = item.Date.Replace("/", ""), CODID = item.CODID, Count = item.Count, info = item.info, @@ -44,7 +44,7 @@ namespace Back.Services.Warehouse public async Task Update(RemittanceDto item) { var model = await _ReceiptRepo.Get(w => w.ID == item.ID).FirstOrDefaultAsync(); - model.Date = item.Date; + model.Date = item.Date.Replace("/", ""); model.CODID = item.CODID; model.Count = item.Count; model.info = item.info; diff --git a/Back/Services/Warehouse/WarehouseService.cs b/Back/Services/Warehouse/WarehouseService.cs index b3105fd..c0409d2 100644 --- a/Back/Services/Warehouse/WarehouseService.cs +++ b/Back/Services/Warehouse/WarehouseService.cs @@ -1,4 +1,5 @@ -using Back.Common; + +using Back.Common; using Back.Data.Contracts; using Back.Data.Models.Warehouse; using Microsoft.EntityFrameworkCore; @@ -36,7 +37,7 @@ namespace Back.Services.Warehouse info = s.info, Type = TypeCirculation.Remittance, ModelTypeID = (int)s.Type, - ModelTypeTitle = s.Type.GetDisplayName(), + ModelTypeTitle = s.Type.GetEnumDisplayName(), invoiceID = s.InvoiceID, }); if (!string.IsNullOrEmpty(date)) @@ -55,24 +56,23 @@ namespace Back.Services.Warehouse info = s.info, Type = TypeCirculation.Receipt, ModelTypeID = (int)s.Type, - ModelTypeTitle = s.Type.GetDisplayName(), + ModelTypeTitle = s.Type.GetEnumDisplayName(), invoiceID = s.InvoiceID, + ForSale = s.ForSale, }); if (!string.IsNullOrEmpty(date)) RequestReceipt = RequestReceipt.Where(w => w.Date == date); if (CODID != 0) RequestReceipt = RequestReceipt.Where(w => w.CODID == CODID); - try - { - var item = await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).ToListAsync(); - } - catch (Exception ex) - { + var itemsReceipt = await RequestReceipt.ToListAsync(); + var Remittance = await RequestRemittance.ToListAsync(); - throw; - } - return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize); + + return await itemsReceipt.Union(Remittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize); + + + // return await RequestReceipt.Union(RequestRemittance).OrderByDescending(o => o.Date).Paging(PageIndex, PageSize); //var list = await RequestReceipt.ToListAsync(); //list.AddRange(await RequestRemittance.ToListAsync()); //return await list.OrderByDescending(o=>o.Date).AsQueryable().Paging(PageIndex, PageSize); diff --git a/Back/Validations/Warehouse/Receipt/ADDValidation.cs b/Back/Validations/Warehouse/Receipt/ADDValidation.cs index f7bb132..28a1722 100644 --- a/Back/Validations/Warehouse/Receipt/ADDValidation.cs +++ b/Back/Validations/Warehouse/Receipt/ADDValidation.cs @@ -16,7 +16,7 @@ namespace Back.Validations.Warehouse.Receipt RuleFor(model => model) .Custom((model, context) => { - if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result) + if (!servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result) context.AddFailure("کد کالا یافت نشد"); }); diff --git a/Back/Validations/Warehouse/Receipt/UpdateValidation.cs b/Back/Validations/Warehouse/Receipt/UpdateValidation.cs index bcfc88e..f31ecb8 100644 --- a/Back/Validations/Warehouse/Receipt/UpdateValidation.cs +++ b/Back/Validations/Warehouse/Receipt/UpdateValidation.cs @@ -26,17 +26,11 @@ namespace Back.Validations.Warehouse.Receipt context.AddFailure("رسید یافت نشد"); else { - if (ORGitem.CODID != model.Item1.CODID) - { - if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result) - context.AddFailure("کد کالا یافت نشد"); - } - else - { + if (ORGitem.CODID != model.Item1.CODID) { - context.AddFailure("در رسید امکان ویرایش کالا انکان پذیر نیست"); + context.AddFailure("در رسید امکان ویرایش کالا امکان پذیر نیست"); } else { @@ -69,7 +63,7 @@ namespace Back.Validations.Warehouse.Receipt } - } + } }); diff --git a/Back/Validations/Warehouse/Remittance/ADDValidation.cs b/Back/Validations/Warehouse/Remittance/ADDValidation.cs index 0e1b8a8..9d849bc 100644 --- a/Back/Validations/Warehouse/Remittance/ADDValidation.cs +++ b/Back/Validations/Warehouse/Remittance/ADDValidation.cs @@ -14,7 +14,7 @@ namespace Back.Validations.Warehouse.Remittance RuleFor(model => model) .Custom((model, context) => { - if (servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result) + if (!servCOD.ExistCodByCompanyID(model.Item1.CODID, model.Item2).Result) context.AddFailure("کد کالا یافت نشد"); }); diff --git a/Back/Validations/Warehouse/Remittance/UpdateValidation.cs b/Back/Validations/Warehouse/Remittance/UpdateValidation.cs index 766f0cb..8972a6e 100644 --- a/Back/Validations/Warehouse/Remittance/UpdateValidation.cs +++ b/Back/Validations/Warehouse/Remittance/UpdateValidation.cs @@ -27,7 +27,7 @@ namespace Back.Validations.Warehouse.Remittance if (ORGitem.CODID != model.Item1.CODID) { - context.AddFailure("در حئاله امکان ویرایش کالا انکان پذیر نیست"); + context.AddFailure("در حواله امکان ویرایش کالا امکان پذیر نیست"); } else { diff --git a/TaxPayerFull/CUSComponent/WarehouseItem.razor b/TaxPayerFull/CUSComponent/WarehouseItem.razor index 0567711..1c9cf3d 100644 --- a/TaxPayerFull/CUSComponent/WarehouseItem.razor +++ b/TaxPayerFull/CUSComponent/WarehouseItem.razor @@ -13,20 +13,61 @@ @alertMessage -
    - @if (_UsedFromInvoice) - { + + @if (_UsedFromInvoice) + { +
    • style="color:indianred"این سند از فاکتور صادر شده، ویرایش مستقیم آن ممکن نیست

    • - } -
    -
    - +
+ } + +
+
+ + + +
+
+ + +
+
+ + +
+
+
+
+ + + +
+
+ + +
+
@*
*@ -
- - -
-
- - -
- -
- -
+ + @if (model.Type == TypeCirculation.Receipt) { -
- +
+
+ +
} -
- - -
-
- @if (model.CODID == 0) + @if (NewItem) {