home *** CD-ROM | disk | FTP | other *** search
/ Global Amiga Experience / globalamigaexperience.iso / applications / databases / sbase4pro / invoice / invoice.sbp < prev    next >
Text File  |  1995-07-10  |  7KB  |  310 lines

  1. SBP
  2.  ÿ½ *** Browning 3/14/91
  3.  ÿ½ *** Invoice driven by DML Procedural program
  4.  ÿ½ *** Learning example 
  5.  ÿ½ *** Requires V1.21 or greater
  6.  ÿ½ *** Not presented as a finished application
  7.  
  8.  ÿ³ÿ_ÿwErrTrap
  9.  ÿ¬ÿ…
  10.  ÿÊÿË""
  11.  
  12.  ÿ½ *** Initialize the panel, W$, and pan% for execute statement
  13.  ÿ½ *** used in WaitMenu: below.  W$ and pan% are modified by the  
  14.  ÿ½ *** routine in Column3:
  15.  ÿâÿe:w$ÿ"wait panel off or menu":pan%ÿ1
  16.  
  17.  ÿ´ÿ™"product"
  18.  ÿ´ÿœ"invoice"
  19.  
  20.  ÿ½ *** Set up menu structure
  21.  ÿ¬1,0,1,"&File      "
  22.  ÿ¬1,1,1,"&Print"
  23.  ÿ¬1,2,1,"&Setup printer"
  24.  ÿ¬1,3,3
  25.  ÿ¬1,4,1,"E&xit"
  26.  
  27.  ÿ¬2,0,1,"&Record    "
  28.  ÿ¬2,1,1,"&New"
  29.  ÿ¬2,2,3
  30.  ÿ¬2,3,1,"&Delete "
  31.  
  32.  
  33.  ÿ¬3,0,1,"&Utility   "
  34.  ÿ¬3,1,1,"&VCR Panel"
  35.  ÿ¬3,2,3
  36.  ÿ¬3,3,1,"&Shell"
  37.  
  38. WaitMenu: 
  39.  ÿÊÿË"Choose item from menu"
  40.  ÿ¬ÿ³column%,item%
  41.  ÿ–w$
  42.  ÿ³column%ÿvColumn1,Column2,Column3
  43.  ÿwWaitMenu 
  44.  
  45. Column1: ÿ½ *** File Menu
  46.  ÿÉÿæitem%
  47. ÿæ1
  48. ÿ¹ÿYÿíÿs0,0,0,0,0,0,0
  49. ÿæ2
  50. ÿÊÿhÿÂ
  51. ÿæ4
  52. ÿ:ÿ’
  53.  ÿ’ÿÉ
  54.  ÿÃ
  55.  
  56. Column2: ÿ½ *** Record Menu 
  57.  ÿÉÿæitem%
  58. ÿæ1
  59. ÿvEnterIt
  60. ÿæ3
  61. ÿvDeleteIt
  62.  ÿ’ÿÉ
  63.  ÿÃ
  64.  
  65. Column3: ÿ½ *** Utility Menu 
  66.  ÿÉÿæitem%
  67. ÿæ1:ÿ½ *** w$ is used in WaitMenu: 
  68. ÿ¡Pan%ÿ1ÿp
  69. w$ÿ"wait panel or menu"
  70. Pan%ÿ0
  71. ÿ^
  72. w$ÿ"panel off:wait panel off or menu"
  73. Pan%ÿ1
  74. ÿ’ÿ¡
  75. ÿæ3
  76. ÿƒ"newshell"
  77. ÿßÿ³
  78.  ÿ’ÿÉ
  79.  ÿÃ
  80.  
  81. EnterIt: ÿ½ *** Complete entry and validation of form data
  82.  ÿÿœ
  83. CustDataEntry: ÿ½ *** Handle customer entry and validation
  84.  ÿÊÿË"Enter full or partial customer code or N to create new customer"
  85.  ÿ”C_LINK.customer,1
  86.  ÿ½ *** Make user enter something
  87.  ÿØc_link.customerÿ""
  88. ÿÊÿË"*** Blank entry NOT accepted ***"
  89. ÿ›x%%ÿ1ÿq10:ÿ:ÿ±x%%
  90. ÿÏÿ›.7
  91. ÿÊÿË"Enter full or partial customer code or N to create new customer"
  92. ÿ”c_link.customer
  93.  ÿÙ
  94.  ÿÊÿË""
  95.  ÿ¡ÿ>(C_LINK.customer)ÿ"N"ÿpÿvAddNewCustomer
  96.  ÿ½ *** Find the record if it exists
  97.  ÿ¡ÿJ(C_LINK.customer,C_LINK.customer)ÿp
  98. ÿÉÿ¥C_LINK.customerÿ™"customer":ÿ½ *** Make the true record current
  99. ÿœ:ÿ½ *** Make it show on the form 
  100.  ÿ^
  101. ÿÂ"Choose Customer OR","Enter N for NEW",20,,C_LINK.customer,30,C_LINK.customer,COMPANY.customer
  102. ÿ¡ÿ>(C_LINK.customer)ÿ"N"ÿpÿvAddNewCustomer
  103. ÿÉÿ¥C_LINK.customerÿ™"customer"
  104. ÿœ
  105.  ÿ’ÿ¡
  106.  ÿÊÿË""
  107.  C_LINK.invhdrÿC_LINK.customer
  108.  D_LINK.invhdrÿÿI("invhdr")
  109. HeaderEntry: ÿ½ Handle invoice header information
  110.  ÿÊÿË"Enter SHIP TO address"
  111.  ÿ”scompany.invhdrÿqszip.invhdr:ÿ½ *** Enter Ship-to address
  112.  INVDATE.invhdrÿÿQ: ÿ½ *** Set date automatically
  113.  ÿÊÿË"Accept or modify terms"
  114.  INVTERMS.invhdrÿTERMS.customer: ÿ½ *** Move data in customer file to invhdr
  115.  ÿ”invterms.invhdr:ÿ½ *** Give the user the chance to modify
  116. BodyEntry: 
  117.  rct%%ÿ1:ÿ½ *** Set row counter
  118.  ÿ½ *** ORDER returns a negative when Escape key pressed 
  119.  ÿØÿµÿÿ1
  120. ÿÊÿË"Enter quantity"
  121. ÿ”quantity.ldetailÿ"rct%%
  122. ÿ¡quantity.ldetailÿ0ÿpÿ’ÿØ
  123. ÿÊÿË"Enter full or partial stock code"
  124. ÿ”stkcode.ldetailÿ"rct%%
  125. ÿ½ *** Do not accept a blank entry
  126. ÿØstkcode.ldetailÿ""
  127. ÿÊÿË"Blank entry NOT accepted"
  128. ÿ›x%%ÿ1ÿq10:ÿ:ÿ±x%%
  129. ÿÏÿ›.7
  130. ÿÊÿË"Enter full or partial stock code or N for new product"
  131. ÿ”stkcode.ldetailÿ"rct%%
  132. ÿÙ
  133. ÿ¡ÿ>(stkcode.ldetail)ÿ"N"ÿpÿvAddNewProduct
  134. LkUp: ÿ½ *** Verify stockcode exists and give option for new code.
  135. ÿ¡ÿD(stkcode.ldetail,stkcode.product)ÿp
  136. ÿ^
  137. ÿÂ"Choose code OR","Enter 'N' to add new code.",20,a%,stkcode.ldetail,50,stkcode.product,description.product
  138. ÿ¡ÿ>(stkcode.ldetail)ÿ"N"ÿpÿvAddNewProduct
  139. ÿwLkUp
  140. ÿ’ÿ¡
  141. ÿ½ *** Get data from product file and move it to ldetail file 
  142. description.ldetailÿdescription.product
  143. unitcost.ldetailÿunitcost.product
  144. extcost.ldetailÿ(quantity.ldetailÿunitcost.ldetail)
  145. ÿ½ *** Move data from file ldetail to current form transaction line and show it
  146. ÿÍÿœÿ"rct%%:ÿœ
  147. ÿ½ *** Move the cursor back to start of line so data can be modified
  148. ÿ½ *** Perhaps bad accounting practice but client wishes it
  149. ÿÊÿË"Accept or modify description line"
  150. ÿ”description.ldetailÿ"rct%%
  151. ÿÊÿË"Accept or modify unit price"
  152. ÿ”unitcost.ldetailÿ"rct%%
  153. ÿÊÿË""
  154. extcost.ldetailÿ(quantity.ldetailÿunitcost.ldetail)
  155. invtotal.invhdrÿÿl(extcost.ldetail)
  156. ÿÍÿœÿ"rct%%:ÿœ
  157. rct%%ÿrct%%ÿ1
  158.  ÿÙ
  159.  ÿÂ"Save this invoice?","",130,a%
  160.  ÿ¡a%ÿp
  161. ÿÌÿœ
  162.  ÿ^
  163. ÿÉÿœÿY
  164. ÿœ
  165.  ÿ’ÿ¡
  166.  ÿÃ
  167.  
  168. AddNewCustomer: ÿ½ *** 'N' was entered  
  169.  ÿÂ"Are you sure you want","to create a new customer?",130,a%
  170.  ÿ¡a%ÿp
  171. ÿÊÿË"Enter customer information"
  172. ÿÿ™"customer"
  173. ÿ”company.customerÿqzip.customer
  174. x%%ÿ1
  175. ky$ÿÿ+(company.customer,3)ÿÿ(x%%,"000.")
  176. ÿØÿJ(ky$,c_link.customer)
  177. x%%ÿx%%ÿ1
  178. ky$ÿÿ+(company,3)ÿÿ(x%%,"000.")
  179. ÿÙ
  180. c_link.customerÿky$
  181. ÿÂ"Add this customer","to customer file?",130,a%
  182. ÿ¡a%ÿp
  183. ÿÌÿ™"customer"
  184. ÿ^
  185. ÿÉÿœÿY
  186. ÿœ
  187. ÿwWaitMenu 
  188. ÿ’ÿ¡
  189. ÿœ
  190. ÿÃ
  191.  ÿ^
  192.  ÿÃ
  193.  ÿ’ÿ¡
  194.  ÿÃ
  195.  
  196. AddNewProduct: ÿ½ *** 'N' was entered in Lookup (Lkup) 
  197.  desc$ÿ"":unit%ÿ0:stkcode$ÿ""
  198.  ÿÂ"Are you sure you want","to create a new product entry?",130,a%
  199.  ÿ¡a%ÿp
  200. ÿœ2
  201. ÿÊÿË"Enter product description EXAMPLE: Widget Brown"
  202. 79 :ÿ”79:ÿ½ *** desc$
  203. ÿ¡ÿ/(desc$)ÿ
  204. 3ÿpÿw79
  205. ÿÊÿË"Enter product unitcost EXAMPLE: 14.98"
  206. 80 :ÿ”80:ÿ½ *** unit%
  207. ÿ¡unit%ÿ    0ÿpÿw80
  208. ÿÊÿË"Generating unique ID"
  209. ÿ½ *** Build unique stock code
  210. x%%ÿ1
  211. stkcode$ÿÿ+(desc$,3)ÿÿ(x%%,"000.")
  212. ÿØÿJ(stkcode$,stkcode.product)
  213. x%%ÿx%%ÿ1
  214. stkcode$ÿÿ+(desc$,3)ÿÿ(x%%,"000.")
  215. ÿÙ
  216. ÿœ
  217. ÿÂ"Add this product","to product file?",130,a%
  218. ÿ¡a%ÿp
  219. ÿÿ™"product"
  220. stkcode.productÿstkcode$
  221. description.productÿdesc$
  222. unitcost.productÿunit%
  223. ÿÌÿ™"product"
  224. ÿÉÿœÿ"rct%%
  225. stkcode.ldetailÿstkcode.product
  226. ÿ^
  227. ÿœ1
  228. ÿÃ
  229. ÿ’ÿ¡
  230. ÿœ1
  231. ÿÃ
  232.  ÿ^
  233.  ÿœ1
  234.  ÿÃ
  235.  ÿ’ÿ¡
  236.  ÿœ1
  237.  ÿÃ
  238.  
  239. DeleteIt: 
  240.  ÿ•dlt$
  241.  ÿ×dlt$(12)
  242.  dlt$(0)ÿ"1> Just this invoice"
  243.  dlt$(1)ÿ"2> Customer and all of its invoices"
  244.  rdlt$ÿ""
  245.  ÿÂ"Choose the appropriate deletion method","",20,a%,rdlt$,40,dlt$
  246.  ÿÉÿæÿ0(ÿ+(rdlt$,1))
  247. ÿæ1
  248. ÿÂ"Are you sure you wish","to delete this invoice?",148,a%
  249. ÿ¡a%ÿp
  250. ÿØÿD(d_link.invhdr,d_link.ldetail)
  251. ÿÉÿ¾ÿ™"ldetail"
  252. ÿÙ
  253. ÿÉÿ¾ÿ™"invhdr"
  254. ÿ^
  255. ÿÃ
  256. ÿ’ÿ¡
  257. ÿæ2
  258. ÿÂ"You are about to delete this customer","and ALL invoices! Are you SURE?",148,a%
  259. ÿ¡a%ÿp
  260. ÿØÿD(c_link.customer,c_link.invhdr)
  261. ÿØÿD(d_link.invhdr,d_link.ldetail)
  262. ÿÉÿ¾ÿ™"ldetail"
  263. ÿÙ
  264. ÿÉÿ¾ÿ™"invhdr"
  265. ÿÙ
  266. ÿÉÿ¾ÿ™"customer"
  267. ÿ^
  268. ÿÃ
  269. ÿ’ÿ¡
  270. ÿæÿ^
  271. ÿÃ
  272.  ÿ’ÿÉ
  273.  ÿÉÿœÿY
  274.  ÿœ
  275.  ÿÃ
  276.  
  277. ErrTrap: 
  278.  ÿÉÿæÿ&
  279. ÿæ10
  280. ÿ
  281. ÿy
  282. ÿæ8
  283. ÿy
  284. ÿæ11
  285. ÿÂ"Break detected","End program execution?",130,a%
  286. ÿ¡a%ÿp
  287. ÿ’
  288. ÿ^
  289. ÿy
  290. ÿæÿ^
  291. ÿ›x%%ÿ1ÿq10:ÿ:ÿ±x%%
  292. ÿÊÿË"*** Error "ÿÿ((ÿ&)ÿ" "ÿÿ(ÿ&,"000."):ÿ’
  293.  ÿ’ÿÉ
  294.  
  295.  
  296.