Пример #1
0
		public static void printAssetOnsite(DataTable dtMachines, string sCustomer, string sCustCode, string sCustPhone, string sCustFax, string sCustContact)
		{
			
			using (Solsage_Process_Management_System.Documents.MachinesOnSite reportMachinesOnSite = new Solsage_Process_Management_System.Documents.MachinesOnSite())
			{
				using (Solsage_Process_Management_System.Documents.PrintInvoice frmPrint = new Solsage_Process_Management_System.Documents.PrintInvoice())
				{
					reportMachinesOnSite.SetDataSource(dtMachines);
					
					foreach (CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition forReport in reportMachinesOnSite.DataDefinition.FormulaFields)
					{

						switch (forReport.FormulaName)
						{
							case "{@sGlobCompanyName}":
								forReport.Text = "'" + Global.sCompanyName.Trim() + "'";
								break;
							case "{@sGlobCompanyRegName}":
								forReport.Text = "'" + Global.sRegName.Trim() + "'";
								break;                            
							case "{@sGlobTel}":
								forReport.Text = "'" + Global.sCompanyTel.Trim() + "'";
								break;
							case "{@sGlobFax}":
								forReport.Text = "'" + Global.sCompanyFax.Trim() + "'";
								break;
							case "{@sGlobPost1}":
								forReport.Text = "'" + Global.sCompanyPostAd1.Trim() + "'";
								break;
							case "{@sGlobPost2}":
								forReport.Text = "'" + Global.sCompanyPostAd2.Trim() + "'";
								break;
							case "{@sGlobPost3}":
								forReport.Text = "'" + Global.sCompanyPostAd3.Trim() + "'";
								break;
							case "{@sGlobAdd1}":
								forReport.Text = "'" + Global.sCompanyAd1.Trim() + "'";
								break;
							case "{@sGlobAdd2}":
								forReport.Text = "'" + Global.sCompanyAd2.Trim() + "'";
								break;
							case "{@sGlobAdd3}":
								forReport.Text = "'" + Global.sCompanyAd3.Trim() + "'";
								break;                            
							case "{@CompanyCell}":
								forReport.Text = "'" + Global.sInvoiceContactNumber + "'";
								break;

							case "{@sCustomer}":
								forReport.Text = "'" + sCustomer + "'";
								break;
							case "{@sCustCode}":
								forReport.Text = "'" + sCustCode + "'";
								break;
							case "{@sCustPhone}":
								forReport.Text = "'" + sCustPhone + "'";
								break;
							case "{@sCustFax}":
								forReport.Text = "'" + sCustFax + "'";
								break;
							case "{@sCustContact}":
								forReport.Text = "'" + sCustContact + "'";
								break;
							
						}
					   
					}

					frmPrint.crystalReportViewer1.ReportSource = reportMachinesOnSite;
					//   frmPrint.printThisDocument();
					frmPrint.ShowDialog();
					
				}
			}
		}
Пример #2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     MachinesOnSite rpt = new MachinesOnSite();
     rpt.Site = this.Site;
     return rpt;
 }