private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogoIconOnly());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                string fromDateTest = txtFromDate.Text;
                if (fromDateTest.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a From Date.");
                    throw (warn);
                }
                DateTime fromDate;
                try {
                    fromDate = Convert.ToDateTime(fromDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid From Date.");
                    throw (warn);
                }

                string toDateTest = txtToDate.Text;
                if (toDateTest.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a To Date.");
                    throw (warn);
                }
                DateTime toDate;
                try {
                    toDate = Convert.ToDateTime(toDateTest);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid To Date.");
                    throw (warn);
                }

                string shid = txtShid.Text;

                string pdf = WSCReports.rptDirectDeliveryStatement.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate,
                                                                                  shid, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #2
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogoIconOnly());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "").Replace(":", "_");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;
                string      shid          = txtPsSHID.Text;
                string      fromShid      = txtPsFromSHID.Text;
                string      toShid        = txtPsToSHID.Text;
                string      sigImagePath  = Page.MapPath("~/ZHost/Misc/CertificateSignature.gif");
                string      sigName       = lblSigName.Text;
                string      sigTitle      = lblSigTitle.Text;

                //-----------------------------------------------------
                // Given a specific shid, erase any range query.
                //-----------------------------------------------------
                if (shid.Length > 0)
                {
                    fromShid           = "";
                    toShid             = "";
                    txtPsFromSHID.Text = fromShid;
                    txtPsToSHID.Text   = toShid;
                }

                string equityType = (Common.UILib.GetDropDownValue(ddlEquityType) == "1" ? "PAT" : "RET");

                string certificateDate = txtCertificateDate.Text.Trim();
                if (certificateDate.Length == 0)
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You need to enter a Certificate Date.");
                    return;
                }
                DateTime dtCertificateDate = DateTime.Now;
                try {
                    dtCertificateDate = Convert.ToDateTime(certificateDate);
                }
                catch {
                    Common.CWarning warn = new Common.CWarning("Please enter a valid Certificate Date.");
                    throw (warn);
                }

                string pdf = WSCReports.rptCertificate.ReportPackager(Convert.ToInt32(cropYear), equityType, dtCertificateDate,
                                                                      shid, fromShid, toShid, fileName, logoUrl, pdfTempFolder, sigName, sigTitle, sigImagePath);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual pathb
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
                btnDeletePDF.Enabled = true;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #3
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth = Globals.SecurityState;
                //string logoUrl = Page.MapPath(WSCReportsExec.GetReportLogo());
                string logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogoIconOnly());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "").Replace(":", "_");
                string cropYear      = ((MasterReportTemplate)Master).CropYear;
                string shid          = txtPsSHID.Text;
                string fromShid      = txtPsFromSHID.Text;
                string toShid        = txtPsToSHID.Text;

                //-----------------------------------------------------
                // Given a specific shid, erase any range query.
                //-----------------------------------------------------
                if (shid.Length > 0)
                {
                    fromShid           = "";
                    toShid             = "";
                    txtPsFromSHID.Text = fromShid;
                    txtPsToSHID.Text   = toShid;
                }

                string paymentType = "";
                string groupType   = (Common.UILib.GetDropDownValue(ddlEquityType) == "1" ? "PAT" : "RET");

                if (groupType == "PAT")
                {
                    paymentType = Common.UILib.GetDropDownText(ddlPatPaymentDesc);
                }
                else
                {
                    paymentType = Common.UILib.GetDropDownText(ddlRetPaymentDesc);
                }

                if (paymentType.StartsWith("None"))
                {
                    Common.CWarning warn = new Common.CWarning("Please select an Equity Type and Payment Type having a Payment Date.");
                    throw (warn);
                }

                string paymentDate = txtStatementDate.Text.Trim();
                if (paymentDate.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Sorry, you need to select a Crop Year, Equity Type and Payment Type having a Payment Date.");
                    throw (warn);
                }

                string pdf = WSCReports.rptStatementPatronageRetain.ReportPackager(Convert.ToInt32(cropYear), groupType, paymentType, paymentDate,
                                                                                   shid, fromShid, toShid, fileName, logoUrl, pdfTempFolder);

                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((MasterReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }