ChrisCompleteCodeTrunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Telerik.Reporting;
using LPD;
namespace Action_Tire_Payment_Processor
{
public partial class ReceiptForm : Form
{
int RecID = -1;
bool Loyalty = false;
public ReceiptForm(int RecID, bool Loyalty)
{
InitializeComponent();
//UriReportSource rs = new UriReportSource();
//rs.Uri = "ATC Receipt.trdx";
//rs.Parameters.Add(new Telerik.Reporting.Parameter("ID", RecID));
//reportViewer1.ReportSource = rs;
this.RecID = RecID;
this.Loyalty = Loyalty;
if (Loyalty)
{
labelResponse.Visible = false;
lblResponse2.Visible = false;
lblResponse.Visible = false;
labelAuthCode.Visible = false;
lblAuthCode.Visible = false;
lblResponse.Text = "SUCCESS";
lblResponse.Visible = true;
}
}
private void btnOkay_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnPrint_Click(object sender, EventArgs e)
{
//PrintReceipt(RecID);
ReceiptPreview rp = Loyalty ? new ReceiptPreview(RecID, Loyalty, lblType.Text) : new ReceiptPreview(RecID, false);
rp.ShowDialog();
}
private void ReceiptForm_Load(object sender, EventArgs e)
{
//this.reportViewer1.RefreshReport();
}
private void PrintReceipt(int RecID)
{
Telerik.Reporting.Processing.ReportProcessor reportProcessor =
new Telerik.Reporting.Processing.ReportProcessor();
// set any deviceInfo settings if necessary
System.Collections.Hashtable deviceInfo =
new System.Collections.Hashtable();
UriReportSource rs = new UriReportSource();
rs.Uri = "ATC Receipt.trdx";
rs.Parameters.Add(new Telerik.Reporting.Parameter("ID", RecID));
//reportViewer1.ReportSource = rs;
//reportViewer1.RefreshReport();
if (Settings.GetOption("USEDEFAULTPRINTER").Equals("False"))
{
Telerik.Reporting.Processing.RenderingResult result =
reportProcessor.RenderReport("PDF", rs, deviceInfo);
string fileName = RecID.ToString() + ".pdf";
string path = @"E:\Temp";
string filePath = System.IO.Path.Combine(path, fileName);
using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
{
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}
Printer p = new Printer(Settings.GetOption("PRINTERIP"), "lp1", Settings.GetOption("STORE"));
p.LPR(filePath, true);
}
else
{
// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings
= new System.Drawing.Printing.PrinterSettings();
// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =
new System.Drawing.Printing.StandardPrintController();
reportProcessor.PrintController = standardPrintController;
reportProcessor.PrintReport(rs, printerSettings);
}
//saveAsPCL(filePath);
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
BBDSCHRIS
|
Wed 22 Aug, 2018 20:08:03 +0000 |
|