home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / WordProcessors / DAT-WW5C.DMS / in.adf / Archive / WwRexx.lha / Create_An_Invoice < prev    next >
Encoding:
Text File  |  1996-02-09  |  7.2 KB  |  365 lines

  1. /*    Create_An_Invoice
  2.  
  3.         Digita Wizard Script for Wordworth 5
  4.         Copyright ©1996, Digita International Ltd.
  5.         
  6.         Created: 19 January 1996
  7.         Author:  Mark Jackson
  8.  
  9.         Note: This Wizard contains DigiSense -
  10.             ° It calculates the total cost for each item (individual
  11.               price x quantity),
  12.             ° It adds up the overall total,
  13.             ° It automatically capitalises post codes,
  14.             ° It leaves out any blank address lines, so that you do
  15.               not have to fill in all of the fields.
  16. */
  17.  
  18.  
  19. OPTIONS FailAt 100
  20. OPTIONS RESULTS
  21.  
  22.  
  23. /* Default contents */
  24. invname = "Liz Oaten"
  25. invcompany = "Digita International Ltd."
  26. invadd1 = "Black Horse House"
  27. invadd2 = "Exmouth"
  28. invadd3 = "Devon"
  29. invpostcode = "EX8 1JL"
  30. invcountry = "England"
  31. fromname = invname
  32. company = invcompany
  33. add1 = invadd1
  34. add2 = invadd2
  35. add3 = invadd3
  36. postcode = invpostcode
  37. country = invcountry
  38.  
  39. custinvname = "Customer's Name"
  40. custinvcompany = "Customer's Company"
  41. custinvadd1 = "Customer's Address"
  42. custinvadd2 = "Customer's Address"
  43. custinvadd3 = "Customer's Address"
  44. custinvpostcode = "Customer's Address"
  45. custinvcountry = "Customer's Address"
  46. custname = custinvname
  47. custcompany = custinvcompany
  48. custadd1 = custinvadd1
  49. custadd2 = custinvadd2
  50. custadd3 = custinvadd3
  51. custpostcode = custinvpostcode
  52. custcountry = custinvcountry
  53.  
  54. defname = ""
  55. defcompany = ""
  56. defadd1 = ""
  57. defadd2 = ""
  58. defadd3 = ""
  59. defpostcode = ""
  60. defcountry = ""
  61.  
  62. defcustname = ""
  63. defcustcompany = ""
  64. defcustadd1 = ""
  65. defcustadd2 = ""
  66. defcustadd3 = ""
  67. defcustpostcode = ""
  68. defcustcountry = ""
  69.  
  70. product. = ""
  71. price. = ""
  72. quantity. = ""
  73.  
  74. prodcount = 1
  75. product.prodcount = "Widget"
  76. price.prodcount = "5.55"
  77. quantity.prodcount = "10"
  78.  
  79.  
  80. /* Foreign users can change the currency symbol below,
  81.    e.g. to 'DM' for German currency or "$" for USA.   */
  82. currency = "£"
  83.  
  84. /* Start */
  85. START:
  86. WizardReq TITLE "Invoice Wizard" LABEL "This Wizard will help you create a Sales Invoice." LABEL "" LABEL " Click Next or press Enter to continue to the next step" LABEL " click Previous to return to the previous step, if available" LABEL " click Cancel to quit without creating an invoice or" LABEL " click Finish to create an invoice using the default parameters." BUTTON 1 "_Next" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
  87. if (Result = "-1") THEN
  88.     EXIT
  89. if (Result = 3) THEN
  90.     SIGNAL FINISH    
  91.  
  92.  
  93. /* Step 1 */
  94. STEP1:
  95. WizardReq TITLE "Invoice Wizard" LABEL "Please type your details:" LABEL "" TEXTBOX 1 "N_ame:" CONTENTS defname TEXTBOX 2 "Co_mpany:" CONTENTS defcompany TEXTBOX 3 "Address _1:" CONTENTS defadd1 TEXTBOX 4 "Address _2:" CONTENTS defadd2 TEXTBOX 5 "Address _3:" CONTENTS defadd3 TEXTBOX 6 "P_ost Code:" CONTENTS defpostcode TEXTBOX 7 "Count_ry:" CONTENTS defcountry BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
  96. buttonresult = Result
  97. if (buttonresult = -1) THEN
  98.     EXIT
  99. if (buttonresult = 2) THEN
  100.     SIGNAL START
  101.  
  102. /* Get and store results */
  103. Wizard_GetTextBox 1
  104. fromname = Result
  105.  
  106. Wizard_GetTextBox 2
  107. company = Result
  108.  
  109. Wizard_GetTextBox 3
  110. add1 = Result
  111.  
  112. Wizard_GetTextBox 4
  113. add2 = Result
  114.  
  115. Wizard_GetTextBox 5
  116. add3 = Result
  117.  
  118. Wizard_GetTextBox 6
  119. postcode = UPPER(Result)
  120.  
  121. Wizard_GetTextBox 7
  122. country = Result
  123.  
  124.  
  125. if (buttonresult = 3) THEN
  126.     SIGNAL FINISH
  127.  
  128.  
  129. /* Step 2 */
  130. STEP2:
  131. WizardReq TITLE "Invoice Wizard" LABEL "Please type your customers details:" LABEL "" TEXTBOX 1 "N_ame:" CONTENTS defcustname TEXTBOX 2 "Co_mpany:" CONTENTS defcustcompany TEXTBOX 3 "Address _1:" CONTENTS defcustadd1 TEXTBOX 4 "Address _2:" CONTENTS defcustadd2 TEXTBOX 5 "Address _3:" CONTENTS defcustadd3 TEXTBOX 6 "_Post Code:" CONTENTS defcustpostcode TEXTBOX 7 "Count_ry:" CONTENTS defcustcountry BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
  132. buttonresult = Result
  133. if (buttonresult = -1) THEN
  134.     EXIT
  135. if (buttonresult = 2) THEN DO
  136.     defname = fromname
  137.     defcompany = company
  138.     defadd1 = add1
  139.     defadd2 = add2
  140.     defadd3 = add3
  141.     defpostcode = postcode
  142.     defcountry = country
  143.     SIGNAL STEP1
  144.     END
  145.  
  146. /* Get and store results */
  147. Wizard_GetTextBox 1
  148. custname = Result
  149.  
  150. Wizard_GetTextBox 2
  151. custcompany = Result
  152.  
  153. Wizard_GetTextBox 3
  154. custadd1 = Result
  155.  
  156. Wizard_GetTextBox 4
  157. custadd2 = Result
  158.  
  159. Wizard_GetTextBox 5
  160. custadd3 = Result
  161.  
  162. Wizard_GetTextBox 6
  163. custpostcode = UPPER(Result)
  164.  
  165. Wizard_GetTextBox 7
  166. custcountry = Result
  167.  
  168.  
  169. if (buttonresult = 3) THEN
  170.     SIGNAL FINISH
  171.  
  172.  
  173. /* Step 3 */
  174. STEP3:
  175. finished = 0
  176. prodcount = 0
  177.  
  178. DO WHILE finished = 0
  179.     prodcount = prodcount + 1
  180.     WizardReq TITLE "Invoice Wizard" LABEL "Please type the invoice details:" LABEL "" TEXTBOX 1 "_Product:" TEXTBOX 2 "P_rice:" TEXTBOX 3 "_Quantity:" BUTTON 1 "_Another" BUTTON 2 "No _More" BUTTON "-1" "_Cancel"
  181.     buttonresult = Result
  182.     If buttonresult = -1  THEN
  183.         Exit
  184.     If buttonresult = 2 THEN
  185.         Finished = 1
  186.  
  187.     Wizard_GetTextBox 1
  188.     if Result ~= "" THEN
  189.         product.prodcount = Result
  190.  
  191.     Wizard_GetTextBox 2
  192.     if Result ~= "" THEN
  193.         price.prodcount = Result
  194.  
  195.     Wizard_GetTextBox 3
  196.     if Result ~= "" THEN
  197.         quantity.prodcount = Result
  198. END
  199.  
  200.  
  201. /* Create Invoice */
  202. FINISH:
  203. New
  204. ADDRESS VALUE Result
  205.  
  206. Document A4 "0.5in" "0.5in" "0.6in" "1.0in"
  207.  
  208. Paragraph 0 0 0 CENTRE AUTO SINGLE NONE NONE
  209. Font NAME "Shannon Book" SIZE 30 BOLD WIDTH 400
  210. Smallcaps
  211. Text 'Invoice'
  212. Smallcaps
  213.  
  214. NewParagraph
  215. LeftJustify
  216. Font SIZE 14 PLAIN WIDTH 100
  217. NewParagraph
  218.  
  219. Insertdate
  220.  
  221. NewParagraph
  222. NewParagraph
  223. NewParagraph
  224.  
  225. Bold
  226. Text 'FROM:'
  227. NewParagraph
  228. Plain
  229.  
  230. /* Your Details */
  231. if fromname ~= "" THEN DO
  232.     Text fromname
  233.     NewParagraph
  234. END
  235. if company ~= "" THEN DO
  236.     Text company
  237.     NewParagraph
  238. END
  239. if add1 ~= "" THEN DO
  240.     Text add1
  241.     NewParagraph
  242. END
  243. if add2 ~= "" THEN DO
  244.     Text add2
  245.     NewParagraph
  246. END
  247. if add3 ~= "" THEN DO
  248.     Text add3
  249.     NewParagraph
  250. END
  251. if postcode ~= "" THEN DO
  252.     Text postcode
  253.     NewParagraph
  254. END
  255. if country ~= "" THEN DO
  256.     Text country
  257.     NewParagraph
  258. END
  259.  
  260. NewParagraph
  261. NewParagraph
  262.  
  263. Bold
  264. Text 'TO:'
  265. NewParagraph
  266. Plain
  267.  
  268. /* Customers Details */
  269. if custname ~= "" THEN DO
  270.     Text custname
  271.     NewParagraph
  272. END
  273. if custcompany ~= "" THEN DO
  274.     Text custcompany
  275.     NewParagraph
  276. END
  277. if custadd1 ~= "" THEN DO
  278.     Text custadd1
  279.     NewParagraph
  280. END
  281. if custadd2 ~= "" THEN DO
  282.     Text custadd2
  283.     NewParagraph
  284. END
  285. if custadd3 ~= "" THEN DO
  286.     Text custadd3
  287.     NewParagraph
  288. END
  289. if custpostcode ~= "" THEN DO
  290.     Text custpostcode
  291.     NewParagraph
  292. END
  293. if custcountry ~= "" THEN DO
  294.     Text custcountry
  295.     NewParagraph
  296. END
  297.  
  298. NewParagraph
  299. NewParagraph
  300.  
  301. Bold
  302. SetTab LEFT "1.0in"
  303. SetTab LEFT "2.9in"
  304. SetTab LEFT "4.1in"
  305. SetTab LEFT "5.6in"
  306. Paragraph 0 0 0 LEFT AUTO SINGLE NONE "4 pt"
  307.  
  308. Text '    PRODUCT    PRICE    QUANTITY    TOTAL'
  309. Plain
  310.  
  311. NewParagraph
  312. Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE
  313.  
  314. finaltotal = 0
  315. loopcount = 0
  316. DO WHILE loopcount ~= prodcount
  317.     loopcount = loopcount + 1
  318.     
  319.     Text "    "
  320.     Text product.loopcount
  321.     Text "    "
  322.     Text price.loopcount
  323.     Text "    "
  324.     Text quantity.loopcount
  325.     Text "    "
  326.     prodtotal = price.loopcount * quantity.loopcount
  327.     Text prodtotal
  328.     NewParagraph
  329.     finaltotal = finaltotal + prodtotal
  330. END
  331.  
  332. Paragraph 0 0 0 LEFT AUTO SINGLE "4 pt" NONE
  333.  
  334. Text '                '
  335. Text currency
  336. Text finaltotal
  337.  
  338. NewParagraph
  339. Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE
  340. NewParagraph
  341. NewParagraph
  342.  
  343. CentreJustify
  344. Bold
  345. Text 'Thank you for your order'
  346. Plain
  347. NewParagraph
  348. NewParagraph
  349. NewParagraph
  350. RightJustify
  351. Font SIZE 9 ITALIC
  352. Text 'Payment is required within 28 days.  E&OE.'
  353. Plain
  354.  
  355. RequestResponse "Save Document?"
  356. If (RC = 0) THEN
  357.     SaveAs
  358.  
  359. RequestResponse "Print Document?"
  360. If (RC = 0) THEN
  361.     Print
  362.  
  363. RequestNotify PROMPT "The Sales Invoice Wizard has finished."
  364. End
  365.