home *** CD-ROM | disk | FTP | other *** search
/ PC Direkt 1998 #11 / PCDIREKT_1198.bin / SHOWDATA / ECKESHOP.DXR / 00039_print2.ls < prev    next >
Encoding:
Text File  |  1998-03-20  |  3.8 KB  |  125 lines

  1. global gPrintText
  2.  
  3. on printit_Xtra
  4.   global printer, gpropfont, gmonofont, Xtrapath, sharedPath
  5.   if not objectp(printer) then
  6.     alert("There is no currently selected printer. Printing features are disabled.")
  7.   else
  8.     cursor(4)
  9.     if the platform contains "mac" then
  10.       set bild1 to "bestell1.pct"
  11.       set bild2 to "bestell2.pct"
  12.     else
  13.       set bild1 to "bestell1.bmp"
  14.       set bild2 to "bestell2.bmp"
  15.     end if
  16.     reset(printer)
  17.     setDocumentName(printer, "AOL-Shop")
  18.     setMargins(printer, rect(20, 48, 20, 40))
  19.     newPage(printer)
  20.     newFrame(printer, rect(0, 0, getPaperWidth(printer), 415), 0)
  21.     set myfile to sharedPath & bild1
  22.     appendFile(printer, myfile)
  23.     setTextFont(printer, gmonofont)
  24.     setTextSize(printer, 10)
  25.     setTextStyle(printer, "normal")
  26.     setTextJust(printer, "left")
  27.     newFrame(printer, rect(60, 220, getPaperWidth(printer), 415), 0)
  28.     append(printer, gPrintText)
  29.     newFrame(printer, rect(0, getPaperHeight(printer) / 2, getPaperWidth(printer), getPaperHeight(printer)), 0)
  30.     set myfile to sharedPath & bild2
  31.     appendFile(printer, myfile)
  32.     setProgressMsg(printer, "Das Bestellformular wird gedruckt.")
  33.     cursor(-1)
  34.     if doJobSetup(printer) = 1 then
  35.       updateStage()
  36.       printPreview(printer)
  37.       print(printer)
  38.     end if
  39.   end if
  40.   if objectp(printer) then
  41.     set printer to 0
  42.   end if
  43. end
  44.  
  45. on fieldmani
  46.   set gPrintText to EMPTY & RETURN
  47.   leftText("Anz", 5, " ")
  48.   leftText("Produkt", 51, " ")
  49.   leftText("Einzel", 8, " ")
  50.   leftText("Gesamt", 8, " ")
  51.   leftText(RETURN, 0, EMPTY)
  52.   leftText(EMPTY, 70, "_")
  53.   leftText(RETURN, 0, EMPTY)
  54.   repeat with i = 1 to the number of lines in field "Name2" - 1
  55.     rightText(line i of field "Anzahl2", 3, " ")
  56.     leftText(EMPTY, 2, " ")
  57.     leftText(line i of field "Name2", 51, ".")
  58.     rightText(line i of field "EPreis2", 6, ".")
  59.     rightText(line i of field "GPreis2", 8, " ")
  60.     leftText(RETURN, 0, EMPTY)
  61.   end repeat
  62.   leftText(EMPTY, 70, "_")
  63.   leftText(RETURN, 0, EMPTY)
  64.   rightText(the text of field "summe", 70, " ")
  65.   leftText(RETURN, 0, EMPTY)
  66.   rightText("Versandkostenpauschale:    6.95", 70, " ")
  67.   leftText(RETURN, 0, EMPTY)
  68.   rightText("_______", 70, " ")
  69.   leftText(RETURN, 0, EMPTY)
  70.   rightText("Summe:", 62, " ")
  71.   rightText(chckStr(float(value(field "summe")) + 6.95000000000000018), 8, " ")
  72.   return gPrintText
  73. end
  74.  
  75. on chckStr fl
  76.   set i to integer(fl)
  77.   if float(i) > fl then
  78.     set i to i - 1
  79.   end if
  80.   set fract to integer((fl - float(i)) * 100.0)
  81.   if fract < 10 then
  82.     set frstr to "0" & string(fract)
  83.   else
  84.     set frstr to string(fract)
  85.   end if
  86.   return string(i) & "." & frstr
  87. end
  88.  
  89. on leftText T, n, c
  90.   set gPrintText to gPrintText & char 1 to n of T
  91.   set m to n - length(T)
  92.   if m > 0 then
  93.     repeat with i = 1 to m
  94.       set gPrintText to gPrintText & c
  95.     end repeat
  96.   end if
  97. end
  98.  
  99. on rightText T, n, c
  100.   set m to n - length(T)
  101.   if m > 0 then
  102.     repeat with i = 1 to m
  103.       set gPrintText to gPrintText & c
  104.     end repeat
  105.   end if
  106.   set gPrintText to gPrintText & char 1 to n of T
  107. end
  108.  
  109. on oldfieldmani
  110.   set the text of member "Anzahl3" to "Anzahl" & RETURN & the text of field "Anzahl2"
  111.   set the textSize of member "Anzahl3" to 10
  112.   set the textSize of line 1 of member "Anzahl3" to 14
  113.   set the text of member "Name3" to "Produkt" & RETURN & the text of field "Name2"
  114.   set the textSize of member "Name3" to 10
  115.   set the textSize of line 1 of member "Name3" to 14
  116.   set the text of member "EPreis3" to "Einzelpreis" & RETURN & the text of field "EPreis2"
  117.   set the textSize of member "EPreis3" to 10
  118.   set the textSize of line 1 of member "EPreis3" to 14
  119.   set the text of member "GPreis3" to "Gesamtpreis" & RETURN & the text of field "GPreis2"
  120.   set the textSize of member "GPreis3" to 10
  121.   set the textSize of line 1 of member "GPreis3" to 14
  122.   set the text of member "Summe3" to the text of field "Summe"
  123.   set the textSize of member "Summe3" to 14
  124. end
  125.