/// <summary> /// Function to use the setting the product default values /// </summary> /// <param name="index"></param> /// <param name="decProductId"></param> public void AssignProductDefaultValues(int index, decimal decProductId) { DataTable dtbl = new DataTable(); try { ProductInfo infoproduct = new ProductInfo(); ProductSP spproduct = new ProductSP(); infoproduct = spproduct.productViewByProductId(decProductId); dgvProduct.Rows[index].Cells["dgvtxtProductName"].Value = infoproduct.ProductName; dgvProduct.Rows[index].Cells["dgvtxtProductCode"].Value = infoproduct.ProductCode; dtbl = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, decProductId.ToString(), index); } catch (Exception ex) { MessageBox.Show("RI:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill product Details while return from Product creation when creating new Product /// </summary> /// <param name="decProductId"></param> public void ReturnFromProductCreation(decimal decProductId) { try { if (decProductId != 0) { this.Enabled = true; ProductInfo infoProduct = new ProductInfo(); ProductSP spProduct = new ProductSP(); infoProduct = spProduct.productViewByProductId(decProductId); isValueChange = true; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value = infoProduct.PurchaseRate; UnitComboFill(decProductId, dgvPurchaseOrder.CurrentRow.Index, dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value = infoProduct.UnitId; UnitConvertionSP SpUnitConvertion = new UnitConvertionSP(); dtblunitconversionViewAll = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(infoProduct.ProductCode); foreach (DataRow drUnitByProduct in dtblunitconversionViewAll.Rows) { if (dgvPurchaseOrder.CurrentRow.Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionId"].Value = drUnitByProduct.ItemArray[2].ToString(); dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value = drUnitByProduct.ItemArray[3].ToString(); } } decCurrentConversionRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtUnitConversionRate"].Value.ToString()); decCurrentRate = Convert.ToDecimal(dgvPurchaseOrder.CurrentRow.Cells["dgvtxtRate"].Value.ToString()); NewAmountCalculation("dgvtxtQty", dgvPurchaseOrder.CurrentRow.Index); CalculateTotalAmount(); } } catch (Exception ex) { MessageBox.Show("PO59:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }