/// <summary> /// Clear function and voucherno generation based on settings /// </summary> public void Clear() { try { PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); SettingsBll BllSettings = new SettingsBll(); if (isAutomatic) { strVoucherNo = BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId).ToString(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (strVoucherNo != BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId).ToString()) { strVoucherNo = BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPurchaseOrderTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decPurchaseSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strOrderNo = strPrefix + strVoucherNo + strSuffix; txtOrderNo.Text = strOrderNo; txtOrderNo.ReadOnly = true; txtDate.Focus(); } else { txtOrderNo.Text = string.Empty; txtOrderNo.ReadOnly = false; txtOrderNo.Focus(); } dtpDate.Value = PublicVariables._dtCurrentDate; dtpDate.MinDate = PublicVariables._dtFromDate; dtpDate.MaxDate = PublicVariables._dtToDate; dtpDueDate.Value = PublicVariables._dtCurrentDate; this.txtDueDate.Text = this.dtpDueDate.Value.ToString("dd-MMM-yyyy"); dtpDueDate.MinDate = PublicVariables._dtFromDate; dtpDueDate.MaxDate = PublicVariables._dtToDate; txtDueDays.Text = "0"; CashOrPartyComboFill(); if (!ShowProductCode()) { this.dgvPurchaseOrder.Columns["dgvtxtProductCode"].Visible = false; } if (!ShowBarcode()) { this.dgvPurchaseOrder.Columns["dgvtxtBarcode"].Visible = false; } if (BllSettings.SettingsStatusCheck("ShowUnit") == "Yes") { dgvPurchaseOrder.Columns["dgvcmbUnit"].Visible = true; } else { dgvPurchaseOrder.Columns["dgvcmbUnit"].Visible = false; } if (PrintAfetrSave()) { cbxPrintAfterSave.Checked = true; } else { cbxPrintAfterSave.Checked = false; } txtNarration.Text = string.Empty; btnSave.Text = "Save"; btnDelete.Enabled = false; cbxCancel.Enabled = true; cbxCancel.Checked = false; dgvPurchaseOrder.Rows.Clear(); txtTotalAmount.Text = string.Empty; } catch (Exception ex) { MessageBox.Show("PO28:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }