/// <summary> /// Function to insert values to RejectionOutMaster Table /// </summary> /// <param name="rejectionoutmasterinfo"></param> public void RejectionOutMasterAdd(RejectionOutMasterInfo rejectionoutmasterinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RejectionOutMasterAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.RejectionOutMasterId; sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.VoucherNo; sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.InvoiceNo; sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.SuffixPrefixId; sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.VoucherTypeId; sprmparam = sccmd.Parameters.Add("@materialReceiptMasterId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.MaterialReceiptMasterId; sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime); sprmparam.Value = rejectionoutmasterinfo.Date; sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.LedgerId; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.Narration; sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.ExchangeRateId; sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.TotalAmount; sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.UserId; sprmparam = sccmd.Parameters.Add("@lrNo", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.LrNo; sprmparam = sccmd.Parameters.Add("@transportationCompany", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.TransportationCompany; sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal); sprmparam.Value = rejectionoutmasterinfo.FinancialYearId; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = rejectionoutmasterinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = rejectionoutmasterinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from RejectionOutMaster table based on the parameter /// </summary> /// <param name="rejectionOutMasterId"></param> /// <returns></returns> public RejectionOutMasterInfo RejectionOutMasterView(decimal rejectionOutMasterId) { RejectionOutMasterInfo rejectionoutmasterinfo = new RejectionOutMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RejectionOutMasterView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal); sprmparam.Value = rejectionOutMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { rejectionoutmasterinfo.RejectionOutMasterId = decimal.Parse(sdrreader[0].ToString()); rejectionoutmasterinfo.VoucherNo = sdrreader[1].ToString(); rejectionoutmasterinfo.InvoiceNo = sdrreader[2].ToString(); rejectionoutmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString()); rejectionoutmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[4].ToString()); rejectionoutmasterinfo.MaterialReceiptMasterId = decimal.Parse(sdrreader[5].ToString()); rejectionoutmasterinfo.Date = DateTime.Parse(sdrreader[6].ToString()); rejectionoutmasterinfo.LedgerId = decimal.Parse(sdrreader[7].ToString()); rejectionoutmasterinfo.Narration = sdrreader[8].ToString(); rejectionoutmasterinfo.ExchangeRateId = decimal.Parse(sdrreader[9].ToString()); rejectionoutmasterinfo.TotalAmount = decimal.Parse(sdrreader[10].ToString()); rejectionoutmasterinfo.UserId = decimal.Parse(sdrreader[11].ToString()); rejectionoutmasterinfo.LrNo = sdrreader[12].ToString(); rejectionoutmasterinfo.TransportationCompany = sdrreader[13].ToString(); rejectionoutmasterinfo.FinancialYearId = decimal.Parse(sdrreader[14].ToString()); rejectionoutmasterinfo.ExtraDate = DateTime.Parse(sdrreader[15].ToString()); rejectionoutmasterinfo.Extra1 = sdrreader[16].ToString(); rejectionoutmasterinfo.Extra2 = sdrreader[17].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(rejectionoutmasterinfo); }
/// <summary> /// Function to get particular values from RejectionOutMaster table based on the parameter /// </summary> /// <param name="rejectionOutMasterId"></param> /// <returns></returns> public RejectionOutMasterInfo RejectionOutMasterView(decimal rejectionOutMasterId) { RejectionOutMasterInfo rejectionoutmasterinfo = new RejectionOutMasterInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("RejectionOutMasterView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal); sprmparam.Value = rejectionOutMasterId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { rejectionoutmasterinfo.RejectionOutMasterId = decimal.Parse(sdrreader[0].ToString()); rejectionoutmasterinfo.VoucherNo = sdrreader[1].ToString(); rejectionoutmasterinfo.InvoiceNo = sdrreader[2].ToString(); rejectionoutmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString()); rejectionoutmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[4].ToString()); rejectionoutmasterinfo.MaterialReceiptMasterId = decimal.Parse(sdrreader[5].ToString()); rejectionoutmasterinfo.Date = DateTime.Parse(sdrreader[6].ToString()); rejectionoutmasterinfo.LedgerId = decimal.Parse(sdrreader[7].ToString()); rejectionoutmasterinfo.Narration = sdrreader[8].ToString(); rejectionoutmasterinfo.ExchangeRateId = decimal.Parse(sdrreader[9].ToString()); rejectionoutmasterinfo.TotalAmount = decimal.Parse(sdrreader[10].ToString()); rejectionoutmasterinfo.UserId = decimal.Parse(sdrreader[11].ToString()); rejectionoutmasterinfo.LrNo = sdrreader[12].ToString(); rejectionoutmasterinfo.TransportationCompany = sdrreader[13].ToString(); rejectionoutmasterinfo.FinancialYearId = decimal.Parse(sdrreader[14].ToString()); rejectionoutmasterinfo.ExtraDate = DateTime.Parse(sdrreader[15].ToString()); rejectionoutmasterinfo.Extra1 = sdrreader[16].ToString(); rejectionoutmasterinfo.Extra2 = sdrreader[17].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return rejectionoutmasterinfo; }
/// <summary> /// Fill function for edit /// </summary> public void FillRejectionOutReportForEdit() { try { dgvProduct.Rows.Clear(); isDoCellValueChange = false; isFromRegister = true; btnSave.Text = "Update"; btnDelete.Enabled = true; txtRejectionOutNo.ReadOnly = true; infoRejectionOutMaster = spRejectionOutMaster.RejectionOutMasterView(decRejectionOutId); MaterialReceiptMasterSP SpMaterialReceiptMaster = new MaterialReceiptMasterSP(); MaterialReceiptMasterInfo InfoMaterialReceiptMaster = new MaterialReceiptMasterInfo(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); InfoMaterialReceiptMaster = SpMaterialReceiptMaster.MaterialReceiptMasterView(infoRejectionOutMaster.MaterialReceiptMasterId); strRejectionOutVoucherNo = spRejectionOutMaster.GetRejectionOutVoucherNo(infoRejectionOutMaster.RejectionOutMasterId); txtRejectionOutNo.Text = infoRejectionOutMaster.InvoiceNo; strVoucherNo = infoRejectionOutMaster.VoucherNo.ToString(); decRejectionOutSuffixPrefixId = Convert.ToDecimal(infoRejectionOutMaster.SuffixPrefixId); decRejectionOutVoucherTypeId = Convert.ToDecimal(infoRejectionOutMaster.VoucherTypeId); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decRejectionOutVoucherTypeId); infoVoucherType = spVoucherType.VoucherTypeView(decRejectionOutVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; if (!isAutomatic) { txtRejectionOutNo.ReadOnly = false; txtRejectionOutNo.Focus(); } else { txtRejectionOutNo.ReadOnly = true; txtDate.Focus(); } decRejectionOutTypeId = decRejectionOutVoucherTypeId; txtDate.Text = infoRejectionOutMaster.Date.ToString("dd-MMM-yyyy"); cmbCashOrParty.SelectedValue = infoRejectionOutMaster.LedgerId; cmbVoucherType.SelectedValue = InfoMaterialReceiptMaster.VoucherTypeId; cmbMaterialReceiptNo.SelectedValue = Convert.ToDecimal(infoRejectionOutMaster.MaterialReceiptMasterId.ToString()); txtTransportationCompany.Text = infoRejectionOutMaster.TransportationCompany; txtNarration.Text = infoRejectionOutMaster.Narration; cmbCurrency.SelectedValue = infoRejectionOutMaster.ExchangeRateId; txtTotalAmount.Text = infoRejectionOutMaster.TotalAmount.ToString(); txtLrNo.Text = infoRejectionOutMaster.LrNo.ToString(); DataTable dtblRejectionOut = spRejectionOutDetails.RejectionOutDetailsViewByRejectionOutMasterId(infoRejectionOutMaster.RejectionOutMasterId); for (int i = 0; i < dtblRejectionOut.Rows.Count; i++) { dgvProduct.Rows.Add(); GodownComboFill(); isAmountcalc = false; decRejectionOutDetailId = Convert.ToDecimal(dtblRejectionOut.Rows[i]["rejectionOutDetailsId"].ToString()); dgvProduct.Rows[i].Cells["dgvtxtSlNo"].Value = dtblRejectionOut.Rows[i]["slno"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtProductId"].Value = dtblRejectionOut.Rows[i]["productId"].ToString(); ProductDefaultValues(i, Convert.ToDecimal(dtblRejectionOut.Rows[i]["productId"].ToString())); BatchComboFill(Convert.ToDecimal(dtblRejectionOut.Rows[i]["productId"].ToString()), i, dgvProduct.Rows[i].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["batchId"].ToString()); dgvProduct.Rows[i].Cells["dgvtxtQty"].Value = dtblRejectionOut.Rows[i]["qty"].ToString(); UnitComboFill(Convert.ToDecimal(dtblRejectionOut.Rows[i]["productId"].ToString()), i, dgvProduct.Rows[i].Cells["dgvcmbUnit"].ColumnIndex); isDoCellValueChange = true; isDoAfterGridFill = true; isValueChange = true; isAmountcalc = true; dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["unitId"].ToString()); isDoCellValueChange = false; isDoAfterGridFill = false; isValueChange = false; dgvProduct.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["godownId"].ToString()); RackComboFill(Convert.ToDecimal(dtblRejectionOut.Rows[i]["godownId"].ToString()), dgvProduct, i); dgvProduct.Rows[i].Cells["dgvcmbRack"].Value = Convert.ToDecimal(dtblRejectionOut.Rows[i]["rackId"].ToString()); dgvProduct.Rows[i].Cells["dgvtxtBarcode"].Value = dtblRejectionOut.Rows[i]["barcode"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtRejectionOutDetailsId"].Value = decRejectionOutDetailId; dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = dtblRejectionOut.Rows[i]["rate"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtAmount"].Value = dtblRejectionOut.Rows[i]["amount"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtunitConversionId"].Value = dtblRejectionOut.Rows[i]["UnitConversionId"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtconversionRate"].Value = dtblRejectionOut.Rows[i]["conversionRate"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtmaterialReceiptDetailsId"].Value = dtblRejectionOut.Rows[i]["materialReceiptDetailsId"].ToString(); } TotalAmount(); isAmountcalc = true; isDoAfterGridFill = true; isFromRegister = false; isDoCellValueChange = true; isValueChange = true; } catch (Exception ex) { MessageBox.Show("RO36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }