/// <summary> /// расчет стоимости с НДС /// </summary> /// <param name="contractId"></param> /// <returns></returns> public decimal GetTotalPriceCount(Guid contractId) { var priceCounts = AppContext.OBK_ContractPrice.Where(e => e.ContractId == contractId).ToList(); var tPrice = priceCounts.Sum(e => Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(e.OBK_Ref_PriceList.Price) * e.Count), 2)); return(tPrice); }
public decimal GetContractPrice(Guid?contractId) { var results = AppContext.OBK_ContractPrice.Where(e => e.ContractId == contractId).ToList(); decimal totalCount = results.Sum(e => Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(e.OBK_Ref_PriceList.Price) * e.Count), 2)); return(totalCount); }
/// <summary> /// расчет 1-копий с НДС public decimal GetZbkCopyNds(Guid copyId) { var refType = AppContext.OBK_Ref_Type.FirstOrDefault(o => o.Code == "5"); var ref_PriceList = AppContext.OBK_Ref_PriceList.FirstOrDefault(o => o.TypeId == refType.Id); return(Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(ref_PriceList.Price)), 2)); }
/// <summary> /// расчет стоимости копий ЗБК с НДС public decimal GetTotalPriceZbkCopy(Guid copyId) { var copy = AppContext.OBK_ZBKCopy.FirstOrDefault(o => o.Id == copyId); var refType = AppContext.OBK_Ref_Type.FirstOrDefault(o => o.Code == "5"); var ref_PriceList = AppContext.OBK_Ref_PriceList.FirstOrDefault(o => o.TypeId == refType.Id); if (copy.ExpApplication == false) { return(Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(ref_PriceList.Price) * copy.CopyQuantity * 2), 2)); } return(Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(ref_PriceList.Price) * copy.CopyQuantity), 2)); }
public IEnumerable <EmpContractPaymentPriceViewModel> GetContractPrice(Guid contractId) { var contract = _uow.GetQueryable <EMP_Contract>().First(x => x.Id == contractId); int i = 1; return(contract.EMP_CostWorks.Select(x => new EmpContractPaymentPriceViewModel { Line = i++, PriceWithTax = Math.Round(TaxHelper.GetCalculationTax(x.Price ?? 0), 2), //Price = Math.Round((decimal?)x.Count ?? 0 * TaxHelper.GetCalculationTax(x.Price ?? 0), 2), Count = x.Count ?? 0, ServiceName = x.EMP_Ref_PriceList.EMP_Ref_ServiceType.NameRu, ProductName = contract.MedicalDeviceName })); }
public ActionResult GetContractPrice(Guid id) { var model = payRepo.GetContract(id); List<ContractPrice> result = new List<ContractPrice>(); int i = 1; foreach (var com in model.OBK_ContractPrice) { var cPrice = new ContractPrice(); cPrice.Line = i; cPrice.Count = com.Count; cPrice.PriceWithTax = Math.Round(TaxHelper.GetCalculationTax(com.OBK_Ref_PriceList.Price), 2) ; cPrice.Price = Math.Round(com.Count * TaxHelper.GetCalculationTax(com.OBK_Ref_PriceList.Price), 2); cPrice.ServiceName = com.OBK_Ref_PriceList.NameRu; cPrice.ProductName = com.OBK_RS_Products.NameRu; result.Add(cPrice); i++; } return Json(new { isSuccess = true, result }); }
private void SavePayments(EMP_Contract contract) { var pay = new EMP_DirectionToPayments { Id = Guid.NewGuid(), CreateDate = DateTime.Now, ContractId = contract.Id, CreateEmployeeId = UserHelper.GetCurrentEmployee().Id, CreateEmployeeValues = UserHelper.GetCurrentEmployee().DisplayName, DirectionDate = DateTime.Now, Number = contract.Number, PayerId = contract.OBK_Declarant.Id, PayerValue = contract.OBK_Declarant.NameRu, IsDeleted = false, TotalPrice = contract.EMP_CostWorks.Sum(e => Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(e.Price.Value) * e.Count), 2)), StatusId = _uow.GetQueryable <OBK_Ref_PaymentStatus>() .Where(e => e.Code == OBK_Ref_PaymentStatus.OnFormation).Select(x => x.Id).FirstOrDefault() }; _uow.Insert(pay); _uow.Save(); }