1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
| package util;
import java.awt.*;
import java.awt.print.*;
import java.awt.geom.*;
import Interface.*;
import java.rmi.*;
import java.util.*;
public class Printing implements Printable
{
public static IEcr ecr;
public static void InzetFormulierProductieEcr(IEcr ecr2) {
ecr=ecr2;
boolean showPrintDialog = true;
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(new Printing());
PrinterJob pJ = PrinterJob.getPrinterJob();
Paper A4_paper = new Paper();
A4_paper.setSize(595, 845);
A4_paper.setImageableArea(60, 60, 451, 698);
PageFormat pF = new PageFormat();
pF.setOrientation(PageFormat.PORTRAIT);
pF.setPaper(A4_paper);
Printing painter = new Printing ();
Book book = new Book();
book.append(painter, pF);
pJ.setPageable(book);
try {
pJ.print();
}
catch (PrinterException pE) {
System.out.println("Printing Error");
}
}
public int print (Graphics g, PageFormat pf, int pageIndex)
{
if(pageIndex==0)
{
g.setFont(new Font("Arial", Font.BOLD, 24));
g.drawString("Inzet Formulier Production", 125, 100); // Draw the letter 1 at pixel coordinates (100,100)
g.setFont(new Font("Arial", Font.PLAIN, 8));
g.drawString( "PEARLCHAIN INVULFORMULIER t.b.v. INZET NIEUWE OF VERANDERDE PRODUCTEN",110, 120);
g.setColor(Color.BLACK);
g.drawRect(75, 125, 440, 75);
g.drawString("Ecr Type", 85, 140);
g.drawString("ECR Number", 175, 140);
g.drawString("Ingangs Datum", 275, 140);
g.drawString("Project/Running", 375, 140);
g.drawString("Cartype", 450, 140);
try {
g.drawString(ecr.getEcrType(), 85, 150);
g.drawString(ecr.getEcrNumber().toString(), 175, 150);
g.drawString(DatumConvert.calendarToString(ecr.getImplementationDate(),
"dd-MM-yyyy"), 275, 150);
g.drawString(ecr.getProject().toString(), 375, 150);
Vector cartype = (Vector) ecr.getCarType();
int y = 150;
for (int i = 0; i < cartype.size(); i++) {
ICarType icartype = (ICarType) cartype.get(i);
g.drawString(icartype.getCarType(), 450, y);
y += 10;
}
g.drawString("Part Nummer", 85, 225);
g.drawString("Oude Index", 175, 225);
g.drawString("Nieuwe Index", 275, 225);
g.drawString("Omschrijving", 375, 225);
Vector parts = ecr.getParts();
y = 250;
for (int i = 0; i < parts.size(); i++) {
IParts tempPart = (IParts) parts.get(i);
g.drawString("" + tempPart.getPartNumber(), 85, y);
g.drawString("" + tempPart.getOldIndex(), 175, y);
g.drawString("" + tempPart.getNewIndex(), 275, y);
g.drawString("" + tempPart.getPartDescription(), 375, y);
y += 20;
}
g.drawString("Pearchain nummer eerste inzet", 85, y);
y += 5;
g.drawRect(75, y, 440, 75);
for (int i = 0; i < 100; i++) {
g.drawString("Pearchain nummer eerste inzet", 85, y);
y += 20;
}
}
catch (RemoteException ex) {
System.out.println("Reading ecr data failed: " + ex.toString());
}
return PAGE_EXISTS;
}
else
{
return NO_SUCH_PAGE;
}
}
} |