/// <summary> ///FunctionToFill ProductDetales /// </summary> /// <param name="strProduct"></param> /// <param name="inRowIndex"></param> /// <param name="strFillMode"></param> public void ProductDetailsFill(string strProduct, int inRowIndex, string strFillMode) { try { string barcode = string.Empty; decimal decCurrentConversionRate = 0; DataTable dtbl = new DataTable(); UnitConvertionSP spUnitConversion = new UnitConvertionSP(); SalesReturnDetailsSP spdetailes = new SalesReturnDetailsSP(); BatchSP spbatch = new BatchSP(); ProductSP spproduct = new ProductSP(); if (strFillMode == "dgvTextBarcode") { dtbl = spdetailes.productviewbybarcodeforSR(strProduct, decSalesReturnVoucherTypeId); } if (strFillMode == "dgvTextProductName") { dtbl = spproduct.ProductCodeViewByProductName(strProduct, decSalesReturnVoucherTypeId); } if (strFillMode == "dgvTextProductCode") { dtbl = spproduct.ProductNameViewByProductCode(strProduct, decSalesReturnVoucherTypeId); } if (dtbl.Rows.Count != 0) { DGVGodownComboFill(); // SerialNo(); dgvSalesReturn.Rows[inRowIndex].Cells["productId"].Value = dtbl.Rows[0]["productId"]; decimal decProductId = Convert.ToDecimal(dgvSalesReturn.Rows[inRowIndex].Cells["productId"].Value.ToString()); dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextBarcode"].Value = dtbl.Rows[0]["barcode"]; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextProductCode"].Value = dtbl.Rows[0]["productCode"]; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextProductName"].Value = dtbl.Rows[0]["productName"]; // dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextQty"].Value = dtbl.Rows[0]["qty"]; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextQty"].Value = string.Empty; UnitComboFill(decProductId, inRowIndex, dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbUnit"].ColumnIndex); dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbUnit"].Value = Convert.ToDecimal(dtbl.Rows[0]["unitId"].ToString()); dgvSalesReturn.Rows[inRowIndex].Cells["unitConversionId"].Value = dtbl.Rows[0]["unitConversionId"]; dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbGodown"].Value = Convert.ToDecimal(dtbl.Rows[0]["godownId"].ToString()); RackComboFill(Convert.ToDecimal(dtbl.Rows[0]["godownId"].ToString()), inRowIndex, dgvSalesReturn.CurrentRow.Cells["dgvCmbRack"].ColumnIndex); dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString()); BatchComboFill(decProductId, inRowIndex, dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbBatch"].ColumnIndex); dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbBatch"].Value = Convert.ToDecimal(dtbl.Rows[0]["batchId"].ToString()); decimal decBatchId = Convert.ToDecimal(dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbBatch"].Value.ToString()); dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextRate"].Value = Math.Round(Convert.ToDecimal(dtbl.Rows[0]["salesRate"].ToString()), PublicVariables._inNoOfDecimalPlaces); getProductRate(inRowIndex, decProductId, decBatchId); TaxGridFill(); dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbTax"].Value = Convert.ToDecimal(dtbl.Rows[0]["taxId"].ToString()); dgvSalesReturn.Rows[inRowIndex].Cells["conversionRate"].Value = dtbl.Rows[0]["conversionRate"]; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextDiscountPercentage"].Value = dtbl.Rows[0]["discountPercent"].ToString(); dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextDiscountAmount"].Value = Math.Round(Convert.ToDecimal(dtbl.Rows[0]["discount"]), PublicVariables._inNoOfDecimalPlaces); dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextDiscountAmount"].ReadOnly = true; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextNetValue"].Value = Math.Round(Convert.ToDecimal(dtbl.Rows[0]["netvalue"]), PublicVariables._inNoOfDecimalPlaces); GrossValueCalculation(inRowIndex); DiscountCalculationfordiscountpercentage(inRowIndex, 12); DiscountCalculation(inRowIndex, 13); TotalAmountCalculation(); TaxAmountCalculation(inRowIndex); taxamountfill(); CessTaxamountCalculation(); TotalBillTaxCalculation(); TotalTaxAmtCalculation(); GrandTotalCalculation(); taxAndGridTotalAmountCalculation(inRowIndex); decCurrentConversionRate = Convert.ToDecimal(dtbl.Rows[0]["conversionRate"].ToString()); dgvSalesReturn.Rows[inRowIndex].HeaderCell.Value = "X"; dgvSalesReturn.Rows[inRowIndex].HeaderCell.Style.ForeColor = Color.Red; } else { if (dgvSalesReturn.CurrentRow.Index < dgvSalesReturn.RowCount - 1) { dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextBarcode"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextProductCode"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextProductName"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextQty"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbUnit"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbGodown"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbBatch"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbRack"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextRate"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbTax"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextDiscountPercentage"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextDiscountAmount"].Value = string.Empty; dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextNetValue"].Value = string.Empty; } } } catch (Exception ex) { MessageBox.Show("SR74" + ex.Message, "openmiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }