Re: Budget Builder file: register.e part 2, edit 1
- Posted by Senator Oct 05, 2020
- 1592 views
-- register.e part 2, edit 1 public procedure display_full_note(integer rec=0, integer truncate = 1) integer HLITE, line atom val, bal object data, key, pos sequence display_key, note, display_amt, display_bal init_text_formatter() reset_columns() set_foreground_color(FGC) if rec=0 then rec=prompt_number("\n\nEnter number of record to display #: ",{1,db_table_size()}) truncate = 0 else truncate = 1 end if key = db_record_key(rec) data = db_record_data(rec) note = data[1] val = data[2]/100 bal = balance(rec)/100 if val <0 then val = -val HLITE = RED else HLITE = FGC end if display_amt = text:format("$ [:8,,.2]",val) display_bal = text:format("$ [:8,,.2]",bal) puts(1, "\n\n") pos = get_position() line = pos[1] position(line,pos[2]) -- display rec/key if equal(current_table, BUDGET) then -- BUDGET position(line,1) display("[]",rec,0) -- rec = #### display_key = text:format("[]-[]-[]",{key[1],key[2],key[3]}) position(line,key_col) hilite(display_key,HLC,0) else -- REGISTER/CASH position(line,1) display("[]",rec,0) -- display rec # display_key = text:format("[]-[]",{key[2],key[3]}) position(line,key_col) hilite(display_key,HLC,0) end if -- display note position(line, note_col) if truncate then truncate_note(note, 35) else position(line+1, note_col) set_margins(note_col, amt_col-2) print_formatted(note) end if -- display transaction amt position(line,amt_col) hilite(display_amt,HLITE,0) -- display balance position(line, bal_col) display(display_bal,{},0) init_text_formatter() set_foreground_color(FGC) end procedure procedure display_total(atom total) sequence amt_text, fms = "total $ [:8,,.2]" puts(1,"\n\n") pos = get_position() position(pos[1],amt_col-6) if total < 0 then amt_text = text:format(fms, -total) hilite(amt_text, RED) else amt_text = text:format(fms, total) display(amt_text) end if end procedure public function select_year() integer a, z, year object key sequence range_text key = db_record_key(1) a = key[YEAR] key = db_record_key(db_table_size()) z = key[YEAR] if a=z then year = a -- only 1 year in table else range_text=text:format("Enter year [] <> [] #: ",{a,z}) year = prompt_number(range_text,{a,z}) end if return year end function public function select_month() integer a,z, month object key sequence range_text key = db_record_key(1) a = key[MONTH] key = db_record_key(db_table_size()) z = key[MONTH] range_text=text:format("Enter month # between [] and [] #: ",{a,z}) month = prompt_number(range_text,{a,z}) return month end function -- end register.e part 2, edit 1
Regards, Ken