protected void btnPrintCertificate_Click(object sender, EventArgs e) { ReportDAL rdal = new ReportDAL(); Result oResult = new Result(); Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; if (!string.IsNullOrEmpty(txtRegistrationNo.Text)) { string sCertType = ""; if (ddlCertificateType.SelectedIndex < 1) { ddlCertificateType.SelectedIndex = 0; ucMessage.OpenMessage("Enter a valid certicate type. Please check!", Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); return; } if (oConfig != null) { if (ddlCertificateType.SelectedValue == "1") { sCertType = "Issuance"; oResult = rdal.InvestmentCertificate(txtRegistrationNo.Text, txtIssueName.Text, txtDuplicate.Text, oConfig.BranchID); //Page.RegisterStartupScript(Constants.REPORT_WINDOW, "<script> alert('opended')</script>"); } else if (ddlCertificateType.SelectedValue == "2") { sCertType = "Encashment"; //Encashment oResult = rdal.EncashmentCertificate(txtRegistrationNo.Text, txtIssueName.Text, oConfig.BranchID, txtDuplicate.Text); } else if (ddlCertificateType.SelectedValue == "3") { sCertType = "Interest"; //Payment & TAX Certificate oResult = rdal.PaymentCertificate(txtRegistrationNo.Text, txtIssueName.Text, oConfig.BranchID, ddlTaxYear.SelectedValue.ToString(), txtDuplicate.Text); } if (oResult.Status) { IssueDAL oIssueDAL = new IssueDAL(); oIssueDAL.Save_CertificatePrintLog(hdIssueTransNo.Value, sCertType, (Int32.Parse(txtNoofCertPrint.Text) + 1).ToString("N0"), ddlCertCustomerType.SelectedValue.ToString(), txtChargeAmount.Text, Convert.ToInt32(ddlWaiveCharges.SelectedValue), txtChargeAmount.Text, txtVATAmount.Text, oConfig.UserName); ddlCertificateType_SelectedIndexChanged(sender, e); Session[Constants.SES_RPT_DATA] = oResult.Return; Page.RegisterStartupScript(Constants.REPORT_WINDOW, Util.OpenReport()); } else { ucMessage.OpenMessage("No " + sCertType + " data found for certificate generation. Please check!", Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } } } else { ucMessage.OpenMessage("Enter a valid reg no. Please check!", Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } }