/// <summary> /// Function to clear the fields /// </summary> public void Clear() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); //DebitNoteMasterSP spDebitNoteMaster = new DebitNoteMasterSP(); DebitNoteBll bllDebitNote = new DebitNoteBll(); //-----------------------------------VoucherNo automatic generation-------------------------------------------// if (strVoucherNo == string.Empty) { strVoucherNo = "0"; //strMax; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decDebitNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != bllDebitNote.DebitNoteMasterGetMaxPlusOne(decDebitNoteVoucherTypeId)) { strVoucherNo = bllDebitNote.DebitNoteMasterGetMax(decDebitNoteVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decDebitNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (bllDebitNote.DebitNoteMasterGetMax(decDebitNoteVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decDebitNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); } } //===================================================================================================================// if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); //SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decDebitNoteVoucherTypeId, dtpVoucherDate.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; } dgvDebitNote.Rows.Clear(); VoucherDate(); dtpVoucherDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); txtDebitTotal.Text = string.Empty; txtCreditTotal.Text = string.Empty; btnSave.Text = "Save"; btnDelete.Enabled = false; isEditMode = false; dtblPartyBalance.Clear();//To clear party balance entries to clear the dgvpartybalance PrintCheck(); if (!txtVoucherNo.ReadOnly) { txtVoucherNo.Focus(); } else { txtDate.Select(); } txtNarration.Text = string.Empty; } catch (Exception ex) { MessageBox.Show("DRNT3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }