/* Create_An_Invoice Digita Wizard Script for Wordworth 7 Copyright ©1998, Digita International Ltd. Created: 19 January 1996 Author: Mark Jackson Note: This Wizard contains DigiSense - ° It calculates the total cost for each item (individual price x quantity), ° It adds up the overall total, ° It automatically capitalises post codes, ° It leaves out any blank address lines, so that you do not have to fill in all of the fields. */ OPTIONS FailAt 100 OPTIONS RESULTS /* Default contents */ invname = "Liz Haynes" invcompany = "Digita International Ltd." invadd1 = "Rolle Street" invadd2 = "Exmouth" invadd3 = "Devon" invpostcode = "EX8 1HE" invcountry = "England" fromname = invname company = invcompany add1 = invadd1 add2 = invadd2 add3 = invadd3 postcode = invpostcode country = invcountry custinvname = "Customer's Name" custinvcompany = "Customer's Company" custinvadd1 = "Customer's Address" custinvadd2 = "Customer's Address" custinvadd3 = "Customer's Address" custinvpostcode = "Customer's Address" custinvcountry = "Customer's Address" custname = custinvname custcompany = custinvcompany custadd1 = custinvadd1 custadd2 = custinvadd2 custadd3 = custinvadd3 custpostcode = custinvpostcode custcountry = custinvcountry defname = "" defcompany = "" defadd1 = "" defadd2 = "" defadd3 = "" defpostcode = "" defcountry = "" defcustname = "" defcustcompany = "" defcustadd1 = "" defcustadd2 = "" defcustadd3 = "" defcustpostcode = "" defcustcountry = "" product. = "" price. = "" quantity. = "" prodcount = 1 product.prodcount = "Widget" price.prodcount = "5.55" quantity.prodcount = "10" /* Foreign users can change the currency symbol below, e.g. to 'DM' for German currency or "$" for USA. */ currency = "£" /* Start */ START: 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" if (Result = "-1") THEN EXIT if (Result = 3) THEN SIGNAL FINISH /* Step 1 */ STEP1: 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" buttonresult = Result if (buttonresult = -1) THEN EXIT if (buttonresult = 2) THEN SIGNAL START /* Get and store results */ Wizard_GetTextBox 1 fromname = Result Wizard_GetTextBox 2 company = Result Wizard_GetTextBox 3 add1 = Result Wizard_GetTextBox 4 add2 = Result Wizard_GetTextBox 5 add3 = Result Wizard_GetTextBox 6 postcode = UPPER(Result) Wizard_GetTextBox 7 country = Result if (buttonresult = 3) THEN SIGNAL FINISH /* Step 2 */ STEP2: 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" buttonresult = Result if (buttonresult = -1) THEN EXIT if (buttonresult = 2) THEN DO defname = fromname defcompany = company defadd1 = add1 defadd2 = add2 defadd3 = add3 defpostcode = postcode defcountry = country SIGNAL STEP1 END /* Get and store results */ Wizard_GetTextBox 1 custname = Result Wizard_GetTextBox 2 custcompany = Result Wizard_GetTextBox 3 custadd1 = Result Wizard_GetTextBox 4 custadd2 = Result Wizard_GetTextBox 5 custadd3 = Result Wizard_GetTextBox 6 custpostcode = UPPER(Result) Wizard_GetTextBox 7 custcountry = Result if (buttonresult = 3) THEN SIGNAL FINISH /* Step 3 */ STEP3: finished = 0 prodcount = 0 DO WHILE finished = 0 prodcount = prodcount + 1 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" buttonresult = Result If buttonresult = -1 THEN Exit If buttonresult = 2 THEN Finished = 1 Wizard_GetTextBox 1 if Result ~= "" THEN product.prodcount = Result Wizard_GetTextBox 2 if Result ~= "" THEN price.prodcount = Result Wizard_GetTextBox 3 if Result ~= "" THEN quantity.prodcount = Result END /* Create Invoice */ FINISH: New ADDRESS VALUE Result Document A4 "0.5in" "0.5in" "0.6in" "1.0in" Paragraph 0 0 0 CENTRE AUTO SINGLE NONE NONE Font NAME "Shannon Book" SIZE 30 BOLD WIDTH 400 Smallcaps Text 'Invoice' Smallcaps NewParagraph LeftJustify Font SIZE 14 PLAIN WIDTH 100 NewParagraph Insertdate NewParagraph NewParagraph NewParagraph Bold Text 'FROM:' NewParagraph Plain /* Your Details */ if fromname ~= "" THEN DO Text fromname NewParagraph END if company ~= "" THEN DO Text company NewParagraph END if add1 ~= "" THEN DO Text add1 NewParagraph END if add2 ~= "" THEN DO Text add2 NewParagraph END if add3 ~= "" THEN DO Text add3 NewParagraph END if postcode ~= "" THEN DO Text postcode NewParagraph END if country ~= "" THEN DO Text country NewParagraph END NewParagraph NewParagraph Bold Text 'TO:' NewParagraph Plain /* Customers Details */ if custname ~= "" THEN DO Text custname NewParagraph END if custcompany ~= "" THEN DO Text custcompany NewParagraph END if custadd1 ~= "" THEN DO Text custadd1 NewParagraph END if custadd2 ~= "" THEN DO Text custadd2 NewParagraph END if custadd3 ~= "" THEN DO Text custadd3 NewParagraph END if custpostcode ~= "" THEN DO Text custpostcode NewParagraph END if custcountry ~= "" THEN DO Text custcountry NewParagraph END NewParagraph NewParagraph Bold SetTab LEFT "1.0in" SetTab LEFT "2.9in" SetTab LEFT "4.1in" SetTab LEFT "5.6in" Paragraph 0 0 0 LEFT AUTO SINGLE NONE "4 pt" Text ' PRODUCT PRICE QUANTITY TOTAL' Plain NewParagraph Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE finaltotal = 0 loopcount = 0 DO WHILE loopcount ~= prodcount loopcount = loopcount + 1 Text " " Text product.loopcount Text " " Text price.loopcount Text " " Text quantity.loopcount Text " " prodtotal = price.loopcount * quantity.loopcount Text prodtotal NewParagraph finaltotal = finaltotal + prodtotal END Paragraph 0 0 0 LEFT AUTO SINGLE "4 pt" NONE Text ' ' Text currency Text finaltotal NewParagraph Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE NewParagraph NewParagraph CentreJustify Bold Text 'Thank you for your order' Plain NewParagraph NewParagraph NewParagraph RightJustify Font SIZE 9 ITALIC Text 'Payment is required within 28 days. E&OE.' Plain RequestResponse "Save Document?" If (RC = 0) THEN SaveAs RequestResponse "Print Document?" If (RC = 0) THEN Print RequestNotify PROMPT "The Sales Invoice Wizard has finished." End