Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
****************************************************************
** SUMMARY.PRG - generalized sales item display function
** J Osako 13 Mar 1996 'This code is cursed'
** Copyright 1996 The Used Computer Store, All Rights Reserved
****************************************************************
PUBLIC TaxRate, zilch
TaxRate = 0.0825
clearage = 1
IF .F. && dummy code for project mangler
DO next IN in_item
DO prev IN in_item
ENDIF
*FUNCTION summary
**********
** summary() - shows the first line of each item record
** and generates a price report for all the items.
DO item_scr && redraw a clean screen
M.itemno = 0
subtotal = 0.00
***************
** first, go thru the records for all the items
** and print them to screen, summing up the prices
** along the way
** WARNING: THIS WILL BREAK WITH MORE THAN listingline-1 ITEMS!!!!!
DO WHILE next() AND M.itemno < listing_line
localsub = price * qty && the full price of current item
@M.itemno+spaced, qty_pos SAY qty SIZE 1,qty_len-1
@ROW(), item_pos SAY LEFT(MLINE(item, 1),item_len)
@ROW(), ser_pos SAY LEFT(MLINE(serialnum,1),ser_len)
@ROW(), stock_pos SAY stocknum SIZE 1,stock_len
@ROW(), war_pos SAY warranty SIZE 1, war_len
@ROW(), price_pos+2 SAY localsub;
SIZE 1, price_len
subtotal = subtotal + localsub && now add the price totals
ENDDO
*****************
** next, print out the subtotal, tax and total for the
**
tax = ROUND((subtotal * TaxRate),2)
tot_l = subtotal + tax
IF tot_l < 0 && Can't Happen
DO oops WITH 'Price calculation error'
ENDIF
@listing_line + clearage, price_pos - 9 SAY 'Subtotal'
@ROW(),price_pos+2 SAY subtotal SIZE 1, price_len
@ROW()+1,price_pos - 5 SAY 'Tax'
@ROW(),price_pos+2 SAY tax SIZE 1, price_len
@ROW()+2,price_pos - 7 SAY 'Total'
@ROW(),price_pos+2 SAY tot_l SIZE 1, price_len
** now, for sales receipts, get the payment form
** and amount for each form, and show the resulting
** change
IF M.transactn = 'Sale'
** initialize the control vars
q_n_a = NULL
STORE 0.00 TO zilch,M.check,M.cash && all init at zero
change = -tot_l
DO WHILE (q_n_a != 'Back') AND !((q_n_a = 'Finished') AND cleared())
q_n_a = NULL && make sure its cleared out
@listing_line+clearage, 1 SAY 'Cash' GET M.cash;
SIZE 1,price_len
@ROW(), COL() SAY ' Credit' GET M.credit;
DEFAULT zilch SIZE 1,price_len
@ROW(), COL() SAY ' From ' GET M.cr_date;
DEFAULT tr_date
@ROW()+1, 1 SAY 'Card' GET M.card;
DEFAULT zilch SIZE 1,price_len
@ROW(), COL() SAY ' Check ' GET M.check;
DEFAULT zilch SIZE 1,price_len
@ROW(), COL() SAY ' Check #' GET M.check_no;
DEFAULT 0 SIZE 1,6
@ROW()+1, 10 SAY 'Change '
@ROW(), COL() SAY change
** check to make sure this is really the whole receipt
@(lower-3), 20 GET q_n_a;
FUNCTION '*H Back;Finished'
READ
change = (M.cash+M.credit+M.card+M.check) - tot_l
ENDDO
IF q_n_a = 'Back'
DO item_scr
DO prev
ELSE
IF SEEK(DTOS(M.tr_date) + timestamp)
GATHER MEMVAR
ELSE
INSERT INTO payform FROM MEMVAR
ENDIF
ENDIF
RETURN q_n_a
ELSE
RETURN NULL
ENDIF
FUNCTION cleared
RETURN (change >= zilch) AND ((M.check = zilch) OR (M.check_no != 0))