void AddWaresReceipt() { ParametersCollection varParameters = new ParametersCollection(); varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32); varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32); varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32); varParameters.Add("parCodeWares", varWares.varCodeWares, DbType.Int32); varParameters.Add("parCodeUnit", varWares.varCodeUnit, DbType.Int32); varParameters.Add("parSort", varReceipt.varSort, DbType.Int32); DataTable varDt = varWDB.GetCountWares(varParameters); if (varDt != null && varDt.Rows.Count > 0 && Convert.ToInt32(varDt.Rows[0][1]) != varReceipt.varSort) { Quantity.Value += Convert.ToDecimal(varDt.Rows[0][0]); } QuantityValueChanged(null, null); varParameters.Add("parTypePrice", 0, DbType.Int32); varParameters.Add("parCodeWarehouse", GlobalVar.varCodeWarehouse, DbType.Int32); varParameters.Add("parSum", (varWares.varPrice * varWares.varQuantity) * (1 + varWares.varPercentVat) * varWares.varCoefficient, DbType.Decimal); varParameters.Add("parSumVat", varWares.varPrice * varWares.varQuantity * varWares.varPercentVat * varWares.varCoefficient, DbType.Decimal); varParameters.Add("parQuantity", varWares.varQuantity, DbType.Decimal); varParameters.Add("parPrice", (varWares.varPrice) * (1 + varWares.varPercentVat) * varWares.varCoefficient, DbType.Decimal); varParameters.Add("parParPrice1", varWares.varCodeDealer, DbType.Int32); varParameters.Add("parParPrice2", varWares.varTypePrice, DbType.Int32); varParameters.Add("parSumDiscount", varWares.varSumDiscount, DbType.Decimal); varParameters.Add("parTypeVat", varWares.varTypeVat, DbType.Int32); varParameters.Add("parUserCreate", varUser.varCodeUser, DbType.Int32); if (varDt != null && varDt.Rows.Count > 0) { varWDB.UpdateQuantityWares(varParameters); } else { varWDB.AddWares(varParameters); } if (GlobalVar.varRecalcPriceOnLine) { varWDB.RecalcPrice(varReceipt.varCodeReceipt); } ViewWaresReceipt(); // add columns //WaresReceipt.Refresh(); //bindingSource1.DataSource=varDtViewWaresReceipt; Wares.DataSource = varDtViewWaresReceipt; Wares.Refresh(); Input.Focus(); //grid1.DataBindings.Add( bindingSource1); /* @parIdWorkplace, @parCodePeriod, @parCodeReceipt, @parCodeWares, @parCodeUnit, * @parTypePrice, @parCodeWarehouse, @parSum, @parSumVat,@parQuantity, * @parCodeDk, @parCodeDiscount, @parSumDiscount, @parTypeVat, @parSort, * @parUserCreate*/ }
public decimal AddWaresReceipt(decimal parQuantity) { decimal varQuantity; ParametersCollection varParameters = new ParametersCollection(); varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32); varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32); varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32); varParameters.Add("parCodeWares", varWares.varCodeWares, DbType.Int32); varParameters.Add("parCodeUnit", varWares.varCodeUnit, DbType.Int32); varParameters.Add("parSort", varReceipt.varSort, DbType.Int32); varQuantity = varWDB.GetCountWares(varParameters); varWares.varQuantity = varQuantity + parQuantity; varParameters.Add("parTypePrice", 0, DbType.Int32); varParameters.Add("parCodeWarehouse", GlobalVar.varCodeWarehouse, DbType.Int32); varParameters.Add("parSum", (varWares.varPrice * varWares.varQuantity) * (1 + varWares.varPercentVat) * varWares.varCoefficient, DbType.Decimal); varParameters.Add("parSumVat", varWares.varPrice * varWares.varQuantity * varWares.varPercentVat * varWares.varCoefficient, DbType.Decimal); varParameters.Add("parQuantity", varWares.varQuantity, DbType.Decimal); varParameters.Add("parPrice", (varWares.varPrice) * (1 + varWares.varPercentVat) * varWares.varCoefficient, DbType.Decimal); varParameters.Add("parParPrice1", varWares.varCodeDealer, DbType.Int32); varParameters.Add("parParPrice2", varWares.varTypePrice, DbType.Int32); varParameters.Add("parSumDiscount", varWares.varSumDiscount, DbType.Decimal); varParameters.Add("parTypeVat", varWares.varTypeVat, DbType.Int32); varParameters.Add("parUserCreate", varUser.varCodeUser, DbType.Int32); if (varQuantity > 0) { varWDB.UpdateQuantityWares(varParameters); } else { varWDB.AddWares(varParameters); } if (GlobalVar.varRecalcPriceOnLine) { varWDB.RecalcPrice(varReceipt.varCodeReceipt); } return(varWares.varQuantity); }