/// <summary> /// To reset the form here and Generate the voucher no generation /// </summary> public void Clear() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); if (btnSave.Text == "Update") { if (frmPaymentRegisterObj != null) { frmPaymentRegisterObj.Close(); } } if (isAutomatic) { SalaryVoucherBll BllSalaryVoucher = new SalaryVoucherBll(); //PaymentMasterSP SpPaymentMaster = new PaymentMasterSP(); PaymentVoucherBll BllPaymentVoucher = new PaymentVoucherBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != BllPaymentVoucher.PaymentMasterMax(decPaymentVoucherTypeId) + 1) { strVoucherNo = BllPaymentVoucher.PaymentMasterMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (BllPaymentVoucher.PaymentMasterMax(decPaymentVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.Text = string.Empty; txtVoucherNo.ReadOnly = false; } dtpDate.MinDate = PublicVariables._dtFromDate; dtpDate.MaxDate = PublicVariables._dtToDate; dtpDate.Value = PublicVariables._dtCurrentDate; cmbBankorCash.SelectedIndex = -1; txtNarration.Text = string.Empty; txtTotal.Text = string.Empty; dgvPaymentVoucher.ClearSelection(); dgvPaymentVoucher.Rows.Clear(); btnSave.Text = "Save"; btnDelete.Enabled = false; cbxPrintafterSave.Checked = false; dtblPartyBalance.Clear(); if (isAutomatic) { txtDate.Select(); } else { txtVoucherNo.Select(); } PrintCheck(); } catch (Exception ex) { MessageBox.Show("PV9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }