I et gammelt VB3 program har jeg denne kode til at printe en faktura med ramme omkring:
\'overskrift
\'--------------------------------------------------------------
On Error GoTo printfejl
printer.Print \"\" \'aktivér printer
printer.FontName = \"Times New Roman\"
printer.FontSize = 20
printer.FontBold = 1
\'printer.Print Tab(20); \"Joka\' Handel & Udlejning tlf. 5545 9678\"
printer.Print Tab(20); \"JkfSoft-demo tlf. 55 81 18 28\"
printer.Print Tab(20); \"Test\"
printer.FontSize = 16
printer.Print Tab(38); \"Spjellerup Bygade 52, 4262 Sandved.\"
printer.Print \"\"
printer.Print \"\"
printer.FontSize = 14
printer.FontName = \"Times New Roman\"
printer.Print Tab(16); stam(1) \'navn
printer.Print Tab(16); stam(2) \'adr
printer.Print Tab(16); stam(3) & \" \" & stam(4); Tab(70); \"Kundenr. \" & stam(0)
printer.FontBold = 0
printer.Print Tab(75); \"Faktura nr. \" & stam(5)
printer.Print Tab(75); \"Dato: \" & stam(6)
printer.FontSize = 12
printer.Print Tab(18); \"_____________________________________________________________________________\"
printer.Print \" \"
printer.Print Tab(20); \"Varenummer\"; Tab(35); \"Antal\"; Tab(45); \"Betegnelse\"; Tab(85); \"Enhedspris\"; Tab(105); \"Pris\"
printer.Print Tab(18); \"_____________________________________________________________________________\"
printer.Print \" \"
For x = 0 To fakpost - 1
xfa = 35
If Len(fa(x)) = 1 Then xfa = 38
If Len(fa(x)) = 2 Then xfa = 37
If Len(fa(x)) = 3 Then xfa = 36
xep = 84
If Len(ep(x)) = 4 Then xep = 89
If Len(ep(x)) = 5 Then xep = 88
If Len(ep(x)) = 6 Then xep = 87
If Len(ep(x)) = 7 Then xep = 86
If Len(ep(x)) = 8 Then xep = 85
xup = 100
If Len(ump(x)) = 4 Then xup = 105
If Len(ump(x)) = 5 Then xup = 104
If Len(ump(x)) = 6 Then xup = 103
If Len(ump(x)) = 7 Then xup = 102
If Len(ump(x)) = 8 Then xup = 101
printer.Print Tab(20); fnr(x); Tab(xfa); fa(x); Tab(42); betegn(x); Tab(xep); ep(x); Tab(xup); ump(x)
If Val(ump(x)) > 0 Then formoms = formoms + Val(ump(x) * 100) / 100
Next
For x = 0 To 25 - fakpost
printer.Print \"\" \'tomme linier for at få sum nederst
Next
printer.Print Tab(18); \"_____________________________________________________________________________\"
antlin = Len(Format(formoms, \"fixed\"))
xup = 99
If antlin = 4 Then xup = 105
If antlin = 5 Then xup = 104
If antlin = 6 Then xup = 103
If antlin = 7 Then xup = 102
If antlin = 8 Then xup = 101
If antlin = 9 Then xup = 100
printer.Print Tab(85); \"subtotal\"; Tab(xup); Format(formoms, \"fixed\")
subtotal = Format(formoms, \"fixed\") \'til faktura-database
If rabat > 0 Then
antlin = Len(Format(rabat, \"fixed\"))
xup = 101
If antlin = 4 Then xup = 104
If antlin = 5 Then xup = 103
If antlin = 6 Then xup = 102
printer.Print Tab(85); \"Prisafslag\"; Tab(xup); \"- \" & Format(rabat, \"fixed\")
End If
antlin = Len(Format((formoms - rabat) * .25, \"fixed\"))
xup = 99
If antlin = 4 Then xup = 105
If antlin = 5 Then xup = 104
If antlin = 6 Then xup = 103
If antlin = 7 Then xup = 102
If antlin = 8 Then xup = 101
If antlin = 9 Then xup = 100
printer.Print Tab(85); \"25% moms\"; Tab(xup); Format((formoms - rabat) * .25, \"fixed\")
momsbelob = Format((formoms - rabat) * .25, \"fixed\") \'til faktura-database
printer.Print Tab(18); \"_____________________________________________________________________________\"
printer.Print \"\"
printer.FontBold = 1
printer.FontSize = 16
printer.Print Tab(48); \"Fakturabeløb kr.\"; Tab(73); Format((formoms - rabat) * 1.25, \"fixed\")
fakbelob = Format((formoms - rabat) * 1.25, \"fixed\") \'til faktura-database
printer.Print Tab(14); \"=================================================\"
printer.FontBold = 0
printer.FontSize = 12
printer.Print Tab(25); \"Betalingsbetingelser: 10 dage fra fakturadato med mindre andet er aftalt\"
printer.Print \"\"
printer.Print Tab(20); stam(7)
printer.Print \"\"
printer.Print \"\"
\'printer.Print Tab(20); \"E-post: joka@adr.dk\"; Tab(50); \"Internet:
www.jokahandel.dk\"; Tab(90); \"Mobiltlf. 4063 9678\"
printer.DrawWidth = 2
printer.Print Tab(22); \"E-post: salg@jkfsoft.dk\"; Tab(55); \"Internet:
www.jkfsoft.dk\"; Tab(90); \"Tlf. 5581 1828\"
printer.DrawWidth = 1
printer.Line (1630, 1600)-(10870, 14500), , B
printer.Line (1630, 15200)-(10870, 15600), , B
printer.EndDoc
Exit Sub
printfejl:
x = MsgBox(\"Printeren melder fejl, undersøg printer og papir - muligvis mangler du bare fonten Vagabond.\", 16, \"Medd. fra udskriv faktura.\")
Exit Sub
Resume Next
M.v.h. Jørn