/// <summary> /// Function to clear the fields /// </summary> public void Clear() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); StockJournalMasterSP spMaster = new StockJournalMasterSP(); if (isAutomatic) { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); if (Convert.ToDecimal(strVoucherNo) != spMaster.StockJournalMasterMaxPlusOne(decVoucherTypeId)) { strVoucherNo = spMaster.StockJournalMasterMax(decVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); if (spMaster.StockJournalMasterMax(decVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); } } SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = string.Empty; strInvoiceNo = txtVoucherNo.Text.Trim(); } if (PrintAfetrSave()) { cbxPrintAfterSave.Checked = true; } else { cbxPrintAfterSave.Checked = false; } btnDelete.Enabled = false; btnSave.Text = "Save"; gbxTransactionType.Enabled = true; cmbFinishedGoods.Enabled = true; txtQty.Enabled = true; btnAdd.Enabled = true; VoucherDate(); dgvConsumption.Rows.Clear(); dgvProduction.Rows.Clear(); dgvAdditionalCost.Rows.Clear(); cmbFinishedGoods.Text = string.Empty; txtQty.Text = String.Empty; txtNarration.Text = string.Empty; //AutoCompleteProducts(); lblAdditionalCostAmount.Text = "0.00"; lblConsumptionAmount.Text = "0.00"; lblProductionAmount.Text = "0.00"; } catch (Exception ex) { MessageBox.Show("SJ:29" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }