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

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

                int    cropYear = Convert.ToInt32(((HarvestReportTemplate)Master).CropYear);
                string shid     = ((HarvestReportTemplate)Master).SHID.ToString();

                DateTime activityFromDate = DateTime.MinValue;
                DateTime activityToDate   = DateTime.MinValue;
                bool     isLienInfoWanted = false;

                WSCReports.rptEquityStatement rptEqStmt = new WSCReports.rptEquityStatement();
                string pdf = rptEqStmt.ReportPackager(cropYear, DateTime.Now, shid, false, fileName, logoUrl, pdfTempFolder,
                                                      activityFromDate, activityToDate, isLienInfoWanted);

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

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)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.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = txtFileName.Text;

                // Get File Name
                if (fileName.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                string pdf = "";

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                pdf = WSCReports.rptBeet1099.ReportPackager(cropYear, 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);
            }
        }
        protected void btnPrintForm_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = "btnPrintForm_Click";

            try {
                if (UsrCntSelector.IsChangedSHID)
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "You changed the SHID without pressing the Find button.  Please press Find.");
                    return;
                }

                // Give client the url to open the pdf
                string      filePath      = "";
                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + "Field Contracting".Replace(" ", "");

                filePath = WSCReports.rptFieldContracting.ReportPackager(UsrCntSelector.CropYear, "", "", "", UsrCntSelector.FieldID.ToString(), auth.UserID, fileName, logoUrl, pdfTempFolder);

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

                locPDF.Text = filePath;
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((PrimaryTemplate)Page.Master).ShowWarning(ex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

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

                if (reportDate == null || reportDate.Length == 0 || !Common.CodeLib.IsDate(reportDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid report date, mm/dd/yyyy");
                    throw (warn);
                }

                WSCReports.rptContractPayeeSummary rpt = new WSCReports.rptContractPayeeSummary();
                string pdf = rpt.ReportPackager(Int32.Parse(cropYear), DateTime.Parse(reportDate), 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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                WSCSecurity auth           = Globals.SecurityState;
                string      logoUrl        = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder  = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName       = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");
                string      contractNumber = Common.UILib.GetListText(lstCdsContract, ",");

                // Check required fields: contract number
                if (String.IsNullOrEmpty(contractNumber))
                {
                    Common.CWarning warn = new Common.CWarning("You must select a Contract.");
                    throw (warn);
                }

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                string pdf      = WSCReports.rptContractDeliverySummary.ReportPackager(Convert.ToInt32(cropYear), Convert.ToInt32(contractNumber), fileName, logoUrl, pdfTempFolder);

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

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #6
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 pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string cropYear = ((MasterReportTemplate)Master).CropYear;

                string pdf = WSCReports.rptFieldAgronomy.ReportPackager(Convert.ToInt32(cropYear), _factoryList, _stationList, _contractList, 
                    "", auth.UserID, 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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

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

                int    cropYear = Convert.ToInt32(((HarvestReportTemplate)Master).CropYear);
                int    memberID = ((HarvestReportTemplate)Master).MemberID;
                int    shid     = ((HarvestReportTemplate)Master).SHID;
                string busName  = ((HarvestReportTemplate)Master).BusName;

                string pdf = WSCReports.rptContractSummary.ReportPackager(cropYear, memberID, shid, busName, fileName, logoUrl, pdfTempFolder);

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

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
        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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

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

                // Minimally you must at least pick a factory
                if (_factoryList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must select at least one Factory");
                    throw (warn);
                }

                // Must enter a valid from date
                string   fromDateTemp = txtFromDate.Text;
                DateTime fromDate;
                if (String.IsNullOrEmpty(fromDateTemp) || !DateTime.TryParse(fromDateTemp, out fromDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid From Date.");
                    throw (warn);
                }

                string   toDateTemp = txtToDate.Text;
                DateTime toDate;
                if (String.IsNullOrEmpty(toDateTemp) || !DateTime.TryParse(toDateTemp, out toDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid To Date.");
                    throw (warn);
                }

                bool isPosted   = chkPosted.Checked;
                bool isPreview  = chkPreview.Checked;
                bool isHardCopy = chkWebHardCopyOnly.Checked;
                bool isEmail    = chkEmail.Checked;
                bool isFax      = false;        //	chkFax.Checked;

                string pdf = WSCReports.rptDailyGrowerTareDetailMaster.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate, _factoryList,
                                                                                      _stationList, _contractList, isPosted, isPreview, isHardCopy, isEmail, isFax, 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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                string shid          = ((HarvestReportTemplate)Master).TextShid;
                string logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string fileName      = shid + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                int cropYear = 0;
                int calYear  = 0;
                if (radCalYear.Checked)
                {
                    calYear = Convert.ToInt32(ddlYear.Text);
                }
                else
                {
                    cropYear = Convert.ToInt32(ddlYear.Text);
                }

                int iShid = 0;
                if (!int.TryParse(shid, out iShid))
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a number for the SHID.  Enter a specific SHID or 0 to return all shareholders.");
                    throw(warn);
                }

                string pdf = WSCReports.rptBeetPaymentBreakdown.ReportPackager(iShid, Convert.ToInt32(cropYear), calYear, fileName, logoUrl, pdfTempFolder);
                if (pdf.Length > 0)
                {
                    // convert file system path to virtual path
                    pdf = pdf.Replace(Common.AppHelper.AppPath(), Page.ResolveUrl("~")).Replace(@"\", @"/");
                }

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                if (Common.AppHelper.IsDebugBuild())
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), wex);
                }
                else
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), "Unable to load page correctly at this time.", wex);
                    Common.AppHelper.LogException(wex, HttpContext.Current);
                }
            }
        }
Example #11
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                string   letterDate   = txtLlLetterDate.Text;
                DateTime dtLetterDate = DateTime.Now;
                try {
                    dtLetterDate = Convert.ToDateTime(letterDate);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid Leter Date.");
                    throw(warn);
                }
                string   deadlineDate   = txtLlDeadlineDate.Text;
                DateTime dtDeadlineDate = DateTime.Now;
                try {
                    dtDeadlineDate = Convert.ToDateTime(deadlineDate);
                }
                catch {
                    Common.CWarning warn = new WSCIEMP.Common.CWarning("Please enter a valid Deadline Date.");
                    throw(warn);
                }

                string pdf = WSCReports.rptLandownerLetter.ReportPackager(Convert.ToInt32(cropYear), dtLetterDate, dtDeadlineDate,
                                                                          _factoryList, _stationList, _contractList, 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 #12
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = txtCcFileName.Text;

                // Check required fields: crop year, start #, stop #, file name.
                string contractNumberStart = txtCcContractNumberStart.Text;
                if (contractNumberStart.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter the First Contract Number.");
                    throw (warn);
                }
                string contractNumberStop = txtCcContractNumberStop.Text;
                if (contractNumberStop.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter the Last Contract Number.");
                    throw (warn);
                }
                if (fileName.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                string pdf      = WSCReports.rptContractCards.ReportPackager(cropYear, contractNumberStart, contractNumberStop, 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);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

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

                int    memberID     = ((HarvestReportTemplate)Master).MemberID;
                string cropYear     = ((HarvestReportTemplate)Master).CropYear;
                int    shid         = ((HarvestReportTemplate)Master).SHID;
                string busName      = ((HarvestReportTemplate)Master).BusName;
                string deliveryDate = Common.UILib.GetListText(lstDdsDeliveryDay, ",");

                if (shid == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a SHID.");
                    throw (warn);
                }

                if (deliveryDate.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Delivery Date.");
                    throw (warn);
                }

                string pdf = WSCReports.rptDeliveryByDaySummary.ReportPackager(Convert.ToInt32(cropYear), memberID, shid,
                                                                               busName, deliveryDate, fileName, logoUrl, pdfTempFolder);

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

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #14
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                string statementDate = txtStatementDate.Text.Trim();
                string shid          = txtPsSHID.Text;
                string fromShid      = txtPsFromSHID.Text;
                string toShid        = txtPsToSHID.Text;
                string footerText    = rptParam_Footer.Value;

                string paymentDesc = Common.UILib.GetDropDownText(ddlPsPaymentDesc);
                if (paymentDesc.StartsWith("None"))
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment having a Payment Date.");
                    throw (warn);
                }

                int  paymentID    = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlPsPaymentDesc));
                bool isCumulative = chkPsIsPaymentSummaryCumulative.Checked;

                string pdf = WSCReports.rptPaymentSummary.ReportPackager(Convert.ToInt32(cropYear), statementDate, shid, fromShid, toShid,
                                                                         paymentID, isCumulative, footerText, 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 #15
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                bool   isCumulative = chkGtIsTransmittalCumulative.Checked;
                string paymentDesc  = Common.UILib.GetDropDownText(ddlGtPaymentDesc);
                if (paymentDesc.StartsWith("None"))
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment other than 'None Available'.");
                    throw (warn);
                }
                int paymentNumber = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlGtPaymentDesc));

                string contractList = Common.UILib.GetListText(lstGtContract, ",");
                if (contractList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Contract.");
                    throw (warn);
                }

                string cropYear = ((HarvestReportTemplate)Master).CropYear;
                string pdf      = WSCReports.rptGroTransmittal.ReportPackager(Convert.ToInt32(cropYear), paymentNumber, paymentDesc, null, null,
                                                                              null, "", "", contractList, isCumulative, fileName, logoUrl, pdfTempFolder);

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

                ((HarvestReportTemplate)sender).LocPDF = pdf;
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((HarvestReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #16
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                string cropYear = ((HarvestReportTemplate)Master).CropYear;

                int shid = ((HarvestReportTemplate)Master).SHID;
                if (shid == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must first Find a SHID.");
                    throw (warn);
                }

                string contractList = Common.UILib.GetListText(lstTtcContract, ",");
                if (contractList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must first select a contract.");
                    throw (warn);
                }

                bool   isCSV = radTtcPrintCSV.Checked;
                string pdf   = WSCReports.rptTonsByTruckByContract.ReportPackager(Convert.ToInt32(cropYear), shid, contractList.Replace(" ", ""), isCSV, fileName, logoUrl, pdfTempFolder);

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

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

            try {
                RebuildDeliveryDates();

                WSCSecurity auth          = Globals.SecurityState;
                string      logoUrl       = Page.MapPath(WSCReportsExec.GetReportLogo());
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((HarvestReportTemplate)Master).ReportName.Replace(" ", "");

                int cropYear = Convert.ToInt32(((HarvestReportTemplate)Master).CropYear);

                string cntNo = Common.UILib.GetListText(lstDgtdContract, ",");
                if (cntNo.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please Choose a Contract.");
                    throw (warn);
                }
                int contractNumber = Convert.ToInt32(cntNo);

                string pdf = WSCReports.rptDailyGrowerTareDetail.ReportPackager(cropYear, contractNumber, _deliveryDates, fileName, logoUrl, pdfTempFolder);

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

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

            try {
                WSCSecurity auth          = Globals.SecurityState;
                string      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                //string fileName = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string fileName = txtFileName.Text;
                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);
                }

                int paymentDescID = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlPaymentNumber));

                string warnMsg;
                string pdf = WSCReports.rptDirectDelivery.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate,
                                                                         paymentDescID, fileName, pdfTempFolder, out warnMsg);

                if (warnMsg.Length > 0)
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), warnMsg);
                }

                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 #19
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 #20
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = txtEpFileName.Text;

                // Get File Name
                if (fileName.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please enter a file name.");
                    throw (warn);
                }

                // Get equity type
                bool isPatronage = Common.UILib.GetDropDownText(ddlEpEquityType).StartsWith("Pat");

                string paymentType = "";
                if (isPatronage)
                {
                    try {
                        paymentType = Common.UILib.GetDropDownText(ddlEpPaymentPat);
                    }
                    catch {
                        Common.CWarning warn = new Common.CWarning("Invalid Payment Type");
                        throw (warn);
                    }
                }
                else
                {
                    try {
                        paymentType = Common.UILib.GetDropDownText(ddlEpPaymentRet);
                    }
                    catch {
                        Common.CWarning warn = new Common.CWarning("Invalid Payment Type");
                        throw (warn);
                    }
                }
                if (paymentType.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment Type.  Payment Type cannot be blank.");
                    throw (warn);
                }

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

                // Get payment Date
                string paymentDate = txtStatementDate.Text.Trim();
                if (paymentDate.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("Please select an Equity Type and Payment Type having a Payment Date.");
                    throw (warn);
                }

                string pdf      = "";
                string badSHIDs = "";

                string cropYear = ((MasterReportTemplate)Master).CropYear;
                pdf = WSCReports.rptEquityPayment.ReportPackager(cropYear, isPatronage, paymentType, paymentDate, ref badSHIDs, fileName, logoUrl, pdfTempFolder);

                if (badSHIDs.Length > 0)
                {
                    txtEpWarnSHID.Text = badSHIDs;
                }

                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 #21
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");

                string reportDate      = txtEsReportDate.Text;
                string paymentCropYear = ((MasterReportTemplate)Master).CropYear;
                string shid            = txtEsSHID.Text;
                bool   isActive        = chkEsActiveOnly.Checked;

                if (reportDate == null || reportDate.Length == 0 || !Common.CodeLib.IsDate(reportDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid report date, mm/dd/yyyy");
                    throw (warn);
                }

                DateTime activityFromDate = DateTime.MinValue;
                DateTime activityToDate   = DateTime.MinValue;

                string testActivityFromDate = txtActivityFromDate.Text;
                string testActivityToDate   = txtActivityToDate.Text;

                if (!String.IsNullOrEmpty(testActivityFromDate))
                {
                    if (!DateTime.TryParse(testActivityFromDate, out activityFromDate))
                    {
                        Common.CWarning warn = new Common.CWarning("The Activity From Date is not a valid date.  Please enter as mm/dd/yyyy");
                        throw (warn);
                    }
                }

                if (!String.IsNullOrEmpty(testActivityToDate))
                {
                    if (!DateTime.TryParse(testActivityToDate, out activityToDate))
                    {
                        Common.CWarning warn = new Common.CWarning("The Activity To Date is not a valid date.  Please enter as mm/dd/yyyy");
                        throw (warn);
                    }
                }

                if (activityFromDate != DateTime.MinValue || activityToDate != DateTime.MinValue)
                {
                    if (activityFromDate == DateTime.MinValue || activityToDate == DateTime.MinValue)
                    {
                        if (!DateTime.TryParse(testActivityToDate, out activityToDate))
                        {
                            Common.CWarning warn = new Common.CWarning("When using the Optional Activity Dates, you must enter both the From and To Dates.");
                            throw (warn);
                        }
                    }
                    if (activityToDate < activityFromDate)
                    {
                        Common.CWarning warn = new Common.CWarning("When using the Optional Activity Dates, the From Date must be less than the To Date");
                        throw (warn);
                    }
                }

                bool isLienInfoWanted = chkIsLienInfoWanted.Checked;

                WSCReports.rptEquityStatement rptEqStmt = new WSCReports.rptEquityStatement();
                string pdf = rptEqStmt.ReportPackager(Int32.Parse(paymentCropYear), DateTime.Parse(reportDate), shid, isActive, fileName, logoUrl, pdfTempFolder,
                                                      activityFromDate, activityToDate, isLienInfoWanted);

                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 #22
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);
            }
        }
Example #23
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      pdfTempFolder = Page.MapPath(WSCReportsExec.GetPDFFolderPath());
                string      fileName      = auth.UserID + "_" + ((MasterReportTemplate)Master).ReportName.Replace(" ", "");
                string      cropYear      = ((MasterReportTemplate)Master).CropYear;

                // Minimally you must at least pick a factory
                if (_factoryList.Length == 0)
                {
                    Common.CWarning warn = new Common.CWarning("You must select at least one Factory");
                    throw (warn);
                }

                // Must have selected a payment ID
                if (ddlTxPaymentDesc.SelectedItem == null)
                {
                    Common.CWarning warn = new Common.CWarning("You must select a payment");
                    throw (warn);
                }
                string paymentDescription = Common.UILib.GetDropDownText(ddlTxPaymentDesc);
                if (paymentDescription.StartsWith("None"))
                {
                    Common.CWarning warn = new Common.CWarning("Please select a Payment having a Payment Date.");
                    throw (warn);
                }

                int    paymentNumber = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlTxPaymentDesc));
                string statementDate = txtStatementDate.Text;

                // Must enter a valid from date
                string fromDate = txtTxFromDate.Text;
                if (fromDate.Length == 0 || !Common.CodeLib.IsDate(fromDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid From Date.");
                    throw (warn);
                }

                // Must enter a valid to date
                string toDate = txtTxToDate.Text;
                if (toDate.Length == 0 || !Common.CodeLib.IsDate(toDate))
                {
                    Common.CWarning warn = new Common.CWarning("You must enter a valid To Date.");
                    throw (warn);
                }

                bool isCumulative = chkTxIsTransmittalCumulative.Checked;

                string pdf = WSCReports.rptTransmittal.ReportPackager(Convert.ToInt32(cropYear), paymentNumber, paymentDescription,
                                                                      fromDate, toDate, statementDate, _factoryList,
                                                                      _stationList, _contractList, isCumulative, 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 #24
0
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                // ------------------------------------------------------------------------
                // We need BOTH the url path and file system path to the payment file.
                // ------------------------------------------------------------------------
                string cropYear    = ((MasterReportTemplate)Master).CropYear;
                string paymentDesc = Common.UILib.GetDropDownText(ddlPaymentNumber);
                string fileName    = cropYear.ToString() + " Payment " + paymentDesc + ".csv";
                string urlPath     = WSCReportsExec.GetPDFFolderPath() + @"/" + fileName;
                string filePath    = Page.MapPath(urlPath);

                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);
                }

                int paymentDescID = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlPaymentNumber));

                string warnMsg;
                WSCReports.rptDirectDeliveryExport.ReportPackager(Convert.ToInt32(cropYear), fromDate, toDate, paymentDescID, filePath, out warnMsg);

                if (warnMsg.Length > 0)
                {
                    Common.AppHelper.ShowWarning((HtmlGenericControl)Master.FindControl("divWarning"), warnMsg);
                }

                lnkPaymentFile.Visible     = true;
                lnkPaymentFile.NavigateUrl = urlPath;
                lnkPaymentFile.Text        = "Click Here to Open Your Export Payment File";
                Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Payment Export Complete!");
            }
            catch (System.Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                ((MasterReportTemplate)Page.Master).ShowWarning(ex);
            }
        }
Example #25
0
        private void DoExport()
        {
            const string METHOD_NAME = "DoExport";
            const string dblQuote    = "\"";

            // Recordset returned by calling either stored procedure.
            const int eepexCrop_year         = 1,
                      eepexContract_no       = 2, // this is really SHID/contract no depending on New vs Old proc call
                      eepexAddress_no        = 3,
                      eepexPayment_no        = 4,
                      eepexAdr_contact_name  = 5,
                      eepexAdr_business_name = 6,
                      eepexAdr_line_1        = 7,
                      eepexAdr_line_2        = 8,
                      eepexAdr_city          = 9,
                      eepexAdr_state         = 10,
                      eepexAdr_zip_code      = 11,
                      eepexPayee_name        = 12,
                      eepexPayment_amount    = 13;

            try {
                int    paymentDescID         = 0;
                string procName              = "";
                int    cropYear              = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear));
                int    countExported         = 0;
                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                paymentDescID = Convert.ToInt32(Common.UILib.GetListValues(lstPaymentNumber));

                if (cropYear < 2006)
                {
                    procName = "s70pay_GetPaymentExport";
                }
                else
                {
                    procName = "s70pay_GetPaymentExport2";
                }

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                    using (SqlDataReader dr = WSCPayment.GetPaymentExport(conn, procName, paymentDescID, cropYear)) {
                        while (dr.Read())
                        {
                            //=============================
                            // First time logic: HEADER !!!
                            //=============================
                            if (countExported == 0)
                            {
                                sb.Append(dblQuote);

                                sb.Append(dr.GetName(eepexCrop_year));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexContract_no));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAddress_no));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexPayment_no));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_contact_name));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_business_name));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_line_1));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_line_2));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_city));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_state));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexAdr_zip_code));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexPayee_name));
                                sb.Append(dblQuote);
                                sb.Append(",");

                                sb.Append(dblQuote);
                                sb.Append(dr.GetName(eepexPayment_amount));
                                sb.Append(dblQuote);

                                sb.Append("\n");
                            }

                            sb.Append(dr.GetInt32(eepexCrop_year).ToString());
                            sb.Append(",");
                            sb.Append(dr.GetString(eepexContract_no));
                            sb.Append(",");
                            sb.Append(dr.GetInt32(eepexAddress_no).ToString("#"));       // SHID
                            sb.Append(",");
                            sb.Append(dr.GetInt32(eepexPayment_no).ToString("#"));
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_contact_name));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_business_name));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_line_1));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_line_2));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_city));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_state));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexAdr_zip_code));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetString(eepexPayee_name));
                            sb.Append(dblQuote);
                            sb.Append(",");
                            sb.Append(dblQuote);
                            sb.Append(dr.GetDecimal(eepexPayment_amount).ToString("#0.00"));
                            sb.Append(dblQuote);
                            sb.Append("\n");

                            countExported += 1;
                        }
                    }
                }

                // ------------------------------------------------------------------------
                // We need BOTH the url path and file system path to the payment file.
                // ------------------------------------------------------------------------
                string paymentDesc = Common.UILib.GetListText(lstPaymentNumber, "");
                string fileName    = cropYear.ToString() + " Payment " + paymentDesc + ".csv";
                string urlPath     = WSCReportsExec.GetPDFFolderPath() + @"/" + fileName;

                // Convert to file system path
                string filePath = Page.MapPath(urlPath);

                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filePath, false)) {
                    sw.Write(sb.ToString());
                }

                txtSumExported.Text        = countExported.ToString("#,##0");
                lnkPaymentFile.Visible     = true;
                lnkPaymentFile.NavigateUrl = urlPath;
                lnkPaymentFile.Text        = "Click Here to Open Your Export Payment File";
                Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "Payment Export Complete!");
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }
        private void DoPrintReady(object sender, CommandEventArgs e)
        {
            const string METHOD_NAME = "DoPrintReady";

            try {
                string    shidEntry = txtSsSHID.Text.Replace(" ", "");
                ArrayList alst      = new ArrayList();

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

                if (shidEntry.IndexOf("-") != -1)
                {
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                        string[] sRange = shidEntry.Split(new char[] { '-' });
                        if (sRange.Length == 2)
                        {
                            string fromShid = sRange[0];
                            string toShid   = sRange[1];
                            alst = WSCField.GrowerPerformanceShidsByRange(conn, Convert.ToInt32(cropYear), fromShid, toShid);
                        }
                    }
                }
                else
                {
                    if (shidEntry.IndexOf(",") != -1)
                    {
                        string[] tmp = shidEntry.Split(new char[] { ',' });
                        foreach (string s in tmp)
                        {
                            alst.Add(s);
                        }
                    }
                    else
                    {
                        if (shidEntry.Length > 0)
                        {
                            alst.Add(shidEntry);
                        }
                    }
                }

                string busName = "";
                string pdf     = WSCReports.rptShareholderSummary.ReportPackager(Convert.ToInt32(cropYear), alst, busName, "", "", "", "", "", auth.UserName, fileName, logoUrl, pdfTempFolder);

                if (alst.Count > 0)
                {
                    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);
            }
        }