PKEEP
GCC Consulting
gcc at optonline.net
Tue Aug 24 15:54:11 PDT 2004
Native 5.0.13 dclerk
Finished a program today in which, as a record is entered (chart of accounts) a
browse window is displayed to the right of the screen showing the month to date
and year to date values associated with the code for each month available.
The above uses show=only
My client wanted the ability to adjust the values in the browse window. I added
a routine which changes the browse to a "regular" browse, using show=pkeep,
allowing her to select a month to adjust. Pressing U pops up a screen, from
mo_chart, over the browse line allowing her to adjust the month to date sales.
Once the record is saved, the year to date sales for this record and all
succeeding records for that item # are updated.
The same browse is re-executed. However, the highlight is back on the top item
even though show=pkeep has been used. Anyone run into this problem?
Code below - see @keyu & up_year
Richard Kreiss
GCC Consulting
::declare
old_date(8,ymd/),end_year(8,ymd/),old_sale(len(4),edit(4)),val_dif(12,.2):
:3 eq "D":6="DEBIT":
:3 eq "C":6="CREDIT":
::END:
@wef1::f="1";END:
@keyu::dim dowhat[3](15,*);dowhat["1"]="Update Record";dowhat["2"]="Update
Sales";dowhat["3"]="EXIT":
::sl=listbox(dowhat):
:sl = "3":END:
:sl = "2":GOTO up_year:
::SCREEN ,1:
::END:
@keyc:'***********************************************************:'* change
year to look at:
::declare year(2,#):
:fl = "9":GOTO @entsel:
::dim when[3](12,*);when["1"]="Current Year";when["2"]="Another
Year";when["3"]="EXIT":
::sl(1,.0)=listbox(when):
: sl = "3": END:
: sl = "1": GOTO @entsel:
get_new::INPUT popup("18","-1") year "Enter Year Wanted yy -> ":
: year = "": END:
: mid(year,"1","1") = " ": year="0"{year:
:: nd(8,mdy/)="0101"{year;fl="2":
::date=boy(nd);bd=date;ed=eoy(date):
::lv=1&bd:
::lookup moc = mo_chart k=lv i=D -nx:
: NOT moc: BEEP;ERRORBOX "No Record Exist for the Account
in\r"<"20"{year<"\r";GOTO get_new:
::CLEARB:
::ba="(brw=15,3,43 show=only prc=drop_ne fill=asc,top)":
::bb="[\r Mo_year To date Year_Date \r]":
::bc="*5 *6 *7":
::lookup moc = mo_chart k=1 i=D -nxm b=(ba&bb&bc):
::END:
drop_ne:moc(3) lt bd:drop all before:
:moc(4) gt ed:drop all after:
::END:
@entsel:'***********************************************************:'* list
current values:
::SHOWTOCOL("22","43") "Enter Selection >":
::SHOWCTR("24") "\r D \r-Delete \r H \r-Hardcopy \r U \r-Update \r C \r Change
Date \r F \r-Print \r B \r-Browse":
::declare date(8,mdy/);fl(1,.0,g):
:fl = "2":GOSUB keep_yr:
:fl ne "1":fl = "1":
::date=boy(@td);bd(8,ymd/)=date;ed(8,ymd/)=eoy(date):
::lookup moc = mo_chart k=1 i=D -nxm b="(brw=15,3,43 show=only prc=drop_yr
fill=asc,top)[\r Mo_year To date Year:
::_Date \r]*5 *6 *7":
::END:
drop_yr:moc(3) lt bd:drop all before:
:moc(4) gt ed:drop all after:
::END:
keep_yr::input popup("19","-1") y(1,yesno) "Redisplay Current Year?=\n(Y)es=\kZ
or (N)o -> ":
: y = "Y" or y = "": fl="1";RETURN:
:: fl="9":
::END:
up_year:'**********************************************************:'* updater a
record in the brose window:
::clearb:
::SHOWTOCOL("19","79") "Press \r U \r-To Update, \k4- \b5 SAVE \a-":
::SHOWTOCOL("20","70") "Press \kZ- To END":
::date=boy(@td);bd=date;ed=eoy(date):
::ba="(brw=15,3,43 xkey=ux show=pkeep pop=0 prc=drop_yr fill=asc,top)":
::bb="[\r Mo_year To date Year_Date \r]":
::bc="*5 *6 *7":
::lookup moc = mo_chart k=1 i=D -nxm b=(ba&bb&bc):
: @bk = "x": clearb;SHOW "";fl="1";GOTO @entsel:
: @bk = "u": rn=moc(@rn);ro(2,.0)=(@br+"5");co(2,.0)="43";GOTO
get_rec:
::CLEARB;SHOW "";CLS("19","2");fl="1";GOTO @entsel:
get_rec:'*************************************************************:'* update
the selected record and then adjust year to date for:
:'* the rest of the months:'*:
::lookup moc = mo_chart r=rn -np:
: NOT moc: GOTO up_year:
:'get values for updating
records:old_date=moc(3);end_year=eoy(moc(4));old_sale=moc(6):
::popup(ro,co) update moc,"update":
: @sk = "BRKY": CLEARP;GOTO up_year:
: 'calc difference between old and new values:
val_dif=moc(6)-old_sale:
: 'change year to date by difference between old and new values:
moc(7)=moc(7)+val_dif;write moc:
::lv=1&bom(old_date+"35"):
::lookup moc = mo_chart k=lv i=D -npx:
loop_up: NOT moc: CLEARP;GOTO up_year:
: moc(1) ne 1: CLEARP;GOTO up_year:
: moc(4) gt ed: CLEARP;GOTO up_year:
: moc(6) = "": CLEARP;GOTO up_year:
:: moc(7)=moc(7)+val_dif;WRITE moc:
:: getnext moc:
::GOTO loop_up:
More information about the Filepro-list
mailing list