浏览代码

Initial commit

Brett Credo 8 年之前
当前提交
96daee8cc7
共有 70 个文件被更改,包括 83649 次插入0 次删除
  1. 4 0
      .gitignore
  2. 33 0
      BulkPrinting/BulkPrinting.sln
  3. 6 0
      BulkPrinting/BulkPrinting/App.config
  4. 389 0
      BulkPrinting/BulkPrinting/BatchForm.Designer.cs
  5. 575 0
      BulkPrinting/BulkPrinting/BatchForm.cs
  6. 6302 0
      BulkPrinting/BulkPrinting/BatchForm.resx
  7. 332 0
      BulkPrinting/BulkPrinting/BulkPrinting.csproj
  8. 16 0
      BulkPrinting/BulkPrinting/BulkPrinting.csproj.user
  9. 二进制
      BulkPrinting/BulkPrinting/BulkPrinting_TemporaryKey.pfx
  10. 18 0
      BulkPrinting/BulkPrinting/Configuration.cs
  11. 279 0
      BulkPrinting/BulkPrinting/ExportForm.Designer.cs
  12. 229 0
      BulkPrinting/BulkPrinting/ExportForm.cs
  13. 6293 0
      BulkPrinting/BulkPrinting/ExportForm.resx
  14. 30 0
      BulkPrinting/BulkPrinting/Globals.cs
  15. 106 0
      BulkPrinting/BulkPrinting/Migrations.cs
  16. 497 0
      BulkPrinting/BulkPrinting/Models.cs
  17. 69 0
      BulkPrinting/BulkPrinting/ObservedForm.cs
  18. 6293 0
      BulkPrinting/BulkPrinting/ObservedForm.resx
  19. 346 0
      BulkPrinting/BulkPrinting/OrderForm.Designer.cs
  20. 271 0
      BulkPrinting/BulkPrinting/OrderForm.cs
  21. 6296 0
      BulkPrinting/BulkPrinting/OrderForm.resx
  22. 143 0
      BulkPrinting/BulkPrinting/OrderReport.Designer.cs
  23. 103 0
      BulkPrinting/BulkPrinting/OrderReport.cs
  24. 6293 0
      BulkPrinting/BulkPrinting/OrderReport.resx
  25. 89 0
      BulkPrinting/BulkPrinting/PasswordPrompt.Designer.cs
  26. 55 0
      BulkPrinting/BulkPrinting/PasswordPrompt.cs
  27. 6293 0
      BulkPrinting/BulkPrinting/PasswordPrompt.resx
  28. 331 0
      BulkPrinting/BulkPrinting/PrintAlignmentDialog.Designer.cs
  29. 151 0
      BulkPrinting/BulkPrinting/PrintAlignmentDialog.cs
  30. 6471 0
      BulkPrinting/BulkPrinting/PrintAlignmentDialog.resx
  31. 304 0
      BulkPrinting/BulkPrinting/PrintForm.Designer.cs
  32. 123 0
      BulkPrinting/BulkPrinting/PrintForm.cs
  33. 6296 0
      BulkPrinting/BulkPrinting/PrintForm.resx
  34. 191 0
      BulkPrinting/BulkPrinting/Printer.cs
  35. 23 0
      BulkPrinting/BulkPrinting/Program.cs
  36. 78 0
      BulkPrinting/BulkPrinting/ProgressDialog.Designer.cs
  37. 51 0
      BulkPrinting/BulkPrinting/ProgressDialog.cs
  38. 6293 0
      BulkPrinting/BulkPrinting/ProgressDialog.resx
  39. 36 0
      BulkPrinting/BulkPrinting/Properties/AssemblyInfo.cs
  40. 193 0
      BulkPrinting/BulkPrinting/Properties/Resources.Designer.cs
  41. 160 0
      BulkPrinting/BulkPrinting/Properties/Resources.resx
  42. 26 0
      BulkPrinting/BulkPrinting/Properties/Settings.Designer.cs
  43. 7 0
      BulkPrinting/BulkPrinting/Properties/Settings.settings
  44. 421 0
      BulkPrinting/BulkPrinting/ReprintForm.Designer.cs
  45. 171 0
      BulkPrinting/BulkPrinting/ReprintForm.cs
  46. 6296 0
      BulkPrinting/BulkPrinting/ReprintForm.resx
  47. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 101 clear.png
  48. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 201 clear.png
  49. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 301 clear.png
  50. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 401 clear.png
  51. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 501 clear.png
  52. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 601 clear.png
  53. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 701 clear.png
  54. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 701.png
  55. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 801 clear.png
  56. 二进制
      BulkPrinting/BulkPrinting/Resources/Asset 901 clear.png
  57. 二进制
      BulkPrinting/BulkPrinting/Resources/r_g_bulk_icon.png
  58. 二进制
      BulkPrinting/BulkPrinting/Resources/rgroup_bulk_print_app_260x70.jpg
  59. 二进制
      BulkPrinting/BulkPrinting/Resources/whitedown.png
  60. 二进制
      BulkPrinting/BulkPrinting/Resources/whiteup.png
  61. 二进制
      BulkPrinting/BulkPrinting/SQLite.Interop.dll
  62. 246 0
      BulkPrinting/BulkPrinting/UserLoginForm.Designer.cs
  63. 255 0
      BulkPrinting/BulkPrinting/UserLoginForm.cs
  64. 6296 0
      BulkPrinting/BulkPrinting/UserLoginForm.resx
  65. 1087 0
      BulkPrinting/BulkPrinting/Utility.cs
  66. 282 0
      BulkPrinting/BulkPrinting/VoucherForm.Designer.cs
  67. 163 0
      BulkPrinting/BulkPrinting/VoucherForm.cs
  68. 6333 0
      BulkPrinting/BulkPrinting/VoucherForm.resx
  69. 5 0
      BulkPrinting/BulkPrinting/packages.config
  70. 二进制
      BulkPrinting/BulkPrinting/r_g_bulk_icon.ico

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
1
+BulkPrinting/BulkPrinting/bin/
2
+BulkPrinting/BulkPrinting/obj/
3
+BulkPrinting/.vs/BulkPrinting/v15/.suo
4
+BulkPrinting/packages/

+ 33 - 0
BulkPrinting/BulkPrinting.sln

@@ -0,0 +1,33 @@
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio 15
4
+VisualStudioVersion = 15.0.26430.13
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BulkPrinting", "BulkPrinting\BulkPrinting.csproj", "{17126A58-EAA0-4518-B2BC-58D98581B031}"
7
+EndProject
8
+Global
9
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
+		Debug|Any CPU = Debug|Any CPU
11
+		Debug|x64 = Debug|x64
12
+		Debug|x86 = Debug|x86
13
+		Release|Any CPU = Release|Any CPU
14
+		Release|x64 = Release|x64
15
+		Release|x86 = Release|x86
16
+	EndGlobalSection
17
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
18
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Debug|Any CPU.Build.0 = Debug|Any CPU
20
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Debug|x64.ActiveCfg = Debug|x64
21
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Debug|x86.ActiveCfg = Debug|x86
22
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Debug|x86.Build.0 = Debug|x86
23
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Release|Any CPU.ActiveCfg = Release|Any CPU
24
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Release|Any CPU.Build.0 = Release|Any CPU
25
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Release|x64.ActiveCfg = Release|x64
26
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Release|x64.Build.0 = Release|x64
27
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Release|x86.ActiveCfg = Release|x86
28
+		{17126A58-EAA0-4518-B2BC-58D98581B031}.Release|x86.Build.0 = Release|x86
29
+	EndGlobalSection
30
+	GlobalSection(SolutionProperties) = preSolution
31
+		HideSolutionNode = FALSE
32
+	EndGlobalSection
33
+EndGlobal

+ 6 - 0
BulkPrinting/BulkPrinting/App.config

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<configuration>
3
+    <startup> 
4
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
5
+    </startup>
6
+</configuration>

+ 389 - 0
BulkPrinting/BulkPrinting/BatchForm.Designer.cs

@@ -0,0 +1,389 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class BatchForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.components = new System.ComponentModel.Container();
32
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
33
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BatchForm));
34
+            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
35
+            this.pnlSplitGrids = new System.Windows.Forms.Panel();
36
+            this.btnOrderReport = new System.Windows.Forms.Button();
37
+            this.btnViewPINs = new System.Windows.Forms.Button();
38
+            this.btnExport = new System.Windows.Forms.Button();
39
+            this.btnReprint = new System.Windows.Forms.Button();
40
+            this.grpFilter = new System.Windows.Forms.GroupBox();
41
+            this.rdoFilterExported = new System.Windows.Forms.RadioButton();
42
+            this.rdoFilterReprinted = new System.Windows.Forms.RadioButton();
43
+            this.rdoFilterUnprinted = new System.Windows.Forms.RadioButton();
44
+            this.rdoFilterPrinted = new System.Windows.Forms.RadioButton();
45
+            this.label2 = new System.Windows.Forms.Label();
46
+            this.label1 = new System.Windows.Forms.Label();
47
+            this.dtpFilterEndDate = new System.Windows.Forms.DateTimePicker();
48
+            this.dtpFilterStartDate = new System.Windows.Forms.DateTimePicker();
49
+            this.btnLogout = new System.Windows.Forms.Button();
50
+            this.btnPrint = new System.Windows.Forms.Button();
51
+            this.btnReExport = new System.Windows.Forms.Button();
52
+            this.btnOrder = new System.Windows.Forms.Button();
53
+            this.dgvBatches = new System.Windows.Forms.DataGridView();
54
+            this.LogoutTimer = new System.Windows.Forms.Timer(this.components);
55
+            this.lblLoading = new System.Windows.Forms.Label();
56
+            this.pnlSplitGrids.SuspendLayout();
57
+            this.grpFilter.SuspendLayout();
58
+            ((System.ComponentModel.ISupportInitialize)(this.dgvBatches)).BeginInit();
59
+            this.SuspendLayout();
60
+            // 
61
+            // contextMenuStrip1
62
+            // 
63
+            this.contextMenuStrip1.Name = "contextMenuStrip1";
64
+            this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
65
+            // 
66
+            // pnlSplitGrids
67
+            // 
68
+            this.pnlSplitGrids.AutoSize = true;
69
+            this.pnlSplitGrids.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
70
+            this.pnlSplitGrids.BackColor = System.Drawing.Color.Transparent;
71
+            this.pnlSplitGrids.Controls.Add(this.btnOrderReport);
72
+            this.pnlSplitGrids.Controls.Add(this.btnViewPINs);
73
+            this.pnlSplitGrids.Controls.Add(this.btnExport);
74
+            this.pnlSplitGrids.Controls.Add(this.btnReprint);
75
+            this.pnlSplitGrids.Controls.Add(this.grpFilter);
76
+            this.pnlSplitGrids.Controls.Add(this.btnLogout);
77
+            this.pnlSplitGrids.Controls.Add(this.btnPrint);
78
+            this.pnlSplitGrids.Controls.Add(this.btnReExport);
79
+            this.pnlSplitGrids.Controls.Add(this.btnOrder);
80
+            this.pnlSplitGrids.Dock = System.Windows.Forms.DockStyle.Top;
81
+            this.pnlSplitGrids.Location = new System.Drawing.Point(0, 10);
82
+            this.pnlSplitGrids.Name = "pnlSplitGrids";
83
+            this.pnlSplitGrids.Size = new System.Drawing.Size(1287, 103);
84
+            this.pnlSplitGrids.TabIndex = 3;
85
+            this.pnlSplitGrids.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlSplitGrids_Paint);
86
+            // 
87
+            // btnOrderReport
88
+            // 
89
+            this.btnOrderReport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
90
+            this.btnOrderReport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset201clear;
91
+            this.btnOrderReport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
92
+            this.btnOrderReport.Location = new System.Drawing.Point(118, 0);
93
+            this.btnOrderReport.Name = "btnOrderReport";
94
+            this.btnOrderReport.Size = new System.Drawing.Size(100, 100);
95
+            this.btnOrderReport.TabIndex = 5;
96
+            this.btnOrderReport.UseVisualStyleBackColor = true;
97
+            this.btnOrderReport.Click += new System.EventHandler(this.btnOrderReport_Click);
98
+            this.btnOrderReport.Paint += new System.Windows.Forms.PaintEventHandler(this.btnOrderReport_Paint);
99
+            // 
100
+            // btnViewPINs
101
+            // 
102
+            this.btnViewPINs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
103
+            this.btnViewPINs.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
104
+            this.btnViewPINs.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset601clear;
105
+            this.btnViewPINs.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
106
+            this.btnViewPINs.Location = new System.Drawing.Point(696, 0);
107
+            this.btnViewPINs.Name = "btnViewPINs";
108
+            this.btnViewPINs.Size = new System.Drawing.Size(100, 100);
109
+            this.btnViewPINs.TabIndex = 4;
110
+            this.btnViewPINs.UseVisualStyleBackColor = false;
111
+            this.btnViewPINs.Click += new System.EventHandler(this.btnViewPINs_Click);
112
+            this.btnViewPINs.Paint += new System.Windows.Forms.PaintEventHandler(this.btnViewPINs_Paint);
113
+            // 
114
+            // btnExport
115
+            // 
116
+            this.btnExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
117
+            this.btnExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset501clear;
118
+            this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
119
+            this.btnExport.Location = new System.Drawing.Point(436, 0);
120
+            this.btnExport.Name = "btnExport";
121
+            this.btnExport.Size = new System.Drawing.Size(100, 100);
122
+            this.btnExport.TabIndex = 4;
123
+            this.btnExport.UseVisualStyleBackColor = false;
124
+            this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
125
+            this.btnExport.Paint += new System.Windows.Forms.PaintEventHandler(this.btnExport_Paint);
126
+            // 
127
+            // btnReprint
128
+            // 
129
+            this.btnReprint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
130
+            this.btnReprint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
131
+            this.btnReprint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset801clear;
132
+            this.btnReprint.Enabled = false;
133
+            this.btnReprint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
134
+            this.btnReprint.Location = new System.Drawing.Point(908, 0);
135
+            this.btnReprint.Name = "btnReprint";
136
+            this.btnReprint.Size = new System.Drawing.Size(100, 100);
137
+            this.btnReprint.TabIndex = 4;
138
+            this.btnReprint.UseVisualStyleBackColor = false;
139
+            this.btnReprint.Click += new System.EventHandler(this.btnReprint_Click);
140
+            this.btnReprint.Paint += new System.Windows.Forms.PaintEventHandler(this.btnReprint_Paint);
141
+            // 
142
+            // grpFilter
143
+            // 
144
+            this.grpFilter.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
145
+            this.grpFilter.Controls.Add(this.rdoFilterExported);
146
+            this.grpFilter.Controls.Add(this.rdoFilterReprinted);
147
+            this.grpFilter.Controls.Add(this.rdoFilterUnprinted);
148
+            this.grpFilter.Controls.Add(this.rdoFilterPrinted);
149
+            this.grpFilter.Controls.Add(this.label2);
150
+            this.grpFilter.Controls.Add(this.label1);
151
+            this.grpFilter.Controls.Add(this.dtpFilterEndDate);
152
+            this.grpFilter.Controls.Add(this.dtpFilterStartDate);
153
+            this.grpFilter.Dock = System.Windows.Forms.DockStyle.Right;
154
+            this.grpFilter.ForeColor = System.Drawing.Color.White;
155
+            this.grpFilter.Location = new System.Drawing.Point(1014, 0);
156
+            this.grpFilter.MaximumSize = new System.Drawing.Size(273, 100);
157
+            this.grpFilter.Name = "grpFilter";
158
+            this.grpFilter.Size = new System.Drawing.Size(273, 100);
159
+            this.grpFilter.TabIndex = 3;
160
+            this.grpFilter.TabStop = false;
161
+            this.grpFilter.Text = "Filter";
162
+            // 
163
+            // rdoFilterExported
164
+            // 
165
+            this.rdoFilterExported.AutoSize = true;
166
+            this.rdoFilterExported.Location = new System.Drawing.Point(132, 69);
167
+            this.rdoFilterExported.Name = "rdoFilterExported";
168
+            this.rdoFilterExported.Size = new System.Drawing.Size(115, 17);
169
+            this.rdoFilterExported.TabIndex = 3;
170
+            this.rdoFilterExported.Text = "Exported Vouchers";
171
+            this.rdoFilterExported.UseVisualStyleBackColor = true;
172
+            this.rdoFilterExported.CheckedChanged += new System.EventHandler(this.rdoFilterExported_CheckedChanged);
173
+            // 
174
+            // rdoFilterReprinted
175
+            // 
176
+            this.rdoFilterReprinted.AutoSize = true;
177
+            this.rdoFilterReprinted.Location = new System.Drawing.Point(132, 46);
178
+            this.rdoFilterReprinted.Name = "rdoFilterReprinted";
179
+            this.rdoFilterReprinted.Size = new System.Drawing.Size(119, 17);
180
+            this.rdoFilterReprinted.TabIndex = 3;
181
+            this.rdoFilterReprinted.Text = "Reprinted Vouchers";
182
+            this.rdoFilterReprinted.UseVisualStyleBackColor = true;
183
+            this.rdoFilterReprinted.CheckedChanged += new System.EventHandler(this.rdoFilterReprinted_CheckedChanged);
184
+            // 
185
+            // rdoFilterUnprinted
186
+            // 
187
+            this.rdoFilterUnprinted.AutoSize = true;
188
+            this.rdoFilterUnprinted.Checked = true;
189
+            this.rdoFilterUnprinted.Location = new System.Drawing.Point(6, 69);
190
+            this.rdoFilterUnprinted.Name = "rdoFilterUnprinted";
191
+            this.rdoFilterUnprinted.Size = new System.Drawing.Size(119, 17);
192
+            this.rdoFilterUnprinted.TabIndex = 3;
193
+            this.rdoFilterUnprinted.TabStop = true;
194
+            this.rdoFilterUnprinted.Text = "Unprinted Vouchers";
195
+            this.rdoFilterUnprinted.UseVisualStyleBackColor = true;
196
+            this.rdoFilterUnprinted.CheckedChanged += new System.EventHandler(this.rdoFilterUnprinted_CheckedChanged);
197
+            // 
198
+            // rdoFilterPrinted
199
+            // 
200
+            this.rdoFilterPrinted.AutoSize = true;
201
+            this.rdoFilterPrinted.Location = new System.Drawing.Point(6, 46);
202
+            this.rdoFilterPrinted.Name = "rdoFilterPrinted";
203
+            this.rdoFilterPrinted.Size = new System.Drawing.Size(106, 17);
204
+            this.rdoFilterPrinted.TabIndex = 3;
205
+            this.rdoFilterPrinted.Text = "Printed Vouchers";
206
+            this.rdoFilterPrinted.UseVisualStyleBackColor = true;
207
+            this.rdoFilterPrinted.CheckedChanged += new System.EventHandler(this.rdoFilterPrinted_CheckedChanged);
208
+            // 
209
+            // label2
210
+            // 
211
+            this.label2.AutoSize = true;
212
+            this.label2.Location = new System.Drawing.Point(137, 19);
213
+            this.label2.Name = "label2";
214
+            this.label2.Size = new System.Drawing.Size(23, 13);
215
+            this.label2.TabIndex = 2;
216
+            this.label2.Text = "To:";
217
+            // 
218
+            // label1
219
+            // 
220
+            this.label1.AutoSize = true;
221
+            this.label1.Location = new System.Drawing.Point(6, 19);
222
+            this.label1.Name = "label1";
223
+            this.label1.Size = new System.Drawing.Size(33, 13);
224
+            this.label1.TabIndex = 2;
225
+            this.label1.Text = "From:";
226
+            // 
227
+            // dtpFilterEndDate
228
+            // 
229
+            this.dtpFilterEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
230
+            this.dtpFilterEndDate.Location = new System.Drawing.Point(160, 16);
231
+            this.dtpFilterEndDate.Name = "dtpFilterEndDate";
232
+            this.dtpFilterEndDate.Size = new System.Drawing.Size(96, 20);
233
+            this.dtpFilterEndDate.TabIndex = 0;
234
+            this.dtpFilterEndDate.CloseUp += new System.EventHandler(this.dtpFilterEndDate_CloseUp);
235
+            // 
236
+            // dtpFilterStartDate
237
+            // 
238
+            this.dtpFilterStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
239
+            this.dtpFilterStartDate.Location = new System.Drawing.Point(40, 16);
240
+            this.dtpFilterStartDate.Name = "dtpFilterStartDate";
241
+            this.dtpFilterStartDate.Size = new System.Drawing.Size(96, 20);
242
+            this.dtpFilterStartDate.TabIndex = 0;
243
+            this.dtpFilterStartDate.CloseUp += new System.EventHandler(this.dtpFilterStartDate_CloseUp);
244
+            // 
245
+            // btnLogout
246
+            // 
247
+            this.btnLogout.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
248
+            this.btnLogout.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset101clear;
249
+            this.btnLogout.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
250
+            this.btnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
251
+            this.btnLogout.Location = new System.Drawing.Point(12, 0);
252
+            this.btnLogout.Name = "btnLogout";
253
+            this.btnLogout.Size = new System.Drawing.Size(100, 100);
254
+            this.btnLogout.TabIndex = 1;
255
+            this.btnLogout.UseVisualStyleBackColor = false;
256
+            this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
257
+            this.btnLogout.Paint += new System.Windows.Forms.PaintEventHandler(this.btnLogout_Paint);
258
+            // 
259
+            // btnPrint
260
+            // 
261
+            this.btnPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
262
+            this.btnPrint.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset401clear;
263
+            this.btnPrint.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
264
+            this.btnPrint.Location = new System.Drawing.Point(330, 0);
265
+            this.btnPrint.Name = "btnPrint";
266
+            this.btnPrint.Size = new System.Drawing.Size(100, 100);
267
+            this.btnPrint.TabIndex = 0;
268
+            this.btnPrint.UseVisualStyleBackColor = false;
269
+            this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
270
+            this.btnPrint.Paint += new System.Windows.Forms.PaintEventHandler(this.btnPrint_Paint);
271
+            // 
272
+            // btnReExport
273
+            // 
274
+            this.btnReExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
275
+            this.btnReExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(100)))), ((int)(((byte)(176)))));
276
+            this.btnReExport.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset701clear;
277
+            this.btnReExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
278
+            this.btnReExport.Location = new System.Drawing.Point(802, 0);
279
+            this.btnReExport.Name = "btnReExport";
280
+            this.btnReExport.Size = new System.Drawing.Size(100, 100);
281
+            this.btnReExport.TabIndex = 0;
282
+            this.btnReExport.UseVisualStyleBackColor = false;
283
+            this.btnReExport.Click += new System.EventHandler(this.btnReExport_Click);
284
+            this.btnReExport.Paint += new System.Windows.Forms.PaintEventHandler(this.btnReExport_Paint);
285
+            // 
286
+            // btnOrder
287
+            // 
288
+            this.btnOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
289
+            this.btnOrder.BackgroundImage = global::BulkPrinting.Properties.Resources.Asset301clear;
290
+            this.btnOrder.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
291
+            this.btnOrder.FlatAppearance.BorderColor = System.Drawing.Color.Black;
292
+            this.btnOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
293
+            this.btnOrder.Location = new System.Drawing.Point(224, 0);
294
+            this.btnOrder.Name = "btnOrder";
295
+            this.btnOrder.Size = new System.Drawing.Size(100, 100);
296
+            this.btnOrder.TabIndex = 0;
297
+            this.btnOrder.UseVisualStyleBackColor = false;
298
+            this.btnOrder.Click += new System.EventHandler(this.btnOrder_Click);
299
+            this.btnOrder.Paint += new System.Windows.Forms.PaintEventHandler(this.btnOrder_Paint);
300
+            // 
301
+            // dgvBatches
302
+            // 
303
+            this.dgvBatches.AllowUserToAddRows = false;
304
+            this.dgvBatches.AllowUserToDeleteRows = false;
305
+            this.dgvBatches.AllowUserToResizeRows = false;
306
+            dataGridViewCellStyle1.BackColor = System.Drawing.Color.Azure;
307
+            this.dgvBatches.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
308
+            this.dgvBatches.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
309
+            | System.Windows.Forms.AnchorStyles.Left) 
310
+            | System.Windows.Forms.AnchorStyles.Right)));
311
+            this.dgvBatches.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
312
+            this.dgvBatches.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
313
+            this.dgvBatches.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
314
+            this.dgvBatches.Location = new System.Drawing.Point(12, 119);
315
+            this.dgvBatches.MultiSelect = false;
316
+            this.dgvBatches.Name = "dgvBatches";
317
+            this.dgvBatches.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
318
+            this.dgvBatches.Size = new System.Drawing.Size(1263, 544);
319
+            this.dgvBatches.TabIndex = 4;
320
+            this.dgvBatches.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvBatches_CellContentClick);
321
+            // 
322
+            // LogoutTimer
323
+            // 
324
+            this.LogoutTimer.Enabled = true;
325
+            this.LogoutTimer.Interval = 600000;
326
+            this.LogoutTimer.Tick += new System.EventHandler(this.LogoutTimer_Tick);
327
+            // 
328
+            // lblLoading
329
+            // 
330
+            this.lblLoading.AutoSize = true;
331
+            this.lblLoading.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
332
+            this.lblLoading.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
333
+            this.lblLoading.Location = new System.Drawing.Point(516, 377);
334
+            this.lblLoading.Name = "lblLoading";
335
+            this.lblLoading.Size = new System.Drawing.Size(245, 55);
336
+            this.lblLoading.TabIndex = 6;
337
+            this.lblLoading.Text = "Loading...";
338
+            // 
339
+            // BatchForm
340
+            // 
341
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
342
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
343
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
344
+            this.ClientSize = new System.Drawing.Size(1287, 675);
345
+            this.Controls.Add(this.lblLoading);
346
+            this.Controls.Add(this.dgvBatches);
347
+            this.Controls.Add(this.pnlSplitGrids);
348
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
349
+            this.MinimumSize = new System.Drawing.Size(1149, 714);
350
+            this.Name = "BatchForm";
351
+            this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
352
+            this.Text = "Bulk Printing";
353
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchForm_FormClosing);
354
+            this.Load += new System.EventHandler(this.BatchForm_Load);
355
+            this.pnlSplitGrids.ResumeLayout(false);
356
+            this.grpFilter.ResumeLayout(false);
357
+            this.grpFilter.PerformLayout();
358
+            ((System.ComponentModel.ISupportInitialize)(this.dgvBatches)).EndInit();
359
+            this.ResumeLayout(false);
360
+            this.PerformLayout();
361
+
362
+        }
363
+
364
+        #endregion
365
+        private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
366
+        private System.Windows.Forms.Panel pnlSplitGrids;
367
+        private System.Windows.Forms.Button btnPrint;
368
+        private System.Windows.Forms.Button btnOrder;
369
+        private System.Windows.Forms.DataGridView dgvBatches;
370
+        private System.Windows.Forms.Button btnLogout;
371
+        private System.Windows.Forms.Timer LogoutTimer;
372
+        private System.Windows.Forms.Button btnReExport;
373
+        private System.Windows.Forms.GroupBox grpFilter;
374
+        private System.Windows.Forms.Label label2;
375
+        private System.Windows.Forms.Label label1;
376
+        private System.Windows.Forms.DateTimePicker dtpFilterEndDate;
377
+        private System.Windows.Forms.DateTimePicker dtpFilterStartDate;
378
+        private System.Windows.Forms.Button btnViewPINs;
379
+        private System.Windows.Forms.Button btnExport;
380
+        private System.Windows.Forms.Button btnReprint;
381
+        private System.Windows.Forms.Label lblLoading;
382
+        private System.Windows.Forms.Button btnOrderReport;
383
+        private System.Windows.Forms.RadioButton rdoFilterExported;
384
+        private System.Windows.Forms.RadioButton rdoFilterReprinted;
385
+        private System.Windows.Forms.RadioButton rdoFilterUnprinted;
386
+        private System.Windows.Forms.RadioButton rdoFilterPrinted;
387
+    }
388
+}
389
+

+ 575 - 0
BulkPrinting/BulkPrinting/BatchForm.cs

@@ -0,0 +1,575 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.IO;
11
+using System.Net;
12
+using Newtonsoft.Json;
13
+using Newtonsoft.Json.Serialization;
14
+using System.Data.SQLite;
15
+using System.Threading;
16
+using System.Globalization;
17
+
18
+namespace BulkPrinting
19
+{
20
+    public partial class BatchForm : ObservedForm
21
+    {
22
+        Thread LoadingThread;
23
+        public BatchForm()
24
+        {
25
+            InitializeComponent();
26
+        }
27
+
28
+        private class BatchEvent
29
+        {
30
+            public int PrintCount=0;
31
+            public int ReprintCount=0;
32
+            public int ExportCount=0;
33
+        }
34
+
35
+        public void PopulateGrid()
36
+        {
37
+            Dictionary<int, BatchEvent> BatchEvents = new Dictionary<int, BatchEvent>();
38
+            string Sql = "Select COUNT(v.BatchId) AS Total, v.BatchId,l.EventType,l.Retry FROM Voucher v LEFT JOIN Logs l on v.Id = l.VoucherId WHERE l.EventType in (@printevent,@exportevent) GROUP BY v.BatchId,l.EventType,l.Retry ORDER BY BatchId";
39
+            SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
40
+            Command.Parameters.Add(new SQLiteParameter("@printevent", VendorEvent.VendorEventType.PrintVoucher));
41
+            Command.Parameters.Add(new SQLiteParameter("@exportevent", VendorEvent.VendorEventType.ExportVoucher));
42
+            using (SQLiteDataReader read = Command.ExecuteReader())
43
+            {
44
+                while (read.Read())
45
+                {
46
+                    int BatchId = int.Parse(read["BatchId"].ToString());
47
+                    if (!BatchEvents.ContainsKey(BatchId))
48
+                    {
49
+                        BatchEvents.Add(BatchId, new BatchEvent());
50
+                    }
51
+                    if (read["EventType"].ToString() == "6")
52
+                    {
53
+                        if (read["Retry"].ToString() == "True")
54
+                        {
55
+                            BatchEvents[BatchId].ReprintCount += int.Parse(read["Total"].ToString());
56
+                        }
57
+                        else
58
+                        {
59
+                            BatchEvents[BatchId].PrintCount += int.Parse(read["Total"].ToString());
60
+                        }
61
+                    }
62
+                    else if (read["EventType"].ToString() == "8")
63
+                    {
64
+                        BatchEvents[BatchId].ExportCount += int.Parse(read["Total"].ToString());
65
+                    }
66
+                }
67
+            }
68
+            bool CanOrder = Utility.CheckUserAccess(Utility.UserPermissions.BulkOrder);
69
+            bool CanExport = Utility.CheckUserAccess(Utility.UserPermissions.BulkExport);
70
+            dgvBatches.Rows.Clear();
71
+            dgvBatches.Columns.Clear();
72
+
73
+            dgvBatches.Columns.Add("Id", "ID");
74
+            dgvBatches.Columns.Add("OrderDate", "Order Date");
75
+            if (CanOrder) dgvBatches.Columns.Add("OrderReference", "Order Reference");
76
+            dgvBatches.Columns.Add("NetworkName", "Network Name");
77
+            dgvBatches.Columns.Add("ProductDescription", "Product Description");
78
+            dgvBatches.Columns.Add("VoucherType", "Voucher Type");
79
+            dgvBatches.Columns.Add("FaceValue", "Face Value");
80
+            if (CanOrder) dgvBatches.Columns.Add("RequestedQuantity", "Quantity Ordered");
81
+            dgvBatches.Columns.Add("DeliveredQuantity", "Quantity Delivered");
82
+            if (CanOrder) dgvBatches.Columns.Add("ReadyForDownload", "Batch Ready for Download");
83
+            dgvBatches.Columns.Add("PrintedQuantity", "Quantity Printed");
84
+            if (CanExport) dgvBatches.Columns.Add("Exported", "Exported Batch");
85
+            Sql = "Select Id,OrderDate,OrderReference,NetworkName,ProductDescription,VoucherType,FaceValue,RequestedQuantity,DeliveredQuantity,ReadyForDownload From Batch WHERE OrderDate BETWEEN @startdate AND @enddate";
86
+
87
+
88
+
89
+            SQLiteCommand comm = new SQLiteCommand(Sql, Globals.DBConnection);
90
+
91
+            CultureInfo IVC = CultureInfo.InvariantCulture;
92
+            comm.Parameters.Add(new SQLiteParameter("@startdate", dtpFilterStartDate.Value.Date.ToString("yyyy-MM-dd 00:00:00", IVC)));
93
+            comm.Parameters.Add(new SQLiteParameter("@enddate", dtpFilterEndDate.Value.Date.ToString("yyyy-MM-dd 23:59:59", IVC)));
94
+
95
+
96
+            lblLoading.Hide();
97
+            using (SQLiteDataReader read = comm.ExecuteReader())
98
+            {
99
+                while (read.Read())
100
+                {
101
+                    int BatchId = int.Parse(read["Id"].ToString());
102
+                    if (!BatchEvents.ContainsKey(BatchId))
103
+                    { //For batches with no events
104
+                        BatchEvents.Add(BatchId, new BatchEvent());
105
+                    }
106
+                    int DeliveredQuantity = int.Parse(read["DeliveredQuantity"].ToString());
107
+                    if (rdoFilterPrinted.Checked)
108
+                    {
109
+                        if (BatchEvents[BatchId].PrintCount == 0)
110
+                        {
111
+                            continue;
112
+                        }
113
+                    }
114
+                    if (rdoFilterUnprinted.Checked) {
115
+                        if (BatchEvents[BatchId].PrintCount >= DeliveredQuantity)
116
+                        {
117
+                            continue;
118
+                        }
119
+                    }
120
+                    if (rdoFilterReprinted.Checked) {
121
+                        if (BatchEvents[BatchId].ReprintCount == 0)
122
+                        {
123
+                            continue;
124
+                        }
125
+                    }
126
+                    if (rdoFilterExported.Checked)
127
+                    {
128
+                        if (BatchEvents[BatchId].ExportCount == 0)
129
+                        {
130
+                            continue;
131
+                        }
132
+                    }
133
+                    else {
134
+                        if (BatchEvents[BatchId].ExportCount > 0)
135
+                        {
136
+                            continue;
137
+                        }
138
+                    }
139
+                    var BatchRow = new object[] {
140
+                        BatchId,
141
+                        read["OrderDate"],
142
+                        read["OrderReference"],
143
+                        read["NetworkName"].ToString(),
144
+                        read["ProductDescription"].ToString(),
145
+                        Enum.Parse(typeof(Vouchertype), read["VoucherType"].ToString()).ToString(),
146
+                        "R" +((decimal)read["FaceValue"]).ToString("0.##")};
147
+
148
+                    if (CanOrder)
149
+                        BatchRow = BatchRow.Concat(new[] { read["RequestedQuantity"] }).ToArray();
150
+
151
+                    BatchRow = BatchRow.Concat(new[] { read["DeliveredQuantity"] }).ToArray();
152
+
153
+                    if (CanOrder)
154
+                        BatchRow = BatchRow.Concat(new[] { ((bool)read["ReadyForDownload"] == true ? "Yes" : "No") }).ToArray();
155
+
156
+                    BatchRow = BatchRow.Concat(new[] { (object)BatchEvents[BatchId].PrintCount }).ToArray();
157
+
158
+                    if (CanExport)
159
+                        BatchRow = BatchRow.Concat(new[] { (BatchEvents[BatchId].ExportCount >0?"Exported":"") }).ToArray();
160
+
161
+                    dgvBatches.Rows.Add(BatchRow);
162
+                }
163
+                dgvBatches.Sort(dgvBatches.Columns["OrderDate"], ListSortDirection.Descending);
164
+            }
165
+        }
166
+
167
+        private void BatchForm_Load(object sender, EventArgs e)
168
+        {
169
+            List<Button> LeftButtonList = new List<Button>();
170
+            List<Button> RightButtonList = new List<Button>();
171
+            LeftButtonList.Add(this.btnLogout);
172
+            LeftButtonList.Add(this.btnOrderReport);
173
+            LeftButtonList.Add(this.btnOrder);
174
+            LeftButtonList.Add(this.btnPrint);
175
+            LeftButtonList.Add(this.btnExport);
176
+            RightButtonList.Add(this.btnViewPINs);
177
+            RightButtonList.Add(this.btnReExport);
178
+            RightButtonList.Add(this.btnReprint);
179
+            foreach (Button b in LeftButtonList) {
180
+                b.Hide();
181
+            }
182
+            foreach (Button b in RightButtonList) {
183
+                b.Hide();
184
+            }
185
+
186
+            if (Globals.SessionMode == SessionModes.Online)
187
+            {
188
+                if (!Utility.CheckUserAccess(Utility.UserPermissions.BulkOrder))
189
+                    LeftButtonList.Remove(this.btnOrder);
190
+
191
+                if (!Utility.CheckUserAccess(Utility.UserPermissions.CanPrintOnline))
192
+                    LeftButtonList.Remove(this.btnPrint);
193
+
194
+                if (!Utility.CheckUserAccess(Utility.UserPermissions.CanReprintOnline)) {
195
+                    RightButtonList.Remove(this.btnReprint);
196
+                    rdoFilterReprinted.Hide();
197
+                }
198
+
199
+            }
200
+            else if (Globals.SessionMode == SessionModes.Offline)
201
+            {
202
+                LeftButtonList.Remove(this.btnOrder);
203
+                if (!Utility.CheckUserAccess(Utility.UserPermissions.CanPrintOffline))
204
+                    LeftButtonList.Remove(this.btnPrint);
205
+
206
+                if (!Utility.CheckUserAccess(Utility.UserPermissions.CanReprintOffline)) { 
207
+                    RightButtonList.Remove(this.btnReprint);
208
+                    rdoFilterReprinted.Hide();
209
+                }
210
+            }
211
+            if (!Utility.CheckUserAccess(Utility.UserPermissions.BulkExport)) {
212
+                LeftButtonList.Remove(this.btnExport);
213
+                RightButtonList.Remove(this.btnReExport);
214
+                rdoFilterExported.Hide();
215
+            }
216
+
217
+            if (!Utility.CheckUserAccess(Utility.UserPermissions.BulkViewPins))
218
+                RightButtonList.Remove(this.btnViewPINs);
219
+
220
+            int ButtonX = 12;
221
+            foreach (Button b in LeftButtonList)
222
+            {
223
+                b.Location = new Point(ButtonX, 0);
224
+                b.Show();
225
+                ButtonX += 106;
226
+            }
227
+
228
+            ButtonX = pnlSplitGrids.Width - 378;
229
+            RightButtonList.Reverse();
230
+            foreach (Button b in RightButtonList)
231
+            {
232
+                b.Location = new Point(ButtonX, 0);
233
+                b.Show();
234
+                ButtonX -= 106;
235
+            }
236
+
237
+            lblLoading.Show();
238
+            dtpFilterStartDate.Value = DateTime.Now.AddMonths(-3);
239
+            Globals.OpenBatches = new List<int>();
240
+
241
+            LoadingThread = new Thread(() =>
242
+            {
243
+                Invoke(new Action(() =>
244
+                {
245
+                    this.Enabled = false;
246
+                    PopulateGrid();
247
+                    this.Enabled = true;
248
+                }));
249
+                if (Globals.SessionMode == SessionModes.Online)
250
+                {
251
+                    Utility.SyncAllBatches();
252
+                }
253
+                Invoke(new Action(() =>
254
+                {
255
+                    PopulateGrid();
256
+                }));
257
+            });
258
+            LoadingThread.Start();
259
+            Utility.InitialiseUserLimits();
260
+        }
261
+
262
+        private void btnOrder_Click(object sender, EventArgs e)
263
+        {
264
+            OrderForm orderform = new OrderForm();
265
+            orderform.SourceForm = this;
266
+            orderform.Show();
267
+        }
268
+
269
+        private void btnPrint_Click(object sender, EventArgs e)
270
+        {
271
+            if (dgvBatches.SelectedRows.Count == 0)
272
+            {
273
+                MessageBox.Show("Please choose a batch to print.", "No batch selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
274
+                return;
275
+            }
276
+            if ((string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["Exported"].Index].Value != "")
277
+            {
278
+                MessageBox.Show("This batch has been exported previously. Exported batches cannot be printed.", "Cannot print batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
279
+                return;
280
+            }
281
+            if (Utility.CheckUserAccess(Utility.UserPermissions.BulkOrder)) { //Only check for undownloaded vouchers if the user is able to see them
282
+                if ((string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["ReadyForDownload"].Index].Value == "No") {
283
+                    MessageBox.Show("This batch is not ready to downloaded and cannot be printed.", "Cannot print batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
284
+                    return;
285
+                }
286
+            }
287
+
288
+
289
+            int BatchID = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["Id"].Index].Value;
290
+            if (Globals.OpenBatches.Contains(BatchID)) {
291
+                MessageBox.Show("A print dialog is already open for this batch","Cannot open print dialog",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
292
+                return;
293
+            }
294
+            this.BeginInvoke((Action)delegate {
295
+                PrintForm PrintFormInstance = new PrintForm();
296
+                Globals.OpenBatches.Add(BatchID);
297
+                int TotalVouchers = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["DeliveredQuantity"].Index].Value;
298
+                int VouchersPrinted = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["PrintedQuantity"].Index].Value;
299
+
300
+                PrintFormInstance.PrintDescription=(string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["ProductDescription"].Index].Value;
301
+                PrintFormInstance.BatchOrderDate=(DateTime)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["OrderDate"].Index].Value;
302
+                PrintFormInstance.UnprintedVouchers= TotalVouchers-VouchersPrinted;
303
+                PrintFormInstance.TotalVouchers=TotalVouchers;
304
+                PrintFormInstance.FaceValue=(string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["FaceValue"].Index].Value;
305
+                PrintFormInstance.VoucherTypeName=(string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["VoucherType"].Index].Value;
306
+                PrintFormInstance.BatchID=BatchID;
307
+                PrintFormInstance.NetworkName = (string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["NetworkName"].Index].Value;
308
+
309
+                PrintFormInstance.Show();
310
+            });
311
+        }
312
+
313
+        private void btnLogout_Click(object sender, EventArgs e)
314
+        {
315
+            this.Close();
316
+        }
317
+
318
+        private void pnlSplitGrids_Paint(object sender, PaintEventArgs e)
319
+        {
320
+
321
+        }
322
+
323
+        private void BatchForm_FormClosing(object sender, FormClosingEventArgs e)
324
+        {
325
+            if (Globals.OpenBatches.Count > 0) {
326
+                MessageBox.Show("There are printing jobs in progress - pelase wait for them to complete before logging out.", "Busy printing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
327
+                e.Cancel = true;
328
+                return;
329
+            }
330
+
331
+            if (LoadingThread.IsAlive)
332
+            {
333
+                LoadingThread.Abort();
334
+            }
335
+            Utility.Logout();
336
+        }
337
+
338
+        private void LogoutTimer_Tick(object sender, EventArgs e)
339
+        {
340
+            Utility.Logout();
341
+        }
342
+
343
+        public void ResetTimer()
344
+        {
345
+            LogoutTimer.Stop();
346
+            LogoutTimer.Start();
347
+        }
348
+
349
+        private void btnReExport_Click(object sender, EventArgs e)
350
+        {
351
+            MessageBox.Show("Please be aware that this function is used for exporting vouchers that have already been exported previously. Use this function with caution.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
352
+            ExportForm exportform = new ExportForm(ExportForm.ExportMode.Reexport);
353
+            exportform.Show();
354
+        }
355
+
356
+        private void dtpFilterStartDate_CloseUp(object sender, EventArgs e)
357
+        {
358
+            PopulateGrid();
359
+        }
360
+
361
+        private void dtpFilterEndDate_CloseUp(object sender, EventArgs e)
362
+        {
363
+            PopulateGrid();
364
+        }
365
+
366
+        private void btnExport_Click(object sender, EventArgs e)
367
+        {
368
+            ExportForm exportform = new ExportForm(ExportForm.ExportMode.Export);
369
+            exportform.Show();
370
+        }
371
+
372
+        private void dgvBatches_CellContentClick(object sender, DataGridViewCellEventArgs e)
373
+        {
374
+
375
+        }
376
+
377
+        private void rdoFilterUnprinted_CheckedChanged(object sender, EventArgs e)
378
+        {
379
+            if (rdoFilterUnprinted.Checked)
380
+            {
381
+                PopulateGrid();
382
+                btnPrint.Enabled = true;
383
+                btnReprint.Enabled = false;
384
+            }
385
+        }
386
+
387
+        private void rdoFilterPrinted_CheckedChanged(object sender, EventArgs e)
388
+        {
389
+            if (rdoFilterPrinted.Checked)
390
+            {
391
+                PopulateGrid();
392
+                btnPrint.Enabled = false;
393
+                btnReprint.Enabled = true;
394
+            }
395
+        }
396
+
397
+        private void rdoFilterReprinted_CheckedChanged(object sender, EventArgs e)
398
+        {
399
+            if (rdoFilterReprinted.Checked)
400
+            {
401
+                PopulateGrid();
402
+                btnPrint.Enabled = false;
403
+                btnReprint.Enabled = true;
404
+            }
405
+        }
406
+
407
+        private void rdoFilterExported_CheckedChanged(object sender, EventArgs e)
408
+        {
409
+            if (rdoFilterExported.Checked)
410
+            {
411
+                PopulateGrid();
412
+                btnPrint.Enabled = false;
413
+                btnReprint.Enabled = false;
414
+            }
415
+        }
416
+
417
+        private void btnOrderReport_Click(object sender, EventArgs e)
418
+        {
419
+            OrderReport OrderReportForm = new OrderReport();
420
+            OrderReportForm.Show();
421
+        }
422
+
423
+        private void btnReprint_Click(object sender, EventArgs e)
424
+        {
425
+            if (dgvBatches.SelectedRows.Count == 0) {
426
+                MessageBox.Show("Please choose a batch to reprint.", "No batch selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
427
+                return;
428
+            }
429
+            MessageBox.Show("Please be aware that this function is used for exporting vouchers that have already been exported previously. Use this function with caution.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
430
+            int BatchID = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["Id"].Index].Value;
431
+            if ((string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["Exported"].Index].Value != "")
432
+            {
433
+                MessageBox.Show("This batch has been exported previously. Exported batches cannot be printed.", "Cannot print batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
434
+                return;
435
+            }
436
+            SQLiteCommand Command = new SQLiteCommand("SELECT COUNT(*) FROM Voucher v LEFT JOIN Logs l ON v.Id = l.VoucherId AND l.EventType = @eventtype WHERE l.VoucherId IS NOT NULL AND v.BatchId=@batchid AND Retry=0", Globals.DBConnection);
437
+            Command.Parameters.Add(new SQLiteParameter("@batchid", BatchID));
438
+            Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
439
+            int PrintCount = int.Parse(Command.ExecuteScalar().ToString());
440
+
441
+            if (PrintCount == 0) {
442
+                MessageBox.Show("You can only use the Reprint feature for vouchers that have already been printed. Please choose a batch with previously printed vouchers.", "Cannot reprint batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
443
+                return;
444
+            }
445
+
446
+            if (Utility.CheckUserAccess(Utility.UserPermissions.BulkOrder))
447
+            { //Only check for undownloaded vouchers if the user is able to see them
448
+                if ((string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["ReadyForDownload"].Index].Value == "No")
449
+                {
450
+                    MessageBox.Show("This batch is not ready to downloaded and cannot be printed.", "Cannot print batch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
451
+                    return;
452
+                }
453
+            }
454
+
455
+
456
+            if (Globals.OpenBatches.Contains(BatchID))
457
+            {
458
+                MessageBox.Show("A print dialog is already open for this batch", "Cannot open print dialog", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
459
+                return;
460
+            }
461
+            this.BeginInvoke((Action)delegate {
462
+                ReprintForm PrintFormInstance = new ReprintForm();
463
+                Globals.OpenBatches.Add(BatchID);
464
+                int TotalVouchers = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["DeliveredQuantity"].Index].Value;
465
+                int VouchersPrinted = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["PrintedQuantity"].Index].Value;
466
+
467
+                PrintFormInstance.PrintDescription = (string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["ProductDescription"].Index].Value;
468
+                PrintFormInstance.BatchOrderDate = (DateTime)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["OrderDate"].Index].Value;
469
+                PrintFormInstance.UnprintedVouchers = TotalVouchers - VouchersPrinted;
470
+                PrintFormInstance.TotalVouchers = TotalVouchers;
471
+                PrintFormInstance.FaceValue = (string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["FaceValue"].Index].Value;
472
+                PrintFormInstance.VoucherTypeName = (string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["VoucherType"].Index].Value;
473
+                PrintFormInstance.BatchID = BatchID;
474
+                PrintFormInstance.NetworkName = (string)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["NetworkName"].Index].Value;
475
+
476
+                PrintFormInstance.Show();
477
+            });
478
+
479
+        }
480
+
481
+        private void btnViewPINs_Click(object sender, EventArgs e)
482
+        {
483
+            VoucherForm ViewPINs = new VoucherForm();
484
+            if (dgvBatches.SelectedRows.Count == 0)
485
+            {
486
+                ViewPINs.BatchID = 0;
487
+            }
488
+            else
489
+            {
490
+                ViewPINs.BatchID = (int)dgvBatches.SelectedRows[0].Cells[dgvBatches.Columns["Id"].Index].Value;
491
+            }
492
+            ViewPINs.Show();
493
+        }
494
+
495
+        private void btnLogout_Paint(object sender, PaintEventArgs e)
496
+        {
497
+            Button b = sender as Button;
498
+            if (!b.Enabled)
499
+            {
500
+                e.Graphics.Clear(Color.Gray);
501
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
502
+            }
503
+        }
504
+
505
+        private void btnOrderReport_Paint(object sender, PaintEventArgs e)
506
+        {
507
+            Button b = sender as Button;
508
+            if (!b.Enabled)
509
+            {
510
+                e.Graphics.Clear(Color.Gray);
511
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
512
+            }
513
+        }
514
+
515
+        private void btnOrder_Paint(object sender, PaintEventArgs e)
516
+        {
517
+            Button b = sender as Button;
518
+            if (!b.Enabled)
519
+            {
520
+                e.Graphics.Clear(Color.Gray);
521
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
522
+            }
523
+        }
524
+
525
+        private void btnPrint_Paint(object sender, PaintEventArgs e)
526
+        {
527
+            Button b = sender as Button;
528
+            if (!b.Enabled)
529
+            {
530
+                e.Graphics.Clear(Color.Gray);
531
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
532
+            }
533
+        }
534
+
535
+        private void btnExport_Paint(object sender, PaintEventArgs e)
536
+        {
537
+            Button b = sender as Button;
538
+            if (!b.Enabled)
539
+            {
540
+                e.Graphics.Clear(Color.Gray);
541
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
542
+            }
543
+        }
544
+
545
+        private void btnViewPINs_Paint(object sender, PaintEventArgs e)
546
+        {
547
+            Button b = sender as Button;
548
+            if (!b.Enabled)
549
+            {
550
+                e.Graphics.Clear(Color.Gray);
551
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
552
+            }
553
+        }
554
+
555
+        private void btnReExport_Paint(object sender, PaintEventArgs e)
556
+        {
557
+            Button b = sender as Button;
558
+            if (!b.Enabled)
559
+            {
560
+                e.Graphics.Clear(Color.Gray);
561
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
562
+            }
563
+        }
564
+
565
+        private void btnReprint_Paint(object sender, PaintEventArgs e)
566
+        {
567
+            Button b = sender as Button;
568
+            if (!b.Enabled)
569
+            {
570
+                e.Graphics.Clear(Color.Gray);
571
+                e.Graphics.DrawImage(b.BackgroundImage, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);
572
+            }
573
+        }
574
+    }
575
+}

文件差异内容过多而无法显示
+ 6302 - 0
BulkPrinting/BulkPrinting/BatchForm.resx


+ 332 - 0
BulkPrinting/BulkPrinting/BulkPrinting.csproj

@@ -0,0 +1,332 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{17126A58-EAA0-4518-B2BC-58D98581B031}</ProjectGuid>
8
+    <OutputType>WinExe</OutputType>
9
+    <RootNamespace>BulkPrinting</RootNamespace>
10
+    <AssemblyName>BulkPrinting</AssemblyName>
11
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12
+    <FileAlignment>512</FileAlignment>
13
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14
+    <TargetFrameworkProfile />
15
+    <IsWebBootstrapper>false</IsWebBootstrapper>
16
+    <PublishUrl>C:\Users\Brett\Desktop\Bulk Printing Setup\</PublishUrl>
17
+    <Install>true</Install>
18
+    <InstallFrom>Disk</InstallFrom>
19
+    <UpdateEnabled>false</UpdateEnabled>
20
+    <UpdateMode>Foreground</UpdateMode>
21
+    <UpdateInterval>7</UpdateInterval>
22
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
23
+    <UpdatePeriodically>false</UpdatePeriodically>
24
+    <UpdateRequired>false</UpdateRequired>
25
+    <MapFileExtensions>true</MapFileExtensions>
26
+    <TargetCulture>en-ZA</TargetCulture>
27
+    <ProductName>Bulk Printing</ProductName>
28
+    <PublisherName>R-Group</PublisherName>
29
+    <ApplicationRevision>4</ApplicationRevision>
30
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
31
+    <UseApplicationTrust>false</UseApplicationTrust>
32
+    <CreateDesktopShortcut>true</CreateDesktopShortcut>
33
+    <PublishWizardCompleted>true</PublishWizardCompleted>
34
+    <BootstrapperEnabled>true</BootstrapperEnabled>
35
+  </PropertyGroup>
36
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
37
+    <PlatformTarget>AnyCPU</PlatformTarget>
38
+    <DebugSymbols>true</DebugSymbols>
39
+    <DebugType>full</DebugType>
40
+    <Optimize>false</Optimize>
41
+    <OutputPath>bin\Debug\</OutputPath>
42
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
43
+    <ErrorReport>prompt</ErrorReport>
44
+    <WarningLevel>4</WarningLevel>
45
+    <Prefer32Bit>true</Prefer32Bit>
46
+  </PropertyGroup>
47
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
48
+    <PlatformTarget>AnyCPU</PlatformTarget>
49
+    <DebugType>pdbonly</DebugType>
50
+    <Optimize>true</Optimize>
51
+    <OutputPath>bin\Release\</OutputPath>
52
+    <DefineConstants>TRACE</DefineConstants>
53
+    <ErrorReport>prompt</ErrorReport>
54
+    <WarningLevel>4</WarningLevel>
55
+    <Prefer32Bit>false</Prefer32Bit>
56
+  </PropertyGroup>
57
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
58
+    <DebugSymbols>true</DebugSymbols>
59
+    <OutputPath>bin\x64\Debug\</OutputPath>
60
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
61
+    <DebugType>full</DebugType>
62
+    <PlatformTarget>x64</PlatformTarget>
63
+    <ErrorReport>prompt</ErrorReport>
64
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
65
+    <Prefer32Bit>true</Prefer32Bit>
66
+  </PropertyGroup>
67
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
68
+    <OutputPath>bin\x64\Release\</OutputPath>
69
+    <DefineConstants>TRACE</DefineConstants>
70
+    <Optimize>true</Optimize>
71
+    <DebugType>pdbonly</DebugType>
72
+    <PlatformTarget>x64</PlatformTarget>
73
+    <ErrorReport>prompt</ErrorReport>
74
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
75
+    <Prefer32Bit>true</Prefer32Bit>
76
+  </PropertyGroup>
77
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
78
+    <DebugSymbols>true</DebugSymbols>
79
+    <OutputPath>bin\x86\Debug\</OutputPath>
80
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
81
+    <DebugType>full</DebugType>
82
+    <PlatformTarget>x86</PlatformTarget>
83
+    <ErrorReport>prompt</ErrorReport>
84
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
85
+    <Prefer32Bit>true</Prefer32Bit>
86
+  </PropertyGroup>
87
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
88
+    <OutputPath>bin\x86\Release\</OutputPath>
89
+    <DefineConstants>TRACE</DefineConstants>
90
+    <Optimize>true</Optimize>
91
+    <DebugType>pdbonly</DebugType>
92
+    <PlatformTarget>x86</PlatformTarget>
93
+    <ErrorReport>prompt</ErrorReport>
94
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
95
+    <Prefer32Bit>true</Prefer32Bit>
96
+  </PropertyGroup>
97
+  <PropertyGroup>
98
+    <ApplicationIcon>r_g_bulk_icon.ico</ApplicationIcon>
99
+  </PropertyGroup>
100
+  <PropertyGroup>
101
+    <ManifestCertificateThumbprint>7338156801DC312C589B984DC4B6B09D535C6AE9</ManifestCertificateThumbprint>
102
+  </PropertyGroup>
103
+  <PropertyGroup>
104
+    <ManifestKeyFile>BulkPrinting_TemporaryKey.pfx</ManifestKeyFile>
105
+  </PropertyGroup>
106
+  <PropertyGroup>
107
+    <GenerateManifests>true</GenerateManifests>
108
+  </PropertyGroup>
109
+  <PropertyGroup>
110
+    <SignManifests>true</SignManifests>
111
+  </PropertyGroup>
112
+  <ItemGroup>
113
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
114
+      <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
115
+    </Reference>
116
+    <Reference Include="System" />
117
+    <Reference Include="System.Core" />
118
+    <Reference Include="System.Data.SQLite">
119
+      <HintPath>C:\Program Files (x86)\System.Data.SQLite\2015\bin\System.Data.SQLite.dll</HintPath>
120
+    </Reference>
121
+    <Reference Include="System.Management" />
122
+    <Reference Include="System.Xml.Linq" />
123
+    <Reference Include="System.Data.DataSetExtensions" />
124
+    <Reference Include="Microsoft.CSharp" />
125
+    <Reference Include="System.Data" />
126
+    <Reference Include="System.Deployment" />
127
+    <Reference Include="System.Drawing" />
128
+    <Reference Include="System.Net.Http" />
129
+    <Reference Include="System.Windows.Forms" />
130
+    <Reference Include="System.Xml" />
131
+  </ItemGroup>
132
+  <ItemGroup>
133
+    <Compile Include="Configuration.cs" />
134
+    <Compile Include="ExportForm.cs">
135
+      <SubType>Form</SubType>
136
+    </Compile>
137
+    <Compile Include="ExportForm.Designer.cs">
138
+      <DependentUpon>ExportForm.cs</DependentUpon>
139
+    </Compile>
140
+    <Compile Include="Globals.cs" />
141
+    <Compile Include="Migrations.cs" />
142
+    <Compile Include="ObservedForm.cs">
143
+      <SubType>Form</SubType>
144
+    </Compile>
145
+    <Compile Include="OrderReport.cs">
146
+      <SubType>Form</SubType>
147
+    </Compile>
148
+    <Compile Include="OrderReport.Designer.cs">
149
+      <DependentUpon>OrderReport.cs</DependentUpon>
150
+    </Compile>
151
+    <Compile Include="PasswordPrompt.cs">
152
+      <SubType>Form</SubType>
153
+    </Compile>
154
+    <Compile Include="PasswordPrompt.Designer.cs">
155
+      <DependentUpon>PasswordPrompt.cs</DependentUpon>
156
+    </Compile>
157
+    <Compile Include="PrintAlignmentDialog.cs">
158
+      <SubType>Form</SubType>
159
+    </Compile>
160
+    <Compile Include="PrintAlignmentDialog.Designer.cs">
161
+      <DependentUpon>PrintAlignmentDialog.cs</DependentUpon>
162
+    </Compile>
163
+    <Compile Include="Printer.cs" />
164
+    <Compile Include="Properties\Resources.Designer.cs">
165
+      <AutoGen>True</AutoGen>
166
+      <DesignTime>True</DesignTime>
167
+      <DependentUpon>Resources.resx</DependentUpon>
168
+    </Compile>
169
+    <Compile Include="ReprintForm.cs">
170
+      <SubType>Form</SubType>
171
+    </Compile>
172
+    <Compile Include="ReprintForm.Designer.cs">
173
+      <DependentUpon>ReprintForm.cs</DependentUpon>
174
+    </Compile>
175
+    <Compile Include="PrintForm.cs">
176
+      <SubType>Form</SubType>
177
+    </Compile>
178
+    <Compile Include="PrintForm.Designer.cs">
179
+      <DependentUpon>PrintForm.cs</DependentUpon>
180
+    </Compile>
181
+    <Compile Include="ProgressDialog.cs">
182
+      <SubType>Form</SubType>
183
+    </Compile>
184
+    <Compile Include="ProgressDialog.Designer.cs">
185
+      <DependentUpon>ProgressDialog.cs</DependentUpon>
186
+    </Compile>
187
+    <Compile Include="Utility.cs" />
188
+    <Compile Include="Models.cs" />
189
+    <Compile Include="OrderForm.cs">
190
+      <SubType>Form</SubType>
191
+    </Compile>
192
+    <Compile Include="OrderForm.Designer.cs">
193
+      <DependentUpon>OrderForm.cs</DependentUpon>
194
+    </Compile>
195
+    <Compile Include="BatchForm.cs">
196
+      <SubType>Form</SubType>
197
+    </Compile>
198
+    <Compile Include="BatchForm.Designer.cs">
199
+      <DependentUpon>BatchForm.cs</DependentUpon>
200
+    </Compile>
201
+    <Compile Include="Program.cs" />
202
+    <Compile Include="Properties\AssemblyInfo.cs" />
203
+    <Compile Include="UserLoginForm.cs">
204
+      <SubType>Form</SubType>
205
+    </Compile>
206
+    <Compile Include="UserLoginForm.Designer.cs">
207
+      <DependentUpon>UserLoginForm.cs</DependentUpon>
208
+    </Compile>
209
+    <Compile Include="VoucherForm.cs">
210
+      <SubType>Form</SubType>
211
+    </Compile>
212
+    <Compile Include="VoucherForm.Designer.cs">
213
+      <DependentUpon>VoucherForm.cs</DependentUpon>
214
+    </Compile>
215
+    <EmbeddedResource Include="ExportForm.resx">
216
+      <DependentUpon>ExportForm.cs</DependentUpon>
217
+    </EmbeddedResource>
218
+    <EmbeddedResource Include="ObservedForm.resx">
219
+      <DependentUpon>ObservedForm.cs</DependentUpon>
220
+    </EmbeddedResource>
221
+    <EmbeddedResource Include="OrderForm.resx">
222
+      <DependentUpon>OrderForm.cs</DependentUpon>
223
+    </EmbeddedResource>
224
+    <EmbeddedResource Include="OrderReport.resx">
225
+      <DependentUpon>OrderReport.cs</DependentUpon>
226
+    </EmbeddedResource>
227
+    <EmbeddedResource Include="PasswordPrompt.resx">
228
+      <DependentUpon>PasswordPrompt.cs</DependentUpon>
229
+    </EmbeddedResource>
230
+    <EmbeddedResource Include="PrintAlignmentDialog.resx">
231
+      <DependentUpon>PrintAlignmentDialog.cs</DependentUpon>
232
+    </EmbeddedResource>
233
+    <EmbeddedResource Include="BatchForm.resx">
234
+      <DependentUpon>BatchForm.cs</DependentUpon>
235
+    </EmbeddedResource>
236
+    <EmbeddedResource Include="ReprintForm.resx">
237
+      <DependentUpon>ReprintForm.cs</DependentUpon>
238
+    </EmbeddedResource>
239
+    <EmbeddedResource Include="PrintForm.resx">
240
+      <DependentUpon>PrintForm.cs</DependentUpon>
241
+    </EmbeddedResource>
242
+    <EmbeddedResource Include="ProgressDialog.resx">
243
+      <DependentUpon>ProgressDialog.cs</DependentUpon>
244
+    </EmbeddedResource>
245
+    <EmbeddedResource Include="Properties\Resources.resx">
246
+      <Generator>ResXFileCodeGenerator</Generator>
247
+      <SubType>Designer</SubType>
248
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
249
+    </EmbeddedResource>
250
+    <EmbeddedResource Include="UserLoginForm.resx">
251
+      <DependentUpon>UserLoginForm.cs</DependentUpon>
252
+    </EmbeddedResource>
253
+    <EmbeddedResource Include="VoucherForm.resx">
254
+      <DependentUpon>VoucherForm.cs</DependentUpon>
255
+    </EmbeddedResource>
256
+    <None Include="BulkPrinting_TemporaryKey.pfx" />
257
+    <None Include="packages.config" />
258
+    <None Include="Properties\Settings.settings">
259
+      <Generator>SettingsSingleFileGenerator</Generator>
260
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
261
+    </None>
262
+    <Compile Include="Properties\Settings.Designer.cs">
263
+      <AutoGen>True</AutoGen>
264
+      <DependentUpon>Settings.settings</DependentUpon>
265
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
266
+    </Compile>
267
+  </ItemGroup>
268
+  <ItemGroup>
269
+    <None Include="App.config" />
270
+  </ItemGroup>
271
+  <ItemGroup>
272
+    <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
273
+      <Visible>False</Visible>
274
+      <ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
275
+      <Install>true</Install>
276
+    </BootstrapperPackage>
277
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
278
+      <Visible>False</Visible>
279
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
280
+      <Install>false</Install>
281
+    </BootstrapperPackage>
282
+  </ItemGroup>
283
+  <ItemGroup>
284
+    <None Include="Resources\Asset 901 clear.png" />
285
+  </ItemGroup>
286
+  <ItemGroup>
287
+    <None Include="Resources\Asset 101 clear.png" />
288
+  </ItemGroup>
289
+  <ItemGroup>
290
+    <None Include="Resources\Asset 201 clear.png" />
291
+  </ItemGroup>
292
+  <ItemGroup>
293
+    <None Include="Resources\Asset 301 clear.png" />
294
+  </ItemGroup>
295
+  <ItemGroup>
296
+    <None Include="Resources\Asset 401 clear.png" />
297
+  </ItemGroup>
298
+  <ItemGroup>
299
+    <None Include="Resources\Asset 501 clear.png" />
300
+  </ItemGroup>
301
+  <ItemGroup>
302
+    <None Include="Resources\Asset 601 clear.png" />
303
+  </ItemGroup>
304
+  <ItemGroup>
305
+    <None Include="Resources\Asset 701.png" />
306
+  </ItemGroup>
307
+  <ItemGroup>
308
+    <None Include="Resources\Asset 701 clear.png" />
309
+  </ItemGroup>
310
+  <ItemGroup>
311
+    <None Include="Resources\Asset 801 clear.png" />
312
+  </ItemGroup>
313
+  <ItemGroup>
314
+    <None Include="Resources\whitedown.png" />
315
+  </ItemGroup>
316
+  <ItemGroup>
317
+    <None Include="Resources\whiteup.png" />
318
+  </ItemGroup>
319
+  <ItemGroup>
320
+    <None Include="Resources\r_g_bulk_icon.png" />
321
+  </ItemGroup>
322
+  <ItemGroup>
323
+    <None Include="Resources\rgroup_bulk_print_app_260x70.jpg" />
324
+  </ItemGroup>
325
+  <ItemGroup>
326
+    <Content Include="r_g_bulk_icon.ico" />
327
+    <Content Include="SQLite.Interop.dll">
328
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
329
+    </Content>
330
+  </ItemGroup>
331
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
332
+</Project>

+ 16 - 0
BulkPrinting/BulkPrinting/BulkPrinting.csproj.user

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <PropertyGroup>
4
+    <PublishUrlHistory>C:\Users\Brett\Desktop\Bulk Printing Setup\|C:\Users\Brett\Desktop\R-Group Deploy\|publish\</PublishUrlHistory>
5
+    <InstallUrlHistory />
6
+    <SupportUrlHistory />
7
+    <UpdateUrlHistory />
8
+    <BootstrapperUrlHistory />
9
+    <ErrorReportUrlHistory />
10
+    <FallbackCulture>en-US</FallbackCulture>
11
+    <VerifyUploadedFiles>false</VerifyUploadedFiles>
12
+  </PropertyGroup>
13
+  <PropertyGroup>
14
+    <EnableSecurityDebugging>false</EnableSecurityDebugging>
15
+  </PropertyGroup>
16
+</Project>

二进制
BulkPrinting/BulkPrinting/BulkPrinting_TemporaryKey.pfx


+ 18 - 0
BulkPrinting/BulkPrinting/Configuration.cs

@@ -0,0 +1,18 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+using System.IO;
7
+
8
+namespace BulkPrinting
9
+{
10
+    public static class Configuration
11
+    {
12
+        public const string ServerDN = "196.31.118.146";
13
+        public const string ServerPort = "443";//"50069";
14
+        public const string MaxDBFileName = "maxdata.dat";
15
+        public const string MaxDataPathName = "M@X";
16
+        //public const IDictionary<string>
17
+    }
18
+}

+ 279 - 0
BulkPrinting/BulkPrinting/ExportForm.Designer.cs

@@ -0,0 +1,279 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class ExportForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExportForm));
32
+            this.btnRemoveBatch = new System.Windows.Forms.Button();
33
+            this.btnAddBatch = new System.Windows.Forms.Button();
34
+            this.lstSelectedBatches = new System.Windows.Forms.ListBox();
35
+            this.lstBatchList = new System.Windows.Forms.ListBox();
36
+            this.btnExport = new System.Windows.Forms.Button();
37
+            this.btnCancel = new System.Windows.Forms.Button();
38
+            this.lblBatchType = new System.Windows.Forms.Label();
39
+            this.label2 = new System.Windows.Forms.Label();
40
+            this.label1 = new System.Windows.Forms.Label();
41
+            this.label3 = new System.Windows.Forms.Label();
42
+            this.cmbNetwork = new System.Windows.Forms.ComboBox();
43
+            this.label4 = new System.Windows.Forms.Label();
44
+            this.label5 = new System.Windows.Forms.Label();
45
+            this.label6 = new System.Windows.Forms.Label();
46
+            this.dtpEndDate = new System.Windows.Forms.DateTimePicker();
47
+            this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
48
+            this.SuspendLayout();
49
+            // 
50
+            // btnRemoveBatch
51
+            // 
52
+            this.btnRemoveBatch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
53
+            this.btnRemoveBatch.FlatAppearance.BorderColor = System.Drawing.Color.Black;
54
+            this.btnRemoveBatch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
55
+            this.btnRemoveBatch.ForeColor = System.Drawing.Color.White;
56
+            this.btnRemoveBatch.Location = new System.Drawing.Point(314, 160);
57
+            this.btnRemoveBatch.Name = "btnRemoveBatch";
58
+            this.btnRemoveBatch.Size = new System.Drawing.Size(86, 23);
59
+            this.btnRemoveBatch.TabIndex = 16;
60
+            this.btnRemoveBatch.Text = "<< Remove";
61
+            this.btnRemoveBatch.UseVisualStyleBackColor = false;
62
+            this.btnRemoveBatch.Click += new System.EventHandler(this.btnRemoveBatch_Click);
63
+            // 
64
+            // btnAddBatch
65
+            // 
66
+            this.btnAddBatch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
67
+            this.btnAddBatch.FlatAppearance.BorderColor = System.Drawing.Color.Black;
68
+            this.btnAddBatch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
69
+            this.btnAddBatch.ForeColor = System.Drawing.Color.White;
70
+            this.btnAddBatch.Location = new System.Drawing.Point(314, 131);
71
+            this.btnAddBatch.Name = "btnAddBatch";
72
+            this.btnAddBatch.Size = new System.Drawing.Size(86, 23);
73
+            this.btnAddBatch.TabIndex = 15;
74
+            this.btnAddBatch.Text = "Add >>";
75
+            this.btnAddBatch.UseVisualStyleBackColor = false;
76
+            this.btnAddBatch.Click += new System.EventHandler(this.btnAddBatch_Click);
77
+            // 
78
+            // lstSelectedBatches
79
+            // 
80
+            this.lstSelectedBatches.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
81
+            this.lstSelectedBatches.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
82
+            this.lstSelectedBatches.FormattingEnabled = true;
83
+            this.lstSelectedBatches.Location = new System.Drawing.Point(406, 34);
84
+            this.lstSelectedBatches.Name = "lstSelectedBatches";
85
+            this.lstSelectedBatches.Size = new System.Drawing.Size(296, 314);
86
+            this.lstSelectedBatches.TabIndex = 13;
87
+            // 
88
+            // lstBatchList
89
+            // 
90
+            this.lstBatchList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
91
+            this.lstBatchList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
92
+            this.lstBatchList.FormattingEnabled = true;
93
+            this.lstBatchList.Location = new System.Drawing.Point(12, 34);
94
+            this.lstBatchList.Name = "lstBatchList";
95
+            this.lstBatchList.Size = new System.Drawing.Size(296, 236);
96
+            this.lstBatchList.TabIndex = 14;
97
+            // 
98
+            // btnExport
99
+            // 
100
+            this.btnExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
101
+            this.btnExport.FlatAppearance.BorderColor = System.Drawing.Color.Black;
102
+            this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
103
+            this.btnExport.ForeColor = System.Drawing.Color.White;
104
+            this.btnExport.Location = new System.Drawing.Point(627, 360);
105
+            this.btnExport.Name = "btnExport";
106
+            this.btnExport.Size = new System.Drawing.Size(75, 23);
107
+            this.btnExport.TabIndex = 17;
108
+            this.btnExport.Text = "Export";
109
+            this.btnExport.UseVisualStyleBackColor = false;
110
+            this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
111
+            // 
112
+            // btnCancel
113
+            // 
114
+            this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
115
+            this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
116
+            this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
117
+            this.btnCancel.ForeColor = System.Drawing.Color.White;
118
+            this.btnCancel.Location = new System.Drawing.Point(546, 360);
119
+            this.btnCancel.Name = "btnCancel";
120
+            this.btnCancel.Size = new System.Drawing.Size(75, 23);
121
+            this.btnCancel.TabIndex = 17;
122
+            this.btnCancel.Text = "Cancel";
123
+            this.btnCancel.UseVisualStyleBackColor = false;
124
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
125
+            // 
126
+            // lblBatchType
127
+            // 
128
+            this.lblBatchType.AutoSize = true;
129
+            this.lblBatchType.ForeColor = System.Drawing.Color.White;
130
+            this.lblBatchType.Location = new System.Drawing.Point(12, 13);
131
+            this.lblBatchType.Name = "lblBatchType";
132
+            this.lblBatchType.Size = new System.Drawing.Size(71, 13);
133
+            this.lblBatchType.TabIndex = 18;
134
+            this.lblBatchType.Text = "New Batches";
135
+            // 
136
+            // label2
137
+            // 
138
+            this.label2.AutoSize = true;
139
+            this.label2.ForeColor = System.Drawing.Color.White;
140
+            this.label2.Location = new System.Drawing.Point(406, 13);
141
+            this.label2.Name = "label2";
142
+            this.label2.Size = new System.Drawing.Size(117, 13);
143
+            this.label2.TabIndex = 19;
144
+            this.label2.Text = "Batches to be exported";
145
+            // 
146
+            // label1
147
+            // 
148
+            this.label1.AutoSize = true;
149
+            this.label1.ForeColor = System.Drawing.Color.White;
150
+            this.label1.Location = new System.Drawing.Point(12, 278);
151
+            this.label1.Name = "label1";
152
+            this.label1.Size = new System.Drawing.Size(29, 13);
153
+            this.label1.TabIndex = 20;
154
+            this.label1.Text = "Filter";
155
+            // 
156
+            // label3
157
+            // 
158
+            this.label3.AutoSize = true;
159
+            this.label3.ForeColor = System.Drawing.Color.White;
160
+            this.label3.Location = new System.Drawing.Point(12, 305);
161
+            this.label3.Name = "label3";
162
+            this.label3.Size = new System.Drawing.Size(50, 13);
163
+            this.label3.TabIndex = 21;
164
+            this.label3.Text = "Network:";
165
+            // 
166
+            // cmbNetwork
167
+            // 
168
+            this.cmbNetwork.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
169
+            this.cmbNetwork.FormattingEnabled = true;
170
+            this.cmbNetwork.Location = new System.Drawing.Point(68, 302);
171
+            this.cmbNetwork.Name = "cmbNetwork";
172
+            this.cmbNetwork.Size = new System.Drawing.Size(238, 21);
173
+            this.cmbNetwork.TabIndex = 22;
174
+            this.cmbNetwork.SelectedIndexChanged += new System.EventHandler(this.cmbNetwork_SelectedIndexChanged);
175
+            // 
176
+            // label4
177
+            // 
178
+            this.label4.AutoSize = true;
179
+            this.label4.ForeColor = System.Drawing.Color.White;
180
+            this.label4.Location = new System.Drawing.Point(12, 332);
181
+            this.label4.Name = "label4";
182
+            this.label4.Size = new System.Drawing.Size(74, 13);
183
+            this.label4.TabIndex = 23;
184
+            this.label4.Text = "Date Ordered:";
185
+            // 
186
+            // label5
187
+            // 
188
+            this.label5.AutoSize = true;
189
+            this.label5.ForeColor = System.Drawing.Color.White;
190
+            this.label5.Location = new System.Drawing.Point(180, 360);
191
+            this.label5.Name = "label5";
192
+            this.label5.Size = new System.Drawing.Size(20, 13);
193
+            this.label5.TabIndex = 26;
194
+            this.label5.Text = "To";
195
+            // 
196
+            // label6
197
+            // 
198
+            this.label6.AutoSize = true;
199
+            this.label6.ForeColor = System.Drawing.Color.White;
200
+            this.label6.Location = new System.Drawing.Point(170, 332);
201
+            this.label6.Name = "label6";
202
+            this.label6.Size = new System.Drawing.Size(30, 13);
203
+            this.label6.TabIndex = 27;
204
+            this.label6.Text = "From";
205
+            // 
206
+            // dtpEndDate
207
+            // 
208
+            this.dtpEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
209
+            this.dtpEndDate.Location = new System.Drawing.Point(206, 358);
210
+            this.dtpEndDate.Name = "dtpEndDate";
211
+            this.dtpEndDate.Size = new System.Drawing.Size(100, 20);
212
+            this.dtpEndDate.TabIndex = 24;
213
+            this.dtpEndDate.ValueChanged += new System.EventHandler(this.dtpEndDate_ValueChanged);
214
+            // 
215
+            // dtpStartDate
216
+            // 
217
+            this.dtpStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
218
+            this.dtpStartDate.Location = new System.Drawing.Point(206, 332);
219
+            this.dtpStartDate.Name = "dtpStartDate";
220
+            this.dtpStartDate.Size = new System.Drawing.Size(100, 20);
221
+            this.dtpStartDate.TabIndex = 25;
222
+            this.dtpStartDate.CloseUp += new System.EventHandler(this.dtpStartDate_CloseUp);
223
+            // 
224
+            // ExportForm
225
+            // 
226
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
227
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
228
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
229
+            this.ClientSize = new System.Drawing.Size(711, 394);
230
+            this.Controls.Add(this.label5);
231
+            this.Controls.Add(this.label6);
232
+            this.Controls.Add(this.dtpEndDate);
233
+            this.Controls.Add(this.dtpStartDate);
234
+            this.Controls.Add(this.label4);
235
+            this.Controls.Add(this.cmbNetwork);
236
+            this.Controls.Add(this.label3);
237
+            this.Controls.Add(this.label1);
238
+            this.Controls.Add(this.label2);
239
+            this.Controls.Add(this.lblBatchType);
240
+            this.Controls.Add(this.btnCancel);
241
+            this.Controls.Add(this.btnExport);
242
+            this.Controls.Add(this.btnRemoveBatch);
243
+            this.Controls.Add(this.btnAddBatch);
244
+            this.Controls.Add(this.lstSelectedBatches);
245
+            this.Controls.Add(this.lstBatchList);
246
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
247
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
248
+            this.MaximizeBox = false;
249
+            this.MaximumSize = new System.Drawing.Size(727, 452);
250
+            this.MinimizeBox = false;
251
+            this.MinimumSize = new System.Drawing.Size(727, 352);
252
+            this.Name = "ExportForm";
253
+            this.Text = "Export Batches";
254
+            this.Load += new System.EventHandler(this.ExportForm_Load);
255
+            this.ResumeLayout(false);
256
+            this.PerformLayout();
257
+
258
+        }
259
+
260
+        #endregion
261
+
262
+        private System.Windows.Forms.Button btnRemoveBatch;
263
+        private System.Windows.Forms.Button btnAddBatch;
264
+        private System.Windows.Forms.ListBox lstSelectedBatches;
265
+        private System.Windows.Forms.ListBox lstBatchList;
266
+        private System.Windows.Forms.Button btnExport;
267
+        private System.Windows.Forms.Button btnCancel;
268
+        private System.Windows.Forms.Label lblBatchType;
269
+        private System.Windows.Forms.Label label2;
270
+        private System.Windows.Forms.Label label1;
271
+        private System.Windows.Forms.Label label3;
272
+        private System.Windows.Forms.ComboBox cmbNetwork;
273
+        private System.Windows.Forms.Label label4;
274
+        private System.Windows.Forms.Label label5;
275
+        private System.Windows.Forms.Label label6;
276
+        private System.Windows.Forms.DateTimePicker dtpEndDate;
277
+        private System.Windows.Forms.DateTimePicker dtpStartDate;
278
+    }
279
+}

+ 229 - 0
BulkPrinting/BulkPrinting/ExportForm.cs

@@ -0,0 +1,229 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Data.SQLite;
11
+using System.IO;
12
+using System.Globalization;
13
+
14
+namespace BulkPrinting
15
+{
16
+    public partial class ExportForm : Form
17
+    {
18
+        public enum ExportMode {
19
+            Export,
20
+            Reexport
21
+        }
22
+
23
+        private ExportMode SelectedMode;
24
+
25
+        private class BatchItem {
26
+            public int Id;
27
+            public string Description;
28
+            public int Quantity;
29
+            public decimal FaceValue;
30
+            public override string ToString()
31
+            {
32
+                return "[" + Id.ToString() + "] " + this.Description + " (" + Quantity.ToString() + " Vouchers)";
33
+            }
34
+        }
35
+        public ExportForm(ExportMode Mode)
36
+        {
37
+            SelectedMode = Mode;
38
+            InitializeComponent();
39
+        }
40
+
41
+        private void btnCancel_Click(object sender, EventArgs e)
42
+        {
43
+            this.Close();
44
+        }
45
+
46
+        private void PopulateBatchList() {
47
+            string Sql = "SELECT b.Id,b.FaceValue,b.ProductDescription,b.DeliveredQuantity,COUNT(l.Id) AS Exported,COUNT(l2.Id) AS Printed FROM Batch b LEFT JOIN Voucher v on v.BatchId = b.Id LEFT JOIN Logs l on v.Id = l.VoucherId AND l.EventType=@exportevent LEFT JOIN Logs l2 on v.Id = l2.VoucherId AND l2.EventType=@printevent WHERE ReadyForDownload=1 AND b.OrderDate BETWEEN @startdate AND @enddate";
48
+            if (cmbNetwork.SelectedItem.ToString() != "All") {
49
+                Sql += " AND b.NetworkName=@networkname";
50
+            }
51
+            Sql += " GROUP BY b.Id,b.FaceValue,b.ProductDescription,b.DeliveredQuantity";
52
+            SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
53
+            if (cmbNetwork.SelectedItem.ToString() != "All")
54
+            {
55
+                Command.Parameters.Add(new SQLiteParameter("@networkname", cmbNetwork.SelectedItem.ToString()));
56
+            }
57
+            CultureInfo IVC = CultureInfo.InvariantCulture;
58
+            Command.Parameters.Add(new SQLiteParameter("@startdate", dtpStartDate.Value.Date.ToString("yyyy-MM-dd 00:00:00", IVC)));
59
+            Command.Parameters.Add(new SQLiteParameter("@enddate", dtpEndDate.Value.Date.ToString("yyyy-MM-dd 23:59:59", IVC)));
60
+            Command.Parameters.Add(new SQLiteParameter("@printevent", VendorEvent.VendorEventType.PrintVoucher));
61
+            Command.Parameters.Add(new SQLiteParameter("@exportevent", VendorEvent.VendorEventType.ExportVoucher));
62
+            Command.ExecuteNonQuery();
63
+            lstBatchList.Items.Clear();
64
+            using (SQLiteDataReader read = Command.ExecuteReader())
65
+            {
66
+                while (read.Read())
67
+                {
68
+                    if (read["Printed"].ToString() == "0")
69
+                    {
70
+                        if ((SelectedMode == ExportMode.Export && read["Exported"].ToString() != "0") ||
71
+                            (SelectedMode == ExportMode.Reexport && read["Exported"].ToString() == "0"))
72
+                        {
73
+                            continue;
74
+                        }
75
+                        BatchItem NewBatchItem = new BatchItem();
76
+                        NewBatchItem.Id = int.Parse(read["Id"].ToString());
77
+                        NewBatchItem.Description = read["ProductDescription"].ToString();
78
+                        NewBatchItem.Quantity = int.Parse(read["DeliveredQuantity"].ToString());
79
+                        NewBatchItem.FaceValue = int.Parse(read["FaceValue"].ToString());
80
+                        lstBatchList.Items.Add(NewBatchItem);
81
+                    }
82
+                }
83
+            }
84
+        }
85
+
86
+        private void ExportForm_Load(object sender, EventArgs e)
87
+        {
88
+            if (SelectedMode == ExportMode.Export)
89
+            {
90
+                this.Text = "Export Vouchers";
91
+                lblBatchType.Text = "New Batches";
92
+            }
93
+            else if (SelectedMode == ExportMode.Reexport)
94
+            {
95
+                this.Text = "Re-export Vouchers";
96
+                lblBatchType.Text = "Previously Exported Batches";
97
+            }
98
+            string Sql = "SELECT DISTINCT NetworkName FROM Batch";
99
+            SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
100
+            Command.ExecuteNonQuery();
101
+            cmbNetwork.Items.Clear();
102
+            cmbNetwork.Items.Add("All");
103
+            using (SQLiteDataReader read = Command.ExecuteReader())
104
+            {
105
+                while (read.Read())
106
+                {
107
+                    cmbNetwork.Items.Add(read["NetworkName"]);
108
+                }
109
+            }
110
+            cmbNetwork.SelectedItem="All";
111
+            dtpStartDate.Value = DateTime.Now.AddMonths(-3);
112
+            dtpEndDate.Value = DateTime.Now;
113
+            PopulateBatchList();
114
+        }
115
+
116
+        private void btnAddBatch_Click(object sender, EventArgs e)
117
+        {
118
+            if (this.lstBatchList.SelectedIndex == -1)
119
+            {
120
+                return;
121
+            }
122
+            lstSelectedBatches.Items.Add(lstBatchList.SelectedItem);
123
+            lstBatchList.Items.Remove(lstBatchList.SelectedItem);
124
+        }
125
+
126
+        private void btnRemoveBatch_Click(object sender, EventArgs e)
127
+        {
128
+            if (this.lstSelectedBatches.SelectedIndex == -1)
129
+            {
130
+                return;
131
+            }
132
+            lstBatchList.Items.Add(lstSelectedBatches.SelectedItem);
133
+            lstSelectedBatches.Items.Remove(lstSelectedBatches.SelectedItem);
134
+        }
135
+
136
+        private void btnExport_Click(object sender, EventArgs e)
137
+        {
138
+            if (lstSelectedBatches.Items.Count == 0)
139
+            {
140
+                MessageBox.Show("Please select at least one batch from the left list to add to the export list on the right.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
141
+                return;
142
+            }
143
+            using (var PathDialog = new FolderBrowserDialog())
144
+            {
145
+                DialogResult Result = PathDialog.ShowDialog();
146
+                if (Result == DialogResult.OK && !string.IsNullOrWhiteSpace(PathDialog.SelectedPath))
147
+                {
148
+                    //using (var logger = new Utility.BulkLogger())
149
+                    //{
150
+
151
+                    List<EventLog> LogEvents = new List<EventLog>();
152
+
153
+                    string Sql = "SELECT v.Id,v.ExpiryDate,v.Serial,v.EncryptedPIN,b.FaceValue,v.BatchId,v.SequenceNumber,b.ProductDescription,COUNT(l.Id) AS Exports FROM Voucher v LEFT JOIN Logs l ON v.Id = l.VoucherId AND l.EventType=@eventtype LEFT JOIN Batch b ON v.BatchId=b.Id WHERE BatchId=@batchid GROUP BY v.Id,v.ExpiryDate,v.Serial,v.EncryptedPIN,b.FaceValue,v.BatchId,v.SequenceNumber,b.ProductDescription";
154
+                    SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
155
+
156
+                    foreach (BatchItem ExportBatch in lstSelectedBatches.Items)
157
+                    {
158
+                        /*  -Id
159
+                            -Expiry
160
+                            -Serial
161
+                            -PIN
162
+                            -Face Value
163
+                            -BatchID
164
+                            -SQN
165
+                            -Description
166
+                        */
167
+                        if (Command.Parameters.Count == 0)
168
+                        {
169
+                            Command.Parameters.Add(new SQLiteParameter("@batchid", ExportBatch.Id));
170
+                            Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.ExportVoucher));
171
+                        }
172
+                        else
173
+                        {
174
+                            Command.Parameters[0].Value = ExportBatch.Id;
175
+                            Command.Parameters[1].Value = VendorEvent.VendorEventType.ExportVoucher;
176
+                        }
177
+                        // Command.Prepare(); // < -- internal
178
+                        Command.ExecuteNonQuery();
179
+                        using (StreamWriter sw = File.CreateText(Path.Combine(PathDialog.SelectedPath, "RG_" + ExportBatch.Id.ToString() + "_" + ExportBatch.Description + "_" + ExportBatch.FaceValue.ToString() + ".txt")))
180
+                        {
181
+                            sw.WriteLine("ID|Expiry|Serial|PIN|Value|BatchId|SQN|Description");
182
+                            using (SQLiteDataReader read = Command.ExecuteReader())
183
+                            {
184
+                                while (read.Read())
185
+                                {
186
+                                    string DecryptedPIN = Utility.TripleDESDecrypt(read["EncryptedPIN"].ToString(), Globals.SessionVoucherKey).ToString();
187
+                                    string ExportRow = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
188
+                                                 read["Id"].ToString(),
189
+                                                 DateTime.Parse(read["ExpiryDate"].ToString()).ToString("dd/MM/yyyy"),
190
+                                                 read["Serial"].ToString(),
191
+                                                 DecryptedPIN,
192
+                                                 read["FaceValue"].ToString(),
193
+                                                 read["BatchId"].ToString(),
194
+                                                 read["SequenceNumber"].ToString(),
195
+                                                 read["ProductDescription"].ToString());
196
+                                    sw.WriteLine(ExportRow);
197
+                                    var ExportEvent = new EventLog();
198
+                                    ExportEvent.EventType = VendorEvent.VendorEventType.ExportVoucher;
199
+                                    ExportEvent.VoucherId = int.Parse(read["Id"].ToString());
200
+                                    ExportEvent.Retry = (read["Exports"].ToString() != "0");
201
+                                    LogEvents.Add(ExportEvent);
202
+                                }
203
+                            }
204
+                        }
205
+                        Utility.LogBulkEvents(LogEvents);
206
+                    }
207
+                }
208
+                MessageBox.Show("Vouchers Exported");
209
+                this.Close();
210
+            }
211
+        }
212
+        
213
+
214
+        private void cmbNetwork_SelectedIndexChanged(object sender, EventArgs e)
215
+        {
216
+            PopulateBatchList();
217
+        }
218
+
219
+        private void dtpStartDate_CloseUp(object sender, EventArgs e)
220
+        {
221
+            PopulateBatchList();
222
+        }
223
+
224
+        private void dtpEndDate_ValueChanged(object sender, EventArgs e)
225
+        {
226
+            PopulateBatchList();
227
+        }
228
+    }
229
+}

文件差异内容过多而无法显示
+ 6293 - 0
BulkPrinting/BulkPrinting/ExportForm.resx


+ 30 - 0
BulkPrinting/BulkPrinting/Globals.cs

@@ -0,0 +1,30 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+using System.Data.SQLite;
7
+using System.Threading;
8
+
9
+namespace BulkPrinting
10
+{
11
+    public static class Globals
12
+    {
13
+        public static SessionModes SessionMode;
14
+        public static OKResponse SessionData;
15
+        public static string HDDSerialNumber;
16
+        public static ICollection<NetworkCatalogue> ProductCatalogue;
17
+        public static byte[] SessionDatabasePassword;
18
+        public static byte[] SessionEncryptedDatabasePassword;
19
+        public static byte[] SessionVoucherKey;
20
+        public static byte[] SessionSalt;
21
+        public static int SessionIterations;
22
+        public static SQLiteConnection DBConnection;
23
+        public static Printer MaxPrinter;
24
+        public static List<int> OpenBatches;
25
+        public static UserLimits UserCurrentUsage;
26
+        public static Thread LogSyncThread;
27
+        public static bool LogSyncWaiting;
28
+        public static bool LogSyncRunning;
29
+    }
30
+}

+ 106 - 0
BulkPrinting/BulkPrinting/Migrations.cs

@@ -0,0 +1,106 @@
1
+using System;
2
+using System.Data.SQLite;
3
+using System.IO;
4
+
5
+namespace BulkPrinting
6
+{
7
+    class Migrations
8
+    {
9
+        public static bool InitialVersion() {
10
+            string MaxDBPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Configuration.MaxDataPathName);
11
+            string MaxDBFilePath = Path.Combine(MaxDBPath, Configuration.MaxDBFileName);
12
+            Globals.DBConnection = new SQLiteConnection(string.Format("Data Source={0};", MaxDBFilePath));
13
+            Globals.DBConnection.SetPassword(Globals.SessionDatabasePassword);
14
+            Globals.DBConnection.Open();
15
+            string sql = "CREATE TABLE Batch (" +
16
+                "Id INT," +
17
+                "OrderDate DATETIME," +
18
+                "OrderGuid VARCHAR(36), " +
19
+                "OrderReference VARCHAR(20) NOT NULL," +
20
+                "NetworkId INT," +
21
+                "NetworkName VARCHAR(20) NOT NULL," +
22
+                "ProductId INT," +
23
+                "ProductDescription VARCHAR(50)," +
24
+                "VoucherType INT," +
25
+                "FaceValue DECIMAL(10,2)," +
26
+                "DiscountPercentage DECIMAL(10,2)," +
27
+                "RequestedQuantity INT," +
28
+                "DeliveredQuantity INT," +
29
+                "Cost DECIMAL(10,2)," +
30
+                "ReadyForDownload BOOLEAN)";
31
+
32
+            SQLiteCommand command = new SQLiteCommand(sql, Globals.DBConnection);
33
+            command.ExecuteNonQuery();
34
+
35
+            sql = "CREATE TABLE Voucher(" +
36
+                "Id INT ," +
37
+                "SequenceNumber INT," +
38
+                "ExpiryDate DATE," +
39
+                "Serial VARCHAR(50)," +
40
+                "EncryptedPIN VARCHAR(50)," +
41
+                "BatchId INT)";
42
+
43
+            command = new SQLiteCommand(sql, Globals.DBConnection);
44
+            command.ExecuteNonQuery();
45
+
46
+            sql = "CREATE TABLE SessionData(" +
47
+                "Key VARCHAR(20)," +
48
+                "Value TEXT)";
49
+
50
+            command = new SQLiteCommand(sql, Globals.DBConnection);
51
+            command.ExecuteNonQuery();
52
+
53
+            sql = "CREATE TABLE Parameters(" +
54
+                "Key VARCHAR(20)," +
55
+                "Value TEXT)";
56
+
57
+            command = new SQLiteCommand(sql, Globals.DBConnection);
58
+            command.ExecuteNonQuery();
59
+
60
+            sql = "CREATE TABLE AccessControlTracking (" +
61
+                "UserID INT NOT NULL," +
62
+                "Permission VARCHAR(20)," +
63
+                "Date DATETIME," +
64
+                "CurrentUsage DECIMAL)";
65
+
66
+            command = new SQLiteCommand(sql, Globals.DBConnection);
67
+            command.ExecuteNonQuery();
68
+
69
+            sql = "CREATE TABLE Logs(" +
70
+                "Id INTEGER PRIMARY KEY," +
71
+                "UserId INT NOT NULL," +
72
+                "VoucherId INT," +
73
+                "EventDate DATETIME," +
74
+                "EventType VARCHAR(50)," +
75
+                "Retry BOOLEAN)";
76
+
77
+            command = new SQLiteCommand(sql, Globals.DBConnection);
78
+            command.ExecuteNonQuery();
79
+
80
+            sql = "CREATE TABLE Orders(" +
81
+                "Id INTEGER PRIMARY KEY," +
82
+                "UserId INT NOT NULL," +
83
+                "UserName VARCHAR(50)," +
84
+                "OrderDate DATETIME," +
85
+                "OrderCost DECIMAL," +
86
+                "BalanceAfterOrder DECIMAL)";
87
+
88
+            command = new SQLiteCommand(sql, Globals.DBConnection);
89
+            command.ExecuteNonQuery();
90
+
91
+            sql = "CREATE TABLE OrderedItems(" +
92
+                "Id INTEGER PRIMARY KEY," +
93
+                "OrderId INT NOT NULL," +
94
+                "Cost DECIMAL," +
95
+                "Quantity INT," +
96
+                "Description VARCHAR(50)," +
97
+                "ProductId)";
98
+
99
+            command = new SQLiteCommand(sql, Globals.DBConnection);
100
+            command.ExecuteNonQuery();
101
+
102
+
103
+            return true;
104
+        }
105
+    }
106
+}

+ 497 - 0
BulkPrinting/BulkPrinting/Models.cs

@@ -0,0 +1,497 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+using Newtonsoft.Json;
7
+using Newtonsoft.Json.Serialization;
8
+
9
+namespace BulkPrinting
10
+{
11
+    public enum SessionModes {
12
+        Invalid = 0,
13
+        Offline = 1,
14
+        Online = 2
15
+    }
16
+
17
+
18
+    public class LoginData
19
+    {
20
+        [JsonProperty("vendorId")]
21
+        public int VendorId { get; set; }
22
+
23
+        [JsonProperty("serialNumber")]
24
+        public string SerialNumber { get; set; }
25
+
26
+        [JsonProperty("userId")]
27
+        public int UserId { get; set; }
28
+
29
+        [JsonProperty("username")]
30
+        public string Username { get; set; }
31
+
32
+        [JsonProperty("password")]
33
+        public string Password { get; set; }
34
+    }
35
+
36
+    public class OrderPlacementData
37
+    {
38
+        [JsonProperty("productId")]
39
+        public int ProductId { get; set; }
40
+
41
+        [JsonProperty("quantity")]
42
+        public int Quantity { get; set; }
43
+
44
+        [JsonProperty("customerReference")]
45
+        public string CustomerReference { get; set; }
46
+    }
47
+
48
+    public class Warehouse
49
+    {
50
+        [JsonProperty("id")]
51
+        public int Id { get; set; }
52
+
53
+        [JsonProperty("name")]
54
+        public string Name { get; set; }
55
+    }
56
+
57
+    public enum AccountStatus
58
+    {
59
+        Unknown,
60
+        Enabled,
61
+        Suspended,
62
+        Closed
63
+    }
64
+
65
+    public class Account
66
+    {
67
+        [JsonProperty("id")]
68
+        public int Id { get; set; }
69
+
70
+        [JsonProperty("name")]
71
+        public string Name { get; set; }
72
+
73
+        [JsonProperty("status")]
74
+        public AccountStatus Status { get; set; }
75
+
76
+        [JsonProperty("reference")]
77
+        public string Reference { get; set; }
78
+
79
+        [JsonProperty("warehouse")]
80
+        public Warehouse Warehouse { get; set; }
81
+
82
+        [JsonProperty("balance")]
83
+        public decimal Balance { get; set; }
84
+    }
85
+
86
+    public class Vendor
87
+    {
88
+        [JsonProperty("Id")]
89
+        public int id { get; set; }
90
+
91
+        [JsonProperty("SerialNumber")]
92
+        public string serialNumber { get; set; }
93
+
94
+        [JsonProperty("AccountId")]
95
+        public int accountId { get; set; }
96
+    }
97
+
98
+    public enum UserLevel
99
+    {
100
+        Unknown = 0,
101
+        Administrator = 4,
102
+        CustomUser = 6
103
+    }
104
+
105
+    public class User
106
+    {
107
+        [JsonProperty("id")]
108
+        public int Id { get; set; }
109
+
110
+        [JsonProperty("username")]
111
+        public string Username { get; set; }
112
+
113
+        [JsonProperty("firstName")]
114
+        public string FirstName { get; set; }
115
+
116
+        [JsonProperty("surname")]
117
+        public string Surname { get; set; }
118
+
119
+        [JsonProperty("account")]
120
+        public Account Account { get; set; }
121
+
122
+        [JsonProperty("enabled")]
123
+        public bool Enabled { get; set; }
124
+
125
+        [JsonProperty("level")]
126
+        public int Level { get; set; }
127
+
128
+        [JsonProperty("system")]
129
+        public int System { get; set; }
130
+
131
+        [JsonProperty("lastLogin")]
132
+        public DateTime LastLogin { get; set; }
133
+
134
+        [JsonProperty("canPrintOnline")]
135
+        public bool CanPrintOnline { get; set; }
136
+
137
+        [JsonProperty("onlinePrintValue")]
138
+        public decimal OnlinePrintValue { get; set; }
139
+
140
+        [JsonProperty("canReprintOnline")]
141
+        public bool CanReprintOnline { get; set; }
142
+
143
+        [JsonProperty("onlineReprintValue")]
144
+        public decimal OnlineReprintValue { get; set; }
145
+
146
+        [JsonProperty("canPrintOffline")]
147
+        public bool CanPrintOffline { get; set; }
148
+
149
+        [JsonProperty("offlinePrintValue")]
150
+        public decimal OfflinePrintValue { get; set; }
151
+
152
+        [JsonProperty("canReprintOffline")]
153
+        public bool CanReprintOffline { get; set; }
154
+
155
+        [JsonProperty("offlineReprintValue")]
156
+        public decimal OfflineReprintValue { get; set; }
157
+
158
+        [JsonProperty("bulkExport")]
159
+        public bool BulkExport { get; set; }
160
+
161
+        [JsonProperty("bulkReExport")]
162
+        public bool BulkReExport { get; set; }
163
+
164
+        [JsonProperty("bulkExportMaxValue")]
165
+        public decimal BulkExportMaxValue { get; set; }
166
+
167
+        [JsonProperty("bulkOrder")]
168
+        public bool BulkOrder { get; set; }
169
+
170
+        [JsonProperty("bulkOrderMaxValue")]
171
+        public decimal BulkOrderMaxValue { get; set; }
172
+
173
+        [JsonProperty("bulkViewPins")]
174
+        public bool BulkViewPins { get; set; }
175
+    }
176
+
177
+    public class Payload
178
+    {
179
+
180
+        [JsonProperty("date")]
181
+        public DateTime Date { get; set; }
182
+
183
+        [JsonProperty("nonce")]
184
+        public string Nonce { get; set; }
185
+
186
+        [JsonProperty("user")]
187
+        public User User { get; set; }
188
+
189
+        [JsonProperty("vendor")]
190
+        public Vendor Vendor { get; set; }
191
+
192
+        [JsonProperty("encryptedDatabasePassword")]
193
+        public byte[] EncryptedDatabasePassword { get; set; }
194
+
195
+        [JsonProperty("encryptedVoucherKey")]
196
+        public byte[] EncryptedVoucherKey { get; set; }
197
+    }
198
+
199
+    public class Credentials
200
+    {
201
+        public string responsePayload;
202
+
203
+        [JsonProperty("payload")]
204
+        public string payloadBase64
205
+        {
206
+            get
207
+            {
208
+                return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(Globals.SessionData.Credentials.Payload)));
209
+            }
210
+            set
211
+            {
212
+                this.responsePayload = value;
213
+                this.Payload = JsonConvert.DeserializeObject<Payload>(Encoding.UTF8.GetString(Convert.FromBase64String(value)));
214
+            }
215
+        }
216
+
217
+        [JsonIgnore]
218
+        public Payload Payload { get; set; }
219
+
220
+        [JsonProperty("salt")]
221
+        public byte[] Salt { get; set; }
222
+
223
+        [JsonProperty("iterations")]
224
+        public int Iterations { get; set; }
225
+
226
+        [JsonProperty("signature")]
227
+        public byte[] Signature { get; set; }
228
+    }
229
+
230
+    public class OKResponse
231
+    {
232
+        [JsonProperty("access_token")]
233
+        public string AccessToken { get; set; }
234
+
235
+
236
+        [JsonProperty("credentials")]
237
+        public Credentials Credentials { get; set; }
238
+
239
+
240
+        [JsonProperty("expires_in")]
241
+        public int ExpiresIn { get; set; }
242
+    }
243
+
244
+    public class OrderData {
245
+        [JsonProperty("productId")]
246
+        public int ProductId { get; set; }
247
+
248
+        [JsonProperty("quantity")]
249
+        public int Quantity { get; set; }
250
+
251
+        [JsonProperty("customerReference")]
252
+        public string CustomerReference { get; set; }
253
+    }
254
+
255
+    public class NetworkCatalogue
256
+    {
257
+        public override string ToString() {
258
+            return this.Name;
259
+        }
260
+
261
+        [JsonProperty("id")]
262
+        public int Id { get; set; }
263
+
264
+        [JsonProperty("name")]
265
+        public string Name { get; set; }
266
+
267
+        [JsonProperty("products")]
268
+        public ICollection<ProductSubCatalogue> Products { get; set; }
269
+    }
270
+
271
+    public class ProductSubCatalogue
272
+    {
273
+        public override string ToString()
274
+        {
275
+            return this.Description;
276
+        }
277
+
278
+        [JsonProperty("id")]
279
+        public int Id { get; set; }
280
+
281
+        [JsonProperty("voucherType")]
282
+        public int VoucherType { get; set; }
283
+
284
+        [JsonProperty("description")]
285
+        public string Description { get; set; }
286
+
287
+        [JsonProperty("faceValue")]
288
+        public decimal FaceValue { get; set; }
289
+
290
+        [JsonProperty("discountPercentage")]
291
+        public decimal DiscountPercentage { get; set; }
292
+    }
293
+
294
+    public class BatchListing {
295
+        [JsonProperty("batch")]
296
+        public Batch Batch { get; set; }
297
+
298
+        [JsonProperty("remainingBalance")]
299
+        public decimal RemainingBalance { get; set; }
300
+    }
301
+
302
+    public class Batch
303
+    {
304
+        [JsonProperty("id")]
305
+        public int Id { get; set; }
306
+
307
+        [JsonProperty("orderDate")]
308
+        public DateTime OrderDate { get; set; }
309
+
310
+        [JsonProperty("orderGuid")]
311
+        public string OrderGuid { get; set; }
312
+
313
+        [JsonProperty("orderReference")]
314
+        public string OrderReference { get; set; }
315
+
316
+        [JsonProperty("networkId")]
317
+        public int NetworkId { get; set; }
318
+
319
+        [JsonProperty("networkName")]
320
+        public string NetworkName { get; set; }
321
+
322
+        [JsonProperty("productId")]
323
+        public int ProductId { get; set; }
324
+
325
+        [JsonProperty("productDescription")]
326
+        public string ProductDescription { get; set; }
327
+
328
+        [JsonProperty("voucherType")]
329
+        public int VoucherType { get; set; }
330
+
331
+        [JsonProperty("faceValue")]
332
+        public decimal FaceValue { get; set; }
333
+
334
+        [JsonProperty("discountPercentage")]
335
+        public decimal DiscountPercentage { get; set; }
336
+
337
+        [JsonProperty("requestedQuantity")]
338
+        public int RequestedQuantity { get; set; }
339
+
340
+        [JsonProperty("deliveredQuantity")]
341
+        public int DeliveredQuantity { get; set; }
342
+
343
+        [JsonProperty("cost")]
344
+        public decimal Cost { get; set; }
345
+
346
+        [JsonProperty("readyForDownload")]
347
+        public bool ReadyForDownload { get; set; }
348
+    }
349
+
350
+    public class Page<T>
351
+    {
352
+        [JsonProperty("items")]
353
+        public List<T> Items { get; set; }
354
+
355
+        [JsonProperty("totalItems")]
356
+        public int TotalItems { get; set; }
357
+
358
+        [JsonProperty("pageNumber")]
359
+        public int PageNumber { get; set; }
360
+
361
+        [JsonProperty("pageSize")]
362
+        public int PageSize { get; set; }
363
+
364
+        [JsonProperty("numPages")]
365
+        public int NumPages { get; set; }
366
+    }
367
+
368
+    public enum Vouchertype
369
+    {
370
+        Voucher = 1,
371
+        SMS = 2,
372
+        Data = 3
373
+    }
374
+
375
+    public class Voucher
376
+    {
377
+        [JsonProperty("id")]
378
+        public int Id { get; set; }
379
+
380
+        [JsonProperty("sequenceNumber")]
381
+        public int SequenceNumber { get; set; }
382
+
383
+        [JsonProperty("expiryDate")]
384
+        public DateTime ExpiryDate { get; set; }
385
+
386
+        [JsonProperty("serial")]
387
+        public string Serial { get; set; }
388
+
389
+        [JsonProperty("encryptedPIN")]
390
+        public string EncryptedPIN { get; set; }
391
+    }
392
+
393
+    public class PrintVoucher
394
+    {
395
+        public int SequenceNumber { get; set; }
396
+        public int BatchId { get; set; }
397
+        public string Serial { get; set; }
398
+        public int VoucherId { get; set; }
399
+        public string Description { get; set; }
400
+        public string DecryptedPIN { get; set; }
401
+    }
402
+
403
+    public class UserLimits {
404
+        public enum UserLimitTypes {
405
+            OnlinePrint ,
406
+            OnlineReprint,
407
+            OfflinePrint,
408
+            OfflineReprint,
409
+            BulkExport,
410
+            BulkOrder
411
+        }
412
+        public decimal OnlinePrintValue { get; set; }
413
+        public decimal OnlineReprintValue { get; set; }
414
+        public decimal OfflinePrintValue { get; set; }
415
+        public decimal OfflineReprintValue { get; set; }
416
+        public decimal BulkExportValue { get; set; }
417
+        public decimal BulkOrderValue { get; set; }
418
+    }
419
+
420
+    public class VendorEvent
421
+    {
422
+        public enum VendorEventType
423
+        {
424
+            Unknown = 0,
425
+            Login = 1, //Logged by Server
426
+            OfflineLogin = 2,
427
+            ExtendLogin = 3, //Logged by Server
428
+            Logout = 4,
429
+            DownloadVoucher = 5, //Logged by Server
430
+            PrintVoucher = 6,
431
+            ViewVoucherPIN = 7,
432
+            ExportVoucher = 8
433
+        }
434
+
435
+        public int Id { get; set; }
436
+
437
+        public int VendorId { get; set; }
438
+
439
+        public int UserId { get; set; }
440
+
441
+        public int? VoucherId { get; set; }
442
+
443
+        public int? RemoteId { get; set; }
444
+
445
+        public DateTimeOffset EventDate { get; set; }
446
+
447
+        public VendorEventType EventType { get; set; }
448
+
449
+        public bool Retry { get; set; }
450
+    }
451
+
452
+    public class EventLog {
453
+        public VendorEvent.VendorEventType EventType { get; set; }
454
+        public int? VoucherId { get; set; }
455
+        public bool Retry { get; set; }
456
+    }
457
+
458
+    public class VendorEventsMetaData {
459
+        [JsonProperty("date")]
460
+        public DateTimeOffset Date { get; set; }
461
+
462
+        [JsonProperty("vendorId")]
463
+        public int VendorId { get; set; }
464
+
465
+        [JsonProperty("lastVendorEventRemoteId")]
466
+        public int? LastVendorEventRemoteId { get; set; }
467
+    }
468
+
469
+    public class RemoteVendorEvent
470
+    {
471
+        [JsonProperty("Id")]
472
+        public int? Id { get; set; }
473
+
474
+        [JsonProperty("VendorId")]
475
+        public int? VendorId { get; set; }
476
+
477
+        [JsonProperty("UserId")]
478
+        public int? UserId { get; set; }
479
+
480
+        [JsonProperty("VoucherId")]
481
+        public int? VoucherId { get; set; }
482
+
483
+        [JsonProperty("EventDate")]
484
+        public DateTimeOffset? EventDate { get; set; }
485
+
486
+        [JsonProperty("EventType")]
487
+        public VendorEvent.VendorEventType? EventType { get; set; }
488
+
489
+        [JsonProperty("Retry")]
490
+        public bool Retry { get; set; }
491
+    }
492
+
493
+    public class RemoteVendorEventResponse {
494
+        [JsonProperty("lastVendorEventRemoteId")]
495
+        public int LastVendorEventRemoteId { get; set; }
496
+    }
497
+}

+ 69 - 0
BulkPrinting/BulkPrinting/ObservedForm.cs

@@ -0,0 +1,69 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+using System.Windows.Forms;
7
+
8
+namespace BulkPrinting
9
+{
10
+    public class ObservedForm : Form
11
+    {
12
+        public ObservedForm()
13
+        {
14
+            KeyPreview = true;
15
+
16
+            Load += ObservedForm_Load;
17
+            FormClosed += ObservedForm_FormClosed;
18
+            MouseMove += ObservedForm_MouseMove;
19
+            KeyDown += ObservedForm_KeyDown;
20
+        }
21
+
22
+        protected virtual void OnUserActivity()
23
+        {
24
+            BatchForm BatchForm = (BatchForm)Application.OpenForms["BatchForm"];
25
+            BatchForm.ResetTimer();
26
+        }
27
+
28
+        private void ObservedForm_Load(object sender, EventArgs e)
29
+        {
30
+            foreach (Control ObservedControl in this.Controls)
31
+            {
32
+                ObservedControl.MouseMove += ObservedForm_MouseMove;
33
+                ObservedControl.KeyDown += ObservedForm_KeyDown;
34
+            }
35
+        }
36
+
37
+        private void ObservedForm_MouseMove(object sender, MouseEventArgs e)
38
+        {
39
+            OnUserActivity();
40
+        }
41
+
42
+        private void ObservedForm_KeyDown(object sender, KeyEventArgs e)
43
+        {
44
+            OnUserActivity();
45
+        }
46
+
47
+        private void ObservedForm_FormClosed(object sender, FormClosedEventArgs e)
48
+        {
49
+            Load -= ObservedForm_Load;
50
+            FormClosed -= ObservedForm_FormClosed;
51
+            MouseMove -= ObservedForm_MouseMove;
52
+            KeyDown -= ObservedForm_KeyDown;
53
+        }
54
+
55
+        private void InitializeComponent()
56
+        {
57
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ObservedForm));
58
+            this.SuspendLayout();
59
+            // 
60
+            // ObservedForm
61
+            // 
62
+            this.ClientSize = new System.Drawing.Size(284, 261);
63
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
64
+            this.Name = "ObservedForm";
65
+            this.ResumeLayout(false);
66
+
67
+        }
68
+    }
69
+}

文件差异内容过多而无法显示
+ 6293 - 0
BulkPrinting/BulkPrinting/ObservedForm.resx


+ 346 - 0
BulkPrinting/BulkPrinting/OrderForm.Designer.cs

@@ -0,0 +1,346 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class OrderForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OrderForm));
32
+            this.lstProductCatalogue = new System.Windows.Forms.ListBox();
33
+            this.numQuantity = new System.Windows.Forms.NumericUpDown();
34
+            this.txtReference = new System.Windows.Forms.TextBox();
35
+            this.btnPlaceOrder = new System.Windows.Forms.Button();
36
+            this.btnCancel = new System.Windows.Forms.Button();
37
+            this.label1 = new System.Windows.Forms.Label();
38
+            this.label2 = new System.Windows.Forms.Label();
39
+            this.btnAddProduct = new System.Windows.Forms.Button();
40
+            this.lstSelectedProducts = new System.Windows.Forms.ListBox();
41
+            this.label3 = new System.Windows.Forms.Label();
42
+            this.lblTotalValue = new System.Windows.Forms.Label();
43
+            this.label5 = new System.Windows.Forms.Label();
44
+            this.lblTotalCost = new System.Windows.Forms.Label();
45
+            this.label7 = new System.Windows.Forms.Label();
46
+            this.lblRemainingBalance = new System.Windows.Forms.Label();
47
+            this.btnRemoveProduct = new System.Windows.Forms.Button();
48
+            this.lblRemainingAllowanceText = new System.Windows.Forms.Label();
49
+            this.lblRemainingAllowance = new System.Windows.Forms.Label();
50
+            this.label4 = new System.Windows.Forms.Label();
51
+            this.label6 = new System.Windows.Forms.Label();
52
+            ((System.ComponentModel.ISupportInitialize)(this.numQuantity)).BeginInit();
53
+            this.SuspendLayout();
54
+            // 
55
+            // lstProductCatalogue
56
+            // 
57
+            this.lstProductCatalogue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
58
+            this.lstProductCatalogue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
59
+            this.lstProductCatalogue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
60
+            this.lstProductCatalogue.FormattingEnabled = true;
61
+            this.lstProductCatalogue.Location = new System.Drawing.Point(12, 25);
62
+            this.lstProductCatalogue.Name = "lstProductCatalogue";
63
+            this.lstProductCatalogue.Size = new System.Drawing.Size(204, 223);
64
+            this.lstProductCatalogue.TabIndex = 0;
65
+            // 
66
+            // numQuantity
67
+            // 
68
+            this.numQuantity.Location = new System.Drawing.Point(222, 128);
69
+            this.numQuantity.Maximum = new decimal(new int[] {
70
+            1000000000,
71
+            0,
72
+            0,
73
+            0});
74
+            this.numQuantity.Name = "numQuantity";
75
+            this.numQuantity.Size = new System.Drawing.Size(86, 20);
76
+            this.numQuantity.TabIndex = 2;
77
+            // 
78
+            // txtReference
79
+            // 
80
+            this.txtReference.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
81
+            this.txtReference.Location = new System.Drawing.Point(238, 293);
82
+            this.txtReference.MaxLength = 20;
83
+            this.txtReference.Name = "txtReference";
84
+            this.txtReference.Size = new System.Drawing.Size(119, 20);
85
+            this.txtReference.TabIndex = 3;
86
+            // 
87
+            // btnPlaceOrder
88
+            // 
89
+            this.btnPlaceOrder.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
90
+            this.btnPlaceOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
91
+            this.btnPlaceOrder.FlatAppearance.BorderColor = System.Drawing.Color.Black;
92
+            this.btnPlaceOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
93
+            this.btnPlaceOrder.Location = new System.Drawing.Point(444, 291);
94
+            this.btnPlaceOrder.Name = "btnPlaceOrder";
95
+            this.btnPlaceOrder.Size = new System.Drawing.Size(75, 23);
96
+            this.btnPlaceOrder.TabIndex = 4;
97
+            this.btnPlaceOrder.Text = "Place Order";
98
+            this.btnPlaceOrder.UseVisualStyleBackColor = false;
99
+            this.btnPlaceOrder.Click += new System.EventHandler(this.btnPlaceOrder_Click);
100
+            // 
101
+            // btnCancel
102
+            // 
103
+            this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
104
+            this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
105
+            this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
106
+            this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
107
+            this.btnCancel.Location = new System.Drawing.Point(363, 291);
108
+            this.btnCancel.Name = "btnCancel";
109
+            this.btnCancel.Size = new System.Drawing.Size(75, 23);
110
+            this.btnCancel.TabIndex = 5;
111
+            this.btnCancel.Text = "Cancel";
112
+            this.btnCancel.UseVisualStyleBackColor = false;
113
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
114
+            // 
115
+            // label1
116
+            // 
117
+            this.label1.AutoSize = true;
118
+            this.label1.ForeColor = System.Drawing.Color.White;
119
+            this.label1.Location = new System.Drawing.Point(221, 112);
120
+            this.label1.Name = "label1";
121
+            this.label1.Size = new System.Drawing.Size(87, 13);
122
+            this.label1.TabIndex = 6;
123
+            this.label1.Text = "Quantity to Order";
124
+            // 
125
+            // label2
126
+            // 
127
+            this.label2.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
128
+            this.label2.AutoSize = true;
129
+            this.label2.ForeColor = System.Drawing.Color.White;
130
+            this.label2.Location = new System.Drawing.Point(175, 296);
131
+            this.label2.Name = "label2";
132
+            this.label2.Size = new System.Drawing.Size(57, 13);
133
+            this.label2.TabIndex = 7;
134
+            this.label2.Text = "Reference";
135
+            // 
136
+            // btnAddProduct
137
+            // 
138
+            this.btnAddProduct.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
139
+            this.btnAddProduct.FlatAppearance.BorderColor = System.Drawing.Color.Black;
140
+            this.btnAddProduct.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
141
+            this.btnAddProduct.Location = new System.Drawing.Point(222, 154);
142
+            this.btnAddProduct.Name = "btnAddProduct";
143
+            this.btnAddProduct.Size = new System.Drawing.Size(86, 23);
144
+            this.btnAddProduct.TabIndex = 8;
145
+            this.btnAddProduct.Text = "Add >>";
146
+            this.btnAddProduct.UseVisualStyleBackColor = false;
147
+            this.btnAddProduct.Click += new System.EventHandler(this.btnAddProduct_Click);
148
+            // 
149
+            // lstSelectedProducts
150
+            // 
151
+            this.lstSelectedProducts.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
152
+            this.lstSelectedProducts.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
153
+            this.lstSelectedProducts.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
154
+            this.lstSelectedProducts.FormattingEnabled = true;
155
+            this.lstSelectedProducts.Location = new System.Drawing.Point(315, 25);
156
+            this.lstSelectedProducts.Name = "lstSelectedProducts";
157
+            this.lstSelectedProducts.Size = new System.Drawing.Size(204, 223);
158
+            this.lstSelectedProducts.TabIndex = 0;
159
+            // 
160
+            // label3
161
+            // 
162
+            this.label3.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
163
+            this.label3.AutoSize = true;
164
+            this.label3.ForeColor = System.Drawing.Color.White;
165
+            this.label3.Location = new System.Drawing.Point(331, 253);
166
+            this.label3.Name = "label3";
167
+            this.label3.Size = new System.Drawing.Size(107, 13);
168
+            this.label3.TabIndex = 9;
169
+            this.label3.Text = "Total Voucher Value:";
170
+            // 
171
+            // lblTotalValue
172
+            // 
173
+            this.lblTotalValue.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
174
+            this.lblTotalValue.ForeColor = System.Drawing.Color.White;
175
+            this.lblTotalValue.Location = new System.Drawing.Point(444, 253);
176
+            this.lblTotalValue.Name = "lblTotalValue";
177
+            this.lblTotalValue.Size = new System.Drawing.Size(71, 13);
178
+            this.lblTotalValue.TabIndex = 9;
179
+            this.lblTotalValue.Text = "R0";
180
+            this.lblTotalValue.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
181
+            // 
182
+            // label5
183
+            // 
184
+            this.label5.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
185
+            this.label5.AutoSize = true;
186
+            this.label5.ForeColor = System.Drawing.Color.White;
187
+            this.label5.Location = new System.Drawing.Point(351, 275);
188
+            this.label5.Name = "label5";
189
+            this.label5.Size = new System.Drawing.Size(87, 13);
190
+            this.label5.TabIndex = 9;
191
+            this.label5.Text = "Total Order Cost:";
192
+            // 
193
+            // lblTotalCost
194
+            // 
195
+            this.lblTotalCost.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
196
+            this.lblTotalCost.ForeColor = System.Drawing.Color.White;
197
+            this.lblTotalCost.Location = new System.Drawing.Point(447, 275);
198
+            this.lblTotalCost.Name = "lblTotalCost";
199
+            this.lblTotalCost.Size = new System.Drawing.Size(68, 13);
200
+            this.lblTotalCost.TabIndex = 9;
201
+            this.lblTotalCost.Text = "R0";
202
+            this.lblTotalCost.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
203
+            // 
204
+            // label7
205
+            // 
206
+            this.label7.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
207
+            this.label7.AutoSize = true;
208
+            this.label7.ForeColor = System.Drawing.Color.White;
209
+            this.label7.Location = new System.Drawing.Point(13, 257);
210
+            this.label7.Name = "label7";
211
+            this.label7.Size = new System.Drawing.Size(145, 13);
212
+            this.label7.TabIndex = 10;
213
+            this.label7.Text = "Remaining Account Balance:";
214
+            // 
215
+            // lblRemainingBalance
216
+            // 
217
+            this.lblRemainingBalance.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
218
+            this.lblRemainingBalance.AutoSize = true;
219
+            this.lblRemainingBalance.ForeColor = System.Drawing.Color.White;
220
+            this.lblRemainingBalance.Location = new System.Drawing.Point(164, 257);
221
+            this.lblRemainingBalance.Name = "lblRemainingBalance";
222
+            this.lblRemainingBalance.Size = new System.Drawing.Size(21, 13);
223
+            this.lblRemainingBalance.TabIndex = 11;
224
+            this.lblRemainingBalance.Text = "R0";
225
+            // 
226
+            // btnRemoveProduct
227
+            // 
228
+            this.btnRemoveProduct.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
229
+            this.btnRemoveProduct.FlatAppearance.BorderColor = System.Drawing.Color.Black;
230
+            this.btnRemoveProduct.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
231
+            this.btnRemoveProduct.Location = new System.Drawing.Point(222, 184);
232
+            this.btnRemoveProduct.Name = "btnRemoveProduct";
233
+            this.btnRemoveProduct.Size = new System.Drawing.Size(86, 23);
234
+            this.btnRemoveProduct.TabIndex = 12;
235
+            this.btnRemoveProduct.Text = "<< Remove";
236
+            this.btnRemoveProduct.UseVisualStyleBackColor = false;
237
+            this.btnRemoveProduct.Click += new System.EventHandler(this.btnRemoveProduct_Click);
238
+            // 
239
+            // lblRemainingAllowanceText
240
+            // 
241
+            this.lblRemainingAllowanceText.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
242
+            this.lblRemainingAllowanceText.AutoSize = true;
243
+            this.lblRemainingAllowanceText.ForeColor = System.Drawing.Color.White;
244
+            this.lblRemainingAllowanceText.Location = new System.Drawing.Point(13, 275);
245
+            this.lblRemainingAllowanceText.Name = "lblRemainingAllowanceText";
246
+            this.lblRemainingAllowanceText.Size = new System.Drawing.Size(138, 13);
247
+            this.lblRemainingAllowanceText.TabIndex = 13;
248
+            this.lblRemainingAllowanceText.Text = "Remaining Daily Allowance:";
249
+            // 
250
+            // lblRemainingAllowance
251
+            // 
252
+            this.lblRemainingAllowance.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
253
+            this.lblRemainingAllowance.AutoSize = true;
254
+            this.lblRemainingAllowance.ForeColor = System.Drawing.Color.White;
255
+            this.lblRemainingAllowance.Location = new System.Drawing.Point(164, 275);
256
+            this.lblRemainingAllowance.Name = "lblRemainingAllowance";
257
+            this.lblRemainingAllowance.Size = new System.Drawing.Size(21, 13);
258
+            this.lblRemainingAllowance.TabIndex = 11;
259
+            this.lblRemainingAllowance.Text = "R0";
260
+            // 
261
+            // label4
262
+            // 
263
+            this.label4.AutoSize = true;
264
+            this.label4.ForeColor = System.Drawing.Color.White;
265
+            this.label4.Location = new System.Drawing.Point(9, 9);
266
+            this.label4.Name = "label4";
267
+            this.label4.Size = new System.Drawing.Size(95, 13);
268
+            this.label4.TabIndex = 14;
269
+            this.label4.Text = "Product Catalogue";
270
+            // 
271
+            // label6
272
+            // 
273
+            this.label6.AutoSize = true;
274
+            this.label6.ForeColor = System.Drawing.Color.White;
275
+            this.label6.Location = new System.Drawing.Point(312, 9);
276
+            this.label6.Name = "label6";
277
+            this.label6.Size = new System.Drawing.Size(117, 13);
278
+            this.label6.TabIndex = 15;
279
+            this.label6.Text = "Products to be Ordered";
280
+            // 
281
+            // OrderForm
282
+            // 
283
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
284
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
285
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
286
+            this.ClientSize = new System.Drawing.Size(527, 324);
287
+            this.Controls.Add(this.label6);
288
+            this.Controls.Add(this.label4);
289
+            this.Controls.Add(this.lblRemainingAllowanceText);
290
+            this.Controls.Add(this.btnRemoveProduct);
291
+            this.Controls.Add(this.lblRemainingAllowance);
292
+            this.Controls.Add(this.lblRemainingBalance);
293
+            this.Controls.Add(this.label7);
294
+            this.Controls.Add(this.lblTotalCost);
295
+            this.Controls.Add(this.label5);
296
+            this.Controls.Add(this.lblTotalValue);
297
+            this.Controls.Add(this.label3);
298
+            this.Controls.Add(this.btnAddProduct);
299
+            this.Controls.Add(this.label2);
300
+            this.Controls.Add(this.label1);
301
+            this.Controls.Add(this.btnCancel);
302
+            this.Controls.Add(this.btnPlaceOrder);
303
+            this.Controls.Add(this.txtReference);
304
+            this.Controls.Add(this.numQuantity);
305
+            this.Controls.Add(this.lstSelectedProducts);
306
+            this.Controls.Add(this.lstProductCatalogue);
307
+            this.ForeColor = System.Drawing.Color.White;
308
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
309
+            this.MaximizeBox = false;
310
+            this.MaximumSize = new System.Drawing.Size(543, 1000);
311
+            this.MinimizeBox = false;
312
+            this.MinimumSize = new System.Drawing.Size(543, 363);
313
+            this.Name = "OrderForm";
314
+            this.Text = "Order Vouchers";
315
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OrderForm_FormClosing);
316
+            this.Load += new System.EventHandler(this.OrderForm_Load);
317
+            ((System.ComponentModel.ISupportInitialize)(this.numQuantity)).EndInit();
318
+            this.ResumeLayout(false);
319
+            this.PerformLayout();
320
+
321
+        }
322
+
323
+        #endregion
324
+
325
+        private System.Windows.Forms.ListBox lstProductCatalogue;
326
+        private System.Windows.Forms.NumericUpDown numQuantity;
327
+        private System.Windows.Forms.TextBox txtReference;
328
+        private System.Windows.Forms.Button btnPlaceOrder;
329
+        private System.Windows.Forms.Button btnCancel;
330
+        private System.Windows.Forms.Label label1;
331
+        private System.Windows.Forms.Label label2;
332
+        private System.Windows.Forms.Button btnAddProduct;
333
+        private System.Windows.Forms.ListBox lstSelectedProducts;
334
+        private System.Windows.Forms.Label label3;
335
+        private System.Windows.Forms.Label lblTotalValue;
336
+        private System.Windows.Forms.Label label5;
337
+        private System.Windows.Forms.Label lblTotalCost;
338
+        private System.Windows.Forms.Label label7;
339
+        private System.Windows.Forms.Label lblRemainingBalance;
340
+        private System.Windows.Forms.Button btnRemoveProduct;
341
+        private System.Windows.Forms.Label lblRemainingAllowanceText;
342
+        private System.Windows.Forms.Label lblRemainingAllowance;
343
+        private System.Windows.Forms.Label label4;
344
+        private System.Windows.Forms.Label label6;
345
+    }
346
+}

+ 271 - 0
BulkPrinting/BulkPrinting/OrderForm.cs

@@ -0,0 +1,271 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Collections.ObjectModel;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+using System.IO;
12
+using System.Net;
13
+using Newtonsoft.Json;
14
+using Newtonsoft.Json.Serialization;
15
+using System.Runtime.CompilerServices;
16
+using System.Threading;
17
+using System.Data.SQLite;
18
+
19
+namespace BulkPrinting
20
+{
21
+    public partial class OrderForm : ObservedForm
22
+    {
23
+        private class OrderItem : INotifyPropertyChanged
24
+        {
25
+            private int _quantity;
26
+            public int Quantity {
27
+                get { return _quantity; }
28
+                set
29
+                {
30
+                    _quantity = value;
31
+                    _notifyPropertyChanged("ToString");
32
+                }
33
+            }
34
+            public event PropertyChangedEventHandler PropertyChanged;
35
+            private void _notifyPropertyChanged([CallerMemberName] String propertyName = "")
36
+            {
37
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
38
+            }
39
+            public int ProductId;
40
+            public string ProductDescription;
41
+            public decimal FaceValue;
42
+            public decimal DiscountPercentage;
43
+            public override string ToString() {
44
+                return this.Quantity.ToString() + " X " + this.ProductDescription;
45
+            }
46
+        }
47
+
48
+        private BindingList<OrderItem> SelectedProducts = new BindingList<OrderItem>();
49
+        public BatchForm SourceForm;
50
+
51
+        public OrderForm()
52
+        {
53
+            InitializeComponent();
54
+        }
55
+
56
+        private void OrderForm_Load(object sender, EventArgs e)
57
+        {
58
+            SourceForm.Enabled = false;
59
+            this.lstSelectedProducts.DataSource = SelectedProducts;
60
+            this.lstSelectedProducts.DisplayMember = "ToString";
61
+            bool Result = Utility.RESTRequest<ICollection<NetworkCatalogue>>(ref Globals.ProductCatalogue, "/api/products/");
62
+            if (Result == true)
63
+            {
64
+                //lstSelectedProducts.Items.Clear();
65
+                lstProductCatalogue.Items.Clear();
66
+                foreach (NetworkCatalogue Network in Globals.ProductCatalogue) {
67
+                    foreach (ProductSubCatalogue Product in Network.Products)
68
+                    {
69
+                        lstProductCatalogue.Items.Add(Product);
70
+                    }
71
+                }
72
+                this.txtReference.Text = Globals.SessionData.Credentials.Payload.User.FirstName;
73
+            }
74
+            else {
75
+                MessageBox.Show("Could not retrieve product catalogue. Please ensure that you are online.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
76
+                this.Close();
77
+            }
78
+            decimal RemainingUserLimit = 0;
79
+            this.lblRemainingBalance.Text = "R" + Globals.SessionData.Credentials.Payload.User.Account.Balance.ToString("0.##");
80
+            RemainingUserLimit = Utility.CheckRemainingUserLimit(UserLimits.UserLimitTypes.BulkOrder);
81
+            if (RemainingUserLimit > -1)
82
+            {
83
+                this.lblRemainingAllowance.Text = "R" + RemainingUserLimit.ToString("0.##");
84
+                this.lblRemainingAllowanceText.Show();
85
+                this.lblRemainingAllowance.Show();
86
+            }
87
+            else
88
+            {
89
+                this.lblRemainingAllowanceText.Hide();
90
+                this.lblRemainingAllowance.Hide();
91
+            }
92
+        }
93
+
94
+
95
+        private void btnPlaceOrder_Click(object sender, EventArgs e)
96
+        {
97
+            if (this.SelectedProducts.Count==0)
98
+            {
99
+                MessageBox.Show("Please add products to the order list on the right before clicking the Order button.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
100
+                return;
101
+            }
102
+            if (this.txtReference.Text == "")
103
+            {
104
+                MessageBox.Show("Please enter a reference code.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
105
+                return;
106
+            }
107
+            string OrderReviewMessage = "Please ensure that you carefully review the list of products you wish to order:\n";
108
+            decimal TotalCost = 0;
109
+            for (int i = 0; i < this.SelectedProducts.Count; i++)
110
+            {
111
+                OrderItem OrderedItem = this.SelectedProducts[i];
112
+                decimal ItemCost = OrderedItem.Quantity * OrderedItem.FaceValue * (1 - (OrderedItem.DiscountPercentage / 100));
113
+                TotalCost += ItemCost;
114
+                OrderReviewMessage += "R" + ItemCost.ToString("0.##") + " - " + OrderedItem.Quantity.ToString() + " X " + OrderedItem.ProductDescription + "\n";
115
+            }
116
+            OrderReviewMessage += "______________________\nTotal Order Cost: R" + TotalCost.ToString("0.##") + "\n";
117
+            OrderReviewMessage += "Remaining Balance After Order: R" + (Globals.SessionData.Credentials.Payload.User.Account.Balance - TotalCost).ToString("0.##") + "\n\n";
118
+            OrderReviewMessage += "Would you like to proceed with the order?";
119
+            DialogResult PlaceOrder = MessageBox.Show(OrderReviewMessage, "Proceed?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
120
+            if (PlaceOrder == DialogResult.Yes) {
121
+                string Sql = "INSERT INTO Orders (UserId,UserName,OrderDate,OrderCost,BalanceAfterOrder) VALUES (@userid,@username,datetime('now'),@ordercost,@balanceafterorder)";
122
+                SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
123
+                Command.Parameters.Add(new SQLiteParameter("@userid", Globals.SessionData.Credentials.Payload.User.Id));
124
+                Command.Parameters.Add(new SQLiteParameter("@username", Globals.SessionData.Credentials.Payload.User.FirstName + " " + Globals.SessionData.Credentials.Payload.User.Surname));
125
+                Command.Parameters.Add(new SQLiteParameter("@ordercost", TotalCost));
126
+                Command.Parameters.Add(new SQLiteParameter("@balanceafterorder", Globals.SessionData.Credentials.Payload.User.Account.Balance - TotalCost));
127
+                Command.ExecuteNonQuery();
128
+
129
+                Sql = "SELECT MAX(Id) FROM Orders";
130
+                Command = new SQLiteCommand(Sql, Globals.DBConnection);
131
+                int OrderId = int.Parse(Command.ExecuteScalar().ToString()); 
132
+
133
+                Sql = "INSERT INTO OrderedItems (OrderId,Cost,Quantity,Description,ProductId) VALUES (@orderId,@cost,@quantity,@description,@productid)";
134
+                for (int i = 0; i < this.SelectedProducts.Count; i++)
135
+                {
136
+                    OrderItem OrderedItem = this.SelectedProducts[i];
137
+                    decimal ItemCost = OrderedItem.Quantity * OrderedItem.FaceValue * (1 - (OrderedItem.DiscountPercentage / 100));
138
+                    Command = new SQLiteCommand(Sql, Globals.DBConnection);
139
+                    Command.Parameters.Add(new SQLiteParameter("@orderId", OrderId));
140
+                    Command.Parameters.Add(new SQLiteParameter("@cost", ItemCost));
141
+                    Command.Parameters.Add(new SQLiteParameter("@quantity", OrderedItem.Quantity));
142
+                    Command.Parameters.Add(new SQLiteParameter("@description", OrderedItem.ProductDescription));
143
+                    Command.Parameters.Add(new SQLiteParameter("@productid", OrderedItem.ProductId));
144
+                    Command.ExecuteNonQuery();
145
+                }
146
+
147
+                this.Hide();
148
+                string CustomerReference = txtReference.Text;
149
+
150
+                ProgressDialog Progress = new ProgressDialog();
151
+                Progress.Show();
152
+                Thread t = new Thread(() => {
153
+                    Progress.UpdateProgressText("Please wait...");
154
+                    Progress.UpdateProgressBar(0);
155
+                    for (int i=0; i<this.SelectedProducts.Count; i++)
156
+                    {
157
+                        OrderItem OrderedItem = this.SelectedProducts[i];
158
+                        Progress.UpdateProgressText("Placing order for " + OrderedItem.Quantity.ToString() + " of " + OrderedItem.ProductDescription + "...");
159
+                        OrderPlacementData OrderData = new OrderPlacementData();
160
+                        OrderData.ProductId = OrderedItem.ProductId;
161
+                        OrderData.Quantity = OrderedItem.Quantity;
162
+                        OrderData.CustomerReference = CustomerReference;
163
+                        BatchListing OrderedBatch = new BatchListing();
164
+                        bool OrderResult = Utility.RESTRequest<OrderPlacementData, BatchListing>(OrderData, ref OrderedBatch, "/api/batches/");
165
+                        //TODO: Handle failed order
166
+                        Utility.DownloadBatch(OrderedBatch.Batch);
167
+                        Globals.SessionData.Credentials.Payload.User.Account.Balance = OrderedBatch.RemainingBalance;
168
+                        Utility.AddUserUsage(UserLimits.UserLimitTypes.BulkOrder, OrderedBatch.Batch.Cost);
169
+                        Progress.UpdateProgressBar((int)Math.Round(100 * (((decimal)i+1)/(decimal)SelectedProducts.Count)));
170
+                        Thread.Sleep(50);
171
+                    }
172
+
173
+                    Progress.Invoke((Action)(() => Progress.Close()));
174
+                    this.Invoke((Action)(() => { SourceForm.PopulateGrid(); this.Close(); }));
175
+                });
176
+                t.Start();
177
+            }
178
+        }
179
+
180
+        private void btnCancel_Click(object sender, EventArgs e)
181
+        {
182
+            this.Close();
183
+        }
184
+
185
+        private void btnAddProduct_Click(object sender, EventArgs e)
186
+        {
187
+            if (this.lstProductCatalogue.SelectedIndex == -1)
188
+            {
189
+                MessageBox.Show("Please select a product from the left list to add to the order list on the right.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
190
+                return;
191
+            }
192
+            if (this.numQuantity.Value < 1)
193
+            {
194
+                MessageBox.Show("Please select a valid quantity.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
195
+                return;
196
+            }
197
+
198
+            decimal TotalValue = 0;
199
+            decimal TotalCost = 0;
200
+
201
+
202
+            ProductSubCatalogue SelectedProduct = (ProductSubCatalogue)this.lstProductCatalogue.SelectedItem;
203
+            bool ProductFound = false;
204
+            decimal SelectionCost;
205
+            foreach (OrderItem OrderedItem in this.SelectedProducts)
206
+            {
207
+                TotalValue += OrderedItem.Quantity * OrderedItem.FaceValue;
208
+                TotalCost += OrderedItem.Quantity * OrderedItem.FaceValue * (1 - (OrderedItem.DiscountPercentage / 100));
209
+            }
210
+            foreach (OrderItem OrderedItem in this.SelectedProducts)
211
+            {
212
+                if (SelectedProduct.Id == OrderedItem.ProductId)
213
+                {
214
+                    TotalValue += (decimal)this.numQuantity.Value * OrderedItem.FaceValue;
215
+                    SelectionCost = (decimal)this.numQuantity.Value * OrderedItem.FaceValue * (1 - (OrderedItem.DiscountPercentage / 100));
216
+                    TotalCost += SelectionCost;
217
+                    if (TotalCost > Globals.SessionData.Credentials.Payload.User.Account.Balance)
218
+                    {
219
+                        MessageBox.Show("Your balance is insufficient to add this selection (R" + SelectionCost.ToString("0.##") + ").", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
220
+                        return;
221
+                    }
222
+                    if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.BulkOrder,TotalCost))
223
+                    {
224
+                        MessageBox.Show("Adding this selection (R" + SelectionCost.ToString("0.##") + ") exceeds your user limit for the day.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
225
+                        return;
226
+                    }
227
+                    ProductFound = true;
228
+                    OrderedItem.Quantity += (int)this.numQuantity.Value;
229
+                }
230
+            }
231
+            if (ProductFound == false)
232
+            {
233
+                TotalValue += (decimal)this.numQuantity.Value * SelectedProduct.FaceValue;
234
+                SelectionCost = (decimal)this.numQuantity.Value * SelectedProduct.FaceValue * (1 - (SelectedProduct.DiscountPercentage / 100));
235
+                TotalCost += SelectionCost;
236
+                if (TotalCost > Globals.SessionData.Credentials.Payload.User.Account.Balance)
237
+                {
238
+                    MessageBox.Show("Your balance is insufficient to add this selection (R" + SelectionCost.ToString("0.##") + ").", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
239
+                    return;
240
+                }
241
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.BulkOrder, TotalCost))
242
+                {
243
+                    MessageBox.Show("Adding this selection (R" + SelectionCost.ToString("0.##") + ") exceeds your user limit for the day.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
244
+                    return;
245
+                }
246
+                OrderItem NewOrderItem = new OrderItem();
247
+                NewOrderItem.ProductId = SelectedProduct.Id;
248
+                NewOrderItem.ProductDescription = SelectedProduct.Description;
249
+                NewOrderItem.Quantity = (int)this.numQuantity.Value;
250
+                NewOrderItem.FaceValue = SelectedProduct.FaceValue;
251
+                NewOrderItem.DiscountPercentage = SelectedProduct.DiscountPercentage;
252
+                this.SelectedProducts.Add(NewOrderItem);
253
+            }
254
+            this.lblTotalValue.Text = "R"+TotalValue.ToString("0.##");
255
+            this.lblTotalCost.Text = "R"+TotalCost.ToString("0.##");
256
+        }
257
+
258
+        private void btnRemoveProduct_Click(object sender, EventArgs e)
259
+        {
260
+            if (this.lstProductCatalogue.SelectedIndex != -1)
261
+            {
262
+                this.SelectedProducts.Remove((OrderItem)this.lstSelectedProducts.SelectedItem);
263
+            }
264
+        }
265
+
266
+        private void OrderForm_FormClosing(object sender, FormClosingEventArgs e)
267
+        {
268
+            SourceForm.Enabled = true;
269
+        }
270
+    }
271
+}

文件差异内容过多而无法显示
+ 6296 - 0
BulkPrinting/BulkPrinting/OrderForm.resx


+ 143 - 0
BulkPrinting/BulkPrinting/OrderReport.Designer.cs

@@ -0,0 +1,143 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class OrderReport
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OrderReport));
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
34
+            this.label2 = new System.Windows.Forms.Label();
35
+            this.dtpEndDate = new System.Windows.Forms.DateTimePicker();
36
+            this.dgvOrderReport = new System.Windows.Forms.DataGridView();
37
+            this.btnSaveToCSV = new System.Windows.Forms.Button();
38
+            ((System.ComponentModel.ISupportInitialize)(this.dgvOrderReport)).BeginInit();
39
+            this.SuspendLayout();
40
+            // 
41
+            // label1
42
+            // 
43
+            this.label1.AutoSize = true;
44
+            this.label1.ForeColor = System.Drawing.Color.White;
45
+            this.label1.Location = new System.Drawing.Point(13, 13);
46
+            this.label1.Name = "label1";
47
+            this.label1.Size = new System.Drawing.Size(171, 13);
48
+            this.label1.TabIndex = 0;
49
+            this.label1.Text = "Show Report for Orders          From";
50
+            this.label1.Click += new System.EventHandler(this.label1_Click);
51
+            // 
52
+            // dtpStartDate
53
+            // 
54
+            this.dtpStartDate.Location = new System.Drawing.Point(183, 10);
55
+            this.dtpStartDate.Name = "dtpStartDate";
56
+            this.dtpStartDate.Size = new System.Drawing.Size(200, 20);
57
+            this.dtpStartDate.TabIndex = 1;
58
+            this.dtpStartDate.ValueChanged += new System.EventHandler(this.dtpStartDate_ValueChanged);
59
+            // 
60
+            // label2
61
+            // 
62
+            this.label2.AutoSize = true;
63
+            this.label2.ForeColor = System.Drawing.Color.White;
64
+            this.label2.Location = new System.Drawing.Point(395, 12);
65
+            this.label2.Name = "label2";
66
+            this.label2.Size = new System.Drawing.Size(20, 13);
67
+            this.label2.TabIndex = 0;
68
+            this.label2.Text = "To";
69
+            // 
70
+            // dtpEndDate
71
+            // 
72
+            this.dtpEndDate.Location = new System.Drawing.Point(421, 10);
73
+            this.dtpEndDate.Name = "dtpEndDate";
74
+            this.dtpEndDate.Size = new System.Drawing.Size(200, 20);
75
+            this.dtpEndDate.TabIndex = 1;
76
+            this.dtpEndDate.ValueChanged += new System.EventHandler(this.dtpEndDate_ValueChanged);
77
+            // 
78
+            // dgvOrderReport
79
+            // 
80
+            this.dgvOrderReport.AllowUserToAddRows = false;
81
+            this.dgvOrderReport.AllowUserToDeleteRows = false;
82
+            this.dgvOrderReport.AllowUserToResizeRows = false;
83
+            this.dgvOrderReport.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
84
+            | System.Windows.Forms.AnchorStyles.Left) 
85
+            | System.Windows.Forms.AnchorStyles.Right)));
86
+            this.dgvOrderReport.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
87
+            this.dgvOrderReport.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
88
+            this.dgvOrderReport.Location = new System.Drawing.Point(16, 36);
89
+            this.dgvOrderReport.MultiSelect = false;
90
+            this.dgvOrderReport.Name = "dgvOrderReport";
91
+            this.dgvOrderReport.ReadOnly = true;
92
+            this.dgvOrderReport.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
93
+            this.dgvOrderReport.Size = new System.Drawing.Size(1254, 568);
94
+            this.dgvOrderReport.TabIndex = 2;
95
+            // 
96
+            // btnSaveToCSV
97
+            // 
98
+            this.btnSaveToCSV.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
99
+            this.btnSaveToCSV.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
100
+            this.btnSaveToCSV.FlatAppearance.BorderColor = System.Drawing.Color.Black;
101
+            this.btnSaveToCSV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
102
+            this.btnSaveToCSV.ForeColor = System.Drawing.Color.White;
103
+            this.btnSaveToCSV.Location = new System.Drawing.Point(1166, 7);
104
+            this.btnSaveToCSV.Name = "btnSaveToCSV";
105
+            this.btnSaveToCSV.Size = new System.Drawing.Size(104, 23);
106
+            this.btnSaveToCSV.TabIndex = 3;
107
+            this.btnSaveToCSV.Text = "Save To CSV";
108
+            this.btnSaveToCSV.UseVisualStyleBackColor = false;
109
+            this.btnSaveToCSV.Click += new System.EventHandler(this.btnSaveToCSV_Click);
110
+            // 
111
+            // OrderReport
112
+            // 
113
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
114
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
115
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
116
+            this.ClientSize = new System.Drawing.Size(1282, 616);
117
+            this.Controls.Add(this.btnSaveToCSV);
118
+            this.Controls.Add(this.dgvOrderReport);
119
+            this.Controls.Add(this.dtpEndDate);
120
+            this.Controls.Add(this.dtpStartDate);
121
+            this.Controls.Add(this.label2);
122
+            this.Controls.Add(this.label1);
123
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
124
+            this.MinimumSize = new System.Drawing.Size(813, 532);
125
+            this.Name = "OrderReport";
126
+            this.Text = "Order Reports";
127
+            this.Load += new System.EventHandler(this.OrderReport_Load);
128
+            ((System.ComponentModel.ISupportInitialize)(this.dgvOrderReport)).EndInit();
129
+            this.ResumeLayout(false);
130
+            this.PerformLayout();
131
+
132
+        }
133
+
134
+        #endregion
135
+
136
+        private System.Windows.Forms.Label label1;
137
+        private System.Windows.Forms.DateTimePicker dtpStartDate;
138
+        private System.Windows.Forms.Label label2;
139
+        private System.Windows.Forms.DateTimePicker dtpEndDate;
140
+        private System.Windows.Forms.DataGridView dgvOrderReport;
141
+        private System.Windows.Forms.Button btnSaveToCSV;
142
+    }
143
+}

+ 103 - 0
BulkPrinting/BulkPrinting/OrderReport.cs

@@ -0,0 +1,103 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Data.SQLite;
11
+using System.IO;
12
+using System.Globalization;
13
+
14
+namespace BulkPrinting
15
+{
16
+    public partial class OrderReport : Form
17
+    {
18
+        public OrderReport()
19
+        {
20
+            InitializeComponent();
21
+        }
22
+
23
+        private void RefreshReportGrid()
24
+        {
25
+            dgvOrderReport.Rows.Clear();
26
+            dgvOrderReport.Columns.Clear();
27
+            dgvOrderReport.Columns.Add("Id", "Order ID");
28
+            dgvOrderReport.Columns.Add("UserId", "User ID");
29
+            dgvOrderReport.Columns.Add("UserName", "User Name");
30
+            dgvOrderReport.Columns.Add("OrderDate", "Order Date");
31
+            dgvOrderReport.Columns.Add("Description", "Description");
32
+            dgvOrderReport.Columns.Add("OrderCost", "Total Order Cost");
33
+            dgvOrderReport.Columns.Add("BalanceAfterOrder", "Balance After Order");
34
+            dgvOrderReport.Columns.Add("Cost", "Individual Product Cost");
35
+            dgvOrderReport.Columns.Add("Quantity", "Quantity of Vouchers");
36
+            string Sql = "Select o.Id,o.UserId,o.UserName,o.OrderDate,oi.Description,o.OrderCost,o.BalanceAfterOrder,oi.Cost,oi.Quantity From Orders o LEFT JOIN OrderedItems oi on oi.OrderId = o.Id WHERE o.OrderDate BETWEEN @startdate AND @enddate";
37
+            SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
38
+            CultureInfo IVC = CultureInfo.InvariantCulture;
39
+            Command.Parameters.Add(new SQLiteParameter("@startdate", dtpStartDate.Value.ToString("yyyy-MM-dd 00:00:00", IVC)));
40
+            Command.Parameters.Add(new SQLiteParameter("@enddate", dtpEndDate.Value.ToString("yyyy-MM-dd 23:59:59", IVC)));
41
+
42
+            using (SQLiteDataReader read = Command.ExecuteReader())
43
+            {
44
+                while (read.Read())
45
+                {
46
+                    dgvOrderReport.Rows.Add(new object[] {
47
+                    read.GetValue(0).ToString(),
48
+                    read.GetValue(1).ToString(),
49
+                    read.GetValue(2).ToString(),
50
+                    read.GetValue(3).ToString(),
51
+                    read.GetValue(4).ToString(),
52
+                    read.GetValue(5).ToString(),
53
+                    read.GetValue(6).ToString(),
54
+                    read.GetValue(7).ToString(),
55
+                    read.GetValue(8).ToString(),
56
+                });
57
+                }
58
+            }
59
+
60
+        }
61
+
62
+        private void OrderReport_Load(object sender, EventArgs e)
63
+        {
64
+            dtpStartDate.Value = DateTime.Now.AddMonths(-3);
65
+        }
66
+
67
+        private void dtpStartDate_ValueChanged(object sender, EventArgs e)
68
+        {
69
+            RefreshReportGrid();
70
+        }
71
+
72
+        private void dtpEndDate_ValueChanged(object sender, EventArgs e)
73
+        {
74
+            RefreshReportGrid();
75
+        }
76
+
77
+        private void btnSaveToCSV_Click(object sender, EventArgs e)
78
+        {
79
+            SaveFileDialog SFD = new SaveFileDialog();
80
+            SFD.Filter = "*.csv|*.*";
81
+            SFD.FilterIndex = 0;
82
+            if (SFD.ShowDialog() == DialogResult.OK)
83
+            {
84
+                using (StreamWriter OutputStream = new StreamWriter(SFD.OpenFile()))
85
+                {
86
+                    for (int i = 0; i < dgvOrderReport.RowCount - 1; i++)
87
+                    {
88
+                        for (int j = 0; j < 9; j++) {
89
+                            OutputStream.Write(dgvOrderReport.Rows[i].Cells[j].Value.ToString() + ",");
90
+                        }
91
+                        OutputStream.Write("\n");
92
+                    }
93
+                }
94
+                this.Close();
95
+            }
96
+        }
97
+
98
+        private void label1_Click(object sender, EventArgs e)
99
+        {
100
+
101
+        }
102
+    }
103
+}

文件差异内容过多而无法显示
+ 6293 - 0
BulkPrinting/BulkPrinting/OrderReport.resx


+ 89 - 0
BulkPrinting/BulkPrinting/PasswordPrompt.Designer.cs

@@ -0,0 +1,89 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class PasswordPrompt
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PasswordPrompt));
32
+            this.txtPassword = new System.Windows.Forms.TextBox();
33
+            this.btnVerify = new System.Windows.Forms.Button();
34
+            this.label1 = new System.Windows.Forms.Label();
35
+            this.SuspendLayout();
36
+            // 
37
+            // txtPassword
38
+            // 
39
+            this.txtPassword.Location = new System.Drawing.Point(12, 38);
40
+            this.txtPassword.Name = "txtPassword";
41
+            this.txtPassword.PasswordChar = '*';
42
+            this.txtPassword.Size = new System.Drawing.Size(183, 20);
43
+            this.txtPassword.TabIndex = 0;
44
+            // 
45
+            // btnVerify
46
+            // 
47
+            this.btnVerify.Location = new System.Drawing.Point(63, 64);
48
+            this.btnVerify.Name = "btnVerify";
49
+            this.btnVerify.Size = new System.Drawing.Size(75, 23);
50
+            this.btnVerify.TabIndex = 1;
51
+            this.btnVerify.Text = "Verify";
52
+            this.btnVerify.UseVisualStyleBackColor = true;
53
+            this.btnVerify.Click += new System.EventHandler(this.btnVerify_Click);
54
+            // 
55
+            // label1
56
+            // 
57
+            this.label1.AutoSize = true;
58
+            this.label1.Location = new System.Drawing.Point(23, 9);
59
+            this.label1.Name = "label1";
60
+            this.label1.Size = new System.Drawing.Size(158, 26);
61
+            this.label1.TabIndex = 2;
62
+            this.label1.Text = "Please reenter your password to\r\n verify your permissions.";
63
+            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
64
+            // 
65
+            // PasswordPrompt
66
+            // 
67
+            this.AcceptButton = this.btnVerify;
68
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
69
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
71
+            this.ClientSize = new System.Drawing.Size(205, 96);
72
+            this.Controls.Add(this.label1);
73
+            this.Controls.Add(this.btnVerify);
74
+            this.Controls.Add(this.txtPassword);
75
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
76
+            this.Name = "PasswordPrompt";
77
+            this.Text = "Password";
78
+            this.ResumeLayout(false);
79
+            this.PerformLayout();
80
+
81
+        }
82
+
83
+        #endregion
84
+
85
+        private System.Windows.Forms.TextBox txtPassword;
86
+        private System.Windows.Forms.Button btnVerify;
87
+        private System.Windows.Forms.Label label1;
88
+    }
89
+}

+ 55 - 0
BulkPrinting/BulkPrinting/PasswordPrompt.cs

@@ -0,0 +1,55 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+
11
+namespace BulkPrinting
12
+{
13
+    public partial class PasswordPrompt : Form
14
+    {
15
+        public PasswordPrompt()
16
+        {
17
+            InitializeComponent();
18
+        }
19
+
20
+        public string EncryptedVoucherPIN;
21
+
22
+        private void btnVerify_Click(object sender, EventArgs e)
23
+        {
24
+            byte[] userKey;
25
+            byte[] UnencryptedVoucherKey;
26
+            using (var derivedBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(
27
+                txtPassword.Text + "shie5heeX6pekaehovuS2yu0Ciejah7a",
28
+                Globals.SessionSalt,
29
+                Globals.SessionIterations))
30
+            {
31
+                userKey = derivedBytes.GetBytes(32);
32
+            }
33
+            try
34
+            {
35
+                UnencryptedVoucherKey = Utility.AesDecryptBytes(Globals.SessionData.Credentials.Payload.EncryptedVoucherKey, userKey);
36
+            }
37
+            catch (Exception)
38
+            {
39
+                MessageBox.Show("Password error. Logging out.", "Password error", MessageBoxButtons.OK, MessageBoxIcon.Error);
40
+                Utility.Logout();
41
+                return;
42
+            }
43
+            if (UnencryptedVoucherKey.SequenceEqual(Globals.SessionVoucherKey)) {
44
+                this.Hide();
45
+                MessageBox.Show(Utility.TripleDESDecrypt(EncryptedVoucherPIN, UnencryptedVoucherKey).ToString());
46
+                this.Close();
47
+            }
48
+            else {
49
+                MessageBox.Show("Password error. Logging out.", "Password error", MessageBoxButtons.OK, MessageBoxIcon.Error);
50
+                Utility.Logout();
51
+            }
52
+        }
53
+    }
54
+}
55
+

文件差异内容过多而无法显示
+ 6293 - 0
BulkPrinting/BulkPrinting/PasswordPrompt.resx


+ 331 - 0
BulkPrinting/BulkPrinting/PrintAlignmentDialog.Designer.cs

@@ -0,0 +1,331 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class PrintAlignmentDialog
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.components = new System.ComponentModel.Container();
32
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PrintAlignmentDialog));
33
+            this.label1 = new System.Windows.Forms.Label();
34
+            this.btnPrintJob = new System.Windows.Forms.Button();
35
+            this.btnAlignment = new System.Windows.Forms.Button();
36
+            this.lblBatchNumber = new System.Windows.Forms.Label();
37
+            this.label6 = new System.Windows.Forms.Label();
38
+            this.lblNetwork = new System.Windows.Forms.Label();
39
+            this.lblVoucherType = new System.Windows.Forms.Label();
40
+            this.lblFaceValue = new System.Windows.Forms.Label();
41
+            this.lblBatchOrderDate = new System.Windows.Forms.Label();
42
+            this.label7 = new System.Windows.Forms.Label();
43
+            this.label5 = new System.Windows.Forms.Label();
44
+            this.label4 = new System.Windows.Forms.Label();
45
+            this.label8 = new System.Windows.Forms.Label();
46
+            this.lblPrintDescription = new System.Windows.Forms.Label();
47
+            this.grpAlignment = new System.Windows.Forms.GroupBox();
48
+            this.btnExpand = new System.Windows.Forms.Button();
49
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
50
+            this.lblBusyPrinting = new System.Windows.Forms.Label();
51
+            this.tmrPrinterKeepalive = new System.Windows.Forms.Timer(this.components);
52
+            this.pictureBox2 = new System.Windows.Forms.PictureBox();
53
+            this.grpAlignment.SuspendLayout();
54
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
55
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
56
+            this.SuspendLayout();
57
+            // 
58
+            // label1
59
+            // 
60
+            this.label1.AutoSize = true;
61
+            this.label1.ForeColor = System.Drawing.Color.White;
62
+            this.label1.Location = new System.Drawing.Point(6, 191);
63
+            this.label1.Name = "label1";
64
+            this.label1.Size = new System.Drawing.Size(423, 104);
65
+            this.label1.TabIndex = 1;
66
+            this.label1.Text = resources.GetString("label1.Text");
67
+            // 
68
+            // btnPrintJob
69
+            // 
70
+            this.btnPrintJob.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
71
+            this.btnPrintJob.FlatAppearance.BorderColor = System.Drawing.Color.Black;
72
+            this.btnPrintJob.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
73
+            this.btnPrintJob.ForeColor = System.Drawing.Color.White;
74
+            this.btnPrintJob.Location = new System.Drawing.Point(152, 146);
75
+            this.btnPrintJob.Name = "btnPrintJob";
76
+            this.btnPrintJob.Size = new System.Drawing.Size(113, 23);
77
+            this.btnPrintJob.TabIndex = 2;
78
+            this.btnPrintJob.Text = "Print Job";
79
+            this.btnPrintJob.UseVisualStyleBackColor = false;
80
+            this.btnPrintJob.Click += new System.EventHandler(this.btnPrintJob_Click);
81
+            // 
82
+            // btnAlignment
83
+            // 
84
+            this.btnAlignment.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
85
+            this.btnAlignment.FlatAppearance.BorderColor = System.Drawing.Color.Black;
86
+            this.btnAlignment.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
87
+            this.btnAlignment.ForeColor = System.Drawing.Color.White;
88
+            this.btnAlignment.Location = new System.Drawing.Point(151, 310);
89
+            this.btnAlignment.Name = "btnAlignment";
90
+            this.btnAlignment.Size = new System.Drawing.Size(113, 23);
91
+            this.btnAlignment.TabIndex = 2;
92
+            this.btnAlignment.Text = "Print Alignment";
93
+            this.btnAlignment.UseVisualStyleBackColor = false;
94
+            this.btnAlignment.Click += new System.EventHandler(this.btnAlignment_Click);
95
+            // 
96
+            // lblBatchNumber
97
+            // 
98
+            this.lblBatchNumber.AutoSize = true;
99
+            this.lblBatchNumber.ForeColor = System.Drawing.Color.White;
100
+            this.lblBatchNumber.Location = new System.Drawing.Point(248, 70);
101
+            this.lblBatchNumber.Name = "lblBatchNumber";
102
+            this.lblBatchNumber.Size = new System.Drawing.Size(0, 13);
103
+            this.lblBatchNumber.TabIndex = 26;
104
+            // 
105
+            // label6
106
+            // 
107
+            this.label6.AutoSize = true;
108
+            this.label6.ForeColor = System.Drawing.Color.White;
109
+            this.label6.Location = new System.Drawing.Point(164, 70);
110
+            this.label6.Name = "label6";
111
+            this.label6.Size = new System.Drawing.Size(78, 13);
112
+            this.label6.TabIndex = 25;
113
+            this.label6.Text = "Batch Number:";
114
+            // 
115
+            // lblNetwork
116
+            // 
117
+            this.lblNetwork.AutoSize = true;
118
+            this.lblNetwork.ForeColor = System.Drawing.Color.White;
119
+            this.lblNetwork.Location = new System.Drawing.Point(248, 130);
120
+            this.lblNetwork.Name = "lblNetwork";
121
+            this.lblNetwork.Size = new System.Drawing.Size(0, 13);
122
+            this.lblNetwork.TabIndex = 19;
123
+            // 
124
+            // lblVoucherType
125
+            // 
126
+            this.lblVoucherType.AutoSize = true;
127
+            this.lblVoucherType.ForeColor = System.Drawing.Color.White;
128
+            this.lblVoucherType.Location = new System.Drawing.Point(248, 115);
129
+            this.lblVoucherType.Name = "lblVoucherType";
130
+            this.lblVoucherType.Size = new System.Drawing.Size(0, 13);
131
+            this.lblVoucherType.TabIndex = 20;
132
+            // 
133
+            // lblFaceValue
134
+            // 
135
+            this.lblFaceValue.AutoSize = true;
136
+            this.lblFaceValue.ForeColor = System.Drawing.Color.White;
137
+            this.lblFaceValue.Location = new System.Drawing.Point(248, 100);
138
+            this.lblFaceValue.Name = "lblFaceValue";
139
+            this.lblFaceValue.Size = new System.Drawing.Size(0, 13);
140
+            this.lblFaceValue.TabIndex = 21;
141
+            // 
142
+            // lblBatchOrderDate
143
+            // 
144
+            this.lblBatchOrderDate.AutoSize = true;
145
+            this.lblBatchOrderDate.ForeColor = System.Drawing.Color.White;
146
+            this.lblBatchOrderDate.Location = new System.Drawing.Point(248, 85);
147
+            this.lblBatchOrderDate.Name = "lblBatchOrderDate";
148
+            this.lblBatchOrderDate.Size = new System.Drawing.Size(0, 13);
149
+            this.lblBatchOrderDate.TabIndex = 24;
150
+            // 
151
+            // label7
152
+            // 
153
+            this.label7.AutoSize = true;
154
+            this.label7.ForeColor = System.Drawing.Color.White;
155
+            this.label7.Location = new System.Drawing.Point(192, 130);
156
+            this.label7.Name = "label7";
157
+            this.label7.Size = new System.Drawing.Size(50, 13);
158
+            this.label7.TabIndex = 17;
159
+            this.label7.Text = "Network:";
160
+            // 
161
+            // label5
162
+            // 
163
+            this.label5.AutoSize = true;
164
+            this.label5.ForeColor = System.Drawing.Color.White;
165
+            this.label5.Location = new System.Drawing.Point(165, 115);
166
+            this.label5.Name = "label5";
167
+            this.label5.Size = new System.Drawing.Size(77, 13);
168
+            this.label5.TabIndex = 18;
169
+            this.label5.Text = "Voucher Type:";
170
+            // 
171
+            // label4
172
+            // 
173
+            this.label4.AutoSize = true;
174
+            this.label4.ForeColor = System.Drawing.Color.White;
175
+            this.label4.Location = new System.Drawing.Point(178, 100);
176
+            this.label4.Name = "label4";
177
+            this.label4.Size = new System.Drawing.Size(64, 13);
178
+            this.label4.TabIndex = 16;
179
+            this.label4.Text = "Face Value:";
180
+            // 
181
+            // label8
182
+            // 
183
+            this.label8.AutoSize = true;
184
+            this.label8.ForeColor = System.Drawing.Color.White;
185
+            this.label8.Location = new System.Drawing.Point(149, 85);
186
+            this.label8.Name = "label8";
187
+            this.label8.Size = new System.Drawing.Size(93, 13);
188
+            this.label8.TabIndex = 13;
189
+            this.label8.Text = "Batch Order Date:";
190
+            // 
191
+            // lblPrintDescription
192
+            // 
193
+            this.lblPrintDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
194
+            this.lblPrintDescription.ForeColor = System.Drawing.Color.White;
195
+            this.lblPrintDescription.Location = new System.Drawing.Point(17, 5);
196
+            this.lblPrintDescription.Name = "lblPrintDescription";
197
+            this.lblPrintDescription.Size = new System.Drawing.Size(397, 65);
198
+            this.lblPrintDescription.TabIndex = 12;
199
+            this.lblPrintDescription.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
200
+            // 
201
+            // grpAlignment
202
+            // 
203
+            this.grpAlignment.Controls.Add(this.btnExpand);
204
+            this.grpAlignment.Controls.Add(this.pictureBox1);
205
+            this.grpAlignment.Controls.Add(this.label1);
206
+            this.grpAlignment.Controls.Add(this.btnAlignment);
207
+            this.grpAlignment.ForeColor = System.Drawing.Color.White;
208
+            this.grpAlignment.Location = new System.Drawing.Point(1, 173);
209
+            this.grpAlignment.Name = "grpAlignment";
210
+            this.grpAlignment.Size = new System.Drawing.Size(428, 341);
211
+            this.grpAlignment.TabIndex = 27;
212
+            this.grpAlignment.TabStop = false;
213
+            this.grpAlignment.Text = "Alignment";
214
+            this.grpAlignment.Enter += new System.EventHandler(this.grpAlignment_Enter);
215
+            // 
216
+            // btnExpand
217
+            // 
218
+            this.btnExpand.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
219
+            this.btnExpand.FlatAppearance.BorderColor = System.Drawing.Color.Black;
220
+            this.btnExpand.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
221
+            this.btnExpand.ForeColor = System.Drawing.Color.Black;
222
+            this.btnExpand.Image = global::BulkPrinting.Properties.Resources.whitedown;
223
+            this.btnExpand.Location = new System.Drawing.Point(58, 0);
224
+            this.btnExpand.Name = "btnExpand";
225
+            this.btnExpand.Size = new System.Drawing.Size(19, 15);
226
+            this.btnExpand.TabIndex = 28;
227
+            this.btnExpand.UseVisualStyleBackColor = false;
228
+            this.btnExpand.Click += new System.EventHandler(this.btnExpand_Click);
229
+            // 
230
+            // pictureBox1
231
+            // 
232
+            this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
233
+            this.pictureBox1.Location = new System.Drawing.Point(74, 19);
234
+            this.pictureBox1.Name = "pictureBox1";
235
+            this.pictureBox1.Size = new System.Drawing.Size(276, 169);
236
+            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
237
+            this.pictureBox1.TabIndex = 0;
238
+            this.pictureBox1.TabStop = false;
239
+            // 
240
+            // lblBusyPrinting
241
+            // 
242
+            this.lblBusyPrinting.AutoSize = true;
243
+            this.lblBusyPrinting.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
244
+            this.lblBusyPrinting.Location = new System.Drawing.Point(34, 285);
245
+            this.lblBusyPrinting.Name = "lblBusyPrinting";
246
+            this.lblBusyPrinting.Size = new System.Drawing.Size(363, 111);
247
+            this.lblBusyPrinting.TabIndex = 3;
248
+            this.lblBusyPrinting.Text = "Printing in progress\r\nPlease do not close this \r\ndialog until it is finished.";
249
+            this.lblBusyPrinting.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
250
+            this.lblBusyPrinting.Visible = false;
251
+            // 
252
+            // tmrPrinterKeepalive
253
+            // 
254
+            this.tmrPrinterKeepalive.Enabled = true;
255
+            this.tmrPrinterKeepalive.Interval = 60000;
256
+            this.tmrPrinterKeepalive.Tick += new System.EventHandler(this.tmrPrinterKeepalive_Tick);
257
+            // 
258
+            // pictureBox2
259
+            // 
260
+            this.pictureBox2.Image = global::BulkPrinting.Properties.Resources.r_g_bulk_icon;
261
+            this.pictureBox2.Location = new System.Drawing.Point(3, 70);
262
+            this.pictureBox2.Name = "pictureBox2";
263
+            this.pictureBox2.Size = new System.Drawing.Size(121, 104);
264
+            this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
265
+            this.pictureBox2.TabIndex = 28;
266
+            this.pictureBox2.TabStop = false;
267
+            // 
268
+            // PrintAlignmentDialog
269
+            // 
270
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
271
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
272
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
273
+            this.ClientSize = new System.Drawing.Size(431, 188);
274
+            this.Controls.Add(this.pictureBox2);
275
+            this.Controls.Add(this.grpAlignment);
276
+            this.Controls.Add(this.lblBatchNumber);
277
+            this.Controls.Add(this.label6);
278
+            this.Controls.Add(this.lblBusyPrinting);
279
+            this.Controls.Add(this.lblNetwork);
280
+            this.Controls.Add(this.lblVoucherType);
281
+            this.Controls.Add(this.lblFaceValue);
282
+            this.Controls.Add(this.lblBatchOrderDate);
283
+            this.Controls.Add(this.label7);
284
+            this.Controls.Add(this.label5);
285
+            this.Controls.Add(this.label4);
286
+            this.Controls.Add(this.label8);
287
+            this.Controls.Add(this.lblPrintDescription);
288
+            this.Controls.Add(this.btnPrintJob);
289
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
290
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
291
+            this.MaximizeBox = false;
292
+            this.MaximumSize = new System.Drawing.Size(447, 553);
293
+            this.MinimizeBox = false;
294
+            this.MinimumSize = new System.Drawing.Size(447, 227);
295
+            this.Name = "PrintAlignmentDialog";
296
+            this.Text = "Print Vouchers";
297
+            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.PrintAlignmentDialog_FormClosed);
298
+            this.Load += new System.EventHandler(this.PrintAlignmentDialog_Load);
299
+            this.grpAlignment.ResumeLayout(false);
300
+            this.grpAlignment.PerformLayout();
301
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
302
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
303
+            this.ResumeLayout(false);
304
+            this.PerformLayout();
305
+
306
+        }
307
+
308
+        #endregion
309
+
310
+        private System.Windows.Forms.PictureBox pictureBox1;
311
+        private System.Windows.Forms.Label label1;
312
+        private System.Windows.Forms.Button btnPrintJob;
313
+        private System.Windows.Forms.Button btnAlignment;
314
+        private System.Windows.Forms.Label lblBatchNumber;
315
+        private System.Windows.Forms.Label label6;
316
+        private System.Windows.Forms.Label lblNetwork;
317
+        private System.Windows.Forms.Label lblVoucherType;
318
+        private System.Windows.Forms.Label lblFaceValue;
319
+        private System.Windows.Forms.Label lblBatchOrderDate;
320
+        private System.Windows.Forms.Label label7;
321
+        private System.Windows.Forms.Label label5;
322
+        private System.Windows.Forms.Label label4;
323
+        private System.Windows.Forms.Label label8;
324
+        private System.Windows.Forms.Label lblPrintDescription;
325
+        private System.Windows.Forms.GroupBox grpAlignment;
326
+        private System.Windows.Forms.Label lblBusyPrinting;
327
+        private System.Windows.Forms.Timer tmrPrinterKeepalive;
328
+        private System.Windows.Forms.Button btnExpand;
329
+        private System.Windows.Forms.PictureBox pictureBox2;
330
+    }
331
+}

+ 151 - 0
BulkPrinting/BulkPrinting/PrintAlignmentDialog.cs

@@ -0,0 +1,151 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Data.SQLite;
11
+using System.Threading;
12
+
13
+namespace BulkPrinting
14
+{
15
+    public partial class PrintAlignmentDialog : Form
16
+    {
17
+        public PrintAlignmentDialog()
18
+        {
19
+            InitializeComponent();
20
+        }
21
+
22
+        public string PrintDescription;
23
+        public DateTime BatchOrderDate;
24
+        public string FaceValue;
25
+        public string VoucherTypeName;
26
+        public string NetworkName;
27
+        public int BatchID;
28
+        public int? NumVouchers;
29
+        public int? FirstSeqNo;
30
+        public int? LastSeqNo;
31
+
32
+        private void PrintAlignmentDialog_Load(object sender, EventArgs e)
33
+        {
34
+            this.Height = 227;
35
+            grpAlignment.Show();
36
+            lblBusyPrinting.Hide();
37
+
38
+            lblPrintDescription.Text = "Ready to Print: ";
39
+            if (FirstSeqNo != null && LastSeqNo != null) {
40
+                lblPrintDescription.Text += "Vouchers numbered " + FirstSeqNo.ToString() + " to " + LastSeqNo.ToString() + "\nFrom Batch \"" + PrintDescription+"\"";
41
+            }
42
+            else if (NumVouchers != null) {
43
+                lblPrintDescription.Text += NumVouchers.ToString() + " Vouchers\nFrom Batch \"" + PrintDescription + "\"";
44
+            }
45
+
46
+            lblBatchNumber.Text = BatchID.ToString();
47
+            lblBatchOrderDate.Text = BatchOrderDate.Date.ToString("dd/MM/yyyy");
48
+            lblFaceValue.Text = FaceValue;
49
+            lblVoucherType.Text = VoucherTypeName;
50
+            lblNetwork.Text = NetworkName;
51
+        }
52
+
53
+        private void btnAlignment_Click(object sender, EventArgs e)
54
+        {
55
+            if (Globals.MaxPrinter.Open("Alignment")==0) return;
56
+
57
+            var PrinterInitString = new StringBuilder();
58
+            PrinterInitString.Append(Printer.INITIALISE_PRINTER).Append(Printer.UNIDIRECTIONAL_OFF).Append(Printer.EMPHASISE_ON);
59
+            Globals.MaxPrinter.Print(PrinterInitString.ToString());
60
+
61
+            string AlignmentPage ="";// = Printer.UNIDIRECTIONAL_OFF;
62
+
63
+            for (var i = 0; i < 8; i++) //Two full pages of vouchers
64
+            {
65
+                AlignmentPage += "\r\n\n\n" +
66
+                "[VOUCHER  PIN  CODE]     [VOUCHER  PIN  CODE]      [VOUCHER  PIN  CODE]     [VOUCHER  PIN  CODE]     [VOUCHER  PIN  CODE]\r\n\n" +
67
+                "[VOUCHER SERIAL NUM]     [VOUCHER SERIAL NUM]      [VOUCHER SERIAL NUM]     [VOUCHER SERIAL NUM]     [VOUCHER SERIAL NUM]\r\n" +
68
+                "[BATCHNO/SEQNO/PAGE]     [BATCHNO/SEQNO/PAGE]      [BATCHNO/SEQNO/PAGE]     [BATCHNO/SEQNO/PAGE]     [BATCHNO/SEQNO/PAGE]\r\n" +
69
+                "[VOUCHERDESCRIPTION]     [VOUCHERDESCRIPTION]      [VOUCHERDESCRIPTION]     [VOUCHERDESCRIPTION]     [VOUCHERDESCRIPTION]\r\n\n\n\n\n\n\n\n\n\n\n";
70
+                
71
+            }
72
+            
73
+            Globals.MaxPrinter.Print(AlignmentPage);
74
+            Globals.MaxPrinter.Close();
75
+        }
76
+
77
+        private void btnPrintJob_Click(object sender, EventArgs e)
78
+        {
79
+            int FirstVoucherSequenceNumber;
80
+            int LastVoucherSequenceNumber;
81
+
82
+
83
+            if (FirstSeqNo != null && LastSeqNo != null)
84
+            {
85
+                FirstVoucherSequenceNumber = (int)FirstSeqNo;
86
+                LastVoucherSequenceNumber = (int)LastSeqNo;
87
+            }
88
+            else if (NumVouchers != null)
89
+            {
90
+                string Sql = "SELECT MIN(v.SequenceNumber) FROM Voucher v " +
91
+                    "LEFT JOIN Logs l ON v.Id = l.VoucherId AND l.EventType = @eventtype " +
92
+                    "WHERE v.BatchId = @batchid AND l.id IS NULL";
93
+                SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
94
+                Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
95
+                Command.Parameters.Add(new SQLiteParameter("@batchid", BatchID));
96
+                FirstVoucherSequenceNumber = Convert.ToInt32(Command.ExecuteScalar());
97
+                LastVoucherSequenceNumber = FirstVoucherSequenceNumber + (int)NumVouchers - 1;
98
+            }
99
+            else {
100
+                MessageBox.Show("An unknown error has occured. Please try again.", "Voucher numbering error", MessageBoxButtons.OK, MessageBoxIcon.Error);
101
+                this.Close();
102
+                return;
103
+            }
104
+            BatchForm BatchForm = (BatchForm)Application.OpenForms["BatchForm"];
105
+            grpAlignment.Hide();
106
+            this.Height = 553;
107
+            lblBusyPrinting.Show();
108
+            this.Enabled = false;
109
+            Thread t = new Thread(() =>
110
+            {
111
+                Utility.PrintVouchers(this.BatchID, FirstVoucherSequenceNumber, LastVoucherSequenceNumber);
112
+                Globals.OpenBatches.Remove(BatchID);
113
+                this.Invoke((Action)(() => {
114
+                    BatchForm.PopulateGrid();
115
+                    this.Enabled = true;
116
+                    this.Close();
117
+                }));
118
+            });
119
+            t.Start();
120
+
121
+        }
122
+
123
+        private void grpAlignment_Enter(object sender, EventArgs e)
124
+        {
125
+
126
+        }
127
+
128
+        private void tmrPrinterKeepalive_Tick(object sender, EventArgs e)
129
+        {
130
+            BatchForm BatchForm = (BatchForm)Application.OpenForms["BatchForm"];
131
+            BatchForm.ResetTimer();
132
+        }
133
+
134
+        private void PrintAlignmentDialog_FormClosed(object sender, FormClosedEventArgs e)
135
+        {
136
+            Globals.OpenBatches.Remove(BatchID);
137
+        }
138
+
139
+        private void btnExpand_Click(object sender, EventArgs e)
140
+        {
141
+            if (this.Height == 227) {
142
+                this.Height = 553;
143
+                btnExpand.Image = Properties.Resources.whiteup;
144
+            }
145
+            else {
146
+                this.Height = 227;
147
+                btnExpand.Image = Properties.Resources.whitedown;
148
+            }
149
+        }
150
+    }
151
+}

文件差异内容过多而无法显示
+ 6471 - 0
BulkPrinting/BulkPrinting/PrintAlignmentDialog.resx


+ 304 - 0
BulkPrinting/BulkPrinting/PrintForm.Designer.cs

@@ -0,0 +1,304 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class PrintForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PrintForm));
32
+            this.lblPrintDescription = new System.Windows.Forms.Label();
33
+            this.label1 = new System.Windows.Forms.Label();
34
+            this.label2 = new System.Windows.Forms.Label();
35
+            this.label3 = new System.Windows.Forms.Label();
36
+            this.label4 = new System.Windows.Forms.Label();
37
+            this.label5 = new System.Windows.Forms.Label();
38
+            this.lblBatchOrderDate = new System.Windows.Forms.Label();
39
+            this.lblUnprintedVouchers = new System.Windows.Forms.Label();
40
+            this.lblTotalVouchers = new System.Windows.Forms.Label();
41
+            this.lblFaceValue = new System.Windows.Forms.Label();
42
+            this.lblVoucherType = new System.Windows.Forms.Label();
43
+            this.label6 = new System.Windows.Forms.Label();
44
+            this.lblBatchNumber = new System.Windows.Forms.Label();
45
+            this.btnCancel = new System.Windows.Forms.Button();
46
+            this.btnNext = new System.Windows.Forms.Button();
47
+            this.lblNumVouchers = new System.Windows.Forms.Label();
48
+            this.numNumVouchers = new System.Windows.Forms.NumericUpDown();
49
+            this.label7 = new System.Windows.Forms.Label();
50
+            this.lblNetwork = new System.Windows.Forms.Label();
51
+            ((System.ComponentModel.ISupportInitialize)(this.numNumVouchers)).BeginInit();
52
+            this.SuspendLayout();
53
+            // 
54
+            // lblPrintDescription
55
+            // 
56
+            this.lblPrintDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
57
+            this.lblPrintDescription.ForeColor = System.Drawing.Color.White;
58
+            this.lblPrintDescription.Location = new System.Drawing.Point(13, 13);
59
+            this.lblPrintDescription.Name = "lblPrintDescription";
60
+            this.lblPrintDescription.Size = new System.Drawing.Size(259, 23);
61
+            this.lblPrintDescription.TabIndex = 1;
62
+            this.lblPrintDescription.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
63
+            this.lblPrintDescription.Click += new System.EventHandler(this.lblPrintDescription_Click);
64
+            // 
65
+            // label1
66
+            // 
67
+            this.label1.AutoSize = true;
68
+            this.label1.ForeColor = System.Drawing.Color.White;
69
+            this.label1.Location = new System.Drawing.Point(78, 56);
70
+            this.label1.Name = "label1";
71
+            this.label1.Size = new System.Drawing.Size(93, 13);
72
+            this.label1.TabIndex = 2;
73
+            this.label1.Text = "Batch Order Date:";
74
+            // 
75
+            // label2
76
+            // 
77
+            this.label2.AutoSize = true;
78
+            this.label2.ForeColor = System.Drawing.Color.White;
79
+            this.label2.Location = new System.Drawing.Point(15, 72);
80
+            this.label2.Name = "label2";
81
+            this.label2.Size = new System.Drawing.Size(157, 13);
82
+            this.label2.TabIndex = 3;
83
+            this.label2.Text = "Unprinted Vouchers Remaining:";
84
+            // 
85
+            // label3
86
+            // 
87
+            this.label3.AutoSize = true;
88
+            this.label3.ForeColor = System.Drawing.Color.White;
89
+            this.label3.Location = new System.Drawing.Point(47, 87);
90
+            this.label3.Name = "label3";
91
+            this.label3.Size = new System.Drawing.Size(124, 13);
92
+            this.label3.TabIndex = 4;
93
+            this.label3.Text = "Total Vouchers in Batch:";
94
+            // 
95
+            // label4
96
+            // 
97
+            this.label4.AutoSize = true;
98
+            this.label4.ForeColor = System.Drawing.Color.White;
99
+            this.label4.Location = new System.Drawing.Point(107, 102);
100
+            this.label4.Name = "label4";
101
+            this.label4.Size = new System.Drawing.Size(64, 13);
102
+            this.label4.TabIndex = 5;
103
+            this.label4.Text = "Face Value:";
104
+            // 
105
+            // label5
106
+            // 
107
+            this.label5.AutoSize = true;
108
+            this.label5.ForeColor = System.Drawing.Color.White;
109
+            this.label5.Location = new System.Drawing.Point(94, 117);
110
+            this.label5.Name = "label5";
111
+            this.label5.Size = new System.Drawing.Size(77, 13);
112
+            this.label5.TabIndex = 6;
113
+            this.label5.Text = "Voucher Type:";
114
+            // 
115
+            // lblBatchOrderDate
116
+            // 
117
+            this.lblBatchOrderDate.AutoSize = true;
118
+            this.lblBatchOrderDate.ForeColor = System.Drawing.Color.White;
119
+            this.lblBatchOrderDate.Location = new System.Drawing.Point(177, 56);
120
+            this.lblBatchOrderDate.Name = "lblBatchOrderDate";
121
+            this.lblBatchOrderDate.Size = new System.Drawing.Size(0, 13);
122
+            this.lblBatchOrderDate.TabIndex = 7;
123
+            // 
124
+            // lblUnprintedVouchers
125
+            // 
126
+            this.lblUnprintedVouchers.AutoSize = true;
127
+            this.lblUnprintedVouchers.ForeColor = System.Drawing.Color.White;
128
+            this.lblUnprintedVouchers.Location = new System.Drawing.Point(177, 72);
129
+            this.lblUnprintedVouchers.Name = "lblUnprintedVouchers";
130
+            this.lblUnprintedVouchers.Size = new System.Drawing.Size(0, 13);
131
+            this.lblUnprintedVouchers.TabIndex = 7;
132
+            // 
133
+            // lblTotalVouchers
134
+            // 
135
+            this.lblTotalVouchers.AutoSize = true;
136
+            this.lblTotalVouchers.ForeColor = System.Drawing.Color.White;
137
+            this.lblTotalVouchers.Location = new System.Drawing.Point(177, 87);
138
+            this.lblTotalVouchers.Name = "lblTotalVouchers";
139
+            this.lblTotalVouchers.Size = new System.Drawing.Size(0, 13);
140
+            this.lblTotalVouchers.TabIndex = 7;
141
+            // 
142
+            // lblFaceValue
143
+            // 
144
+            this.lblFaceValue.AutoSize = true;
145
+            this.lblFaceValue.ForeColor = System.Drawing.Color.White;
146
+            this.lblFaceValue.Location = new System.Drawing.Point(177, 102);
147
+            this.lblFaceValue.Name = "lblFaceValue";
148
+            this.lblFaceValue.Size = new System.Drawing.Size(0, 13);
149
+            this.lblFaceValue.TabIndex = 7;
150
+            // 
151
+            // lblVoucherType
152
+            // 
153
+            this.lblVoucherType.AutoSize = true;
154
+            this.lblVoucherType.ForeColor = System.Drawing.Color.White;
155
+            this.lblVoucherType.Location = new System.Drawing.Point(177, 117);
156
+            this.lblVoucherType.Name = "lblVoucherType";
157
+            this.lblVoucherType.Size = new System.Drawing.Size(0, 13);
158
+            this.lblVoucherType.TabIndex = 7;
159
+            // 
160
+            // label6
161
+            // 
162
+            this.label6.AutoSize = true;
163
+            this.label6.ForeColor = System.Drawing.Color.White;
164
+            this.label6.Location = new System.Drawing.Point(93, 41);
165
+            this.label6.Name = "label6";
166
+            this.label6.Size = new System.Drawing.Size(78, 13);
167
+            this.label6.TabIndex = 10;
168
+            this.label6.Text = "Batch Number:";
169
+            // 
170
+            // lblBatchNumber
171
+            // 
172
+            this.lblBatchNumber.AutoSize = true;
173
+            this.lblBatchNumber.ForeColor = System.Drawing.Color.White;
174
+            this.lblBatchNumber.Location = new System.Drawing.Point(177, 41);
175
+            this.lblBatchNumber.Name = "lblBatchNumber";
176
+            this.lblBatchNumber.Size = new System.Drawing.Size(0, 13);
177
+            this.lblBatchNumber.TabIndex = 11;
178
+            // 
179
+            // btnCancel
180
+            // 
181
+            this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
182
+            this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
183
+            this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
184
+            this.btnCancel.ForeColor = System.Drawing.Color.White;
185
+            this.btnCancel.Location = new System.Drawing.Point(50, 174);
186
+            this.btnCancel.Name = "btnCancel";
187
+            this.btnCancel.Size = new System.Drawing.Size(75, 23);
188
+            this.btnCancel.TabIndex = 12;
189
+            this.btnCancel.Text = "Cancel";
190
+            this.btnCancel.UseVisualStyleBackColor = false;
191
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
192
+            // 
193
+            // btnNext
194
+            // 
195
+            this.btnNext.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
196
+            this.btnNext.FlatAppearance.BorderColor = System.Drawing.Color.Black;
197
+            this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
198
+            this.btnNext.ForeColor = System.Drawing.Color.White;
199
+            this.btnNext.Location = new System.Drawing.Point(177, 174);
200
+            this.btnNext.Name = "btnNext";
201
+            this.btnNext.Size = new System.Drawing.Size(75, 23);
202
+            this.btnNext.TabIndex = 13;
203
+            this.btnNext.Text = "Next";
204
+            this.btnNext.UseVisualStyleBackColor = false;
205
+            this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
206
+            // 
207
+            // lblNumVouchers
208
+            // 
209
+            this.lblNumVouchers.AutoSize = true;
210
+            this.lblNumVouchers.ForeColor = System.Drawing.Color.White;
211
+            this.lblNumVouchers.Location = new System.Drawing.Point(28, 149);
212
+            this.lblNumVouchers.Name = "lblNumVouchers";
213
+            this.lblNumVouchers.Size = new System.Drawing.Size(143, 13);
214
+            this.lblNumVouchers.TabIndex = 16;
215
+            this.lblNumVouchers.Text = "Number of Vouchers to Print:";
216
+            // 
217
+            // numNumVouchers
218
+            // 
219
+            this.numNumVouchers.Location = new System.Drawing.Point(177, 147);
220
+            this.numNumVouchers.Name = "numNumVouchers";
221
+            this.numNumVouchers.Size = new System.Drawing.Size(95, 20);
222
+            this.numNumVouchers.TabIndex = 18;
223
+            // 
224
+            // label7
225
+            // 
226
+            this.label7.AutoSize = true;
227
+            this.label7.ForeColor = System.Drawing.Color.White;
228
+            this.label7.Location = new System.Drawing.Point(121, 132);
229
+            this.label7.Name = "label7";
230
+            this.label7.Size = new System.Drawing.Size(50, 13);
231
+            this.label7.TabIndex = 6;
232
+            this.label7.Text = "Network:";
233
+            // 
234
+            // lblNetwork
235
+            // 
236
+            this.lblNetwork.AutoSize = true;
237
+            this.lblNetwork.ForeColor = System.Drawing.Color.White;
238
+            this.lblNetwork.Location = new System.Drawing.Point(177, 132);
239
+            this.lblNetwork.Name = "lblNetwork";
240
+            this.lblNetwork.Size = new System.Drawing.Size(0, 13);
241
+            this.lblNetwork.TabIndex = 7;
242
+            // 
243
+            // PrintForm
244
+            // 
245
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
246
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
247
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
248
+            this.ClientSize = new System.Drawing.Size(284, 209);
249
+            this.ControlBox = false;
250
+            this.Controls.Add(this.numNumVouchers);
251
+            this.Controls.Add(this.lblNumVouchers);
252
+            this.Controls.Add(this.btnNext);
253
+            this.Controls.Add(this.btnCancel);
254
+            this.Controls.Add(this.lblBatchNumber);
255
+            this.Controls.Add(this.label6);
256
+            this.Controls.Add(this.lblNetwork);
257
+            this.Controls.Add(this.lblVoucherType);
258
+            this.Controls.Add(this.lblFaceValue);
259
+            this.Controls.Add(this.lblTotalVouchers);
260
+            this.Controls.Add(this.lblUnprintedVouchers);
261
+            this.Controls.Add(this.lblBatchOrderDate);
262
+            this.Controls.Add(this.label7);
263
+            this.Controls.Add(this.label5);
264
+            this.Controls.Add(this.label4);
265
+            this.Controls.Add(this.label3);
266
+            this.Controls.Add(this.label2);
267
+            this.Controls.Add(this.label1);
268
+            this.Controls.Add(this.lblPrintDescription);
269
+            this.ForeColor = System.Drawing.Color.White;
270
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
271
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
272
+            this.MaximizeBox = false;
273
+            this.MinimizeBox = false;
274
+            this.Name = "PrintForm";
275
+            this.Text = "Print Vouchers";
276
+            this.Load += new System.EventHandler(this.PrintForm_Load);
277
+            ((System.ComponentModel.ISupportInitialize)(this.numNumVouchers)).EndInit();
278
+            this.ResumeLayout(false);
279
+            this.PerformLayout();
280
+
281
+        }
282
+
283
+        #endregion
284
+        private System.Windows.Forms.Label lblPrintDescription;
285
+        private System.Windows.Forms.Label label1;
286
+        private System.Windows.Forms.Label label2;
287
+        private System.Windows.Forms.Label label3;
288
+        private System.Windows.Forms.Label label4;
289
+        private System.Windows.Forms.Label label5;
290
+        private System.Windows.Forms.Label lblBatchOrderDate;
291
+        private System.Windows.Forms.Label lblUnprintedVouchers;
292
+        private System.Windows.Forms.Label lblTotalVouchers;
293
+        private System.Windows.Forms.Label lblFaceValue;
294
+        private System.Windows.Forms.Label lblVoucherType;
295
+        private System.Windows.Forms.Label label6;
296
+        private System.Windows.Forms.Label lblBatchNumber;
297
+        private System.Windows.Forms.Button btnCancel;
298
+        private System.Windows.Forms.Button btnNext;
299
+        private System.Windows.Forms.Label lblNumVouchers;
300
+        private System.Windows.Forms.NumericUpDown numNumVouchers;
301
+        private System.Windows.Forms.Label label7;
302
+        private System.Windows.Forms.Label lblNetwork;
303
+    }
304
+}

+ 123 - 0
BulkPrinting/BulkPrinting/PrintForm.cs

@@ -0,0 +1,123 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Data.SQLite;
11
+
12
+namespace BulkPrinting
13
+{
14
+    public partial class PrintForm : Form
15
+    {
16
+        public PrintForm()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        public string PrintDescription;
22
+        public DateTime BatchOrderDate;
23
+        public int UnprintedVouchers;
24
+        public int TotalVouchers;
25
+        public string FaceValue;
26
+        public string VoucherTypeName;
27
+        public string NetworkName;
28
+        public int BatchID;
29
+        private Boolean CanReprintThisSession;
30
+
31
+        private void PrintForm_Load(object sender, EventArgs e)
32
+        {
33
+            CanReprintThisSession =
34
+                ((Globals.SessionMode == SessionModes.Online &&
35
+                    Utility.CheckUserAccess(Utility.UserPermissions.CanReprintOnline)) ||
36
+                (Globals.SessionMode == SessionModes.Offline &&
37
+                    Utility.CheckUserAccess(Utility.UserPermissions.CanReprintOffline)));
38
+            lblPrintDescription.Text = PrintDescription;
39
+            lblBatchNumber.Text = BatchID.ToString();
40
+            lblBatchOrderDate.Text = BatchOrderDate.Date.ToString("dd/MM/yyyy");
41
+            lblUnprintedVouchers.Text = UnprintedVouchers.ToString();
42
+            lblTotalVouchers.Text = TotalVouchers.ToString();
43
+            lblFaceValue.Text = FaceValue;
44
+            lblVoucherType.Text = VoucherTypeName;
45
+            lblNetwork.Text = NetworkName;
46
+            numNumVouchers.Maximum = UnprintedVouchers;
47
+        }
48
+
49
+        private void btnCancel_Click(object sender, EventArgs e)
50
+        {
51
+            Globals.OpenBatches.Remove(BatchID);
52
+            this.Close();
53
+        }
54
+
55
+        private void btnNext_Click(object sender, EventArgs e)
56
+        {
57
+            decimal VoucherCount;
58
+
59
+            if (numNumVouchers.Value < 1)
60
+            {
61
+                MessageBox.Show("Please select a valid number of vouchers to print", "Invalid print value", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
62
+                return;
63
+            }
64
+
65
+            if (numNumVouchers.Value > UnprintedVouchers)
66
+            {
67
+                if (CanReprintThisSession)
68
+                {
69
+                    MessageBox.Show("You have selected more vouchers than are available to print. If you wish to reprint vouchers that have already been printed, please select the 'Print Voucher Range' option and type in the starting and ending voucher sequence numbers to print that range.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
70
+                    return;
71
+                }
72
+                else
73
+                {
74
+                    MessageBox.Show("You have selected more vouchers than are available to print.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
75
+                    return;
76
+                }
77
+            }
78
+            string Sql = "SELECT FaceValue FROM Batch WHERE Id = @id";
79
+            SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
80
+            Command.Parameters.Add(new SQLiteParameter("@id", BatchID));
81
+
82
+            VoucherCount = numNumVouchers.Value;
83
+            decimal TotalVoucherValue = VoucherCount * (decimal)Command.ExecuteScalar();
84
+            if (Globals.SessionMode == SessionModes.Online)
85
+            {
86
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.OnlinePrint, TotalVoucherValue))
87
+                {
88
+                    MessageBox.Show("You have selected more vouchers than your permissions allow you to print today.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
89
+                    return;
90
+                }
91
+            }
92
+            if (Globals.SessionMode == SessionModes.Offline)
93
+            {
94
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.OfflinePrint, TotalVoucherValue))
95
+                {
96
+                    MessageBox.Show("You have selected more vouchers than your permissions allow you to print today.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
97
+                    return;
98
+                }
99
+            }
100
+            if (Globals.MaxPrinter.ChoosePrinter())
101
+            {
102
+                PrintAlignmentDialog printdialog = new PrintAlignmentDialog();
103
+                printdialog.PrintDescription = PrintDescription;
104
+                printdialog.BatchID = BatchID;
105
+                printdialog.BatchOrderDate = BatchOrderDate;
106
+                printdialog.FaceValue = FaceValue;
107
+                printdialog.VoucherTypeName = VoucherTypeName;
108
+                printdialog.NetworkName = NetworkName;
109
+                printdialog.NumVouchers = (int)numNumVouchers.Value;
110
+                printdialog.FirstSeqNo = null;
111
+                printdialog.LastSeqNo = null;
112
+                printdialog.Show();
113
+                this.Close();
114
+            }
115
+
116
+        }
117
+
118
+        private void lblPrintDescription_Click(object sender, EventArgs e)
119
+        {
120
+
121
+        }
122
+    }
123
+}

文件差异内容过多而无法显示
+ 6296 - 0
BulkPrinting/BulkPrinting/PrintForm.resx


+ 191 - 0
BulkPrinting/BulkPrinting/Printer.cs

@@ -0,0 +1,191 @@
1
+using System;
2
+using System.Drawing.Printing;
3
+using System.Windows.Forms;
4
+using System.Runtime.InteropServices;
5
+using System.Text;
6
+
7
+namespace BulkPrinting
8
+{
9
+    public class Printer
10
+    {
11
+        public const string UNIDIRECTIONAL_ON = "\x1B\x55\x31";
12
+        public const string UNIDIRECTIONAL_OFF = "\x1B\x55\x30";
13
+        public const string CR = "\x0d";
14
+        public const string LF = "\x0a";
15
+        public const string FORMFEED = "\x0c";
16
+        public const string LINESPACE18 = "\x1B\x30";
17
+        public const string LINESPACE772 = "\x1B\x31";
18
+        public const string CHARPITCHS1 = "\x1B\x37";
19
+        public const string CHARPITCHS2 = "\x1B\x36";
20
+        public const string CHARPITCHPUB = "\x1B\x21\x5a";
21
+        public const string CHARPITCHS0 = "\x1B\x21\x40";
22
+        public const string INITIALISE_PRINTER = "\x1B\x40";
23
+        public const string EMPHASISE_ON = "\x1B\x45";
24
+        public const string EMPHASISE_OFF = "\x1B\x46";
25
+
26
+        public const int JOB_CONTROL_DELETE = 5;
27
+
28
+        // Structure and API declarions:
29
+        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
30
+        public class DOCINFOA
31
+        {
32
+            [MarshalAs(UnmanagedType.LPStr)] public string pDocName;
33
+            [MarshalAs(UnmanagedType.LPStr)] public string pOutputFile;
34
+            [MarshalAs(UnmanagedType.LPStr)] public string pDataType;
35
+        }
36
+        [StructLayout(LayoutKind.Sequential)]
37
+        private struct SYSTEMTIME
38
+        {
39
+            Int16 wYear;
40
+            Int16 wMonth;
41
+            Int16 wDayOfWeek;
42
+            Int16 wDay;
43
+            Int16 wHour;
44
+            Int16 wMinute;
45
+            Int16 wSecond;
46
+            Int16 wMilliseconds;
47
+        }
48
+        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
49
+        struct JOB_INFO_1
50
+        {
51
+            public UInt32 JobId;
52
+            [MarshalAs(UnmanagedType.LPStr)] public string pPrinterName;
53
+            [MarshalAs(UnmanagedType.LPStr)] public string pMachineName;
54
+            [MarshalAs(UnmanagedType.LPStr)] public string pUserName;
55
+            [MarshalAs(UnmanagedType.LPStr)] public string pDocument;
56
+            [MarshalAs(UnmanagedType.LPStr)] public string pDatatype;
57
+            [MarshalAs(UnmanagedType.LPStr)] public string pStatus;
58
+            public UInt32 Status;
59
+            public UInt32 Priority;
60
+            public UInt32 Position;
61
+            public UInt32 TotalPages;
62
+            public UInt32 PagesPrinted;
63
+            public SYSTEMTIME Submitted;
64
+        }
65
+        [DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
66
+        public static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);
67
+
68
+        [DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
69
+        public static extern bool ClosePrinter(IntPtr hPrinter);
70
+
71
+        [DllImport("winspool.Drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
72
+        public static extern int StartDocPrinter(IntPtr hPrinter, Int32 level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);
73
+
74
+        [DllImport("winspool.Drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
75
+        public static extern bool EndDocPrinter(IntPtr hPrinter);
76
+
77
+        [DllImport("winspool.Drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
78
+        public static extern bool StartPagePrinter(IntPtr hPrinter);
79
+
80
+        [DllImport("winspool.Drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
81
+        public static extern bool EndPagePrinter(IntPtr hPrinter);
82
+
83
+        [DllImport("winspool.Drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
84
+        public static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);
85
+
86
+        [DllImport("winspool.drv", EntryPoint = "GetJobA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
87
+        private static extern bool GetJob (IntPtr hPrinter, Int32 JobId, Int32 Level, out byte[] pJob, Int32 cbBuf, out Int32 pcbNeeded);
88
+
89
+        [DllImport("winspool.drv", EntryPoint = "SetJobA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
90
+        private static extern bool SetJob(IntPtr hPrinter, int JobId, int Level, out byte pJob, int Command_Renamed);
91
+        /*=================================================*/
92
+
93
+        private IntPtr HandlePrinter;
94
+        private PrinterSettings ps;
95
+
96
+        public Printer()
97
+        {
98
+            HandlePrinter = IntPtr.Zero;
99
+            ps = new PrinterSettings();
100
+        }
101
+
102
+        public string PrinterName
103
+        {
104
+            get
105
+            {
106
+                return ps.PrinterName;
107
+            }
108
+            set
109
+            {
110
+                ps.PrinterName = value;
111
+            }
112
+        }
113
+
114
+        public bool ChoosePrinter()
115
+        {
116
+            PrintDialog pd = new PrintDialog();
117
+            pd.UseEXDialog = true; //Required for AMD64 based processors
118
+            pd.PrinterSettings = ps;
119
+            if (pd.ShowDialog() == DialogResult.OK)
120
+            {
121
+                ps = pd.PrinterSettings;
122
+                return true;
123
+            }
124
+            else
125
+                return false;
126
+        }
127
+
128
+        public bool GetJobInfo(int JobID) {
129
+            //JOB_INFO_1 JobInfo = new JOB_INFO_1();
130
+            byte[] JobInfoByte;
131
+            int pcbNeeded;
132
+            if (HandlePrinter == IntPtr.Zero) return false;
133
+
134
+            GetJob(HandlePrinter, JobID, 1, out JobInfoByte, 240, out pcbNeeded);
135
+            return false;
136
+        }
137
+
138
+        public int Open(string DocName)
139
+        {
140
+            // see if printer is already open
141
+            if (HandlePrinter != IntPtr.Zero) return 0;
142
+
143
+            // opens the printer
144
+            bool risp = OpenPrinter(ps.PrinterName, out HandlePrinter, IntPtr.Zero);
145
+            if (risp == false) return 0;
146
+
147
+            // starts a print job
148
+            DOCINFOA MyDocInfo = new DOCINFOA();
149
+            MyDocInfo.pDocName = DocName;
150
+            MyDocInfo.pOutputFile = null;
151
+            MyDocInfo.pDataType = "RAW";
152
+
153
+            int JobID = StartDocPrinter(HandlePrinter, 1, MyDocInfo);
154
+            if (JobID > 0)
155
+            {
156
+                StartPagePrinter(HandlePrinter); //starts a page       
157
+            }
158
+            return JobID;
159
+        }
160
+
161
+        public bool Close()
162
+        {
163
+            if (HandlePrinter == IntPtr.Zero) return false;
164
+            if (!EndPagePrinter(HandlePrinter)) return false;
165
+            if (!EndDocPrinter(HandlePrinter)) return false;
166
+            if (!ClosePrinter(HandlePrinter)) return false;
167
+            HandlePrinter = IntPtr.Zero;
168
+            return true;
169
+        }
170
+
171
+        public bool Print(string outputstring)
172
+        {
173
+            if (HandlePrinter == IntPtr.Zero) return false;
174
+
175
+            IntPtr buf = Marshal.StringToCoTaskMemAnsi(outputstring);
176
+
177
+            Int32 done = 0;
178
+            bool ok = WritePrinter(HandlePrinter, buf, outputstring.Length, out done);
179
+
180
+            Marshal.FreeCoTaskMem(buf);
181
+
182
+            if (!ok) return false;
183
+            else return true;
184
+        }
185
+
186
+        public void NewPage() {
187
+            EndPagePrinter(HandlePrinter);
188
+            StartPagePrinter(HandlePrinter);
189
+        }
190
+    }
191
+}

+ 23 - 0
BulkPrinting/BulkPrinting/Program.cs

@@ -0,0 +1,23 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+using System.Windows.Forms;
6
+
7
+namespace BulkPrinting
8
+{
9
+    static class Program
10
+    {
11
+        /// <summary>
12
+        /// The main entry point for the application.
13
+        /// </summary>
14
+        [STAThread]
15
+        static void Main()
16
+        {
17
+            Globals.HDDSerialNumber = Utility.GetHDDSerial();
18
+            Application.EnableVisualStyles();
19
+            Application.SetCompatibleTextRenderingDefault(false);
20
+            Application.Run(new UserLoginForm());
21
+        }
22
+    }
23
+}

+ 78 - 0
BulkPrinting/BulkPrinting/ProgressDialog.Designer.cs

@@ -0,0 +1,78 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class ProgressDialog
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProgressDialog));
32
+            this.pbrProgress = new System.Windows.Forms.ProgressBar();
33
+            this.lblProgressText = new System.Windows.Forms.Label();
34
+            this.SuspendLayout();
35
+            // 
36
+            // pbrProgress
37
+            // 
38
+            this.pbrProgress.Location = new System.Drawing.Point(12, 79);
39
+            this.pbrProgress.Name = "pbrProgress";
40
+            this.pbrProgress.Size = new System.Drawing.Size(260, 23);
41
+            this.pbrProgress.TabIndex = 0;
42
+            // 
43
+            // lblProgressText
44
+            // 
45
+            this.lblProgressText.BackColor = System.Drawing.Color.Transparent;
46
+            this.lblProgressText.ForeColor = System.Drawing.Color.White;
47
+            this.lblProgressText.Location = new System.Drawing.Point(12, 13);
48
+            this.lblProgressText.Name = "lblProgressText";
49
+            this.lblProgressText.Size = new System.Drawing.Size(260, 63);
50
+            this.lblProgressText.TabIndex = 1;
51
+            this.lblProgressText.Text = "label1";
52
+            this.lblProgressText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
53
+            // 
54
+            // ProgressDialog
55
+            // 
56
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
57
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
58
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
59
+            this.ClientSize = new System.Drawing.Size(284, 116);
60
+            this.ControlBox = false;
61
+            this.Controls.Add(this.lblProgressText);
62
+            this.Controls.Add(this.pbrProgress);
63
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
64
+            this.MaximizeBox = false;
65
+            this.MinimizeBox = false;
66
+            this.Name = "ProgressDialog";
67
+            this.Text = "Please Wait";
68
+            this.Load += new System.EventHandler(this.ProgressDialog_Load);
69
+            this.ResumeLayout(false);
70
+
71
+        }
72
+
73
+        #endregion
74
+
75
+        private System.Windows.Forms.ProgressBar pbrProgress;
76
+        private System.Windows.Forms.Label lblProgressText;
77
+    }
78
+}

+ 51 - 0
BulkPrinting/BulkPrinting/ProgressDialog.cs

@@ -0,0 +1,51 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Threading;
11
+
12
+namespace BulkPrinting
13
+{
14
+    public partial class ProgressDialog : Form
15
+    {
16
+        public ProgressDialog()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        public void UpdateProgressBar(int Percentage)
22
+        {
23
+            if (this.InvokeRequired)
24
+            {
25
+                this.Invoke((Action<int>)UpdateProgressBar, Percentage);
26
+            }
27
+            else
28
+            {
29
+                pbrProgress.Value = Percentage;
30
+                pbrProgress.Refresh();
31
+            }
32
+        }
33
+
34
+        public void UpdateProgressText(string ProgressText) {
35
+            if (this.InvokeRequired)
36
+            {
37
+                this.Invoke((Action<string>)UpdateProgressText, ProgressText);
38
+            }
39
+            else
40
+            {
41
+                lblProgressText.Text = ProgressText;
42
+                lblProgressText.Refresh();
43
+            }
44
+        }
45
+
46
+        private void ProgressDialog_Load(object sender, EventArgs e)
47
+        {
48
+
49
+        }
50
+    }
51
+}

文件差异内容过多而无法显示
+ 6293 - 0
BulkPrinting/BulkPrinting/ProgressDialog.resx


+ 36 - 0
BulkPrinting/BulkPrinting/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// General Information about an assembly is controlled through the following
6
+// set of attributes. Change these attribute values to modify the information
7
+// associated with an assembly.
8
+[assembly: AssemblyTitle("BulkPrinting")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("BulkPrinting")]
13
+[assembly: AssemblyCopyright("Copyright ©  2017")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// Setting ComVisible to false makes the types in this assembly not visible
18
+// to COM components.  If you need to access a type in this assembly from
19
+// COM, set the ComVisible attribute to true on that type.
20
+[assembly: ComVisible(false)]
21
+
22
+// The following GUID is for the ID of the typelib if this project is exposed to COM
23
+[assembly: Guid("17126a58-eaa0-4518-b2bc-58d98581b031")]
24
+
25
+// Version information for an assembly consists of the following four values:
26
+//
27
+//      Major Version
28
+//      Minor Version
29
+//      Build Number
30
+//      Revision
31
+//
32
+// You can specify all the values or you can default the Build and Revision Numbers
33
+// by using the '*' as shown below:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 193 - 0
BulkPrinting/BulkPrinting/Properties/Resources.Designer.cs

@@ -0,0 +1,193 @@
1
+//------------------------------------------------------------------------------
2
+// <auto-generated>
3
+//     This code was generated by a tool.
4
+//     Runtime Version:4.0.30319.42000
5
+//
6
+//     Changes to this file may cause incorrect behavior and will be lost if
7
+//     the code is regenerated.
8
+// </auto-generated>
9
+//------------------------------------------------------------------------------
10
+
11
+namespace BulkPrinting.Properties {
12
+    using System;
13
+    
14
+    
15
+    /// <summary>
16
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
17
+    /// </summary>
18
+    // This class was auto-generated by the StronglyTypedResourceBuilder
19
+    // class via a tool like ResGen or Visual Studio.
20
+    // To add or remove a member, edit your .ResX file then rerun ResGen
21
+    // with the /str option, or rebuild your VS project.
22
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25
+    internal class Resources {
26
+        
27
+        private static global::System.Resources.ResourceManager resourceMan;
28
+        
29
+        private static global::System.Globalization.CultureInfo resourceCulture;
30
+        
31
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32
+        internal Resources() {
33
+        }
34
+        
35
+        /// <summary>
36
+        ///   Returns the cached ResourceManager instance used by this class.
37
+        /// </summary>
38
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39
+        internal static global::System.Resources.ResourceManager ResourceManager {
40
+            get {
41
+                if (object.ReferenceEquals(resourceMan, null)) {
42
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BulkPrinting.Properties.Resources", typeof(Resources).Assembly);
43
+                    resourceMan = temp;
44
+                }
45
+                return resourceMan;
46
+            }
47
+        }
48
+        
49
+        /// <summary>
50
+        ///   Overrides the current thread's CurrentUICulture property for all
51
+        ///   resource lookups using this strongly typed resource class.
52
+        /// </summary>
53
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54
+        internal static global::System.Globalization.CultureInfo Culture {
55
+            get {
56
+                return resourceCulture;
57
+            }
58
+            set {
59
+                resourceCulture = value;
60
+            }
61
+        }
62
+        
63
+        /// <summary>
64
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
65
+        /// </summary>
66
+        internal static System.Drawing.Bitmap Asset101clear {
67
+            get {
68
+                object obj = ResourceManager.GetObject("Asset101clear", resourceCulture);
69
+                return ((System.Drawing.Bitmap)(obj));
70
+            }
71
+        }
72
+        
73
+        /// <summary>
74
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
75
+        /// </summary>
76
+        internal static System.Drawing.Bitmap Asset201clear {
77
+            get {
78
+                object obj = ResourceManager.GetObject("Asset201clear", resourceCulture);
79
+                return ((System.Drawing.Bitmap)(obj));
80
+            }
81
+        }
82
+        
83
+        /// <summary>
84
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
85
+        /// </summary>
86
+        internal static System.Drawing.Bitmap Asset301clear {
87
+            get {
88
+                object obj = ResourceManager.GetObject("Asset301clear", resourceCulture);
89
+                return ((System.Drawing.Bitmap)(obj));
90
+            }
91
+        }
92
+        
93
+        /// <summary>
94
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
95
+        /// </summary>
96
+        internal static System.Drawing.Bitmap Asset401clear {
97
+            get {
98
+                object obj = ResourceManager.GetObject("Asset401clear", resourceCulture);
99
+                return ((System.Drawing.Bitmap)(obj));
100
+            }
101
+        }
102
+        
103
+        /// <summary>
104
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
105
+        /// </summary>
106
+        internal static System.Drawing.Bitmap Asset501clear {
107
+            get {
108
+                object obj = ResourceManager.GetObject("Asset501clear", resourceCulture);
109
+                return ((System.Drawing.Bitmap)(obj));
110
+            }
111
+        }
112
+        
113
+        /// <summary>
114
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
115
+        /// </summary>
116
+        internal static System.Drawing.Bitmap Asset601clear {
117
+            get {
118
+                object obj = ResourceManager.GetObject("Asset601clear", resourceCulture);
119
+                return ((System.Drawing.Bitmap)(obj));
120
+            }
121
+        }
122
+        
123
+        /// <summary>
124
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
125
+        /// </summary>
126
+        internal static System.Drawing.Bitmap Asset701clear {
127
+            get {
128
+                object obj = ResourceManager.GetObject("Asset701clear", resourceCulture);
129
+                return ((System.Drawing.Bitmap)(obj));
130
+            }
131
+        }
132
+        
133
+        /// <summary>
134
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
135
+        /// </summary>
136
+        internal static System.Drawing.Bitmap Asset801clear {
137
+            get {
138
+                object obj = ResourceManager.GetObject("Asset801clear", resourceCulture);
139
+                return ((System.Drawing.Bitmap)(obj));
140
+            }
141
+        }
142
+        
143
+        /// <summary>
144
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
145
+        /// </summary>
146
+        internal static System.Drawing.Bitmap Asset901clear {
147
+            get {
148
+                object obj = ResourceManager.GetObject("Asset901clear", resourceCulture);
149
+                return ((System.Drawing.Bitmap)(obj));
150
+            }
151
+        }
152
+        
153
+        /// <summary>
154
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
155
+        /// </summary>
156
+        internal static System.Drawing.Bitmap r_g_bulk_icon {
157
+            get {
158
+                object obj = ResourceManager.GetObject("r_g_bulk_icon", resourceCulture);
159
+                return ((System.Drawing.Bitmap)(obj));
160
+            }
161
+        }
162
+        
163
+        /// <summary>
164
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
165
+        /// </summary>
166
+        internal static System.Drawing.Bitmap rgroup_bulk_print_app_260x70 {
167
+            get {
168
+                object obj = ResourceManager.GetObject("rgroup_bulk_print_app_260x70", resourceCulture);
169
+                return ((System.Drawing.Bitmap)(obj));
170
+            }
171
+        }
172
+        
173
+        /// <summary>
174
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
175
+        /// </summary>
176
+        internal static System.Drawing.Bitmap whitedown {
177
+            get {
178
+                object obj = ResourceManager.GetObject("whitedown", resourceCulture);
179
+                return ((System.Drawing.Bitmap)(obj));
180
+            }
181
+        }
182
+        
183
+        /// <summary>
184
+        ///   Looks up a localized resource of type System.Drawing.Bitmap.
185
+        /// </summary>
186
+        internal static System.Drawing.Bitmap whiteup {
187
+            get {
188
+                object obj = ResourceManager.GetObject("whiteup", resourceCulture);
189
+                return ((System.Drawing.Bitmap)(obj));
190
+            }
191
+        }
192
+    }
193
+}

+ 160 - 0
BulkPrinting/BulkPrinting/Properties/Resources.resx

@@ -0,0 +1,160 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
121
+  <data name="Asset601clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
122
+    <value>..\Resources\Asset 601 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
123
+  </data>
124
+  <data name="Asset401clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
125
+    <value>..\Resources\Asset 401 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126
+  </data>
127
+  <data name="Asset301clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
128
+    <value>..\Resources\Asset 301 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
129
+  </data>
130
+  <data name="Asset801clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
131
+    <value>..\Resources\Asset 801 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
132
+  </data>
133
+  <data name="Asset501clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
134
+    <value>..\Resources\Asset 501 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
135
+  </data>
136
+  <data name="Asset201clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
137
+    <value>..\Resources\Asset 201 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
138
+  </data>
139
+  <data name="Asset101clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
140
+    <value>..\Resources\Asset 101 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
141
+  </data>
142
+  <data name="Asset701clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
143
+    <value>..\Resources\Asset 701 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
144
+  </data>
145
+  <data name="Asset901clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
146
+    <value>..\Resources\Asset 901 clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
147
+  </data>
148
+  <data name="whitedown" type="System.Resources.ResXFileRef, System.Windows.Forms">
149
+    <value>..\Resources\whitedown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
150
+  </data>
151
+  <data name="whiteup" type="System.Resources.ResXFileRef, System.Windows.Forms">
152
+    <value>..\Resources\whiteup.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
153
+  </data>
154
+  <data name="r_g_bulk_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
155
+    <value>..\Resources\r_g_bulk_icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
156
+  </data>
157
+  <data name="rgroup_bulk_print_app_260x70" type="System.Resources.ResXFileRef, System.Windows.Forms">
158
+    <value>..\Resources\rgroup_bulk_print_app_260x70.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
159
+  </data>
160
+</root>

+ 26 - 0
BulkPrinting/BulkPrinting/Properties/Settings.Designer.cs

@@ -0,0 +1,26 @@
1
+//------------------------------------------------------------------------------
2
+// <auto-generated>
3
+//     This code was generated by a tool.
4
+//     Runtime Version:4.0.30319.42000
5
+//
6
+//     Changes to this file may cause incorrect behavior and will be lost if
7
+//     the code is regenerated.
8
+// </auto-generated>
9
+//------------------------------------------------------------------------------
10
+
11
+namespace BulkPrinting.Properties {
12
+    
13
+    
14
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
16
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17
+        
18
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19
+        
20
+        public static Settings Default {
21
+            get {
22
+                return defaultInstance;
23
+            }
24
+        }
25
+    }
26
+}

+ 7 - 0
BulkPrinting/BulkPrinting/Properties/Settings.settings

@@ -0,0 +1,7 @@
1
+<?xml version='1.0' encoding='utf-8'?>
2
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
3
+  <Profiles>
4
+    <Profile Name="(Default)" />
5
+  </Profiles>
6
+  <Settings />
7
+</SettingsFile>

+ 421 - 0
BulkPrinting/BulkPrinting/ReprintForm.Designer.cs

@@ -0,0 +1,421 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class ReprintForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReprintForm));
32
+            this.lblPrintDescription = new System.Windows.Forms.Label();
33
+            this.label1 = new System.Windows.Forms.Label();
34
+            this.label3 = new System.Windows.Forms.Label();
35
+            this.label4 = new System.Windows.Forms.Label();
36
+            this.label5 = new System.Windows.Forms.Label();
37
+            this.lblBatchOrderDate = new System.Windows.Forms.Label();
38
+            this.lblTotalVouchers = new System.Windows.Forms.Label();
39
+            this.lblFaceValue = new System.Windows.Forms.Label();
40
+            this.lblVoucherType = new System.Windows.Forms.Label();
41
+            this.label6 = new System.Windows.Forms.Label();
42
+            this.lblBatchNumber = new System.Windows.Forms.Label();
43
+            this.btnCancel = new System.Windows.Forms.Button();
44
+            this.btnNext = new System.Windows.Forms.Button();
45
+            this.lblFirstSeqNum = new System.Windows.Forms.Label();
46
+            this.numLastSeqNum = new System.Windows.Forms.NumericUpDown();
47
+            this.numFirstSeqNum = new System.Windows.Forms.NumericUpDown();
48
+            this.lblLastSeqNum = new System.Windows.Forms.Label();
49
+            this.label7 = new System.Windows.Forms.Label();
50
+            this.lblNetwork = new System.Windows.Forms.Label();
51
+            this.label8 = new System.Windows.Forms.Label();
52
+            this.rdoRange = new System.Windows.Forms.RadioButton();
53
+            this.rdoSerial = new System.Windows.Forms.RadioButton();
54
+            this.label9 = new System.Windows.Forms.Label();
55
+            this.txtSerialNum = new System.Windows.Forms.TextBox();
56
+            this.label10 = new System.Windows.Forms.Label();
57
+            this.label11 = new System.Windows.Forms.Label();
58
+            this.lblMinSeqNo = new System.Windows.Forms.Label();
59
+            this.lblMaxSeqNo = new System.Windows.Forms.Label();
60
+            ((System.ComponentModel.ISupportInitialize)(this.numLastSeqNum)).BeginInit();
61
+            ((System.ComponentModel.ISupportInitialize)(this.numFirstSeqNum)).BeginInit();
62
+            this.SuspendLayout();
63
+            // 
64
+            // lblPrintDescription
65
+            // 
66
+            this.lblPrintDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
67
+            this.lblPrintDescription.ForeColor = System.Drawing.Color.White;
68
+            this.lblPrintDescription.Location = new System.Drawing.Point(13, 13);
69
+            this.lblPrintDescription.Name = "lblPrintDescription";
70
+            this.lblPrintDescription.Size = new System.Drawing.Size(259, 23);
71
+            this.lblPrintDescription.TabIndex = 1;
72
+            this.lblPrintDescription.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
73
+            // 
74
+            // label1
75
+            // 
76
+            this.label1.AutoSize = true;
77
+            this.label1.ForeColor = System.Drawing.Color.White;
78
+            this.label1.Location = new System.Drawing.Point(88, 96);
79
+            this.label1.Name = "label1";
80
+            this.label1.Size = new System.Drawing.Size(93, 13);
81
+            this.label1.TabIndex = 2;
82
+            this.label1.Text = "Batch Order Date:";
83
+            // 
84
+            // label3
85
+            // 
86
+            this.label3.AutoSize = true;
87
+            this.label3.Location = new System.Drawing.Point(57, 109);
88
+            this.label3.Name = "label3";
89
+            this.label3.Size = new System.Drawing.Size(124, 13);
90
+            this.label3.TabIndex = 4;
91
+            this.label3.Text = "Total Vouchers in Batch:";
92
+            // 
93
+            // label4
94
+            // 
95
+            this.label4.AutoSize = true;
96
+            this.label4.ForeColor = System.Drawing.Color.White;
97
+            this.label4.Location = new System.Drawing.Point(117, 124);
98
+            this.label4.Name = "label4";
99
+            this.label4.Size = new System.Drawing.Size(64, 13);
100
+            this.label4.TabIndex = 5;
101
+            this.label4.Text = "Face Value:";
102
+            // 
103
+            // label5
104
+            // 
105
+            this.label5.AutoSize = true;
106
+            this.label5.ForeColor = System.Drawing.Color.White;
107
+            this.label5.Location = new System.Drawing.Point(104, 139);
108
+            this.label5.Name = "label5";
109
+            this.label5.Size = new System.Drawing.Size(77, 13);
110
+            this.label5.TabIndex = 6;
111
+            this.label5.Text = "Voucher Type:";
112
+            // 
113
+            // lblBatchOrderDate
114
+            // 
115
+            this.lblBatchOrderDate.AutoSize = true;
116
+            this.lblBatchOrderDate.ForeColor = System.Drawing.Color.White;
117
+            this.lblBatchOrderDate.Location = new System.Drawing.Point(187, 96);
118
+            this.lblBatchOrderDate.Name = "lblBatchOrderDate";
119
+            this.lblBatchOrderDate.Size = new System.Drawing.Size(0, 13);
120
+            this.lblBatchOrderDate.TabIndex = 7;
121
+            // 
122
+            // lblTotalVouchers
123
+            // 
124
+            this.lblTotalVouchers.AutoSize = true;
125
+            this.lblTotalVouchers.ForeColor = System.Drawing.Color.White;
126
+            this.lblTotalVouchers.Location = new System.Drawing.Point(187, 109);
127
+            this.lblTotalVouchers.Name = "lblTotalVouchers";
128
+            this.lblTotalVouchers.Size = new System.Drawing.Size(0, 13);
129
+            this.lblTotalVouchers.TabIndex = 7;
130
+            // 
131
+            // lblFaceValue
132
+            // 
133
+            this.lblFaceValue.AutoSize = true;
134
+            this.lblFaceValue.ForeColor = System.Drawing.Color.White;
135
+            this.lblFaceValue.Location = new System.Drawing.Point(187, 124);
136
+            this.lblFaceValue.Name = "lblFaceValue";
137
+            this.lblFaceValue.Size = new System.Drawing.Size(0, 13);
138
+            this.lblFaceValue.TabIndex = 7;
139
+            // 
140
+            // lblVoucherType
141
+            // 
142
+            this.lblVoucherType.AutoSize = true;
143
+            this.lblVoucherType.ForeColor = System.Drawing.Color.White;
144
+            this.lblVoucherType.Location = new System.Drawing.Point(187, 139);
145
+            this.lblVoucherType.Name = "lblVoucherType";
146
+            this.lblVoucherType.Size = new System.Drawing.Size(0, 13);
147
+            this.lblVoucherType.TabIndex = 7;
148
+            // 
149
+            // label6
150
+            // 
151
+            this.label6.AutoSize = true;
152
+            this.label6.ForeColor = System.Drawing.Color.White;
153
+            this.label6.Location = new System.Drawing.Point(103, 81);
154
+            this.label6.Name = "label6";
155
+            this.label6.Size = new System.Drawing.Size(78, 13);
156
+            this.label6.TabIndex = 10;
157
+            this.label6.Text = "Batch Number:";
158
+            // 
159
+            // lblBatchNumber
160
+            // 
161
+            this.lblBatchNumber.AutoSize = true;
162
+            this.lblBatchNumber.ForeColor = System.Drawing.Color.White;
163
+            this.lblBatchNumber.Location = new System.Drawing.Point(187, 81);
164
+            this.lblBatchNumber.Name = "lblBatchNumber";
165
+            this.lblBatchNumber.Size = new System.Drawing.Size(0, 13);
166
+            this.lblBatchNumber.TabIndex = 11;
167
+            // 
168
+            // btnCancel
169
+            // 
170
+            this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
171
+            this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
172
+            this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
173
+            this.btnCancel.ForeColor = System.Drawing.Color.White;
174
+            this.btnCancel.Location = new System.Drawing.Point(145, 312);
175
+            this.btnCancel.Name = "btnCancel";
176
+            this.btnCancel.Size = new System.Drawing.Size(75, 23);
177
+            this.btnCancel.TabIndex = 12;
178
+            this.btnCancel.Text = "Cancel";
179
+            this.btnCancel.UseVisualStyleBackColor = false;
180
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
181
+            // 
182
+            // btnNext
183
+            // 
184
+            this.btnNext.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
185
+            this.btnNext.FlatAppearance.BorderColor = System.Drawing.Color.Black;
186
+            this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
187
+            this.btnNext.ForeColor = System.Drawing.Color.White;
188
+            this.btnNext.Location = new System.Drawing.Point(226, 312);
189
+            this.btnNext.Name = "btnNext";
190
+            this.btnNext.Size = new System.Drawing.Size(75, 23);
191
+            this.btnNext.TabIndex = 13;
192
+            this.btnNext.Text = "Next";
193
+            this.btnNext.UseVisualStyleBackColor = false;
194
+            this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
195
+            // 
196
+            // lblFirstSeqNum
197
+            // 
198
+            this.lblFirstSeqNum.AutoSize = true;
199
+            this.lblFirstSeqNum.ForeColor = System.Drawing.Color.White;
200
+            this.lblFirstSeqNum.Location = new System.Drawing.Point(42, 229);
201
+            this.lblFirstSeqNum.Name = "lblFirstSeqNum";
202
+            this.lblFirstSeqNum.Size = new System.Drawing.Size(158, 13);
203
+            this.lblFirstSeqNum.TabIndex = 17;
204
+            this.lblFirstSeqNum.Text = "To Voucher Sequence Number:";
205
+            // 
206
+            // numLastSeqNum
207
+            // 
208
+            this.numLastSeqNum.Location = new System.Drawing.Point(206, 227);
209
+            this.numLastSeqNum.Name = "numLastSeqNum";
210
+            this.numLastSeqNum.Size = new System.Drawing.Size(95, 20);
211
+            this.numLastSeqNum.TabIndex = 18;
212
+            // 
213
+            // numFirstSeqNum
214
+            // 
215
+            this.numFirstSeqNum.Location = new System.Drawing.Point(206, 204);
216
+            this.numFirstSeqNum.Name = "numFirstSeqNum";
217
+            this.numFirstSeqNum.Size = new System.Drawing.Size(95, 20);
218
+            this.numFirstSeqNum.TabIndex = 18;
219
+            // 
220
+            // lblLastSeqNum
221
+            // 
222
+            this.lblLastSeqNum.AutoSize = true;
223
+            this.lblLastSeqNum.ForeColor = System.Drawing.Color.White;
224
+            this.lblLastSeqNum.Location = new System.Drawing.Point(33, 206);
225
+            this.lblLastSeqNum.Name = "lblLastSeqNum";
226
+            this.lblLastSeqNum.Size = new System.Drawing.Size(168, 13);
227
+            this.lblLastSeqNum.TabIndex = 17;
228
+            this.lblLastSeqNum.Text = "From Voucher Sequence Number:";
229
+            // 
230
+            // label7
231
+            // 
232
+            this.label7.AutoSize = true;
233
+            this.label7.ForeColor = System.Drawing.Color.White;
234
+            this.label7.Location = new System.Drawing.Point(131, 154);
235
+            this.label7.Name = "label7";
236
+            this.label7.Size = new System.Drawing.Size(50, 13);
237
+            this.label7.TabIndex = 6;
238
+            this.label7.Text = "Network:";
239
+            // 
240
+            // lblNetwork
241
+            // 
242
+            this.lblNetwork.AutoSize = true;
243
+            this.lblNetwork.ForeColor = System.Drawing.Color.White;
244
+            this.lblNetwork.Location = new System.Drawing.Point(187, 154);
245
+            this.lblNetwork.Name = "lblNetwork";
246
+            this.lblNetwork.Size = new System.Drawing.Size(0, 13);
247
+            this.lblNetwork.TabIndex = 7;
248
+            // 
249
+            // label8
250
+            // 
251
+            this.label8.AutoSize = true;
252
+            this.label8.ForeColor = System.Drawing.Color.White;
253
+            this.label8.Location = new System.Drawing.Point(12, 13);
254
+            this.label8.Name = "label8";
255
+            this.label8.Size = new System.Drawing.Size(291, 39);
256
+            this.label8.TabIndex = 20;
257
+            this.label8.Text = "Reprinting is only available for previously printed vouchers. \r\nSelect either a r" +
258
+    "ange of vouchers from the currently selected\r\nbatch, or enter a single voucher s" +
259
+    "erial number for reprinting.";
260
+            // 
261
+            // rdoRange
262
+            // 
263
+            this.rdoRange.AutoSize = true;
264
+            this.rdoRange.Checked = true;
265
+            this.rdoRange.ForeColor = System.Drawing.Color.White;
266
+            this.rdoRange.Location = new System.Drawing.Point(30, 55);
267
+            this.rdoRange.Name = "rdoRange";
268
+            this.rdoRange.Size = new System.Drawing.Size(175, 17);
269
+            this.rdoRange.TabIndex = 21;
270
+            this.rdoRange.TabStop = true;
271
+            this.rdoRange.Text = "Choose a range from this batch:";
272
+            this.rdoRange.UseVisualStyleBackColor = true;
273
+            // 
274
+            // rdoSerial
275
+            // 
276
+            this.rdoSerial.AutoSize = true;
277
+            this.rdoSerial.ForeColor = System.Drawing.Color.White;
278
+            this.rdoSerial.Location = new System.Drawing.Point(30, 253);
279
+            this.rdoSerial.Name = "rdoSerial";
280
+            this.rdoSerial.Size = new System.Drawing.Size(247, 17);
281
+            this.rdoSerial.TabIndex = 21;
282
+            this.rdoSerial.Text = "Choose an individual voucher by serial number:";
283
+            this.rdoSerial.UseVisualStyleBackColor = true;
284
+            // 
285
+            // label9
286
+            // 
287
+            this.label9.AutoSize = true;
288
+            this.label9.ForeColor = System.Drawing.Color.White;
289
+            this.label9.Location = new System.Drawing.Point(73, 279);
290
+            this.label9.Name = "label9";
291
+            this.label9.Size = new System.Drawing.Size(39, 13);
292
+            this.label9.TabIndex = 22;
293
+            this.label9.Text = "Serial: ";
294
+            // 
295
+            // txtSerialNum
296
+            // 
297
+            this.txtSerialNum.Location = new System.Drawing.Point(118, 276);
298
+            this.txtSerialNum.Name = "txtSerialNum";
299
+            this.txtSerialNum.Size = new System.Drawing.Size(183, 20);
300
+            this.txtSerialNum.TabIndex = 23;
301
+            this.txtSerialNum.TextChanged += new System.EventHandler(this.txtSerialNum_TextChanged);
302
+            // 
303
+            // label10
304
+            // 
305
+            this.label10.AutoSize = true;
306
+            this.label10.ForeColor = System.Drawing.Color.White;
307
+            this.label10.Location = new System.Drawing.Point(113, 167);
308
+            this.label10.Name = "label10";
309
+            this.label10.Size = new System.Drawing.Size(67, 13);
310
+            this.label10.TabIndex = 6;
311
+            this.label10.Text = "Range Start:";
312
+            // 
313
+            // label11
314
+            // 
315
+            this.label11.AutoSize = true;
316
+            this.label11.ForeColor = System.Drawing.Color.White;
317
+            this.label11.Location = new System.Drawing.Point(116, 180);
318
+            this.label11.Name = "label11";
319
+            this.label11.Size = new System.Drawing.Size(64, 13);
320
+            this.label11.TabIndex = 6;
321
+            this.label11.Text = "Range End:";
322
+            // 
323
+            // lblMinSeqNo
324
+            // 
325
+            this.lblMinSeqNo.AutoSize = true;
326
+            this.lblMinSeqNo.ForeColor = System.Drawing.Color.White;
327
+            this.lblMinSeqNo.Location = new System.Drawing.Point(186, 167);
328
+            this.lblMinSeqNo.Name = "lblMinSeqNo";
329
+            this.lblMinSeqNo.Size = new System.Drawing.Size(0, 13);
330
+            this.lblMinSeqNo.TabIndex = 7;
331
+            // 
332
+            // lblMaxSeqNo
333
+            // 
334
+            this.lblMaxSeqNo.AutoSize = true;
335
+            this.lblMaxSeqNo.ForeColor = System.Drawing.Color.White;
336
+            this.lblMaxSeqNo.Location = new System.Drawing.Point(186, 180);
337
+            this.lblMaxSeqNo.Name = "lblMaxSeqNo";
338
+            this.lblMaxSeqNo.Size = new System.Drawing.Size(0, 13);
339
+            this.lblMaxSeqNo.TabIndex = 7;
340
+            // 
341
+            // ReprintForm
342
+            // 
343
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
344
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
345
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
346
+            this.ClientSize = new System.Drawing.Size(313, 347);
347
+            this.ControlBox = false;
348
+            this.Controls.Add(this.txtSerialNum);
349
+            this.Controls.Add(this.label9);
350
+            this.Controls.Add(this.rdoSerial);
351
+            this.Controls.Add(this.rdoRange);
352
+            this.Controls.Add(this.label8);
353
+            this.Controls.Add(this.numFirstSeqNum);
354
+            this.Controls.Add(this.numLastSeqNum);
355
+            this.Controls.Add(this.lblLastSeqNum);
356
+            this.Controls.Add(this.lblFirstSeqNum);
357
+            this.Controls.Add(this.btnNext);
358
+            this.Controls.Add(this.btnCancel);
359
+            this.Controls.Add(this.lblBatchNumber);
360
+            this.Controls.Add(this.label6);
361
+            this.Controls.Add(this.lblMaxSeqNo);
362
+            this.Controls.Add(this.lblMinSeqNo);
363
+            this.Controls.Add(this.lblNetwork);
364
+            this.Controls.Add(this.lblVoucherType);
365
+            this.Controls.Add(this.lblFaceValue);
366
+            this.Controls.Add(this.lblTotalVouchers);
367
+            this.Controls.Add(this.lblBatchOrderDate);
368
+            this.Controls.Add(this.label11);
369
+            this.Controls.Add(this.label10);
370
+            this.Controls.Add(this.label7);
371
+            this.Controls.Add(this.label5);
372
+            this.Controls.Add(this.label4);
373
+            this.Controls.Add(this.label3);
374
+            this.Controls.Add(this.label1);
375
+            this.Controls.Add(this.lblPrintDescription);
376
+            this.ForeColor = System.Drawing.Color.White;
377
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
378
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
379
+            this.MaximizeBox = false;
380
+            this.MinimizeBox = false;
381
+            this.Name = "ReprintForm";
382
+            this.Text = "Reprint Vouchers";
383
+            this.Load += new System.EventHandler(this.ReprintForm_Load);
384
+            ((System.ComponentModel.ISupportInitialize)(this.numLastSeqNum)).EndInit();
385
+            ((System.ComponentModel.ISupportInitialize)(this.numFirstSeqNum)).EndInit();
386
+            this.ResumeLayout(false);
387
+            this.PerformLayout();
388
+
389
+        }
390
+
391
+        #endregion
392
+        private System.Windows.Forms.Label lblPrintDescription;
393
+        private System.Windows.Forms.Label label1;
394
+        private System.Windows.Forms.Label label3;
395
+        private System.Windows.Forms.Label label4;
396
+        private System.Windows.Forms.Label label5;
397
+        private System.Windows.Forms.Label lblBatchOrderDate;
398
+        private System.Windows.Forms.Label lblTotalVouchers;
399
+        private System.Windows.Forms.Label lblFaceValue;
400
+        private System.Windows.Forms.Label lblVoucherType;
401
+        private System.Windows.Forms.Label label6;
402
+        private System.Windows.Forms.Label lblBatchNumber;
403
+        private System.Windows.Forms.Button btnCancel;
404
+        private System.Windows.Forms.Button btnNext;
405
+        private System.Windows.Forms.Label lblFirstSeqNum;
406
+        private System.Windows.Forms.NumericUpDown numLastSeqNum;
407
+        private System.Windows.Forms.NumericUpDown numFirstSeqNum;
408
+        private System.Windows.Forms.Label lblLastSeqNum;
409
+        private System.Windows.Forms.Label label7;
410
+        private System.Windows.Forms.Label lblNetwork;
411
+        private System.Windows.Forms.Label label8;
412
+        private System.Windows.Forms.RadioButton rdoRange;
413
+        private System.Windows.Forms.RadioButton rdoSerial;
414
+        private System.Windows.Forms.Label label9;
415
+        private System.Windows.Forms.TextBox txtSerialNum;
416
+        private System.Windows.Forms.Label label10;
417
+        private System.Windows.Forms.Label label11;
418
+        private System.Windows.Forms.Label lblMinSeqNo;
419
+        private System.Windows.Forms.Label lblMaxSeqNo;
420
+    }
421
+}

+ 171 - 0
BulkPrinting/BulkPrinting/ReprintForm.cs

@@ -0,0 +1,171 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Data.SQLite;
11
+
12
+namespace BulkPrinting
13
+{
14
+    public partial class ReprintForm : Form
15
+    {
16
+        public ReprintForm()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        public string PrintDescription;
22
+        public DateTime BatchOrderDate;
23
+        public int UnprintedVouchers;
24
+        public int TotalVouchers;
25
+        public string FaceValue;
26
+        public string VoucherTypeName;
27
+        public string NetworkName;
28
+        public int BatchID;
29
+        private Boolean CanReprintThisSession;
30
+        private int MinSeqNo;
31
+        private int MaxSeqNo;
32
+
33
+        private void ReprintForm_Load(object sender, EventArgs e)
34
+        {
35
+            CanReprintThisSession =
36
+                ((Globals.SessionMode == SessionModes.Online &&
37
+                    Utility.CheckUserAccess(Utility.UserPermissions.CanReprintOnline)) ||
38
+                (Globals.SessionMode == SessionModes.Offline &&
39
+                    Utility.CheckUserAccess(Utility.UserPermissions.CanReprintOffline)));
40
+            lblPrintDescription.Text = PrintDescription;
41
+            lblBatchNumber.Text = BatchID.ToString();
42
+            lblBatchOrderDate.Text = BatchOrderDate.Date.ToString("dd/MM/yyyy");
43
+            lblTotalVouchers.Text = TotalVouchers.ToString();
44
+            lblFaceValue.Text = FaceValue;
45
+            lblVoucherType.Text = VoucherTypeName;
46
+            lblNetwork.Text = NetworkName;
47
+            SQLiteCommand Command = new SQLiteCommand("SELECT MIN(v.SequenceNumber), MAX(v.SequenceNumber) FROM Voucher v LEFT JOIN Logs l ON v.Id = l.VoucherId AND l.EventType = @eventtype WHERE l.VoucherId IS NOT NULL AND v.BatchId=@batchid AND Retry=0", Globals.DBConnection);
48
+            Command.Parameters.Add(new SQLiteParameter("@batchid", BatchID));
49
+            Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
50
+            SQLiteDataReader read = Command.ExecuteReader();
51
+            read.Read();
52
+            MinSeqNo = int.Parse(read.GetValue(0).ToString());
53
+            MaxSeqNo = int.Parse(read.GetValue(1).ToString());
54
+            numFirstSeqNum.Minimum = MinSeqNo;
55
+            numFirstSeqNum.Maximum = MaxSeqNo;
56
+            numLastSeqNum.Minimum = MinSeqNo;
57
+            numLastSeqNum.Maximum = MaxSeqNo;
58
+
59
+            lblMinSeqNo.Text = MinSeqNo.ToString();
60
+            lblMaxSeqNo.Text = MaxSeqNo.ToString();
61
+        }
62
+
63
+        private void btnCancel_Click(object sender, EventArgs e)
64
+        {
65
+            Globals.OpenBatches.Remove(BatchID);
66
+            this.Close();
67
+        }
68
+
69
+        private void btnNext_Click(object sender, EventArgs e)
70
+        {
71
+            int SelectedRangeStart = 0;
72
+            int SelectedRangeEnd = 0;
73
+            string Sql;
74
+            SQLiteCommand Command;
75
+
76
+            decimal VoucherCount;
77
+
78
+            if (rdoRange.Checked)
79
+            {
80
+                if (numFirstSeqNum.Value < MinSeqNo || numLastSeqNum.Value > MaxSeqNo)
81
+                {
82
+                    MessageBox.Show(String.Format("Valid sequence numbers are from {0} to {1}", MinSeqNo.ToString(), MaxSeqNo.ToString()), "Invalid print value", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
83
+                    return;
84
+                }
85
+
86
+                if (numFirstSeqNum.Value > numLastSeqNum.Value)
87
+                {
88
+                    MessageBox.Show("The first sequence number in the range must be less than or equal to the last.", "Invalid range", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
89
+                    return;
90
+                }
91
+                if (numLastSeqNum.Value > TotalVouchers)
92
+                {
93
+                    MessageBox.Show("You have a final sequence number higher than the available vouchers to print. Please reduce the last sequence number to equal to or below the total number of vouchers.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
94
+                    return;
95
+                }
96
+                SelectedRangeStart = (int)numFirstSeqNum.Value;
97
+                SelectedRangeEnd = (int)numLastSeqNum.Value;
98
+            }
99
+            else if (rdoSerial.Checked) {
100
+                Sql = "SELECT Count(*) FROM Logs l left join Voucher v on l.VoucherId=v.id WHERE v.Serial=@serialnum and l.EventType=@eventtype and Retry=0";
101
+                Command = new SQLiteCommand(Sql, Globals.DBConnection);
102
+                Command.Parameters.Add(new SQLiteParameter("@serialnum", txtSerialNum.Text));
103
+                Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
104
+                int PrintCount = int.Parse(Command.ExecuteScalar().ToString());
105
+                if (PrintCount == 0) {
106
+                    MessageBox.Show("No voucher with that serial number was found to have been printed. Please provide a previously printed voucher number or use the 'Print' function to print new vouchers.", "Cannot find printed voucher", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
107
+                    return;
108
+                }
109
+            }
110
+            Sql = "SELECT FaceValue FROM Batch WHERE Id=@id";
111
+            Command = new SQLiteCommand(Sql, Globals.DBConnection);
112
+            Command.Parameters.Add(new SQLiteParameter("@id", BatchID));
113
+
114
+            VoucherCount = SelectedRangeEnd - SelectedRangeStart + 1;
115
+            decimal VoucherFaceValue = (decimal)Command.ExecuteScalar();
116
+            int UnprintedVouchersInRange = Utility.GetNumberOfUnprintedVouchersInRange((int)numFirstSeqNum.Value, (int)numLastSeqNum.Value, BatchID);
117
+
118
+            decimal PrintedVoucherValue = (VoucherCount - UnprintedVouchersInRange) * VoucherFaceValue;
119
+            decimal UnprintedVoucherValue = UnprintedVouchersInRange * VoucherFaceValue;
120
+
121
+            if (Globals.SessionMode == SessionModes.Online)
122
+            {
123
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.OnlinePrint, UnprintedVoucherValue))
124
+                {
125
+                    MessageBox.Show("You have selected more vouchers than your permissions allow you to print today.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
126
+                    return;
127
+                }
128
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.OnlineReprint, PrintedVoucherValue))
129
+                {
130
+                    MessageBox.Show("You have selected more previously printed vouchers than your permissions allow you to reprint today.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
131
+                    return;
132
+                }
133
+            }
134
+            if (Globals.SessionMode == SessionModes.Offline)
135
+            {
136
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.OfflinePrint, UnprintedVoucherValue))
137
+                {
138
+                    MessageBox.Show("You have selected more vouchers than your permissions allow you to print today.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
139
+                    return;
140
+                }
141
+                if (!Utility.IsValueWithinRemainingUserLimit(UserLimits.UserLimitTypes.OfflineReprint, PrintedVoucherValue))
142
+                {
143
+                    MessageBox.Show("You have selected more previously printed vouchers than your permissions allow you to reprint today.", "Cannot print that many vouchers", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
144
+                    return;
145
+                }
146
+            }
147
+
148
+            if (Globals.MaxPrinter.ChoosePrinter())
149
+            {
150
+                PrintAlignmentDialog printdialog = new PrintAlignmentDialog();
151
+                printdialog.PrintDescription = PrintDescription;
152
+                printdialog.BatchID = BatchID;
153
+                printdialog.BatchOrderDate = BatchOrderDate;
154
+                printdialog.FaceValue = FaceValue;
155
+                printdialog.VoucherTypeName = VoucherTypeName;
156
+                printdialog.NetworkName = NetworkName;
157
+                printdialog.NumVouchers = null;
158
+                printdialog.FirstSeqNo = (int)numFirstSeqNum.Value;
159
+                printdialog.LastSeqNo = (int)numLastSeqNum.Value;
160
+                printdialog.Show();
161
+                this.Close();
162
+            }
163
+
164
+        }
165
+
166
+        private void txtSerialNum_TextChanged(object sender, EventArgs e)
167
+        {
168
+
169
+        }
170
+    }
171
+}

文件差异内容过多而无法显示
+ 6296 - 0
BulkPrinting/BulkPrinting/ReprintForm.resx


二进制
BulkPrinting/BulkPrinting/Resources/Asset 101 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 201 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 301 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 401 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 501 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 601 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 701 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 701.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 801 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/Asset 901 clear.png


二进制
BulkPrinting/BulkPrinting/Resources/r_g_bulk_icon.png


二进制
BulkPrinting/BulkPrinting/Resources/rgroup_bulk_print_app_260x70.jpg


二进制
BulkPrinting/BulkPrinting/Resources/whitedown.png


二进制
BulkPrinting/BulkPrinting/Resources/whiteup.png


二进制
BulkPrinting/BulkPrinting/SQLite.Interop.dll


+ 246 - 0
BulkPrinting/BulkPrinting/UserLoginForm.Designer.cs

@@ -0,0 +1,246 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class UserLoginForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserLoginForm));
32
+            this.txtUsername = new System.Windows.Forms.TextBox();
33
+            this.txtUserID = new System.Windows.Forms.TextBox();
34
+            this.txtPassword = new System.Windows.Forms.TextBox();
35
+            this.btnLogin = new System.Windows.Forms.Button();
36
+            this.label1 = new System.Windows.Forms.Label();
37
+            this.label2 = new System.Windows.Forms.Label();
38
+            this.label3 = new System.Windows.Forms.Label();
39
+            this.txtVendorID = new System.Windows.Forms.TextBox();
40
+            this.label4 = new System.Windows.Forms.Label();
41
+            this.label5 = new System.Windows.Forms.Label();
42
+            this.lblHDDSerial = new System.Windows.Forms.Label();
43
+            this.chkOffline = new System.Windows.Forms.CheckBox();
44
+            this.chkRemember = new System.Windows.Forms.CheckBox();
45
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
46
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
47
+            this.SuspendLayout();
48
+            // 
49
+            // txtUsername
50
+            // 
51
+            this.txtUsername.Location = new System.Drawing.Point(80, 86);
52
+            this.txtUsername.Name = "txtUsername";
53
+            this.txtUsername.Size = new System.Drawing.Size(192, 20);
54
+            this.txtUsername.TabIndex = 0;
55
+            // 
56
+            // txtUserID
57
+            // 
58
+            this.txtUserID.Location = new System.Drawing.Point(80, 112);
59
+            this.txtUserID.Name = "txtUserID";
60
+            this.txtUserID.Size = new System.Drawing.Size(192, 20);
61
+            this.txtUserID.TabIndex = 1;
62
+            // 
63
+            // txtPassword
64
+            // 
65
+            this.txtPassword.Location = new System.Drawing.Point(80, 138);
66
+            this.txtPassword.Name = "txtPassword";
67
+            this.txtPassword.PasswordChar = '*';
68
+            this.txtPassword.Size = new System.Drawing.Size(192, 20);
69
+            this.txtPassword.TabIndex = 2;
70
+            // 
71
+            // btnLogin
72
+            // 
73
+            this.btnLogin.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
74
+            this.btnLogin.FlatAppearance.BorderColor = System.Drawing.Color.Black;
75
+            this.btnLogin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
76
+            this.btnLogin.ForeColor = System.Drawing.Color.White;
77
+            this.btnLogin.Location = new System.Drawing.Point(12, 220);
78
+            this.btnLogin.Name = "btnLogin";
79
+            this.btnLogin.Size = new System.Drawing.Size(75, 23);
80
+            this.btnLogin.TabIndex = 6;
81
+            this.btnLogin.Text = "Login";
82
+            this.btnLogin.UseVisualStyleBackColor = false;
83
+            this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
84
+            // 
85
+            // label1
86
+            // 
87
+            this.label1.AutoSize = true;
88
+            this.label1.ForeColor = System.Drawing.Color.White;
89
+            this.label1.Location = new System.Drawing.Point(13, 86);
90
+            this.label1.Name = "label1";
91
+            this.label1.Size = new System.Drawing.Size(55, 13);
92
+            this.label1.TabIndex = 5;
93
+            this.label1.Text = "Username";
94
+            this.label1.Click += new System.EventHandler(this.label1_Click);
95
+            // 
96
+            // label2
97
+            // 
98
+            this.label2.AutoSize = true;
99
+            this.label2.ForeColor = System.Drawing.Color.White;
100
+            this.label2.Location = new System.Drawing.Point(12, 112);
101
+            this.label2.Name = "label2";
102
+            this.label2.Size = new System.Drawing.Size(43, 13);
103
+            this.label2.TabIndex = 6;
104
+            this.label2.Text = "User ID";
105
+            this.label2.Click += new System.EventHandler(this.label2_Click);
106
+            // 
107
+            // label3
108
+            // 
109
+            this.label3.AutoSize = true;
110
+            this.label3.ForeColor = System.Drawing.Color.White;
111
+            this.label3.Location = new System.Drawing.Point(12, 138);
112
+            this.label3.Name = "label3";
113
+            this.label3.Size = new System.Drawing.Size(53, 13);
114
+            this.label3.TabIndex = 7;
115
+            this.label3.Text = "Password";
116
+            this.label3.Click += new System.EventHandler(this.label3_Click);
117
+            // 
118
+            // txtVendorID
119
+            // 
120
+            this.txtVendorID.Location = new System.Drawing.Point(80, 165);
121
+            this.txtVendorID.Name = "txtVendorID";
122
+            this.txtVendorID.Size = new System.Drawing.Size(192, 20);
123
+            this.txtVendorID.TabIndex = 3;
124
+            this.txtVendorID.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtVendorID_KeyPress);
125
+            // 
126
+            // label4
127
+            // 
128
+            this.label4.AutoSize = true;
129
+            this.label4.ForeColor = System.Drawing.Color.White;
130
+            this.label4.Location = new System.Drawing.Point(12, 165);
131
+            this.label4.Name = "label4";
132
+            this.label4.Size = new System.Drawing.Size(55, 13);
133
+            this.label4.TabIndex = 9;
134
+            this.label4.Text = "Vendor ID";
135
+            this.label4.Click += new System.EventHandler(this.label4_Click);
136
+            // 
137
+            // label5
138
+            // 
139
+            this.label5.AutoSize = true;
140
+            this.label5.ForeColor = System.Drawing.Color.White;
141
+            this.label5.Location = new System.Drawing.Point(12, 195);
142
+            this.label5.Name = "label5";
143
+            this.label5.Size = new System.Drawing.Size(62, 13);
144
+            this.label5.TabIndex = 10;
145
+            this.label5.Text = "Vendor Key";
146
+            this.label5.Click += new System.EventHandler(this.label5_Click);
147
+            // 
148
+            // lblHDDSerial
149
+            // 
150
+            this.lblHDDSerial.AutoSize = true;
151
+            this.lblHDDSerial.Location = new System.Drawing.Point(81, 195);
152
+            this.lblHDDSerial.Name = "lblHDDSerial";
153
+            this.lblHDDSerial.Size = new System.Drawing.Size(0, 13);
154
+            this.lblHDDSerial.TabIndex = 11;
155
+            // 
156
+            // chkOffline
157
+            // 
158
+            this.chkOffline.AutoSize = true;
159
+            this.chkOffline.ForeColor = System.Drawing.Color.White;
160
+            this.chkOffline.Location = new System.Drawing.Point(99, 224);
161
+            this.chkOffline.Name = "chkOffline";
162
+            this.chkOffline.Size = new System.Drawing.Size(56, 17);
163
+            this.chkOffline.TabIndex = 5;
164
+            this.chkOffline.Text = "Offline";
165
+            this.chkOffline.UseVisualStyleBackColor = true;
166
+            this.chkOffline.CheckedChanged += new System.EventHandler(this.chkOffline_CheckedChanged);
167
+            // 
168
+            // chkRemember
169
+            // 
170
+            this.chkRemember.AutoSize = true;
171
+            this.chkRemember.ForeColor = System.Drawing.Color.White;
172
+            this.chkRemember.Location = new System.Drawing.Point(162, 223);
173
+            this.chkRemember.Name = "chkRemember";
174
+            this.chkRemember.Size = new System.Drawing.Size(95, 17);
175
+            this.chkRemember.TabIndex = 4;
176
+            this.chkRemember.Text = "Remember Me";
177
+            this.chkRemember.UseVisualStyleBackColor = true;
178
+            this.chkRemember.CheckedChanged += new System.EventHandler(this.chkRemember_CheckedChanged);
179
+            // 
180
+            // pictureBox1
181
+            // 
182
+            this.pictureBox1.Image = global::BulkPrinting.Properties.Resources.rgroup_bulk_print_app_260x70;
183
+            this.pictureBox1.Location = new System.Drawing.Point(12, 6);
184
+            this.pictureBox1.Name = "pictureBox1";
185
+            this.pictureBox1.Size = new System.Drawing.Size(260, 71);
186
+            this.pictureBox1.TabIndex = 12;
187
+            this.pictureBox1.TabStop = false;
188
+            this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
189
+            // 
190
+            // UserLoginForm
191
+            // 
192
+            this.AcceptButton = this.btnLogin;
193
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
194
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
195
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
196
+            this.ClientSize = new System.Drawing.Size(284, 253);
197
+            this.Controls.Add(this.pictureBox1);
198
+            this.Controls.Add(this.chkRemember);
199
+            this.Controls.Add(this.chkOffline);
200
+            this.Controls.Add(this.lblHDDSerial);
201
+            this.Controls.Add(this.label5);
202
+            this.Controls.Add(this.label4);
203
+            this.Controls.Add(this.txtVendorID);
204
+            this.Controls.Add(this.label3);
205
+            this.Controls.Add(this.label2);
206
+            this.Controls.Add(this.label1);
207
+            this.Controls.Add(this.btnLogin);
208
+            this.Controls.Add(this.txtPassword);
209
+            this.Controls.Add(this.txtUserID);
210
+            this.Controls.Add(this.txtUsername);
211
+            this.ForeColor = System.Drawing.Color.White;
212
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
213
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
214
+            this.MaximizeBox = false;
215
+            this.MaximumSize = new System.Drawing.Size(300, 292);
216
+            this.MinimizeBox = false;
217
+            this.MinimumSize = new System.Drawing.Size(300, 292);
218
+            this.Name = "UserLoginForm";
219
+            this.Text = "R-Group Bulk Printing";
220
+            this.Load += new System.EventHandler(this.UserLoginForm_Load);
221
+            this.Shown += new System.EventHandler(this.UserLoginForm_Shown);
222
+            this.VisibleChanged += new System.EventHandler(this.UserLoginForm_VisibleChanged);
223
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
224
+            this.ResumeLayout(false);
225
+            this.PerformLayout();
226
+
227
+        }
228
+
229
+        #endregion
230
+
231
+        private System.Windows.Forms.TextBox txtUsername;
232
+        private System.Windows.Forms.TextBox txtUserID;
233
+        private System.Windows.Forms.TextBox txtPassword;
234
+        private System.Windows.Forms.Button btnLogin;
235
+        private System.Windows.Forms.Label label1;
236
+        private System.Windows.Forms.Label label2;
237
+        private System.Windows.Forms.Label label3;
238
+        private System.Windows.Forms.TextBox txtVendorID;
239
+        private System.Windows.Forms.Label label4;
240
+        private System.Windows.Forms.Label label5;
241
+        private System.Windows.Forms.Label lblHDDSerial;
242
+        private System.Windows.Forms.CheckBox chkOffline;
243
+        private System.Windows.Forms.CheckBox chkRemember;
244
+        private System.Windows.Forms.PictureBox pictureBox1;
245
+    }
246
+}

+ 255 - 0
BulkPrinting/BulkPrinting/UserLoginForm.cs

@@ -0,0 +1,255 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.IO;
11
+using System.Net;
12
+using System.Management;
13
+using Newtonsoft.Json;
14
+using Newtonsoft.Json.Serialization;
15
+using System.Data.SQLite;
16
+
17
+namespace BulkPrinting
18
+{
19
+    public partial class UserLoginForm : Form
20
+    {
21
+        public UserLoginForm()
22
+        {
23
+            InitializeComponent();
24
+        }
25
+
26
+        private void btnLogin_Click(object sender, EventArgs e)
27
+        {
28
+            bool LoginSuccessful = false;
29
+            string MaxDBPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Configuration.MaxDataPathName);
30
+            string MaxDBFilePath = Path.Combine(MaxDBPath, Configuration.MaxDBFileName);
31
+            LoginData UserLoginData = new LoginData();
32
+            UserLoginData.VendorId = int.Parse(this.txtVendorID.Text);
33
+            UserLoginData.SerialNumber = Globals.HDDSerialNumber;
34
+            UserLoginData.UserId = int.Parse(this.txtUserID.Text);
35
+            UserLoginData.Username = this.txtUsername.Text;
36
+            UserLoginData.Password = this.txtPassword.Text;
37
+            if (chkOffline.Checked == true) {
38
+                byte[] userKey;
39
+                if (Globals.SessionSalt == null || Globals.SessionIterations == 0){
40
+                    MessageBox.Show("It looks like this user hasn't performed an online login today or since the application started. You must perform an online login at least once during the day to use the offline feature. To use offline mode, please remember not to close the application after each session.", "Cannot perform offline login", MessageBoxButtons.OK, MessageBoxIcon.Error);
41
+                    return;
42
+                }
43
+                using (var derivedBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(
44
+                    UserLoginData.Password + "shie5heeX6pekaehovuS2yu0Ciejah7a",
45
+                    Globals.SessionSalt,
46
+                    Globals.SessionIterations))
47
+                {
48
+                    userKey = derivedBytes.GetBytes(32);
49
+                }
50
+                try
51
+                {
52
+                    Globals.SessionDatabasePassword = Utility.AesDecryptBytes(Globals.SessionEncryptedDatabasePassword, userKey);
53
+                }
54
+                catch (Exception) {
55
+                    MessageBox.Show("An error occured while logging in in offline mode. Please ensure that you have entered the correct user details and password. If the problem persists, please uncheck 'Offline' before logging in again.", "Application error", MessageBoxButtons.OK, MessageBoxIcon.Error);
56
+                    return;
57
+                }
58
+
59
+                if (!File.Exists(MaxDBFilePath))
60
+                {
61
+                    //Shouldn't get here unless the database is deleted or moved
62
+                    MessageBox.Show("A problem has been detected and online initialisation must be performed. You cannot use offline mode until this has been completed.", "Application error", MessageBoxButtons.OK, MessageBoxIcon.Error);
63
+                    return;
64
+                }
65
+                else
66
+                {
67
+                    Globals.DBConnection = new SQLiteConnection(String.Format("Data Source={0};", MaxDBFilePath));
68
+                    Globals.DBConnection.SetPassword(Globals.SessionDatabasePassword);
69
+                    Globals.DBConnection.Open();
70
+                    //Test login success
71
+                    Globals.SessionMode = SessionModes.Offline;
72
+                    SQLiteCommand SQLCommand = new SQLiteCommand("SELECT Value FROM SessionData WHERE Key = 'SessionDataJson'", Globals.DBConnection);
73
+                    Globals.SessionData = JsonConvert.DeserializeObject<OKResponse>(Convert.ToString(SQLCommand.ExecuteScalar()));
74
+                    Globals.SessionVoucherKey = Utility.AesDecryptBytes(Globals.SessionData.Credentials.Payload.EncryptedVoucherKey, userKey);
75
+                    DateTime ServerDate = Globals.SessionData.Credentials.Payload.Date;
76
+                    DateTime Today = DateTime.Now;
77
+                    if (ServerDate.Date != Today.Date) {
78
+                        MessageBox.Show("It looks like this user hasn't performed an online login today or since the application started. You must perform an online login at least once during the day to use the offline feature. To use offline mode, please remember not to close the application after each session.", "Cannot perform offline login", MessageBoxButtons.OK, MessageBoxIcon.Error);
79
+                        return;
80
+                    }
81
+                    Utility.LogEvent(VendorEvent.VendorEventType.OfflineLogin);
82
+                    LoginSuccessful = true;
83
+                }
84
+            }
85
+            else
86
+            {
87
+                if (Utility.Login(UserLoginData, chkOffline.Checked, chkRemember.Checked))
88
+                {
89
+                    byte[] userKey;
90
+                    LoginSuccessful = true;
91
+                    Globals.SessionMode = SessionModes.Online;
92
+                    using (var derivedBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(
93
+                        UserLoginData.Password + "shie5heeX6pekaehovuS2yu0Ciejah7a",
94
+                        Globals.SessionData.Credentials.Salt,
95
+                        Globals.SessionData.Credentials.Iterations))
96
+                    {
97
+                        userKey = derivedBytes.GetBytes(32);
98
+                    }
99
+
100
+                    byte[] signature;
101
+                    using (var hmac = new System.Security.Cryptography.HMACSHA256() { Key = userKey })
102
+                    {
103
+                        signature = hmac.ComputeHash(Encoding.ASCII.GetBytes(Globals.SessionData.Credentials.responsePayload));
104
+                    }
105
+
106
+                    if (!Globals.SessionData.Credentials.Signature.SequenceEqual(signature))
107
+                    {
108
+                        MessageBox.Show("The login attempt failed. Please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
109
+                    }
110
+                    else
111
+                    {
112
+                        Globals.SessionDatabasePassword = Utility.AesDecryptBytes(Globals.SessionEncryptedDatabasePassword, userKey);
113
+                        Globals.SessionVoucherKey = Utility.AesDecryptBytes(Globals.SessionData.Credentials.Payload.EncryptedVoucherKey, userKey);
114
+
115
+                        if (!File.Exists(MaxDBFilePath))
116
+                        {
117
+                            if (!Directory.Exists(MaxDBPath))
118
+                            {
119
+                                Directory.CreateDirectory(MaxDBPath);
120
+                            }
121
+                            SQLiteConnection.CreateFile(MaxDBFilePath);
122
+                            Migrations.InitialVersion();
123
+                        }
124
+                        else
125
+                        {
126
+                            Globals.DBConnection = new SQLiteConnection(String.Format("Data Source={0};", MaxDBFilePath));
127
+                            Globals.DBConnection.SetPassword(Globals.SessionDatabasePassword);
128
+                            Globals.DBConnection.Open();
129
+                        }
130
+                        Utility.SyncLogs(); //Perform log sync before any logging happens to ensure synchronicity with server
131
+                    }
132
+                }
133
+                else
134
+                {
135
+                    MessageBox.Show("The login attempt failed. Please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
136
+                }
137
+            }
138
+            if (LoginSuccessful == true)
139
+            {
140
+                //TODO: Remove - for testing purposes only
141
+                /*
142
+                Globals.SessionData.Credentials.Payload.User.Level = (int)UserLevel.CustomUser;
143
+                Globals.SessionData.Credentials.Payload.User.CanPrintOnline = false;
144
+                Globals.SessionData.Credentials.Payload.User.CanPrintOffline = true;
145
+                Globals.SessionData.Credentials.Payload.User.CanReprintOnline = true;
146
+                Globals.SessionData.Credentials.Payload.User.CanReprintOffline = true;
147
+                Globals.SessionData.Credentials.Payload.User.BulkExport = false;
148
+                Globals.SessionData.Credentials.Payload.User.BulkOrder = true;
149
+                Globals.SessionData.Credentials.Payload.User.BulkViewPins = true;
150
+                Globals.SessionData.Credentials.Payload.User.BulkOrderMaxValue = 1000;
151
+                Globals.SessionData.Credentials.Payload.User.BulkExportMaxValue = 0;
152
+                Globals.SessionData.Credentials.Payload.User.OnlinePrintValue = 0;
153
+                Globals.SessionData.Credentials.Payload.User.OfflinePrintValue = 0;
154
+                Globals.SessionData.Credentials.Payload.User.OnlineReprintValue = 0;
155
+                Globals.SessionData.Credentials.Payload.User.OfflineReprintValue = 0;
156
+                */
157
+                string Sql = "DELETE FROM SessionData"; //Destroy stored session data on login - keep in memory until logout
158
+                SQLiteCommand Command = new SQLiteCommand(Sql, Globals.DBConnection);
159
+                Command.ExecuteNonQuery();
160
+                Globals.MaxPrinter = new Printer();
161
+                this.txtPassword.Text = "";
162
+                this.Hide();
163
+                BatchForm MainWindow = new BatchForm();
164
+                MainWindow.Show();
165
+            }
166
+
167
+
168
+        }
169
+
170
+        private void UserLoginForm_Load(object sender, EventArgs e)
171
+        {
172
+            Globals.LogSyncWaiting = false; //Ensure LogSync starts in correct state
173
+            this.lblHDDSerial.Text = Globals.HDDSerialNumber;
174
+            this.txtUsername.Text = Utility.RegFetch("Username");
175
+            this.txtUserID.Text = Utility.RegFetch("UserID");
176
+            if (this.txtUsername.Text != "") {
177
+                chkRemember.Checked = true;
178
+            }
179
+            this.txtVendorID.Text = Utility.RegFetch("VendorID");
180
+            if (this.txtVendorID.Text != "")
181
+            {
182
+                txtVendorID.Enabled = false;
183
+            }
184
+            this.CenterToScreen();
185
+        }
186
+
187
+        private void txtVendorID_KeyPress(object sender, KeyPressEventArgs e)
188
+        {
189
+            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
190
+            {
191
+                e.Handled = true;
192
+            }
193
+        }
194
+
195
+        private void UserLoginForm_Shown(object sender, EventArgs e)
196
+        {
197
+        }
198
+
199
+        private void UserLoginForm_VisibleChanged(object sender, EventArgs e)
200
+        {
201
+            if (this.Visible == true) {
202
+                List<Form> OpenForms = new List<Form>();
203
+
204
+                foreach (Form f in Application.OpenForms)
205
+                    OpenForms.Add(f);
206
+
207
+                foreach (Form f in OpenForms)
208
+                {
209
+                    if (f.Name != "UserLoginForm")
210
+                        f.Close();
211
+                }
212
+            }
213
+        }
214
+
215
+        private void pictureBox1_Click(object sender, EventArgs e)
216
+        {
217
+
218
+        }
219
+
220
+        private void label4_Click(object sender, EventArgs e)
221
+        {
222
+
223
+        }
224
+
225
+        private void label3_Click(object sender, EventArgs e)
226
+        {
227
+
228
+        }
229
+
230
+        private void label2_Click(object sender, EventArgs e)
231
+        {
232
+
233
+        }
234
+
235
+        private void label1_Click(object sender, EventArgs e)
236
+        {
237
+
238
+        }
239
+
240
+        private void label5_Click(object sender, EventArgs e)
241
+        {
242
+
243
+        }
244
+
245
+        private void chkRemember_CheckedChanged(object sender, EventArgs e)
246
+        {
247
+
248
+        }
249
+
250
+        private void chkOffline_CheckedChanged(object sender, EventArgs e)
251
+        {
252
+
253
+        }
254
+    }
255
+}

文件差异内容过多而无法显示
+ 6296 - 0
BulkPrinting/BulkPrinting/UserLoginForm.resx


文件差异内容过多而无法显示
+ 1087 - 0
BulkPrinting/BulkPrinting/Utility.cs


+ 282 - 0
BulkPrinting/BulkPrinting/VoucherForm.Designer.cs

@@ -0,0 +1,282 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class VoucherForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VoucherForm));
32
+            this.dgvVouchers = new System.Windows.Forms.DataGridView();
33
+            this.lblBatchDetails = new System.Windows.Forms.Label();
34
+            this.rdoPrintDate = new System.Windows.Forms.RadioButton();
35
+            this.rdoVoucherRange = new System.Windows.Forms.RadioButton();
36
+            this.rdoSerialNum = new System.Windows.Forms.RadioButton();
37
+            this.label1 = new System.Windows.Forms.Label();
38
+            this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
39
+            this.dtpEndDate = new System.Windows.Forms.DateTimePicker();
40
+            this.txtSerial = new System.Windows.Forms.TextBox();
41
+            this.lblBatch1 = new System.Windows.Forms.Label();
42
+            this.label3 = new System.Windows.Forms.Label();
43
+            this.label4 = new System.Windows.Forms.Label();
44
+            this.lblBatch2 = new System.Windows.Forms.Label();
45
+            this.numStartSeqNo = new System.Windows.Forms.NumericUpDown();
46
+            this.numEndSeqNo = new System.Windows.Forms.NumericUpDown();
47
+            this.btnSearch = new System.Windows.Forms.Button();
48
+            ((System.ComponentModel.ISupportInitialize)(this.dgvVouchers)).BeginInit();
49
+            ((System.ComponentModel.ISupportInitialize)(this.numStartSeqNo)).BeginInit();
50
+            ((System.ComponentModel.ISupportInitialize)(this.numEndSeqNo)).BeginInit();
51
+            this.SuspendLayout();
52
+            // 
53
+            // dgvVouchers
54
+            // 
55
+            this.dgvVouchers.AllowUserToAddRows = false;
56
+            this.dgvVouchers.AllowUserToDeleteRows = false;
57
+            this.dgvVouchers.AllowUserToResizeRows = false;
58
+            this.dgvVouchers.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
59
+            | System.Windows.Forms.AnchorStyles.Left) 
60
+            | System.Windows.Forms.AnchorStyles.Right)));
61
+            this.dgvVouchers.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(157)))), ((int)(((byte)(233)))));
62
+            this.dgvVouchers.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
63
+            this.dgvVouchers.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
64
+            this.dgvVouchers.Location = new System.Drawing.Point(12, 108);
65
+            this.dgvVouchers.MultiSelect = false;
66
+            this.dgvVouchers.Name = "dgvVouchers";
67
+            this.dgvVouchers.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
68
+            this.dgvVouchers.Size = new System.Drawing.Size(704, 434);
69
+            this.dgvVouchers.TabIndex = 5;
70
+            this.dgvVouchers.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvVouchers_CellContentClick);
71
+            // 
72
+            // lblBatchDetails
73
+            // 
74
+            this.lblBatchDetails.AutoSize = true;
75
+            this.lblBatchDetails.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
76
+            this.lblBatchDetails.Location = new System.Drawing.Point(12, 12);
77
+            this.lblBatchDetails.Name = "lblBatchDetails";
78
+            this.lblBatchDetails.Size = new System.Drawing.Size(0, 25);
79
+            this.lblBatchDetails.TabIndex = 7;
80
+            this.lblBatchDetails.Click += new System.EventHandler(this.lblBatchDetails_Click);
81
+            // 
82
+            // rdoPrintDate
83
+            // 
84
+            this.rdoPrintDate.AutoSize = true;
85
+            this.rdoPrintDate.ForeColor = System.Drawing.Color.White;
86
+            this.rdoPrintDate.Location = new System.Drawing.Point(12, 40);
87
+            this.rdoPrintDate.Name = "rdoPrintDate";
88
+            this.rdoPrintDate.Size = new System.Drawing.Size(123, 17);
89
+            this.rdoPrintDate.TabIndex = 8;
90
+            this.rdoPrintDate.Text = "Date Printed (range):";
91
+            this.rdoPrintDate.UseVisualStyleBackColor = true;
92
+            this.rdoPrintDate.CheckedChanged += new System.EventHandler(this.rdoPrintDate_CheckedChanged);
93
+            // 
94
+            // rdoVoucherRange
95
+            // 
96
+            this.rdoVoucherRange.AutoSize = true;
97
+            this.rdoVoucherRange.ForeColor = System.Drawing.Color.White;
98
+            this.rdoVoucherRange.Location = new System.Drawing.Point(12, 63);
99
+            this.rdoVoucherRange.Name = "rdoVoucherRange";
100
+            this.rdoVoucherRange.Size = new System.Drawing.Size(160, 17);
101
+            this.rdoVoucherRange.TabIndex = 8;
102
+            this.rdoVoucherRange.Text = "Vouchers in Selected Batch:";
103
+            this.rdoVoucherRange.UseVisualStyleBackColor = true;
104
+            this.rdoVoucherRange.CheckedChanged += new System.EventHandler(this.rdoVoucherRange_CheckedChanged);
105
+            // 
106
+            // rdoSerialNum
107
+            // 
108
+            this.rdoSerialNum.AutoSize = true;
109
+            this.rdoSerialNum.Checked = true;
110
+            this.rdoSerialNum.ForeColor = System.Drawing.Color.White;
111
+            this.rdoSerialNum.Location = new System.Drawing.Point(12, 86);
112
+            this.rdoSerialNum.Name = "rdoSerialNum";
113
+            this.rdoSerialNum.Size = new System.Drawing.Size(94, 17);
114
+            this.rdoSerialNum.TabIndex = 8;
115
+            this.rdoSerialNum.TabStop = true;
116
+            this.rdoSerialNum.Text = "Serial Number:";
117
+            this.rdoSerialNum.UseVisualStyleBackColor = true;
118
+            this.rdoSerialNum.CheckedChanged += new System.EventHandler(this.rdoSerialNum_CheckedChanged);
119
+            // 
120
+            // label1
121
+            // 
122
+            this.label1.AutoSize = true;
123
+            this.label1.ForeColor = System.Drawing.Color.White;
124
+            this.label1.Location = new System.Drawing.Point(12, 12);
125
+            this.label1.Name = "label1";
126
+            this.label1.Size = new System.Drawing.Size(120, 13);
127
+            this.label1.TabIndex = 9;
128
+            this.label1.Text = "Search for vouchers by:";
129
+            this.label1.Click += new System.EventHandler(this.label1_Click);
130
+            // 
131
+            // dtpStartDate
132
+            // 
133
+            this.dtpStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
134
+            this.dtpStartDate.Location = new System.Drawing.Point(231, 40);
135
+            this.dtpStartDate.Name = "dtpStartDate";
136
+            this.dtpStartDate.Size = new System.Drawing.Size(100, 20);
137
+            this.dtpStartDate.TabIndex = 10;
138
+            this.dtpStartDate.ValueChanged += new System.EventHandler(this.dtpStartDate_ValueChanged);
139
+            // 
140
+            // dtpEndDate
141
+            // 
142
+            this.dtpEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
143
+            this.dtpEndDate.Location = new System.Drawing.Point(388, 40);
144
+            this.dtpEndDate.Name = "dtpEndDate";
145
+            this.dtpEndDate.Size = new System.Drawing.Size(100, 20);
146
+            this.dtpEndDate.TabIndex = 10;
147
+            this.dtpEndDate.ValueChanged += new System.EventHandler(this.dtpEndDate_ValueChanged);
148
+            // 
149
+            // txtSerial
150
+            // 
151
+            this.txtSerial.Location = new System.Drawing.Point(198, 86);
152
+            this.txtSerial.Name = "txtSerial";
153
+            this.txtSerial.Size = new System.Drawing.Size(290, 20);
154
+            this.txtSerial.TabIndex = 11;
155
+            // 
156
+            // lblBatch1
157
+            // 
158
+            this.lblBatch1.AutoSize = true;
159
+            this.lblBatch1.ForeColor = System.Drawing.Color.White;
160
+            this.lblBatch1.Location = new System.Drawing.Point(195, 65);
161
+            this.lblBatch1.Name = "lblBatch1";
162
+            this.lblBatch1.Size = new System.Drawing.Size(30, 13);
163
+            this.lblBatch1.TabIndex = 12;
164
+            this.lblBatch1.Text = "From";
165
+            this.lblBatch1.Click += new System.EventHandler(this.lblBatch1_Click);
166
+            // 
167
+            // label3
168
+            // 
169
+            this.label3.AutoSize = true;
170
+            this.label3.ForeColor = System.Drawing.Color.White;
171
+            this.label3.Location = new System.Drawing.Point(195, 42);
172
+            this.label3.Name = "label3";
173
+            this.label3.Size = new System.Drawing.Size(30, 13);
174
+            this.label3.TabIndex = 12;
175
+            this.label3.Text = "From";
176
+            this.label3.Click += new System.EventHandler(this.label3_Click);
177
+            // 
178
+            // label4
179
+            // 
180
+            this.label4.AutoSize = true;
181
+            this.label4.ForeColor = System.Drawing.Color.White;
182
+            this.label4.Location = new System.Drawing.Point(362, 42);
183
+            this.label4.Name = "label4";
184
+            this.label4.Size = new System.Drawing.Size(20, 13);
185
+            this.label4.TabIndex = 12;
186
+            this.label4.Text = "To";
187
+            this.label4.Click += new System.EventHandler(this.label4_Click);
188
+            // 
189
+            // lblBatch2
190
+            // 
191
+            this.lblBatch2.AutoSize = true;
192
+            this.lblBatch2.ForeColor = System.Drawing.Color.White;
193
+            this.lblBatch2.Location = new System.Drawing.Point(362, 65);
194
+            this.lblBatch2.Name = "lblBatch2";
195
+            this.lblBatch2.Size = new System.Drawing.Size(20, 13);
196
+            this.lblBatch2.TabIndex = 12;
197
+            this.lblBatch2.Text = "To";
198
+            this.lblBatch2.Click += new System.EventHandler(this.lblBatch2_Click);
199
+            // 
200
+            // numStartSeqNo
201
+            // 
202
+            this.numStartSeqNo.Location = new System.Drawing.Point(231, 63);
203
+            this.numStartSeqNo.Name = "numStartSeqNo";
204
+            this.numStartSeqNo.Size = new System.Drawing.Size(100, 20);
205
+            this.numStartSeqNo.TabIndex = 14;
206
+            this.numStartSeqNo.ValueChanged += new System.EventHandler(this.numStartSeqNo_ValueChanged);
207
+            // 
208
+            // numEndSeqNo
209
+            // 
210
+            this.numEndSeqNo.Location = new System.Drawing.Point(388, 63);
211
+            this.numEndSeqNo.Name = "numEndSeqNo";
212
+            this.numEndSeqNo.Size = new System.Drawing.Size(100, 20);
213
+            this.numEndSeqNo.TabIndex = 14;
214
+            this.numEndSeqNo.ValueChanged += new System.EventHandler(this.numEndSeqNo_ValueChanged);
215
+            // 
216
+            // btnSearch
217
+            // 
218
+            this.btnSearch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
219
+            this.btnSearch.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSearch.BackgroundImage")));
220
+            this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
221
+            this.btnSearch.Location = new System.Drawing.Point(494, 3);
222
+            this.btnSearch.Name = "btnSearch";
223
+            this.btnSearch.Size = new System.Drawing.Size(100, 100);
224
+            this.btnSearch.TabIndex = 13;
225
+            this.btnSearch.UseVisualStyleBackColor = false;
226
+            this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
227
+            // 
228
+            // VoucherForm
229
+            // 
230
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
231
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
232
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
233
+            this.ClientSize = new System.Drawing.Size(728, 554);
234
+            this.Controls.Add(this.numEndSeqNo);
235
+            this.Controls.Add(this.numStartSeqNo);
236
+            this.Controls.Add(this.btnSearch);
237
+            this.Controls.Add(this.lblBatch2);
238
+            this.Controls.Add(this.label4);
239
+            this.Controls.Add(this.label3);
240
+            this.Controls.Add(this.lblBatch1);
241
+            this.Controls.Add(this.txtSerial);
242
+            this.Controls.Add(this.dtpEndDate);
243
+            this.Controls.Add(this.dtpStartDate);
244
+            this.Controls.Add(this.label1);
245
+            this.Controls.Add(this.rdoSerialNum);
246
+            this.Controls.Add(this.rdoVoucherRange);
247
+            this.Controls.Add(this.rdoPrintDate);
248
+            this.Controls.Add(this.lblBatchDetails);
249
+            this.Controls.Add(this.dgvVouchers);
250
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
251
+            this.MinimumSize = new System.Drawing.Size(621, 531);
252
+            this.Name = "VoucherForm";
253
+            this.Text = "View PINs";
254
+            this.Load += new System.EventHandler(this.VoucherForm_Load);
255
+            ((System.ComponentModel.ISupportInitialize)(this.dgvVouchers)).EndInit();
256
+            ((System.ComponentModel.ISupportInitialize)(this.numStartSeqNo)).EndInit();
257
+            ((System.ComponentModel.ISupportInitialize)(this.numEndSeqNo)).EndInit();
258
+            this.ResumeLayout(false);
259
+            this.PerformLayout();
260
+
261
+        }
262
+
263
+        #endregion
264
+
265
+        private System.Windows.Forms.DataGridView dgvVouchers;
266
+        private System.Windows.Forms.Label lblBatchDetails;
267
+        private System.Windows.Forms.RadioButton rdoPrintDate;
268
+        private System.Windows.Forms.RadioButton rdoVoucherRange;
269
+        private System.Windows.Forms.RadioButton rdoSerialNum;
270
+        private System.Windows.Forms.Label label1;
271
+        private System.Windows.Forms.DateTimePicker dtpStartDate;
272
+        private System.Windows.Forms.DateTimePicker dtpEndDate;
273
+        private System.Windows.Forms.TextBox txtSerial;
274
+        private System.Windows.Forms.Label lblBatch1;
275
+        private System.Windows.Forms.Label label3;
276
+        private System.Windows.Forms.Label label4;
277
+        private System.Windows.Forms.Label lblBatch2;
278
+        private System.Windows.Forms.Button btnSearch;
279
+        private System.Windows.Forms.NumericUpDown numStartSeqNo;
280
+        private System.Windows.Forms.NumericUpDown numEndSeqNo;
281
+    }
282
+}

+ 163 - 0
BulkPrinting/BulkPrinting/VoucherForm.cs

@@ -0,0 +1,163 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using System.Data.SQLite;
11
+using System.Globalization;
12
+
13
+namespace BulkPrinting
14
+{
15
+    public partial class VoucherForm : Form
16
+    {
17
+        public VoucherForm()
18
+        {
19
+            InitializeComponent();
20
+        }
21
+
22
+        public int BatchID;
23
+        public string BatchTitle;
24
+
25
+        private void VoucherForm_Load(object sender, EventArgs e)
26
+        {
27
+            if (BatchID > 0)
28
+            {
29
+                rdoVoucherRange.Show();
30
+                lblBatch1.Show();
31
+                lblBatch2.Show();
32
+                numStartSeqNo.Show();
33
+                numEndSeqNo.Show();
34
+                rdoVoucherRange.Text = "Vouchers in Selected Batch(" + BatchID.ToString() + "):";
35
+            }
36
+            else {
37
+                rdoVoucherRange.Hide();
38
+                lblBatch1.Hide();
39
+                lblBatch2.Hide();
40
+                numStartSeqNo.Hide();
41
+                numEndSeqNo.Hide();
42
+            }
43
+        }
44
+
45
+        private void dgvVouchers_CellContentClick(object sender, DataGridViewCellEventArgs e)
46
+        {
47
+
48
+        }
49
+
50
+        private void btnSearch_Click(object sender, EventArgs e)
51
+        {
52
+            string Sql;
53
+            SQLiteCommand Command = new SQLiteCommand();
54
+            if (rdoPrintDate.Checked) {
55
+                Sql = "SELECT v.BatchId, v.Serial, v.SequenceNumber, v.ExpiryDate, v.EncryptedPIN FROM Voucher v LEFT JOIN Logs l on v.Id = l.VoucherId and l.EventType=@eventtype WHERE l.EventDate BETWEEN @startdate AND @enddate";
56
+                Command = new SQLiteCommand(Sql, Globals.DBConnection);
57
+                Command.Parameters.Add(new SQLiteParameter("@eventtype", VendorEvent.VendorEventType.PrintVoucher));
58
+                CultureInfo IVC = CultureInfo.InvariantCulture;
59
+                Command.Parameters.Add(new SQLiteParameter("@startdate", dtpStartDate.Value.ToString("yyyy-MM-dd 00:00:00", IVC)));
60
+                Command.Parameters.Add(new SQLiteParameter("@enddate", dtpEndDate.Value.ToString("yyyy-MM-dd 23:59:59", IVC)));
61
+            }
62
+            else if (rdoVoucherRange.Checked) {
63
+                Sql = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN FROM Voucher WHERE BatchId = @batchid AND SequenceNumber BETWEEN @minseqno AND @maxseqno";
64
+                Command = new SQLiteCommand(Sql, Globals.DBConnection);
65
+                Command.Parameters.Add(new SQLiteParameter("@batchid", BatchID));
66
+                Command.Parameters.Add(new SQLiteParameter("@minseqno", numStartSeqNo.Value));
67
+                Command.Parameters.Add(new SQLiteParameter("@maxseqno", numEndSeqNo.Value));
68
+            }
69
+            else if (rdoSerialNum.Checked) {
70
+                Sql = "SELECT BatchId, Serial, SequenceNumber, ExpiryDate, EncryptedPIN FROM Voucher WHERE Serial=@serial";
71
+                Command = new SQLiteCommand(Sql, Globals.DBConnection);
72
+                Command.Parameters.Add(new SQLiteParameter("@serial", txtSerial.Text));
73
+            }
74
+
75
+            dgvVouchers.Rows.Clear();
76
+            dgvVouchers.Columns.Clear();
77
+            dgvVouchers.Columns.Add("BatchId", "Batch ID");
78
+            dgvVouchers.Columns.Add("Serial", "Serial Number");
79
+            dgvVouchers.Columns.Add("SequenceNumber", "Sequence Number");
80
+            dgvVouchers.Columns.Add("ExpiryDate", "Expiry Date");
81
+            dgvVouchers.Columns.Add("PIN", "PIN");
82
+            using (SQLiteDataReader SQLReader = Command.ExecuteReader())
83
+            {
84
+                while (SQLReader.Read())
85
+                {
86
+                    string VoucherPIN = Utility.TripleDESDecrypt(SQLReader.GetValue(4).ToString(), Globals.SessionVoucherKey).ToString();
87
+                    dgvVouchers.Rows.Add(new object[] {
88
+                        SQLReader.GetValue(0),
89
+                        SQLReader.GetValue(1),
90
+                        SQLReader.GetValue(2),
91
+                        SQLReader.GetValue(3),
92
+                        VoucherPIN
93
+                    });
94
+                }
95
+            }
96
+        }
97
+
98
+        private void rdoSerialNum_CheckedChanged(object sender, EventArgs e)
99
+        {
100
+
101
+        }
102
+
103
+        private void numEndSeqNo_ValueChanged(object sender, EventArgs e)
104
+        {
105
+
106
+        }
107
+
108
+        private void numStartSeqNo_ValueChanged(object sender, EventArgs e)
109
+        {
110
+
111
+        }
112
+
113
+        private void lblBatch2_Click(object sender, EventArgs e)
114
+        {
115
+
116
+        }
117
+
118
+        private void label4_Click(object sender, EventArgs e)
119
+        {
120
+
121
+        }
122
+
123
+        private void label3_Click(object sender, EventArgs e)
124
+        {
125
+
126
+        }
127
+
128
+        private void lblBatch1_Click(object sender, EventArgs e)
129
+        {
130
+
131
+        }
132
+
133
+        private void dtpEndDate_ValueChanged(object sender, EventArgs e)
134
+        {
135
+
136
+        }
137
+
138
+        private void dtpStartDate_ValueChanged(object sender, EventArgs e)
139
+        {
140
+
141
+        }
142
+
143
+        private void label1_Click(object sender, EventArgs e)
144
+        {
145
+
146
+        }
147
+
148
+        private void rdoVoucherRange_CheckedChanged(object sender, EventArgs e)
149
+        {
150
+
151
+        }
152
+
153
+        private void rdoPrintDate_CheckedChanged(object sender, EventArgs e)
154
+        {
155
+
156
+        }
157
+
158
+        private void lblBatchDetails_Click(object sender, EventArgs e)
159
+        {
160
+
161
+        }
162
+    }
163
+}

文件差异内容过多而无法显示
+ 6333 - 0
BulkPrinting/BulkPrinting/VoucherForm.resx


+ 5 - 0
BulkPrinting/BulkPrinting/packages.config

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
4
+  <package id="System.ValueTuple" version="4.3.1" targetFramework="net461" />
5
+</packages>

二进制
BulkPrinting/BulkPrinting/r_g_bulk_icon.ico