/// <summary> /// Пересчет полей в соответствии с доп. ед.изм. /// </summary> private void SetAdvUnitInfo(string _oldVal) { var oldVal = 0; int.TryParse(_oldVal, out oldVal); if (oldVal == 0) { return; } //Unit old = new Unit(_oldVal.ToString(CultureInfo.InvariantCulture)); var old = GetObjectById(typeof(Unit), _oldVal.ToString(CultureInfo.InvariantCulture)) as Unit; if (old != null && factUsl.Count > 0 && factUsl.ResourceId > 0) { var maxscale = factUsl.Resource.GetScale4Unit(efUnit.Value, 3, Document.PlatelschikField.Value.ToString()); factUsl.Count = Math.Round(factUsl.Count / factUsl.Resource.ConvertionCoefficient(old, factUsl.Unit), maxscale); efCount.Value = Convert.Decimal2StrInit((decimal)factUsl.Count, maxscale); factUsl.CostOutNDS = Math.Round(factUsl.CostOutNDS * (decimal)factUsl.Resource.ConvertionCoefficient(old, factUsl.Unit), Scale); efCostOutNDS.Value = factUsl.CostOutNDS.ToString(CultureInfo.InvariantCulture); ShowCalcMessage(factUsl.Recalc(factUsl.CostOutNDS.ToString(), "2", "CostOutNDS", "0", Scale)); } }
/// <summary> /// PreRender для количества /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Count_PreRender(object sender, EventArgs e) { var maxscale = Scale; if (!factUsl.UnitId.ToString().IsNullEmptyOrZero()) { maxscale = factUsl.Resource.GetScale4Unit(factUsl.UnitId.ToString(), 3, Document.PlatelschikField.Value.ToString()); } efCount.Value = Convert.Decimal2StrInit((decimal)factUsl.Count, maxscale); efCount.Precision = maxscale; }
/// <summary> /// PreRender для поля "всего" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Vsego_PreRender(object sender, EventArgs e) { efVsego.Value = Convert.Decimal2StrInit(factUsl.Vsego, Scale); }
/// <summary> /// PreRender для суммы НДС /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SummaNDS_PreRender(object sender, EventArgs e) { efSummaNDS.Value = Convert.Decimal2StrInit(factUsl.SummaNDS, Scale); }
/// <summary> /// PreRender для цены без НДС /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CostOutNDS_PreRender(object sender, EventArgs e) { efCostOutNDS.Value = Convert.Decimal2StrInit(factUsl.CostOutNDS, Scale); }