Added missing field to display price of products on quotation and purchase order

This commit is contained in:
2026-05-25 11:44:18 +01:00
parent 1ae8072219
commit b59a8b6c3d
8 changed files with 2086 additions and 6 deletions
@@ -35,15 +35,22 @@ public class EntityToDtoMappings : Profile
CreateMap<ProductDelivery, GetProductDeliveryDto>();
CreateMap<PurchaseOrder, GetPurchaseOrderDto>()
.ForMember(dest => dest.SupplierName, opt => opt.MapFrom(src => src.Supplier!.Name))
.ForMember(dest => dest.Products, opt => opt.MapFrom(src => src.PurchaseProducts));
CreateMap<PurchaseProduct, GetPurchaseProductDto>();
CreateMap<PurchaseProduct, GetPurchaseProductDto>()
.ForMember(dest => dest.ProductPrice,
opt => opt.MapFrom(src =>
src.Product!.Prices.Where(x => x.SupplierId == src.PurchaseOrder!.SupplierId && x.ProductId == src.ProductId).Select(x => x.SellingPrice).FirstOrDefault()));
CreateMap<Quotation, GetQuotationDto>()
.ForMember(dest => dest.Products, opt => opt.MapFrom(src => src.QuotationProducts));
CreateMap<QuotationProduct, GetQuotationProductDto>();
CreateMap<QuotationProduct, GetQuotationProductDto>()
.ForMember(dest => dest.ProductPrice,
opt => opt.MapFrom(src =>
src.Product!.Prices.Where(x => x.SupplierId == src.Quotation!.SupplierId && x.ProductId == src.ProductId).Select(x => x.SellingPrice).FirstOrDefault()));
CreateMap<Setting, GetSettingDto>();
CreateMap<User, GetUserDto>();