Sfoglia il codice sorgente

Made printer init string configurable via a dialog.
Add page number range reprinting.
Show warning for orders where delivered quantity is zero.
Print vendor ID on vouchers.

Brett Credo 8 anni fa
parent
commit
ae8ba4f69f

+ 9 - 0
BulkPrinting/BulkPrinting/BulkPrinting.csproj

@@ -190,6 +190,12 @@
190 190
       <DependentUpon>PrintAlignmentDialog.cs</DependentUpon>
191 191
     </Compile>
192 192
     <Compile Include="Printer.cs" />
193
+    <Compile Include="PrinterSettingsForm.cs">
194
+      <SubType>Form</SubType>
195
+    </Compile>
196
+    <Compile Include="PrinterSettingsForm.Designer.cs">
197
+      <DependentUpon>PrinterSettingsForm.cs</DependentUpon>
198
+    </Compile>
193 199
     <Compile Include="Properties\Resources.Designer.cs">
194 200
       <AutoGen>True</AutoGen>
195 201
       <DesignTime>True</DesignTime>
@@ -263,6 +269,9 @@
263 269
     <EmbeddedResource Include="BatchForm.resx">
264 270
       <DependentUpon>BatchForm.cs</DependentUpon>
265 271
     </EmbeddedResource>
272
+    <EmbeddedResource Include="PrinterSettingsForm.resx">
273
+      <DependentUpon>PrinterSettingsForm.cs</DependentUpon>
274
+    </EmbeddedResource>
266 275
     <EmbeddedResource Include="ReprintForm.resx">
267 276
       <DependentUpon>ReprintForm.cs</DependentUpon>
268 277
     </EmbeddedResource>

+ 2 - 0
BulkPrinting/BulkPrinting/Globals.cs

@@ -22,5 +22,7 @@ namespace BulkPrinting
22 22
         public static UserLimits UserCurrentUsage;
23 23
         public static LogUploader LogUploader;
24 24
         public static LogDownloader LogDownloader;
25
+
26
+        public static string DefaultPrinterInitString = "1B401B451B55301B4D";
25 27
     }
26 28
 }

+ 17 - 1
BulkPrinting/BulkPrinting/Migrations.cs

@@ -20,7 +20,7 @@ namespace BulkPrinting
20 20
                 throw new Exception(String.Format("Invalid migration value: {0}", result));
21 21
             }
22 22
 
23
-            if (startingMigration > 4)
23
+            if (startingMigration > 5)
24 24
             {
25 25
                 throw new Exception("Database is for a newer version of this application. Please upgrade and try again.");
26 26
             }
@@ -40,6 +40,10 @@ namespace BulkPrinting
40 40
             {
41 41
                 Migration4(db);
42 42
             }
43
+            if (startingMigration < 5)
44
+            {
45
+                Migration5(db);
46
+            }
43 47
             //Add further migration executions here - Migration = '1', '2', '3' etc
44 48
 
45 49
             return;
@@ -248,5 +252,17 @@ namespace BulkPrinting
248 252
                 "UPDATE Parameters SET Value='4' WHERE Key='Migration'"
249 253
            );
250 254
         }
255
+
256
+        public static bool Migration5(DBHelper db)
257
+        {
258
+            return ApplyMigrationQueries(
259
+                db, null,
260
+
261
+                "INSERT INTO Parameters (Key, Value) VALUES ('PrinterInitString', '" + Globals.DefaultPrinterInitString + "')",
262
+
263
+                // IMPORTANT
264
+                "UPDATE Parameters SET Value='5' WHERE Key='Migration'"
265
+           );
266
+        }
251 267
     }
252 268
 }

+ 11 - 0
BulkPrinting/BulkPrinting/OrderForm.cs

@@ -181,6 +181,17 @@ namespace BulkPrinting
181 181
                             Globals.SessionData.Credentials.Payload.User.Account.Balance = OrderedBatch.RemainingBalance;
182 182
                             Utility.AddUserUsage(db, UserLimits.UserLimitTypes.BulkOrder, OrderedBatch.Batch.Cost);
183 183
                             Progress.UpdateProgressBar((int)Math.Round(100 * (((decimal)i + 1) / (decimal)SelectedProducts.Count)));
184
+                            if (OrderedBatch.Batch.DeliveredQuantity == 0)
185
+                            {
186
+                                string ErrorMessage = "Your order for " +
187
+                                    OrderedItem.Quantity.ToString() + " of " + OrderedItem.ProductDescription +
188
+                                    " could not be fulfilled as no vouchers are available.";
189
+                                if (i < (SelectedProducts.Count - 1))
190
+                                {
191
+                                    ErrorMessage += "\nPress OK to continue attempting to order remaining items.";
192
+                                }
193
+                                MessageBox.Show(ErrorMessage, "Error Ordering", MessageBoxButtons.OK, MessageBoxIcon.Error);
194
+                            }
184 195
                             Thread.Sleep(50);
185 196
                         }
186 197
 

+ 8 - 8
BulkPrinting/BulkPrinting/PrintAlignmentDialog.cs

@@ -53,15 +53,14 @@ namespace BulkPrinting
53 53
         private void btnAlignment_Click(object sender, EventArgs e)
54 54
         {
55 55
 
56
-            var PrinterInitString = new StringBuilder();
57
-            //PrinterInitString.Append(Printer.INITIALISE_PRINTER).Append(Printer.EMPHASISE_ON).Append(Printer.UNIDIRECTIONAL_OFF).Append(Printer.CHARPITCHELITE);
56
+            var PrinterInitString = Utility.GetPrinterInitString(Globals.DB);
58 57
             int initJobID = Globals.MaxPrinter.Open("Printer_Init");
59 58
             if (initJobID == 0) return;
60
-            //Globals.MaxPrinter.Print(PrinterInitString.ToString());
61
-            Globals.MaxPrinter.Print(Printer.INITIALISE_PRINTER);
62
-            Globals.MaxPrinter.Print(Printer.UNIDIRECTIONAL_OFF);
63
-            Globals.MaxPrinter.Print(Printer.CHARPITCHELITE);
64
-            Globals.MaxPrinter.Print(Printer.EMPHASISE_ON);
59
+            Globals.MaxPrinter.Print(PrinterInitString.ToString());
60
+            //Globals.MaxPrinter.Print(Printer.INITIALISE_PRINTER);
61
+            //Globals.MaxPrinter.Print(Printer.UNIDIRECTIONAL_OFF);
62
+            //Globals.MaxPrinter.Print(Printer.CHARPITCHELITE);
63
+            //Globals.MaxPrinter.Print(Printer.EMPHASISE_ON);
65 64
             //Globals.MaxPrinter.Close();
66 65
 
67 66
 
@@ -77,7 +76,8 @@ namespace BulkPrinting
77 76
                 "[--VOUCHER  PIN  CODE--]      [--VOUCHER  PIN  CODE--]      [--VOUCHER  PIN  CODE--]       [--VOUCHER  PIN  CODE--]      [--VOUCHER  PIN  CODE--]\r\n\n" +
78 77
                 "[--VOUCHER SERIAL NUM--]      [--VOUCHER SERIAL NUM--]      [--VOUCHER SERIAL NUM--]       [--VOUCHER SERIAL NUM--]      [--VOUCHER SERIAL NUM--]\r\n" +
79 78
                 "[--BATCHNO/SEQNO/PAGE--]      [--BATCHNO/SEQNO/PAGE--]      [--BATCHNO/SEQNO/PAGE--]       [--BATCHNO/SEQNO/PAGE--]      [--BATCHNO/SEQNO/PAGE--]\r\n" +
80
-                "[--VOUCHERDESCRIPTION--]      [--VOUCHERDESCRIPTION--]      [--VOUCHERDESCRIPTION--]       [--VOUCHERDESCRIPTION--]      [--VOUCHERDESCRIPTION--]\r\n\n\n\n\n\n\n\n\n\n\n";
79
+                "[--VOUCHERDESCRIPTION--]      [--VOUCHERDESCRIPTION--]      [--VOUCHERDESCRIPTION--]       [--VOUCHERDESCRIPTION--]      [--VOUCHERDESCRIPTION--]\r\n" +
80
+                "[--VENDOR          ID--]      [--VENDOR          ID--]      [--VENDOR          ID--]       [--VENDOR          ID--]      [--VENDOR          ID--]\r\n\n\n\n\n\n\n\n\n\n";
81 81
             }
82 82
             
83 83
             Globals.MaxPrinter.Print(AlignmentPage);

+ 26 - 9
BulkPrinting/BulkPrinting/PrintForm.Designer.cs

@@ -48,6 +48,7 @@
48 48
             this.numNumVouchers = new System.Windows.Forms.NumericUpDown();
49 49
             this.label7 = new System.Windows.Forms.Label();
50 50
             this.lblNetwork = new System.Windows.Forms.Label();
51
+            this.btnAdvanced = new System.Windows.Forms.Button();
51 52
             ((System.ComponentModel.ISupportInitialize)(this.numNumVouchers)).BeginInit();
52 53
             this.SuspendLayout();
53 54
             // 
@@ -195,11 +196,11 @@
195 196
             this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
196 197
             this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
197 198
             this.btnCancel.ForeColor = System.Drawing.Color.White;
198
-            this.btnCancel.Location = new System.Drawing.Point(67, 214);
199
-            this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
199
+            this.btnCancel.Location = new System.Drawing.Point(154, 211);
200
+            this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
200 201
             this.btnCancel.Name = "btnCancel";
201 202
             this.btnCancel.Size = new System.Drawing.Size(100, 28);
202
-            this.btnCancel.TabIndex = 12;
203
+            this.btnCancel.TabIndex = 2;
203 204
             this.btnCancel.Text = "Cancel";
204 205
             this.btnCancel.UseVisualStyleBackColor = false;
205 206
             this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -210,11 +211,11 @@
210 211
             this.btnNext.FlatAppearance.BorderColor = System.Drawing.Color.Black;
211 212
             this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
212 213
             this.btnNext.ForeColor = System.Drawing.Color.White;
213
-            this.btnNext.Location = new System.Drawing.Point(236, 214);
214
-            this.btnNext.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
214
+            this.btnNext.Location = new System.Drawing.Point(262, 211);
215
+            this.btnNext.Margin = new System.Windows.Forms.Padding(4);
215 216
             this.btnNext.Name = "btnNext";
216 217
             this.btnNext.Size = new System.Drawing.Size(100, 28);
217
-            this.btnNext.TabIndex = 13;
218
+            this.btnNext.TabIndex = 1;
218 219
             this.btnNext.Text = "Next";
219 220
             this.btnNext.UseVisualStyleBackColor = false;
220 221
             this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
@@ -233,10 +234,10 @@
233 234
             // numNumVouchers
234 235
             // 
235 236
             this.numNumVouchers.Location = new System.Drawing.Point(236, 181);
236
-            this.numNumVouchers.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
237
+            this.numNumVouchers.Margin = new System.Windows.Forms.Padding(4);
237 238
             this.numNumVouchers.Name = "numNumVouchers";
238 239
             this.numNumVouchers.Size = new System.Drawing.Size(127, 22);
239
-            this.numNumVouchers.TabIndex = 18;
240
+            this.numNumVouchers.TabIndex = 0;
240 241
             // 
241 242
             // label7
242 243
             // 
@@ -259,6 +260,20 @@
259 260
             this.lblNetwork.Size = new System.Drawing.Size(0, 17);
260 261
             this.lblNetwork.TabIndex = 7;
261 262
             // 
263
+            // btnAdvanced
264
+            // 
265
+            this.btnAdvanced.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
266
+            this.btnAdvanced.FlatAppearance.BorderColor = System.Drawing.Color.Black;
267
+            this.btnAdvanced.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
268
+            this.btnAdvanced.Location = new System.Drawing.Point(13, 211);
269
+            this.btnAdvanced.Margin = new System.Windows.Forms.Padding(4);
270
+            this.btnAdvanced.Name = "btnAdvanced";
271
+            this.btnAdvanced.Size = new System.Drawing.Size(96, 28);
272
+            this.btnAdvanced.TabIndex = 3;
273
+            this.btnAdvanced.Text = "Advanced";
274
+            this.btnAdvanced.UseVisualStyleBackColor = false;
275
+            this.btnAdvanced.Click += new System.EventHandler(this.btnAdvanced_Click);
276
+            // 
262 277
             // PrintForm
263 278
             // 
264 279
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -267,6 +282,7 @@
267 282
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
268 283
             this.ClientSize = new System.Drawing.Size(379, 257);
269 284
             this.ControlBox = false;
285
+            this.Controls.Add(this.btnAdvanced);
270 286
             this.Controls.Add(this.numNumVouchers);
271 287
             this.Controls.Add(this.lblNumVouchers);
272 288
             this.Controls.Add(this.btnNext);
@@ -289,7 +305,7 @@
289 305
             this.ForeColor = System.Drawing.Color.White;
290 306
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
291 307
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
292
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
308
+            this.Margin = new System.Windows.Forms.Padding(4);
293 309
             this.MaximizeBox = false;
294 310
             this.MinimizeBox = false;
295 311
             this.Name = "PrintForm";
@@ -321,5 +337,6 @@
321 337
         private System.Windows.Forms.NumericUpDown numNumVouchers;
322 338
         private System.Windows.Forms.Label label7;
323 339
         private System.Windows.Forms.Label lblNetwork;
340
+        private System.Windows.Forms.Button btnAdvanced;
324 341
     }
325 342
 }

+ 10 - 0
BulkPrinting/BulkPrinting/PrintForm.cs

@@ -119,5 +119,15 @@ namespace BulkPrinting
119 119
         {
120 120
 
121 121
         }
122
+
123
+        private void btnAdvanced_Click(object sender, EventArgs e)
124
+        {
125
+            var dialog = new PrinterSettingsForm();
126
+            dialog.InitString = Utility.GetSavedParameter(Globals.DB, "PrinterInitString");
127
+            if (dialog.ShowDialog() == DialogResult.OK)
128
+            {
129
+                Utility.UpdateSavedParameter(Globals.DB, "PrinterInitString", dialog.InitString);
130
+            }
131
+        }
122 132
     }
123 133
 }

+ 127 - 0
BulkPrinting/BulkPrinting/PrinterSettingsForm.Designer.cs

@@ -0,0 +1,127 @@
1
+namespace BulkPrinting
2
+{
3
+    partial class PrinterSettingsForm
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.label1 = new System.Windows.Forms.Label();
32
+            this.initStringTextBox = new System.Windows.Forms.TextBox();
33
+            this.resetButton = new System.Windows.Forms.Button();
34
+            this.okButton = new System.Windows.Forms.Button();
35
+            this.cancelButton = new System.Windows.Forms.Button();
36
+            this.SuspendLayout();
37
+            // 
38
+            // label1
39
+            // 
40
+            this.label1.AutoSize = true;
41
+            this.label1.ForeColor = System.Drawing.Color.White;
42
+            this.label1.Location = new System.Drawing.Point(13, 13);
43
+            this.label1.Name = "label1";
44
+            this.label1.Size = new System.Drawing.Size(155, 17);
45
+            this.label1.TabIndex = 0;
46
+            this.label1.Text = "Printer Init String (Hex):";
47
+            // 
48
+            // initStringTextBox
49
+            // 
50
+            this.initStringTextBox.Location = new System.Drawing.Point(174, 13);
51
+            this.initStringTextBox.Name = "initStringTextBox";
52
+            this.initStringTextBox.Size = new System.Drawing.Size(475, 22);
53
+            this.initStringTextBox.TabIndex = 0;
54
+            // 
55
+            // resetButton
56
+            // 
57
+            this.resetButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
58
+            this.resetButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
59
+            this.resetButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
60
+            this.resetButton.ForeColor = System.Drawing.Color.White;
61
+            this.resetButton.Location = new System.Drawing.Point(13, 48);
62
+            this.resetButton.Name = "resetButton";
63
+            this.resetButton.Size = new System.Drawing.Size(137, 28);
64
+            this.resetButton.TabIndex = 3;
65
+            this.resetButton.Text = "Reset to Default";
66
+            this.resetButton.UseVisualStyleBackColor = false;
67
+            this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
68
+            // 
69
+            // okButton
70
+            // 
71
+            this.okButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
72
+            this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
73
+            this.okButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
74
+            this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
75
+            this.okButton.ForeColor = System.Drawing.Color.White;
76
+            this.okButton.Location = new System.Drawing.Point(443, 48);
77
+            this.okButton.Name = "okButton";
78
+            this.okButton.Size = new System.Drawing.Size(100, 28);
79
+            this.okButton.TabIndex = 1;
80
+            this.okButton.Text = "OK";
81
+            this.okButton.UseVisualStyleBackColor = false;
82
+            // 
83
+            // cancelButton
84
+            // 
85
+            this.cancelButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(132)))), ((int)(((byte)(186)))));
86
+            this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
87
+            this.cancelButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
88
+            this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
89
+            this.cancelButton.ForeColor = System.Drawing.Color.White;
90
+            this.cancelButton.Location = new System.Drawing.Point(549, 48);
91
+            this.cancelButton.Name = "cancelButton";
92
+            this.cancelButton.Size = new System.Drawing.Size(100, 28);
93
+            this.cancelButton.TabIndex = 2;
94
+            this.cancelButton.Text = "Cancel";
95
+            this.cancelButton.UseVisualStyleBackColor = false;
96
+            // 
97
+            // PrinterSettingsForm
98
+            // 
99
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
100
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
101
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
102
+            this.ClientSize = new System.Drawing.Size(661, 83);
103
+            this.ControlBox = false;
104
+            this.Controls.Add(this.cancelButton);
105
+            this.Controls.Add(this.okButton);
106
+            this.Controls.Add(this.resetButton);
107
+            this.Controls.Add(this.initStringTextBox);
108
+            this.Controls.Add(this.label1);
109
+            this.MaximizeBox = false;
110
+            this.MinimizeBox = false;
111
+            this.Name = "PrinterSettingsForm";
112
+            this.Text = "Advanced Printer Settings";
113
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PrinterSettingsForm_FormClosing);
114
+            this.ResumeLayout(false);
115
+            this.PerformLayout();
116
+
117
+        }
118
+
119
+        #endregion
120
+
121
+        private System.Windows.Forms.Label label1;
122
+        private System.Windows.Forms.TextBox initStringTextBox;
123
+        private System.Windows.Forms.Button resetButton;
124
+        private System.Windows.Forms.Button okButton;
125
+        private System.Windows.Forms.Button cancelButton;
126
+    }
127
+}

+ 40 - 0
BulkPrinting/BulkPrinting/PrinterSettingsForm.cs

@@ -0,0 +1,40 @@
1
+using System;
2
+using System.Windows.Forms;
3
+
4
+namespace BulkPrinting
5
+{
6
+    public partial class PrinterSettingsForm : Form
7
+    {
8
+        public PrinterSettingsForm()
9
+        {
10
+            InitializeComponent();
11
+        }
12
+
13
+        public string InitString
14
+        {
15
+            get { return initStringTextBox.Text.Trim(); }
16
+            set { initStringTextBox.Text = value; }
17
+        }
18
+
19
+        private void PrinterSettingsForm_FormClosing(object sender, FormClosingEventArgs e)
20
+        {
21
+            if (DialogResult == DialogResult.OK)
22
+            {
23
+                try
24
+                {
25
+                    Utility.HexStringToBytes(InitString);
26
+                }
27
+                catch (FormatException)
28
+                {
29
+                    MessageBox.Show("Printer init string is not a valid hex string.", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
30
+                    e.Cancel = true;
31
+                }
32
+            }
33
+        }
34
+
35
+        private void resetButton_Click(object sender, EventArgs e)
36
+        {
37
+            initStringTextBox.Text = Globals.DefaultPrinterInitString;
38
+        }
39
+    }
40
+}

+ 123 - 0
BulkPrinting/BulkPrinting/PrinterSettingsForm.resx

@@ -0,0 +1,123 @@
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
+  <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
121
+    <value>True</value>
122
+  </metadata>
123
+</root>

+ 1 - 1
BulkPrinting/BulkPrinting/Properties/AssemblyInfo.cs

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
33 33
 // by using the '*' as shown below:
34 34
 // [assembly: AssemblyVersion("1.0.*")]
35 35
 [assembly: AssemblyVersion("1.0.*")]
36
-[assembly: AssemblyFileVersion("1.4")]
36
+[assembly: AssemblyFileVersion("1.5")]

+ 91 - 23
BulkPrinting/BulkPrinting/ReprintForm.Designer.cs

@@ -57,8 +57,15 @@
57 57
             this.label11 = new System.Windows.Forms.Label();
58 58
             this.lblMinSeqNo = new System.Windows.Forms.Label();
59 59
             this.lblMaxSeqNo = new System.Windows.Forms.Label();
60
+            this.rdoPageRange = new System.Windows.Forms.RadioButton();
61
+            this.numFirstPageNum = new System.Windows.Forms.NumericUpDown();
62
+            this.numLastPageNum = new System.Windows.Forms.NumericUpDown();
63
+            this.label2 = new System.Windows.Forms.Label();
64
+            this.label12 = new System.Windows.Forms.Label();
60 65
             ((System.ComponentModel.ISupportInitialize)(this.numLastSeqNum)).BeginInit();
61 66
             ((System.ComponentModel.ISupportInitialize)(this.numFirstSeqNum)).BeginInit();
67
+            ((System.ComponentModel.ISupportInitialize)(this.numFirstPageNum)).BeginInit();
68
+            ((System.ComponentModel.ISupportInitialize)(this.numLastPageNum)).BeginInit();
62 69
             this.SuspendLayout();
63 70
             // 
64 71
             // lblPrintDescription
@@ -182,11 +189,11 @@
182 189
             this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
183 190
             this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
184 191
             this.btnCancel.ForeColor = System.Drawing.Color.White;
185
-            this.btnCancel.Location = new System.Drawing.Point(193, 384);
186
-            this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
192
+            this.btnCancel.Location = new System.Drawing.Point(193, 489);
193
+            this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
187 194
             this.btnCancel.Name = "btnCancel";
188 195
             this.btnCancel.Size = new System.Drawing.Size(100, 28);
189
-            this.btnCancel.TabIndex = 12;
196
+            this.btnCancel.TabIndex = 8;
190 197
             this.btnCancel.Text = "Cancel";
191 198
             this.btnCancel.UseVisualStyleBackColor = false;
192 199
             this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -197,11 +204,11 @@
197 204
             this.btnNext.FlatAppearance.BorderColor = System.Drawing.Color.Black;
198 205
             this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
199 206
             this.btnNext.ForeColor = System.Drawing.Color.White;
200
-            this.btnNext.Location = new System.Drawing.Point(301, 384);
201
-            this.btnNext.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
207
+            this.btnNext.Location = new System.Drawing.Point(301, 489);
208
+            this.btnNext.Margin = new System.Windows.Forms.Padding(4);
202 209
             this.btnNext.Name = "btnNext";
203 210
             this.btnNext.Size = new System.Drawing.Size(100, 28);
204
-            this.btnNext.TabIndex = 13;
211
+            this.btnNext.TabIndex = 9;
205 212
             this.btnNext.Text = "Next";
206 213
             this.btnNext.UseVisualStyleBackColor = false;
207 214
             this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
@@ -210,7 +217,7 @@
210 217
             // 
211 218
             this.lblFirstSeqNum.AutoSize = true;
212 219
             this.lblFirstSeqNum.ForeColor = System.Drawing.Color.White;
213
-            this.lblFirstSeqNum.Location = new System.Drawing.Point(56, 282);
220
+            this.lblFirstSeqNum.Location = new System.Drawing.Point(59, 281);
214 221
             this.lblFirstSeqNum.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
215 222
             this.lblFirstSeqNum.Name = "lblFirstSeqNum";
216 223
             this.lblFirstSeqNum.Size = new System.Drawing.Size(208, 17);
@@ -220,24 +227,24 @@
220 227
             // numLastSeqNum
221 228
             // 
222 229
             this.numLastSeqNum.Location = new System.Drawing.Point(275, 279);
223
-            this.numLastSeqNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
230
+            this.numLastSeqNum.Margin = new System.Windows.Forms.Padding(4);
224 231
             this.numLastSeqNum.Name = "numLastSeqNum";
225 232
             this.numLastSeqNum.Size = new System.Drawing.Size(127, 22);
226
-            this.numLastSeqNum.TabIndex = 18;
233
+            this.numLastSeqNum.TabIndex = 4;
227 234
             // 
228 235
             // numFirstSeqNum
229 236
             // 
230 237
             this.numFirstSeqNum.Location = new System.Drawing.Point(275, 251);
231
-            this.numFirstSeqNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
238
+            this.numFirstSeqNum.Margin = new System.Windows.Forms.Padding(4);
232 239
             this.numFirstSeqNum.Name = "numFirstSeqNum";
233 240
             this.numFirstSeqNum.Size = new System.Drawing.Size(127, 22);
234
-            this.numFirstSeqNum.TabIndex = 18;
241
+            this.numFirstSeqNum.TabIndex = 3;
235 242
             // 
236 243
             // lblLastSeqNum
237 244
             // 
238 245
             this.lblLastSeqNum.AutoSize = true;
239 246
             this.lblLastSeqNum.ForeColor = System.Drawing.Color.White;
240
-            this.lblLastSeqNum.Location = new System.Drawing.Point(44, 254);
247
+            this.lblLastSeqNum.Location = new System.Drawing.Point(44, 253);
241 248
             this.lblLastSeqNum.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
242 249
             this.lblLastSeqNum.Name = "lblLastSeqNum";
243 250
             this.lblLastSeqNum.Size = new System.Drawing.Size(223, 17);
@@ -284,10 +291,10 @@
284 291
             this.rdoRange.Checked = true;
285 292
             this.rdoRange.ForeColor = System.Drawing.Color.White;
286 293
             this.rdoRange.Location = new System.Drawing.Point(40, 68);
287
-            this.rdoRange.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
294
+            this.rdoRange.Margin = new System.Windows.Forms.Padding(4);
288 295
             this.rdoRange.Name = "rdoRange";
289 296
             this.rdoRange.Size = new System.Drawing.Size(231, 21);
290
-            this.rdoRange.TabIndex = 21;
297
+            this.rdoRange.TabIndex = 0;
291 298
             this.rdoRange.TabStop = true;
292 299
             this.rdoRange.Text = "Choose a range from this batch:";
293 300
             this.rdoRange.UseVisualStyleBackColor = true;
@@ -296,11 +303,11 @@
296 303
             // 
297 304
             this.rdoSerial.AutoSize = true;
298 305
             this.rdoSerial.ForeColor = System.Drawing.Color.White;
299
-            this.rdoSerial.Location = new System.Drawing.Point(40, 311);
300
-            this.rdoSerial.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
306
+            this.rdoSerial.Location = new System.Drawing.Point(40, 416);
307
+            this.rdoSerial.Margin = new System.Windows.Forms.Padding(4);
301 308
             this.rdoSerial.Name = "rdoSerial";
302 309
             this.rdoSerial.Size = new System.Drawing.Size(328, 21);
303
-            this.rdoSerial.TabIndex = 21;
310
+            this.rdoSerial.TabIndex = 2;
304 311
             this.rdoSerial.Text = "Choose an individual voucher by serial number:";
305 312
             this.rdoSerial.UseVisualStyleBackColor = true;
306 313
             // 
@@ -308,7 +315,7 @@
308 315
             // 
309 316
             this.label9.AutoSize = true;
310 317
             this.label9.ForeColor = System.Drawing.Color.White;
311
-            this.label9.Location = new System.Drawing.Point(97, 343);
318
+            this.label9.Location = new System.Drawing.Point(97, 448);
312 319
             this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
313 320
             this.label9.Name = "label9";
314 321
             this.label9.Size = new System.Drawing.Size(52, 17);
@@ -317,11 +324,11 @@
317 324
             // 
318 325
             // txtSerialNum
319 326
             // 
320
-            this.txtSerialNum.Location = new System.Drawing.Point(157, 340);
321
-            this.txtSerialNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
327
+            this.txtSerialNum.Location = new System.Drawing.Point(157, 445);
328
+            this.txtSerialNum.Margin = new System.Windows.Forms.Padding(4);
322 329
             this.txtSerialNum.Name = "txtSerialNum";
323 330
             this.txtSerialNum.Size = new System.Drawing.Size(243, 22);
324
-            this.txtSerialNum.TabIndex = 23;
331
+            this.txtSerialNum.TabIndex = 7;
325 332
             this.txtSerialNum.TextChanged += new System.EventHandler(this.txtSerialNum_TextChanged);
326 333
             // 
327 334
             // label10
@@ -366,6 +373,55 @@
366 373
             this.lblMaxSeqNo.Size = new System.Drawing.Size(0, 17);
367 374
             this.lblMaxSeqNo.TabIndex = 7;
368 375
             // 
376
+            // rdoPageRange
377
+            // 
378
+            this.rdoPageRange.AutoSize = true;
379
+            this.rdoPageRange.Location = new System.Drawing.Point(40, 320);
380
+            this.rdoPageRange.Name = "rdoPageRange";
381
+            this.rdoPageRange.Size = new System.Drawing.Size(308, 21);
382
+            this.rdoPageRange.TabIndex = 1;
383
+            this.rdoPageRange.TabStop = true;
384
+            this.rdoPageRange.Text = "Choose a page range from the above batch:";
385
+            this.rdoPageRange.UseVisualStyleBackColor = true;
386
+            // 
387
+            // numFirstPageNum
388
+            // 
389
+            this.numFirstPageNum.Location = new System.Drawing.Point(275, 348);
390
+            this.numFirstPageNum.Margin = new System.Windows.Forms.Padding(4);
391
+            this.numFirstPageNum.Name = "numFirstPageNum";
392
+            this.numFirstPageNum.Size = new System.Drawing.Size(127, 22);
393
+            this.numFirstPageNum.TabIndex = 5;
394
+            // 
395
+            // numLastPageNum
396
+            // 
397
+            this.numLastPageNum.Location = new System.Drawing.Point(275, 376);
398
+            this.numLastPageNum.Margin = new System.Windows.Forms.Padding(4);
399
+            this.numLastPageNum.Name = "numLastPageNum";
400
+            this.numLastPageNum.Size = new System.Drawing.Size(127, 22);
401
+            this.numLastPageNum.TabIndex = 6;
402
+            // 
403
+            // label2
404
+            // 
405
+            this.label2.AutoSize = true;
406
+            this.label2.ForeColor = System.Drawing.Color.White;
407
+            this.label2.Location = new System.Drawing.Point(132, 350);
408
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
409
+            this.label2.Name = "label2";
410
+            this.label2.Size = new System.Drawing.Size(135, 17);
411
+            this.label2.TabIndex = 25;
412
+            this.label2.Text = "From Page Number:";
413
+            // 
414
+            // label12
415
+            // 
416
+            this.label12.AutoSize = true;
417
+            this.label12.ForeColor = System.Drawing.Color.White;
418
+            this.label12.Location = new System.Drawing.Point(147, 378);
419
+            this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
420
+            this.label12.Name = "label12";
421
+            this.label12.Size = new System.Drawing.Size(120, 17);
422
+            this.label12.TabIndex = 26;
423
+            this.label12.Text = "To Page Number:";
424
+            // 
369 425
             // ReprintForm
370 426
             // 
371 427
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -373,8 +429,13 @@
373 429
             this.AutoSize = true;
374 430
             this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
375 431
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
376
-            this.ClientSize = new System.Drawing.Size(424, 428);
432
+            this.ClientSize = new System.Drawing.Size(419, 528);
377 433
             this.ControlBox = false;
434
+            this.Controls.Add(this.numFirstPageNum);
435
+            this.Controls.Add(this.numLastPageNum);
436
+            this.Controls.Add(this.label2);
437
+            this.Controls.Add(this.label12);
438
+            this.Controls.Add(this.rdoPageRange);
378 439
             this.Controls.Add(this.txtSerialNum);
379 440
             this.Controls.Add(this.label9);
380 441
             this.Controls.Add(this.rdoSerial);
@@ -406,7 +467,7 @@
406 467
             this.ForeColor = System.Drawing.Color.White;
407 468
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
408 469
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
409
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
470
+            this.Margin = new System.Windows.Forms.Padding(4);
410 471
             this.MaximizeBox = false;
411 472
             this.MinimizeBox = false;
412 473
             this.Name = "ReprintForm";
@@ -414,6 +475,8 @@
414 475
             this.Load += new System.EventHandler(this.ReprintForm_Load);
415 476
             ((System.ComponentModel.ISupportInitialize)(this.numLastSeqNum)).EndInit();
416 477
             ((System.ComponentModel.ISupportInitialize)(this.numFirstSeqNum)).EndInit();
478
+            ((System.ComponentModel.ISupportInitialize)(this.numFirstPageNum)).EndInit();
479
+            ((System.ComponentModel.ISupportInitialize)(this.numLastPageNum)).EndInit();
417 480
             this.ResumeLayout(false);
418 481
             this.PerformLayout();
419 482
 
@@ -448,5 +511,10 @@
448 511
         private System.Windows.Forms.Label label11;
449 512
         private System.Windows.Forms.Label lblMinSeqNo;
450 513
         private System.Windows.Forms.Label lblMaxSeqNo;
514
+        private System.Windows.Forms.RadioButton rdoPageRange;
515
+        private System.Windows.Forms.NumericUpDown numFirstPageNum;
516
+        private System.Windows.Forms.NumericUpDown numLastPageNum;
517
+        private System.Windows.Forms.Label label2;
518
+        private System.Windows.Forms.Label label12;
451 519
     }
452 520
 }

+ 32 - 0
BulkPrinting/BulkPrinting/ReprintForm.cs

@@ -29,6 +29,8 @@ namespace BulkPrinting
29 29
         private Boolean CanReprintThisSession;
30 30
         private int MinSeqNo;
31 31
         private int MaxSeqNo;
32
+        private int MinPageNo;
33
+        private int MaxPageNo;
32 34
 
33 35
         private void ReprintForm_Load(object sender, EventArgs e)
34 36
         {
@@ -57,11 +59,20 @@ namespace BulkPrinting
57 59
                 }
58 60
             }
59 61
 
62
+            // TODO: what if the sequence numbers are contiguous from MinSeqNo to MaxSeqNo.
63
+            MinPageNo = 1;
64
+            MaxPageNo = (MaxSeqNo - MinSeqNo + 20) / 20;
65
+
60 66
             numFirstSeqNum.Minimum = MinSeqNo;
61 67
             numFirstSeqNum.Maximum = MaxSeqNo;
62 68
             numLastSeqNum.Minimum = MinSeqNo;
63 69
             numLastSeqNum.Maximum = MaxSeqNo;
64 70
 
71
+            numFirstPageNum.Minimum = MinPageNo;
72
+            numFirstPageNum.Maximum = MaxPageNo;
73
+            numLastPageNum.Minimum = MinPageNo;
74
+            numLastPageNum.Maximum = MaxPageNo;
75
+
65 76
             lblMinSeqNo.Text = MinSeqNo.ToString();
66 77
             lblMaxSeqNo.Text = MaxSeqNo.ToString();
67 78
         }
@@ -100,6 +111,27 @@ namespace BulkPrinting
100 111
                 SelectedRangeStart = (int)numFirstSeqNum.Value;
101 112
                 SelectedRangeEnd = (int)numLastSeqNum.Value;
102 113
             }
114
+            else if (rdoPageRange.Checked)
115
+            {
116
+                if (numFirstPageNum.Value < MinPageNo || numLastPageNum.Value > MaxPageNo)
117
+                {
118
+                    MessageBox.Show(String.Format("Valid page numbers are from {0} to {1}", MinPageNo.ToString(), MaxPageNo.ToString()), "Invalid print value", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
119
+                    return;
120
+                }
121
+
122
+                if (numFirstPageNum.Value > numLastPageNum.Value)
123
+                {
124
+                    MessageBox.Show("The first page number in the range must be less than or equal to the last.", "Invalid range", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
125
+                    return;
126
+                }
127
+
128
+                SelectedRangeStart = ((int)numFirstPageNum.Value - 1) * 20 + MinSeqNo;
129
+                SelectedRangeEnd = (int)numLastPageNum.Value * 20 + MinSeqNo - 1;
130
+                if (SelectedRangeEnd > MaxSeqNo)
131
+                {
132
+                    SelectedRangeEnd = MaxSeqNo;
133
+                }
134
+            }
103 135
             else if (rdoSerial.Checked) {
104 136
                 int PrintCount = int.Parse(Globals.DB.ExecuteScalar(
105 137
                     "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",

+ 29 - 3
BulkPrinting/BulkPrinting/Utility.cs

@@ -21,6 +21,26 @@ namespace BulkPrinting
21 21
         [DllImport("user32.dll", SetLastError = true)]
22 22
         public static extern bool PostMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
23 23
 
24
+        public static byte[] HexStringToBytes(string hex)
25
+        {
26
+            int numChars = hex.Length;
27
+            if (numChars % 2 != 0)
28
+            {
29
+                throw new FormatException("Invalid hex string length");
30
+            }
31
+        
32
+            byte[] bytes = new byte[numChars / 2];
33
+            for (int i = 0; i < numChars; i += 2)
34
+                bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
35
+            return bytes;
36
+        }
37
+
38
+        public static string GetPrinterInitString(DBHelper db)
39
+        {
40
+            var hex = GetSavedParameter(db, "PrinterInitString");
41
+            return Encoding.ASCII.GetString(HexStringToBytes(hex));
42
+        }
43
+
24 44
         public static string GetHDDSerial()
25 45
         {
26 46
             ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
@@ -409,9 +429,9 @@ namespace BulkPrinting
409 429
             int TotalCount = 0;
410 430
             string SerialNumberTrimmed;
411 431
             bool IsReprint;
432
+            string VendorId = Globals.SessionData.Credentials.Payload.Vendor.id.ToString();
412 433
 
413
-            var PrinterInitString = new StringBuilder();
414
-            PrinterInitString.Append(Printer.INITIALISE_PRINTER).Append(Printer.EMPHASISE_ON).Append(Printer.UNIDIRECTIONAL_OFF).Append(Printer.CHARPITCHELITE);
434
+            var PrinterInitString = GetPrinterInitString(db);
415 435
             int initJobID = Globals.MaxPrinter.Open("Printer_Init");
416 436
             if (initJobID == 0) return;
417 437
             Globals.MaxPrinter.Print(PrinterInitString.ToString());
@@ -481,7 +501,13 @@ namespace BulkPrinting
481 501
                                 IndividualVoucher = VoucherRow[Column];
482 502
                                 PrintRow += (Column == 2 ? " " : "") + IndividualVoucher.Description.PadRight(30, ' ');
483 503
                             }
484
-                            PrintRow = PrintRow.TrimEnd() + "\r\n\n\n\n\n\n\n\n\n\n\n";
504
+                            PrintRow = PrintRow.TrimEnd() + "\r\n";
505
+                            for (int Column = 0; Column < VoucherRow.Count(); Column++)
506
+                            {
507
+                                PrintRow += (Column == 2 ? " " : "") + VendorId.PadRight(30, ' ');
508
+                            }
509
+
510
+                            PrintRow = PrintRow.TrimEnd() + "\r\n\n\n\n\n\n\n\n\n\n";
485 511
                             Globals.MaxPrinter.Print(PrintRow);
486 512
                             foreach (PrintVoucher PrintedVoucher in VoucherRow)
487 513
                             {