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 FillContract() { const string METHOD_NAME = "FillContract"; try { string cropYear = ((MasterReportTemplate)Master).CropYear; ArrayList listIDs = new System.Collections.ArrayList(_contractList.Split(new char[] { ',' })); ListBox lst = lstTxContract; lst.Items.Clear(); List <ListBeetContractIDItem> stateList = WSCReportsExec.ContractsByContractStationNo(Convert.ToInt32(cropYear), _stationList); foreach (ListBeetContractIDItem state in stateList) { ListItem item = new ListItem(state.ContractNumber, state.ContractNumber); lst.Items.Add(item); if (listIDs.Contains(item.Value)) { lst.Items[lst.Items.Count - 1].Selected = true; } } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
public static void GetAddressInfo(SqlConnection conn, int contractID, out string busName, out string address1, out string address2, out string CSZ, out string emailAddress, out string faxNumber) { using (SqlDataReader drAddr = WSCReportsExec.GrowerDetailReportAddr(conn, contractID)) { if (drAddr.Read()) { busName = drAddr.GetString(drAddr.GetOrdinal("Business_Name")); address1 = drAddr.GetString(drAddr.GetOrdinal("Address_1")); address2 = drAddr.GetString(drAddr.GetOrdinal("Address_2")); CSZ = drAddr.GetString(drAddr.GetOrdinal("City")) + ", " + drAddr.GetString(drAddr.GetOrdinal("State")) + " " + drAddr.GetString(drAddr.GetOrdinal("Zip")); emailAddress = drAddr.GetString(drAddr.GetOrdinal("EmailAddress")); faxNumber = drAddr.GetString(drAddr.GetOrdinal("FaxNumber")); } else { busName = ""; address1 = ""; address2 = ""; CSZ = ""; emailAddress = ""; faxNumber = ""; } } }
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); } }
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); } }
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 FillContract() { const string METHOD_NAME = "FillContract"; try { ArrayList listIDs = new System.Collections.ArrayList(_contractList.Split(new char[] { ',' })); ListBox lst = lstFaContract; lst.Items.Clear(); List<ListBeetContractIDItem> stateList = WSCReportsExec.ContractListByStations(_stationList); foreach (ListBeetContractIDItem state in stateList) { ListItem item = new ListItem(state.ContractNumber, state.ContractID); lst.Items.Add(item); if (listIDs.Contains(item.Value)) { lst.Items[lst.Items.Count - 1].Selected = true; } } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void FillContract() { const string METHOD_NAME = "FillContract"; try { lstGtContract.Items.Clear(); string contractList = Common.UILib.GetListText(lstGtContract, ","); string[] list = contractList.Split(new char[] { ',' }); System.Collections.ArrayList contractIDs = new System.Collections.ArrayList(list); string cropYear = ((HarvestReportTemplate)Master).CropYear; int shid = ((HarvestReportTemplate)Master).SHID; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCReportsExec.ContractsByPayeeNumber(conn, Convert.ToInt32(cropYear), shid)) { while (dr.Read()) { string contractNo = dr.GetInt32(dr.GetOrdinal("cnt_contract_no")).ToString(); System.Web.UI.WebControls.ListItem item = new ListItem(contractNo, contractNo); lstGtContract.Items.Add(item); if (contractIDs.Contains(contractNo)) { lstGtContract.Items[lstGtContract.Items.Count - 1].Selected = true; } } } } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void GetContractList(int shid, int cropYear) { try { ddlContractNumber.Items.Clear(); ddlSequence.Items.Clear(); WSCSecurity auth = Globals.SecurityState; ddlContractNumber.Items.Add(""); List <ListBeetContractIDItem> stateList = WSCReportsExec.GetContractListSecure(MemberID, cropYear, auth.UserID); foreach (ListBeetContractIDItem state in stateList) { ddlContractNumber.Items.Add(state.ContractNumber); } if (ddlContractNumber.Items.Count == 1) { ContractNumber = 0; } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + ".GetContractList", ex); throw (wex); } }
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); } }
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); } }
public static string ReportPackager(int cropYear, DateTime fromDate, DateTime toDate, string factoryList, string stationList, string contractList, bool isPosted, bool isPreview, bool isHardCopy, bool isEmail, bool isFax, string fileName, string logoUrl, string pdfTempfolder) { const string METHOD_NAME = "ReportPackager: "; DirectoryInfo pdfDir = null; FileInfo[] pdfFiles = null; string filePath = ""; try { pdfDir = new DirectoryInfo(pdfTempfolder); // Build the output file name by getting a list of all PDF files // that begin with this session ID: use this as a name incrementer. pdfFiles = pdfDir.GetFiles(fileName + "*.pdf"); fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf"; filePath = pdfDir.FullName + @"\" + fileName; try { List <ListGrowerTareItem> hdrList = WSCReportsExec.GrowerDetailReportMasterHdr(cropYear, fromDate, toDate, factoryList, stationList, contractList, isPosted, isHardCopy, isEmail, isFax); if (hdrList.Count == 0) { CWarning warn = new CWarning("No results matched your search criteria."); throw (warn); } using (FileStream fsHardCopy = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read)) { ReportBuilder(hdrList, cropYear, isPosted, isPreview, isHardCopy, isEmail, isFax, fsHardCopy, filePath); } } catch (System.Exception ex) { string errMsg = "cropYear: " + cropYear.ToString(); WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME + ": " + errMsg, ex); throw (wscEx); } return(filePath); } catch (System.Exception ex) { string errMsg = "cropYear: " + cropYear.ToString(); WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME + ": " + errMsg, ex); throw (wscEx); } }
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); } } }
public static string ReportPackager(int cropYear, int memberID, int shid, string busName, string fileName, string logoUrl, string pdfTempfolder) { const string METHOD_NAME = "ReportPackager: "; DirectoryInfo pdfDir = null; FileInfo[] pdfFiles = null; string filePath = ""; try { pdfDir = new DirectoryInfo(pdfTempfolder); // Build the output file name by getting a list of all PDF files // that begin with this session ID: use this as a name incrementer. pdfFiles = pdfDir.GetFiles(fileName + "*.pdf"); fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf"; filePath = pdfDir.FullName + @"\" + fileName; try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCReportsExec.RptContractDeliverySummary(conn, memberID, cropYear)) { using (System.IO.FileStream fs = new FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read)) { ReportBuilder(dr, cropYear, shid, busName, logoUrl, fs); } } } } catch (System.Exception ex) { string errMsg = "cropYear: " + cropYear.ToString() + "; " + "SHID: " + shid; WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME + ": " + errMsg, ex); throw (wscEx); } return(filePath); } catch (System.Exception ex) { string errMsg = "cropYear: " + cropYear.ToString() + "; " + "SHID: " + shid; WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME + ": " + errMsg, ex); throw (wscEx); } }
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); } }
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); } }
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); } }
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); } }
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); } }
private void FillControls() { const string METHOD_NAME = "FillControls"; try { lstCdsContract.Items.Clear(); WSCSecurity auth = Globals.SecurityState; string cropYear = ((HarvestReportTemplate)Master).CropYear; int memberID = ((HarvestReportTemplate)Master).MemberID; List <ListBeetContractIDItem> stateList = WSCReportsExec.GetContractListSecure(memberID, Convert.ToInt32(cropYear), auth.UserID); lstCdsContract.DataSource = stateList; lstCdsContract.DataTextField = "ContractNumber"; lstCdsContract.DataBind(); } catch (System.Exception ex) { Common.CException wscEx = new Common.CException(MOD_NAME + METHOD_NAME + ": ", ex); throw (wscEx); } }
private void FillContractList() { const string METHOD_NAME = "FillContractList"; try { // After slecting a direct delivery, get the selected contract station and fill // list control with contracts related to the station. int cropYear = Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear)); int contractStationNumber = 0; // do we have a specific grid row slected? if (grdDirectDelivery.SelectedRow != null) { contractStationNumber = Convert.ToInt32(grdDirectDelivery.SelectedRow.Cells[(int)GrdDirectDeliveryCols.colContractStation].Text.Substring(0, 2)); } else { // Otherwise has the user selected contract station in the criteria. if (ddlCriteriaContractStation.SelectedIndex > 0) { contractStationNumber = Convert.ToInt32(ddlCriteriaContractStation.SelectedItem.Value); } } if (contractStationNumber > 0) { List <ListBeetContractIDItem> stateList = WSCReportsExec.ContractsByContractStationNo(cropYear, contractStationNumber.ToString()); ddlEditContractNumber.SelectedIndex = -1; ddlEditContractNumber.DataSource = stateList; ddlEditContractNumber.DataBind(); } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void FillStation() { const string METHOD_NAME = "FillStation"; try { ArrayList listIDs = new System.Collections.ArrayList(_stationList.Split(new char[] { ',' })); ListBox lst = lstFaStation; lst.Items.Clear(); List<ListBeetStationIDItem> stateList = WSCReportsExec.StationListGetByFactory(_factoryList); System.Text.StringBuilder sbList = new System.Text.StringBuilder(""); foreach (ListBeetStationIDItem state in stateList) { ListItem item = new ListItem(state.StationNumberName, state.StationID); lst.Items.Add(item); if (listIDs.Contains(item.Value)) { lst.Items[lst.Items.Count - 1].Selected = true; // Rebuild stationList because the listIDs is now qualified against // stations assigned to the valid factory list. sbList.Append(item.Value + ","); } } if (sbList.Length > 0) { sbList.Length = sbList.Length - 1; } _stationList = sbList.ToString(); } 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 { 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 FillControls() { const string METHOD_NAME = "FillControls"; try { lstDdsDeliveryDay.Items.Clear(); if (((HarvestReportTemplate)Master).MemberID > 0) { int memberID = ((HarvestReportTemplate)Master).MemberID; string cropYear = ((HarvestReportTemplate)Master).CropYear; List <ListDeliveryDateItem> stateList = WSCReportsExec.GetDeliveryDays(memberID, Convert.ToInt32(cropYear)); lstDdsDeliveryDay.DataSource = stateList; lstDdsDeliveryDay.DataTextField = "DeliveryDate"; lstDdsDeliveryDay.DataBind(); } } catch (System.Exception ex) { Common.CException wscEx = new Common.CException(MOD_NAME + METHOD_NAME + ": ", ex); throw (wscEx); } }
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); } }
private static void ReportBuilderRetainRedeems(int cropYear, string paymentDate, string shid, string fromShid, string toShid, string logoUrl, System.IO.FileStream fs) { const string METHOD_NAME = "ReportBuilderRetainRedeems: "; string SHID = ""; string equityCropYear = ""; string lastSHID = ""; string lastEquityCropYear = ""; decimal totalCheckAmount = 0; string rptTitle = ""; string statementDate = Convert.ToDateTime(paymentDate).ToString(HEADER_DATE_FORMAT); Document document = null; PdfWriter writer = null; PdfPTable detailTable = null; iTextSharp.text.Image imgLogo = null; StatementPatronageRetainEvent pgEvent = null; try { List <ListStatementPatRetainItem> stateList = WSCReportsExec.RptStatementRetainRedeem(cropYear, shid, fromShid, toShid, paymentDate); for (int i = 0; i < stateList.Count; i++) { ListStatementPatRetainItem state = stateList[i]; if (rptTitle.Length == 0) { rptTitle = "Unit Retain -- " + state.Qualified + " -- " + statementDate; } SHID = state.SHID; equityCropYear = state.EquityCropYear; if (document == null) { // Create the detail table detailTable = PdfReports.CreateTable(_primaryTableLayout, 0); AddRetainRedeemDetailHeader(detailTable); lastSHID = state.SHID; totalCheckAmount = CalcRedeemCheck(stateList, i); // IF YOU CHANGE MARGINS, CHANGE YOUR TABLE LAYOUTS !!! // *** US LETTER: 612 X 792 *** document = new Document(PortraitPageSize.PgPageSize, PortraitPageSize.PgLeftMargin, PortraitPageSize.PgRightMargin, PortraitPageSize.PgTopMargin, PortraitPageSize.PgBottomMargin); // we create a writer that listens to the document // and directs a PDF-stream to a file writer = PdfWriter.GetInstance(document, fs); imgLogo = PdfReports.GetImage(logoUrl, 77, 45, iTextSharp.text.Element.ALIGN_CENTER); // Attach my override event handler(s) pgEvent = new StatementPatronageRetainEvent(); pgEvent.FillEvent(state.SHID, state.BusName, state.Addr1, state.Addr2, state.CSZ, totalCheckAmount, 0, rptTitle, imgLogo); writer.PageEvent = pgEvent; // Open the document document.Open(); } else { if (lastSHID != SHID) { //------------------------------------------------------------------------------------- // When you change members, kick out the page and move on to the next member, // and reset flags. //------------------------------------------------------------------------------------- lastSHID = SHID; lastEquityCropYear = ""; // Add Grand Total Line PdfReports.AddText2Table(detailTable, " ", _normalFont, _primaryTableLayout.Length); PdfReports.AddText2Table(detailTable, "Total Amount", _labelFont, "center"); PdfReports.AddText2Table(detailTable, " ", _normalFont, 2); PdfReports.AddText2Table(detailTable, totalCheckAmount.ToString("$#,##0.00"), _normalFont, "right"); // Add this members detail lines to the document PdfReports.AddTableNoSplit(document, pgEvent, detailTable); // Calc the total for the new SHID totalCheckAmount = CalcRedeemCheck(stateList, i); pgEvent.FillEvent(state.SHID, state.BusName, state.Addr1, state.Addr2, state.CSZ, totalCheckAmount, 0, rptTitle, imgLogo); document.NewPage(); // Refresh the detail table detailTable = PdfReports.CreateTable(_primaryTableLayout, 0); AddRetainRedeemDetailHeader(detailTable); } } // ======================================================= // Build Report // ======================================================= if (state.EquityCropYear != lastEquityCropYear) { // Before resetting the lastEquityCropYear, a non-blank crop year means this is a subsequent // crop year for the same shid. Add a blank if (lastEquityCropYear.Length > 0) { PdfReports.AddText2Table(detailTable, " ", _normalFont, _primaryTableLayout.Length); } lastEquityCropYear = state.EquityCropYear; // Show Equity Data for Crop Year PdfReports.AddText2Table(detailTable, state.EquityCropYear, _normalFont, "center"); PdfReports.AddText2Table(detailTable, state.EquityTons, _normalFont, "right"); PdfReports.AddText2Table(detailTable, state.RatePerTon, _normalFont, "right"); PdfReports.AddText2Table(detailTable, Convert.ToDecimal(state.RedeemAmt).ToString("$#,##0.00"), _normalFont, "right"); if (state.DeductionDesc.Length > 0) { PdfReports.AddText2Table(detailTable, " ", _normalFont, _primaryTableLayout.Length); PdfReports.AddText2Table(detailTable, " ", _normalFont); PdfReports.AddText2Table(detailTable, "Less Deductions: ", _normalItalicFont, "left", 3); PdfReports.AddText2Table(detailTable, " ", _normalFont); PdfReports.AddText2Table(detailTable, state.DeductionDesc, _normalFont, "left", 2); PdfReports.AddText2Table(detailTable, Convert.ToDecimal(state.DeductionAmt).ToString("$#,##0.00"), _normalFont, "right"); } } else { //---------------------------------------------------------- // This is a deduction only line, a subsequent deduction. //---------------------------------------------------------- PdfReports.AddText2Table(detailTable, " ", _normalFont); PdfReports.AddText2Table(detailTable, state.DeductionDesc, _normalFont, "left", 2); PdfReports.AddText2Table(detailTable, Convert.ToDecimal(state.DeductionAmt).ToString("$#,##0.00"), _normalFont, "right"); } } if (detailTable != null) { // Add Grand Total Line PdfReports.AddText2Table(detailTable, " ", _normalFont, _primaryTableLayout.Length); PdfReports.AddText2Table(detailTable, "Total Amount", _labelFont, "center"); PdfReports.AddText2Table(detailTable, " ", _normalFont, 2); PdfReports.AddText2Table(detailTable, totalCheckAmount.ToString("$#,##0.00"), _normalFont, "right"); // Add this members detail lines to the document PdfReports.AddTableNoSplit(document, pgEvent, detailTable); } // ====================================================== // Close document // ====================================================== if (document != null) { pgEvent.IsDocumentClosing = true; document.Close(); document = null; } if (writer == null) { // Warn that we have no data. WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("No records matched your report criteria."); throw (warn); } } catch (Exception ex) { string errMsg = "document is null: " + (document == null).ToString() + "; " + "writer is null: " + (writer == null).ToString(); WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex); throw (wscex); } finally { if (document != null) { pgEvent.IsDocumentClosing = true; document.Close(); } if (writer != null) { writer.Close(); } } }