* Program : FM409.PRG - Financial Manager 4.0.9 UPDATE - "RICK'S CIRCLE" * Author : I. Forgot * Date Written : November 1991 * *--------------------------------------------------------------------- *-------------------- E N H A N C E M E N T S ------------------------ *--------------------------------------------------------------------- * DATE PROGRAMMER VERSION *--------------------------------------------------------------------- * 01.25.2009 I. Forgot 4.0.9 * In function NEW_DIRECTORY: Removed de-bugging code causing the new path to display * twice when it had errors. * * 01.17.2009 I. Forgot 4.0.9 * In PROCEDURE B1020_SHOW_EXPRESSION: Fixed display of "records for:" when * only 1 record is found. * * 01.16.2009 I. Forgot 4.0.9 * in FM_SAVE: 1. replace Clipper '87s GET-READ with FIND_STRING. * 2. Fix 4.0 error when File->Save {to a new filename} crashes program. * * 10.20.2008 I. Forgot 4.0.9 * Begin analysis for 4.0.9 upgrade. TODO: * 1. Lift block on ":S" portion of "transactions:" during File->Save. * - Look at Clipper's "GET" procedure in FM_SAVE. Possible corruption * due to outdated Clipper library. * * 03.28.2008 I. Forgot 4.0 * Changed copyright date from 2007 to 2008 in procedure Welcome_Screen. * * 02.28.2008 I. Forgot 4.0 * Begin testing changes in NEW_DIRECTORY(). * * 02.27.2008 I. Forgot 4.0 * Changed directory error message from * "Inavalid pathname, press a key." to * "The directory you entered contains no .DBF accounts, press a key." * Added call to new function ADD_DIRECTORY_EXTENSION() in NEW_DIRECTORY(). * * 02.19.2008 I. Forgot 4.0 * Begin coding changes in function NEW_DIRECTORY. * * 02.19.2008 I. Forgot 4.0 * Begin null {empty} folder testing. Found errors with * changing directories (File->Retreive->). These * errors are not a result of 4.0 enhancements, but also * exist in v 3.4. * Analysis: * 1. "Pathname of file:" prompt should now read * "New Directory:" * 2. "Enter new path of file" message at bottom of screen * should now read "Enter new directory" * 3. "Invalid pathname" error message should not display for * valid folder names that exist. * * 02.16.2008 I. Forgot 4.0 * Changed Summary screen to exclude utility files * by calling HIDE_UTILITY_FILES in c1000_account_summary. * Initial testing looks good. * * 02.15.2008 I. Forgot 4.0 * Code for procedure HIDE_UTILITY_FILES complete. * Initial testing looks good. * * 02.14.2008 I. Forgot 4.0 * Begin code for procedure HIDE_UTILITY_FILES. * * 02.09.2008 I. Forgot 4.0 * Begin Analysis to remove SORTIN.DBF, SORTOUT.DBF, and FORMAT.DBF * from directory list. Look at ADIR() function. Look at global * variable NUM_FILES and table DIR_FILES[]. * * 01.30.2008 I. Forgot 4.0 * Problem is not with global VAR I140_import_added_count. Same date * electronic wihtdrawals are being bypassed due to typo in * I0200_Verify_Imports. Changes made In: I0510_fill_verify_line, * I0200_Verify_Imports. Tested with active data. Looks OK. * * 01.28.2008 I. Forgot 4.0 * Resume testing with ACTIVE data. * PROBLEM LOG: * 1. File->Import error - After Search->Export with parameters * "Description CT 'paypal'" to ASSTOPAY.DBF from NEWFIRST.DBF, then * File->Import from ASSTOPAY.DBF to NEWFIRST.DBF, the following totals * display: Matched: 7, Not Found: 40, Total Imports: 53. * (Matched + Not Found = Total Imports) should be true. * Tested v. 3.4 (FM34.EXE) with same results. * Solutions: 1. look at global VAR I140_import_added_count * * 01.22.2008 I. Forgot 4.0 * Found no problems with global variable INFILE. * Section of FM_SAVE was deleted by error in v. 4.0 * modifications. Re-pasted the section from v. 3.4 source code * to keep fm_save the same. Test results look OK. * * 01.17.2008 I. Forgot 4.0 * Begin testing new changes. * PROBLEM LOG: * 1. File->Save error - Doesn't save current file. Problem is with global * var INFILE in procedure FM_SAVE. * * 01.12.2008 I. Forgot 4.0 * Begin coding B2800_EXPORT_SELECTION_SCREEN * * 01.11.2008 I. Forgot 4.0 * Begin design of procedure B2800_EXPORT_SELECTION_SCREEN * * 01.10.2008 I. Forgot 4.0 * Replaced call to un_comma() with call to B2250_EXPORT_UN_COMMA() * in B2200_SAVE_EXPORT. Tested with active data. Both Search Results Screen * and export file look OK. * * 01.09.2008 I. Forgot 4.0 * Resume testing with active file NEWFIRST.DBF. Search parms: * DESCRIPTION FIELD CT "PAYPAL". Search results are OK, but export * file has errors in withdrawal and deposit amount fields.(i.e. * AC_WTH_AMT, AC_DEP_AMT). Suspect problem is with un_comma() * function in B2200_SAVE_EXPORT. * * 12.06.2007 I. Forgot 4.0 * Begin testing error cases for legal export filename and path. * * 1 - Can't export, account already opened. - ***OK 12/6/7**** * 2 - Export filename too long. - ***OK 12/6/7**** * 3 - Must enter a filename. * 4 - Filename must contain letters or numbers. * 5 - illegal path name. * 6 - path does not exist. 12/6/7 - PROBLEM: c:\finance\accounts.dbf - error message * "path does not exist" is wrong * * 11.07.2007 I. Forgot 4.0 * Problem: System crashes when saving export file, AND named * folder doesn't exist. (i.e. saving to "a:\finance\export.dbf" when * the folder "finance" doesn't exist. * * 11.06.2007 I. Forgot 4.0 * Problem: warning should display when saving export results to a file * that already exists. * * 10.29.2007 I. Forgot 4.0 * Problems: 1. After {export.dbf} is saved, program control should return to * SEARCH RESULTS screen. * 2. during export file entry, key should return control to * SEARCH RESULTS screen. * * 09.17.2007 I. Forgot 4.0 * Problem: After {export.dbf} is saved, AND new file, F.M. crashes * when press any key to continue. * * 09.13.2007 I. Forgot 4.0 * Added the following Procedure: * - B2200_FIND_EXPORT_FILENAME * * 08.28.2007 I. Forgot 4.0 * Added the following variable: * - B210b_curr_folder * * 08.27.2007 I. Forgot 4.0 * Added the following procedures: * - B2000_EXPORT_SEARCH_RESULTS * - B2100_PAINT_EXPORT_SCREEN * * 08.21.2007 I. Forgot 4.0 * In PROCEDURE B1010_SEARCH_OUT_SCREEN: * - Add "Export results to file" option * * 08.16.2007 I. Forgot 4.0 * In PROCEDURE Welcome_Screen: * - version "BETTY FORD'S CABIN" changed to "MOJO" * * 08.14.2007 I. Forgot 4.0 * Begin v 4.0 "MOJO" upgrade * TO DO LIST: * - Add "EXPORT to file" function in Search Results screen * - Update Title page (Copyrite Date, version #) * - Remove grey mark over "Transactions:" in File->Save screen * - Hide SORTIN.DBF,SORTOUT.DBF, and FORMAT.DBF from file directory * * 12.29.2006 I. Forgot 3.4 * - fixes ADD and CHANGE routines for (Tab left) crashing the program. * get_WITHDRAWAL * - Added end punctuation (".") to error messages in I0520_import_error_1 and * I0530_import_error_3and4 * * 04.14.2006 I. Forgot 3.3 * - Account file location changed from c:\temp->c:\finance\accounts * - version "Santa Monica Version" changed to "FRUIT CAMP" * * 03.08.2006 I. Forgot 3.3 * - Added brightness to "y" and "n" to verification message in PROCEDURE I0600_Import_Summary. * * 03.08.2006 I. Forgot 3.3 * - Changes to I0550_build_results_table. The number of characters following the Mark * symbol in mTable[] incremented by one. Fixes problem after Importing Bank transactions where * last cent digit was always zero. * * 01.28.2006 I. Forgot 3.3 * - Added PROCEDURE I0580_Calculate_Import_Balance making the imported bank transaction's * balance equal the sum or difference with the previous one. * * 01.27.2006 I. Forgot 3.3 * - PROBLEM: Immediately after retrieving a file, AND File->Import->Bank Transaction AND "yes" to * "No match, add to current?" AND "yes" to "import into current account?" the program terminates. * occurrs in I0750_fill_results_sort_file * * 01.21.2006 I. Forgot 3.3 * - copyright date from 2004 -> 2006 * - Sort message changed from * "This will take a minute" to * "This will take a moment" * * 06.07.2004 I. Forgot 3.3 * begin 3.3 upgrade * - Title page * version# 3.2 -> 3.3 * copyright date from 2003 -> 2004 * - When TYPE OF IMPORT = "Bank Transaction File", records now marked "PAID" after * verification and import. * - When TYPE OF IMPORT = "Merge with another account", verification screen no longer displays * with inverse video (Black text on grey background) * - "select type of import" query screen erased before verification begins * - Need to ask: "Save current account to disk?" before Retrieving another file, and * current file has been changed * - (Y/N/Y to All) - "Y", "N", and "A" display in highlight white "set color to (mBright)" * - Top of FILE->RETREIVE (and IMPORT) list wraps around when UP arrow is pressed * - Cleaner key processing during import verification * - DUPLICATE LOGIC SOLUTIONS * 1. duplicate created when: * withdrawal dates match AND * amounts are different AND * multiple transactions occur on same date AND * "Y" is the reply for "No match, add to current?" * 2. duplicate created when: * withdrawal dates match AND * amounts are different AND * a single transaction occurs on the date AND * "Y" is the reply for "No match, add to current?" * - TRANSACTION MATCHING SOLUTIONS * 1. record mismatch when: * deposit dates match AND * multiple deposits in the current file on the same date AND * only 1 deposit in the import file for the same date AND * the imported deposit is NOT for the least current deposit * - PROCEDURES ADDED * 1. I0560_Insert_paid_symbol * 2. I0210_peek_current_withdrawals * 3. I0580_Calculate_Import_Balance * - PROCEDURES MODIFIED * 1. I0120_find_type_of_import * 2. FM_RETRIEVE * 3. Welcome_Screen * 4. JUMP_DOWN * 5. Jump_Up * 6. I0530_import_error_3and4 * 7. I0520_import_error_1 * 8. I0550_build_results_table * * 03.06.2003 I. Forgot 3.2 (SM) * v Santa Monica (SM) upgrade * - changes sortfile and FORMAT.DBF from a:/ to c:/TEMP/ * 02.19.2003 I. Forgot * v Santa Monica (SM) upgrade * - changes sortfile and FORMAT.DBF from c:/ to a:/ * * 10.30.2002 I. Forgot * v 3.2 upgrade * - I0120_find_type_of_import added for bank transaction import * files that have no "PAID" indicator (i.e. First Federal Savings). * These transactions must be assumed paid. Create initial * dialog box for Import Verificationto screen to select one of * the following Import types: * 1. Bank Transaction File * 2. Merge with another account * 09.11.2002 I. Forgot * v 3.1 fixes include: * - added logic to detect differing deposit amounts * 07.25.2002 I. Forgot * Begin coding version 3.0 (File->Import) * 04.13.2001 I. Forgot * 1) Started Coding Account Summary Screen (Ass) * 11.14.2000 I. Forgot * Resume documentation at M.A.T.C. downtown location... * 11.09.2000 I. Forgot * Begin documenting revised code dealing with new "Search" * option. * 10.10.2000 I. Forgot * Resumed coding at M.A.T.C. campus * 09.28.2000 I. Forgot * 1) Started coding for "search" Option * 09.23.2000 I. Forgot * Resumed "New" option changes at M.A.T.C. truax campus * 1) Set mChanged = .f. and Opened = .t. in procedure "SaveFile" * 2) (09.24.2000) When "New" option or "Retrieve" option chosen, and the * current account in memory has been changed, save message was * changed from: "Save account to disk (y/n)?" to * "Save current account to disk (y/n)?" * 3) (09.24.2000) added procedure "Welcome_Screen" * 4) (09.25.2000) added "New" to file options in procedure MM_BAR * 08.22.2000 I. Forgot 10 * Begin changes to Add "New" option to file menu *--------------------------------------------------------------------- * 07.18.2000 I. Forgot 9 * (1) Made changes to procedure EM_CHANGE to remedy the following * problem: * During a "Change" action, when the screen was not full * (i.e. less than 12 transactions) the row pointer (xrow) wasn't * reseting to it's original position. In effect, when a "Change" * action was followed by an "Add" action, the "Add" entry row would * overwrite existing transactions. * * (2) Made changes to procedure PAINT_TOP_ROW so that the number of * transactions would always be displayed, and each time a transaction * was added, the counter would be updated at the top of the screen. * *--------------------------------------------------------------------- * 07.12.2000 I. Forgot 8 * changed typo "Transcations:" to "Transactions:" * *--------------------------------------------------------------------- * 04.11.2000 I. Forgot 7 * added logic in PROCEDURES file_box, Jump_Down, ensure directories * with more than 18 files (accounts) were processed correctly. * *--------------------------------------------------------------------- * 06.18.1999 I. Forgot 6 * Implemented Y2K changes and added transaction counter * using the following global variable: * * num_records *--------------------------------------------------------------------- * 12/02/1997 I. Forgot 5 * Started adding logic to process the following procedures * called from the mainline: * * sort_acct *--------------------------------------------------------------------- * 10/22/1996 I. Forgot 4 * Add logic in fm_save so that Infile would contain the * value of curr_dir if no file had been selected yet * (i.e. a new file). *---------------------------------------------------------------------* * 07/17/1993 I. Forgot 3 * Add logic in XCOM to display negative balances correctly. *--------------------------------------------------------------------- * 07/08/1993 I. Forgot 2 * add logic in BALANCE_ACCT to set mChanged=.t. when new * balance is calculated. *--------------------------------------------------------------------- * 09/20/1992 I. Forgot 1 * Began Changes to display files in pull-down menu * format. This change is in procedure "get_account". * The following table was added: * dir_files[50] ********************************************************************** ********************************************************************** ***************** D O C U M E N T A T I O N *********************** ********************************************************************** * * LANGUAGE Clipper (Nantucket, Summer '87) * * ENVIRONMENT IBM-PC * * HARD DISK LOCATION * * C:\DEVELOP\CLIPPER\FINANCE.PRG (Test) * C:\FINANCE\FINANCE.PRG (Production) * * FILES USED * * 1. ACCOUNT FILE * c:\finance\accounts\format * field name Type Width Dec * ----- ---- ---- ----- --- * AC_DATE Date 8 * AC_CK_NUM Numeric 4 0 * AC_DESC Character 30 * AC_PAID Logical 1 * AC_DEP_AMT Numeric 8 2 * AC_WTH_AMT Numeric 8 2 * AC_BALANCE Numeric 9 2 * * ********************************************************************** ********************************************************************** ****************** * VARIABLES * ****************** PRIVATE mInvColor,; mBlack,; mColor,; mYellow,; mYellowLow,; mYellowHigh,; mWhite,; mCyan,; mCyanBox,; mCyanBlink,; mGetColor,; MBROWN,; MDARKGREEN,; msearchGet,; msearchBlankLine,; mErrColor,; mBright,; mBlackGet,; mWhiteGet,; mGreenHigh,; mGreenLow,; mGreenTop,; blank_row,; bar_index,; num_options,; num_records,; && ** Y2K ** xrow, xcol,; mInkey,; index, xindex,; mTable,; tb_size,; Err_Found, Err_Msg, Err_Pos,; Curr_Balance,; Curr_Dir,; Bk_Bal_Num,; Bk_Bal_Str,; Bk_Date_Val,; Bk_Date_Str,; mChanged,; fTop, fBottom, fLeft, fRight,; mOption,; mSave_scr,; mSave_scr2,; FileName,; ErrBlk,; DefauErr,; db_name,; Opened,; paid,; this_is_sortfile,; SortInFile,; SortOutFile,; FormatFile,; I0310_import_ck_num,; I0315_import_date,; I0320_import_wth_amt,; I0325_import_dep_amt,; I0330_curr_ck_num,; I0335_curr_date,; I0340_curr_wth_amt,; I0345_curr_dep_amt,; I021_import_index,; I022_curr_index,; I023_results_index,; I010_import_filename,; I015_import_directory,; I100_error_code,; I110_verify_screen_row,; I115_verify_line_out,; I120_scroll_up,; I125_overwrite_all_diff_amounts,; I130_import_overwrite_count,; I131_import_verified_count,; I135_overwrite_ignored_count,; I140_import_added_count,; I145_import_ignored_count,; I146_total_matched,; I147_total_not_found,; I155_results_table_count,; I160_import_size,; I165_current_size,; I070_table_index,; I075_add_all_non_matching,; I080_import_type,; I085_results_balance,; && v 3.3 01/28/06 this_is_the_beginning,; &&09.24.2000 c1_bytes_total,; &&04.24.2000 c1_recs_total,; c1_bal_total,; c100c_curr_folder,; B20_EXPORT_TYPE,; && 01.12.2008 v 4.0 B210b_curr_folder,; B2100B_EXPORT_PATH,; B21_GLOBAL_EXPORT_FILENAME,; DATE_DEPTH,CHECK_DEPTH,DESC1_DEPTH,DESC2_DEPTH,DESC_OP_DEPTH,; WITHD_DEPTH,DEPOS_DEPTH,CHANGE_DEPTH,; SDATE_OPERATOR1, SDATE_STR1, SDATE_AND_OR, SDATE_2ND_OP, A075_DATE_STR2,; SCHECK_OPERATOR1, SCHECK_NUM1, SCHECK_AND_OR, SCHECK_2ND_OP, S2ND_CHECKNUM,; SDESC_OPERATOR1, SDESC1, SDESC_AND_OR, SDESC_2ND_OP, SDESC2,; SWITHD_OPERATOR1, SAWITHD_AMT1, SWITHD_AND_OR, SWITHD_2ND_OP, SWAMT_IN_2,; SDEPOS_OPERATOR1, SADEPOS_AMT1, SDEPOS_AND_OR, SDEPOS_2ND_OP, SDAMT_IN_2 *=========================================================================================* *==========================$$ SEARCH ENTRY MATRIX $$====================================* ****************** * TABLES * ****************** declare mTable[1000] declare row_tb[80] declare dir_files[50] declare aSize[50] declare aModified[50] declare aTimes[50] DECLARE SRCH_TABLE[1000] declare c1_sum_table[50] declare I01_import_in_table[1000] declare I02_import_results_table[1000] DECLARE DIR_SCRATCH_TABLE[50] && 02.14.2008 V 4.0 ****************** * MAINLINE * ****************** this_is_the_beginning = .t. && 09.24.2000 do Initialize do while .t. mOption = main_menu() do case case mInkey = 27 .or. mOption = 9 && ESC or Quit do quit_program if mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed EXIT endif case mOption = 1 do file_menu case mOption = 2 do add_rows do init_rows case mOption = 3 do edit_menu case mOption = 4 do balance_acct case mOption = 5 do print_acct case mOption = 6 mSave_scr = SaveScreen(00,00,24,79) do SEARCH_MENU RestScreen(00,00,24,79,mSave_scr) case mOption = 7 do sort_acct case mOption = 8 mSave_scr = SaveScreen(00,00,24,79) do C1000_account_summary && 04.13.2001 RestScreen(00,00,24,79,mSave_scr) endcase enddo close databases return ****************** * PROCEDURES * ****************** PROCEDURE Initialize *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: None * * * * Procedures called: Write_Screen * * add_rows * * init_rows * * Welcome_Screen &&06.24.2000 * * * * Functions called: (none) * * * * * * 06.09.1999 Y2K Changes * * add SET CENTURY ON * * change vars: blank_row * * * * 06.24.2000 add call to procedure Welcome_Screen * *---------------------------------------------------------------* SET CENTURY ON mInvColor = "b/w,w/b,,,b/w" mBlack = "w/n,w+/n,,,w/n" mColor = "w/b,b/w,,,w/b" mWhite = "w+/b,W+/b,,,w+/b" mYellow = "gr+/b,gr+/b,,,gr+/b" mYellowLow = "gr/n,gr/n,,,gr/n" mYellowHigh= "gr+/n,gr+/n,,,gr+/n" mCyan = "n/bg,bg/n,,,n/bg" mCyanBox = "w+/bg,bg/w+,,,w+/bg" mCyanBlink = "n*/bg,bg/n*,,,n*/bg" mGetColor = "w+/bg,w+/bg,,,w+/bg" mErrColor = "w+/r,r/w+,,,w+/r" mBright = "w+/n,n/w+,,,w+/n" mBlackGet = "n/w,w/n,,,n/bg" mSearchGet = "W+/g+,w+/g+,,,n/bg" msearchBlankLine = "g/n,n/g+,,,n/bg" MBROWN = "N/W,W+/GR,n/g+,,,n/bg" MDARKGREEN = "N/W,W+/g,,,n/bg" * mWhiteGet = "b/w,b/w,,,b/w" mWhiteGet = "g/n,n/gr,,,n/gr" mGreenHigh = "g+/n,g+/n,,,g+/n" mGreenLow = "g/n,g/n,,,g/n" mGreenTop = "n/g,n/g,,,n/g" blank_row = "__/__/____ ____ ______________________________" * 06.10.1999 Y2K blank_row = blank_row + " ______.__ ______.__ " blank_row = blank_row + " ______.__ ______.__ " bar_index = 1 num_options = 2 mChanged = .f. num_records = 0 && ** Y2K xrow = 7 tb_size = 1 Curr_Balance = 0.00 Bk_Date_Str = DTOC(DATE()) Bk_Bal_Str = " 0.00" Bk_Date_Val = DATE() Bk_Bal_Num = 0.00 curr_dir = "c:\finance\accounts\*.dbf" FileName = " " db_name = " " Opened = .f. paid = .f. this_is_sortfile = .f. SortInFile = "c:\finance\accounts\sortin" SortOutFile = "c:\finance\accounts\sortout" FormatFile = "c:\finance\accounts\format" I080_import_type = "" && v. 3.3 01/27/06 B20_EXPORT_TYPE = "" && v 4.0 01/12/2008 * AC_DATE = CTOD("01/01/93") * AC_CK_NUM = 1000 * AC_DESC = REPLICATE(" ",80) * AC_PAID = .F. * AC_WTH_AMT = 0.00 * AC_DEP_AMT = 0.00 * AC_BALANCE = 0.00 * AC_DATE = CTOD("01/01/93") * AC_BALANCE = 0.00 if this_is_the_beginning do Welcome_Screen &&09.24.2000 this_is_the_beginning = .f. &&(there can only be 1 beginning.) endif set color to (mColor) set cursor off clear do Write_Screen do add_rows do init_rows return PROCEDURE Welcome_Screen *---------------------------------------------------------------* * Called from: Initialize * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * (06.24.2000) This procedure will paint an introductary * * welcome screen that contains the program title, version, * * author, and copyrite information. A message gives * * instruction saying "press a key to begin." * * * ***************************************************************** * 06/09/04 - v 3.3 revisions * * * * 07/26/02 - v 3.0 revisions * *---------------------------------------------------------------* PRIVATE Box_Length Box_Length = 50 set color to (mCyan) set cursor off clear set color to (mColor) @ 5,14 SAY REPLICATE(" ",Box_Length) @ 6,14 SAY REPLICATE(" ",Box_Length) @ 7,14 SAY REPLICATE(" ",Box_Length) @ 8,14 SAY REPLICATE(" ",Box_Length) @ 9,14 SAY REPLICATE(" ",Box_Length) @ 10,14 SAY REPLICATE(" ",Box_Length) @ 11,14 SAY REPLICATE(" ",Box_Length) @ 12,14 SAY REPLICATE(" ",Box_Length) @ 13,14 SAY REPLICATE(" ",Box_Length) @ 14,14 SAY REPLICATE(" ",Box_Length) @ 15,14 SAY REPLICATE(" ",Box_Length) @ 16,14 SAY REPLICATE(" ",Box_Length) @ 17,14 SAY REPLICATE(" ",Box_Length) @ 18,14 SAY REPLICATE(" ",Box_Length) set color to (mBlack) @ 19,15 SAY REPLICATE(" ",Box_Length) @ 6,64 SAY " " @ 7,64 SAY " " @ 8,64 SAY " " @ 9,64 SAY " " @ 10,64 SAY " " @ 11,64 SAY " " @ 12,64 SAY " " @ 13,64 SAY " " @ 14,64 SAY " " @ 15,64 SAY " " @ 16,64 SAY " " @ 17,64 SAY " " @ 18,64 SAY " " @ 19,64 SAY " " set color to (mWhite) * @ 06,28 SAY "Financial Manager 2.1" * @ 06,28 SAY "Financial Manager 3.0" && v 3.0, 7/26/02 * @ 06,28 SAY "Financial Manager 3.1" && v 3.1, 9/11/02 * @ 06,28 SAY "Financial Manager 3.2" && v 3.2, 11/1/02 * @ 06,25 SAY "Financial Manager 3.2 (SM)" && v SM, 02/19/03 * @ 06,28 SAY "Financial Manager 3.3" && v 3.3 SM, 01/21/06 * @ 08,33 SAY "FRUIT CAMP" && v 3.3, 04/14/06 * @ 06,28 SAY "Financial Manager 3.4" && v 3.4, 12/29/06 * @ 06,28 SAY "Financial Manager 4.0" && v 4.0, 08/16/07 @ 06,27 SAY "Financial Manager 4.0.9" && v 4.0.9, 01/16/09 * @ 08,30 SAY "BETTY FORD'S CABIN" && v 3.4, 12/29/06 set color to (mBlackGet) && v 4.0, 08/16/07 @ 08,35 SAY " MOJO " && v 4.0, 08/16/07 * @ 08,31 SAY " RICK'S CIRCLE " && v 4.0.9, 01/16/09 set color to (mWhite) && v 4.0, 08/16/07 * @ 14,16 SAY "Copyright (c) 1991-2003. Financial Manager is a" * @ 14,16 SAY "Copyright (c) 1991-2007. Financial Manager is a" && v 3.3 01/21/06 * @ 14,16 SAY "Copyright (c) 1991-2008. Financial Manager is a" && v 4.0 03/28/08 @ 14,16 SAY "Copyright (c) 1991-2009. Financial Manager is a" && v 4.0.9 01/16/09 @ 15,17 SAY "Street Sheet production. Get online support @" @ 16,18 SAY "www.angelfire.com/wi/dairyland/cheese.html" @ 17,29 SAY "All rights reserved." * set color to (mCyanBlink) set cursor on @ 11,29 SAY "press a key to begin" mInkey = Inkey(0) PROCEDURE Write_Screen *---------------------------------------------------------------* * Called from: Initialize * * * * Parameters: (none) * * * * Procedures called: paint_top_row * * * * Functions called: (none) * * * * This procedure displays the add and edit screen headers, * * as well as the current date. * * * * 06.09.1999 Y2K - date field is positioned to allow for * * a four digit year. * *---------------------------------------------------------------* do paint_top_row with " " set color to (mBlack) @ 1,00 SAY REPLICATE(" ",80) @ 2,00 SAY REPLICATE(" ",80) @ 3,00 SAY REPLICATE(" ",80) @ 4,00 SAY REPLICATE(" ",80) @ 5,00 SAY REPLICATE(" ",80) @ 6,00 SAY REPLICATE(" ",80) @ 10,00 SAY REPLICATE(" ",80) @ 11,00 SAY REPLICATE(" ",80) @ 12,00 SAY REPLICATE(" ",80) @ 13,00 SAY REPLICATE(" ",80) @ 14,00 SAY REPLICATE(" ",80) @ 15,00 SAY REPLICATE(" ",80) @ 16,00 SAY REPLICATE(" ",80) @ 17,00 SAY REPLICATE(" ",80) @ 18,00 SAY REPLICATE(" ",80) @ 19,00 SAY REPLICATE(" ",80) @ 20,00 SAY REPLICATE(" ",80) @ 21,00 SAY REPLICATE(" ",80) @ 22,00 SAY REPLICATE(" ",80) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) @ 2, 50 SAY "BANK BALANCE: $" @ 3, 47 SAY "CURRENT BALANCE: $" @ 5,12 SAY "CHECK" && **Y2K** from 5,10 @ 5,50 SAY "AMOUNT" && **Y2K** from 5,49 @ 5,62 SAY "AMOUNT" && **Y2K** from 5,61 @ 6,3 SAY "DATE" && **Y2K** from 6,2 @ 6,14 SAY "NO." && **Y2K** from 6,12 @ 6,27 SAY "DESCRIPTION" && **Y2K** from 6,25 @ 6,48 SAY "WITHDRAWAL" && **Y2K** from 6,49 @ 6,62 SAY "DEPOSIT" && **Y2K** from 6,61 @ 6,73 SAY "BALANCE" && **Y2K** from 6,72 set color to (mColor) * 06.10.1999 Y2K @ 2, 41 SAY DATE() @ 2, 39 SAY DATE() @ 2, 66 SAY " 0.00" @ 3, 66 SAY " 0.00" @ 7,00 SAY REPLICATE("Í",80) * @ 9,00 SAY REPLICATE("Í",80) return PROCEDURE paint_top_row *---------------------------------------------------------------* * Called from: Write_Screen * * InitFScreen * * new_directory * * SaveFile * * add_rows * * * * Parameters: screen_type * * * * Procedures called: paint_top_row * * * * Functions called: (none) * * * * This procedure displays the entry screen headers, as well as * * the current date. * * * * 06.09.1999 Y2K - date field is positioned to allow for * * a four digit year. * ***************************************************************** * 07/26/02 v 3.0 revisions - SCREEN_TYPE = "Import" added * *---------------------------------------------------------------* PARAMETERS SCREEN_TYPE if screen_type = "Import" set color to (mGreenTop) else IF SCREEN_TYPE = "Search" set color to (mSearchGet) else set color to (mCyan) endif endif @ 0,00 SAY REPLICATE(" ",80) @ 0,00 SAY "FINANCIAL MANAGER" @ 0,70 SAY DATE() && **Y2K** from 0,72 @ 0,25 SAY "Filename:" * @ 0,49 SAY "Transcations: " && **Y2K** added "Transactions:" @ 0,49 SAY "Transactions: " && **07.12.2000 changed typo "transcation:" @ 0,63 SAY STR(num_records,4) && ** 07.18.2000 if FileName = " " @ 0, 35 SAY "{none}" else @ 0, 35 SAY FileName endif PROCEDURE file_menu *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * FM_BAR * * FM_NEW && 08.22.2000 * * FM_RETRIEVE * * FM_SAVE * * FM_DIRECTORY * * FM_COPY * * FM_DELETE * * * * Functions called: FM_LEFT * * FM_RIGHT * * * * * * This procedure displays the file menu at the bottom of the * * screen. It also processes the chosen file option. * * * * - 7/25/02 v 3.0 add "Import" to menu * *---------------------------------------------------------------* PRIVATE fm_position do paint_message with "fmenu" set color to (mBlack) * @ 23,00 SAY "Retrieve Save Directory Copy Delete" * @ 23,00 SAY "New Retrieve Save Directory Copy Delete" && 08.22.2000 @ 23,00 SAY "New Retrieve Save Import Directory Copy Delete" && v 3.0 set color to (mBright) @ 23,00 SAY "N" && 08.22.2000 @ 23,06 SAY "R" && 08.22.2000 @ 23,17 SAY "S" && 08.22.2000 @ 23,24 SAY "I" && ** v 3.0 @ 23,33 SAY "D" && ** v 3.0 @ 23,45 SAY "C" && ** v 3.0 @ 23,53 SAY "e" && ** v 3.0 fm_position = 1 do fm_bar WITH "draw", fm_position do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow do fm_bar WITH "erase", fm_position fm_position = fm_left(fm_position) do fm_bar WITH "draw", fm_position case mInkey = 4 && Right Arrow do fm_bar WITH "erase", fm_position fm_position = fm_right(fm_position) do fm_bar WITH "draw", fm_position case mInkey = 110 .or. mInkey = 78 && "N" or "n" **08.22.2000 fm_position = 1 EXIT case mInkey = 114 .or. mInkey = 82 && "R" or "r" fm_position = 2 EXIT case mInkey = 115 .or. mInkey = 83 && "S" or "s" fm_position = 3 EXIT case mInkey = 105 .or. mInkey = 73 && "I" or "i" ** v 3.0 - add Import fm_position = 4 EXIT case mInkey = 100 .or. mInkey = 68 && "D" or "d" fm_position = 5 EXIT case mInkey = 99 .or. mInkey = 67 && "C" or "c" fm_position = 6 EXIT case mInkey = 101 .or. mInkey = 69 && "E" or "e" fm_position = 7 EXIT endcase enddo if mInkey <> 27 && ESC not pressed do case case fm_position = 1 do fm_new case fm_position = 2 do fm_retrieve case fm_position = 3 do fm_save case fm_position = 4 && v 3.0 - add fm_import do fm_import case fm_position = 5 do fm_directory case fm_position = 6 do fm_copy case fm_position = 7 do fm_delete otherwise endcase endif set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) set color to (mColor) procedure FM_BAR *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: TYPE, POSITION * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure either erases the cyan bar or paints a new * * one depending on the values of TYPE and POSITION passed from * * procedure FILE_MENU. * *---------------------------------------------------------------* PARAMETERS type, position if type = "draw" set color to (mCyan) else set color to (mBlack) endif do case case position = 1 @ 23,00 SAY "New" && 08.22.2000 set color to (mBlack) if type = "draw" @ 24,00 SAY "Create new account" set color to (mCyan) @ 23,00 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,00 SAY "N" endif case position = 2 @ 23,06 SAY "Retrieve" set color to (mBlack) if type = "draw" @ 24,00 SAY "Retrieve account from disk." set color to (mCyan) @ 23,06 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,06 SAY "R" endif case position = 3 @ 23,17 SAY "Save" set color to (mBlack) if type = "draw" @ 24,00 SAY "Save current account to disk." &&09.24.2000 set color to (mCyan) @ 23,17 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,17 SAY "S" endif case position = 4 @ 23,24 SAY "Import" &&********************************** set color to (mBlack) &&* v 3.0 additions for "Import" * if type = "draw" &&********************************** @ 24,00 SAY "Import file into current account." set color to (mCyan) @ 23,24 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,24 SAY "I" endif case position = 5 @ 23,33 SAY "Directory" set color to (mBlack) if type = "draw" @ 24,00 SAY "Change current disk directory" set color to (mCyan) @ 23,33 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,33 SAY "D" endif case position = 6 @ 23,45 SAY "Copy" set color to (mBlack) if type = "draw" @ 24,00 SAY "Copy current account to new file." set color to (mCyan) @ 23,45 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,45 SAY "C" endif case position = 7 @ 23,52 SAY "Delete" set color to (mBlack) if type = "draw" @ 24,00 SAY "Delete file from current directory." set color to (mCyan) @ 23,52 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,53 SAY "e" endif endcase function FM_LEFT *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: POSITION * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This function tells FILE_MENU the new position of the cyan * * bar when the left arrow key is pressed. * *---------------------------------------------------------------* PARAMETERS position PRIVATE new_position if position = 1 && (Is the cyan bar currently on the "New" option?) * new_position = 5 * new_position = 6 && 08.22.2000 new_position = 7 &&** v 3.0 else new_position = position - 1 endif return new_position function FM_RIGHT *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: POSITION * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This function tells FILE_MENU the new position of the cyan * * bar when the right arrow key is pressed. * *---------------------------------------------------------------* parameters POSITION private NEW_POSITION * if POSITION = 5 && 08.22.2000 * if POSITION = 6 &&(Is the cyan bar currently on the "Delete" option?) if POSITION = 7 && ** v 3.0 NEW_POSITION = 1 else NEW_POSITION = POSITION + 1 endif return NEW_POSITION procedure FM_NEW *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: (none) * * * * Procedures called: INITIALIZE * * * * Functions called: SAVE_CHANGES() * * * * This procedure first inquires to see if the current account * * has changed. If so, a message begs if the account should be * * saved before a new one is opened. Depending on the reply, * * FM_NEW will either save the current acccount, followed by * * invoking the initail routine, or transfer control directly * * to the previously mentioned. * *---------------------------------------------------------------* if mChanged if save_changes() do fm_save endif close databases endif do Initialize procedure FM_RETRIEVE *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: (none) * * * * Procedures called: PAINT_MESSAGE * * INITFSCREEN * * FILE_BOX * * OPEN_FILE * * DRAW_BAR * * ERASE_BAR * * INIT_ROWS * * * * Functions called: NEW_DIRECTORY() * * * * This procedure displays a rectangular list of all the * * accounts in the current directory (folder). The keyboard * * arrow keys control a cyan cyber bar that moves over the * * account file names. An account is selected when the ENTER * * key is touched, and a file opening task is assigned. Moving * * from one directory (or folder) to the other is accomplished * * by pressing the F1 key. * *---------------------------------------------------------------* PRIVATE FileType *-------------------V 3.3 CHANGES 06/11/04----------------------* * If the current file has been modified, F.M. needs to ask if * * the current file needs to be saved before opening another. * *---------------------------------------------------------------* if mChanged if save_changes() do fm_save endif close databases endif *-----------------END OF V 3.3 CHANGES--------------------------* mSave_scr = SaveScreen(01,00,24,79) do InitFScreen bar_size = 12 num_files = ADIR(curr_dir,dir_files) DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 if num_files > 0 do file_box curr_file = 1 curr_pos = 1 do draw_bar do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 28 && F1 (change dir) FileType = new_directory() if FileType = "file" num_files = ADIR(curr_dir,dir_files) DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 do open_file EXIT else if FileType = "dir" do InitFScreen num_files = ADIR(curr_dir,dir_files) DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 if num_files > 0 do file_box curr_file = 1 curr_pos = 1 do draw_bar endif else EXIT endif endif case mInkey = 13 && RETURN FileName = dir_files[curr_file] do open_file mChanged = .f. && V 3.3 06/11/04 EXIT case mInkey = 24 && Down Arrow do erase_bar do jump_down do draw_bar case mInkey = 5 && Up Arrow do erase_bar do jump_up do draw_bar otherwise endcase enddo endif RestScreen(01,00,24,79,mSave_scr) set color to (mColor) do init_rows set cursor on return PROCEDURE InitFScreen *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: (none) * * * * Procedures called: PAINT_TOP_ROW * * PAINT_MESSAGE * * * * Functions called: (none) * * * * This procedure produces an empty screen, then fills the * * opening line with the same information contained on the * * previous screen (title, filename, number of transactions, * * and system date). The current directory pathname is also * * displayed on the third line. * * * *---------------------------------------------------------------* set color to (mBlack) clear do paint_top_row with " " do paint_message with "fm_retrieve" @ 03,10 SAY "Current directory: " + curr_dir @ 24,00 SAY "Press ENTER to select file, F1 to change directory." procedure FILE_BOX *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure draws the box that contains the list of all * * files with the .DBF extension in the current directory. * * * * 04.11.2000 - added logic to ensure directories with more * * than 18 files (accounts) were processed * * correctly. * * * *---------------------------------------------------------------* PRIVATE i DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 fTop = 4 ** 04.11.2000 fBottom = fTop + num_files + 1 if num_files > 18 fBottom = 23 && *-- 04.11.2000 - max file box size for DOS screen else fBottom = fTop + num_files + 1 endif fLeft = 29 fRight = 42 set color to (mColor) @ fTop, fLeft, fBottom, fRight BOX "ÉÍ»º¼ÍȺ " if num_files > 18 for i = 1 to 18 @ (fTop + i), (fLeft + 1) say dir_files[i] next else for i = 1 to num_files @ (fTop + i), (fLeft + 1) say dir_files[i] next endif *************** DE-BUGGING TOOL ******************* * if Opened * De_bug_String="TRUE" * ELSE * De_bug_String="FALSE" * ENDIF * @ 20,22 SAY "Opened=" + De_bug_String * @ 21,22 SAY "DB_NAME=" + DB_NAME * @ 22,22 SAY "CURR_DIR=" + CAPS_CURR_DIR * @ 23,22 SAY "Infile=" + Infile * mInkey = Inkey(0) *************************************************** PROCEDURE HIDE_UTILITY_FILES *---------------------------------------------------------------* * Called from: FILE_BOX * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: UPPER() * * * * This procedure was written on 02/14/2008 as part of the * * v.4.0 upgrade. It will remove or "Hide" the following files * * from the File->Retreive selection box when the current * * folder is "c:\finance\accounts". * * * * FORMAT.DBF * * SORTOUT.DBF * * SORTIN.DBF * * * *---------------------------------------------------------------* PRIVATE I, J, UTILITIES_FOUND, CAPS_CURR_DIR CAPS_CURR_DIR=UPPER(CURR_DIR) IF CAPS_CURR_DIR = "C:\FINANCE\ACCOUNTS\*.DBF" UTILITIES_FOUND = 0 I=1 J=1 DO WHILE (I <= NUM_FILES) && 1st loop builds scratch table without utility files IF (DIR_FILES[I] = "FORMAT.DBF") .OR.; (DIR_FILES[I] = "SORTIN.DBF") .OR.; (DIR_FILES[I] = "SORTOUT.DBF") UTILITIES_FOUND = UTILITIES_FOUND + 1 ELSE DIR_SCRATCH_TABLE[J] = DIR_FILES[I] J=J+1 ENDIF I=I+1 ENDDO NUM_FILES = NUM_FILES - UTILITIES_FOUND I=1 DO WHILE (I <= NUM_FILES) && 2nd loop re-populates DIR_FILES with the scratch table DIR_FILES[I] = DIR_SCRATCH_TABLE[I] I=I+1 ENDDO ENDIF procedure JUMP_DOWN *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure is called from FM_RETRIEVE when the down * * arrow key is pressed. CURR_FILE and CURR_POS are either * * incremented by 1 or reset to 1. * *---------------------------------------------------------------* PRIVATE JU_INDEX if curr_pos < 18 if curr_file = num_files curr_file = 1 curr_pos = 1 else curr_file = curr_file + 1 curr_pos = curr_pos + 1 endif else if curr_file < num_files dummy = SCROLL(fTop+1,fLeft+1,fBottom-1,fRight-1,1) curr_file = curr_file + 1 curr_pos = 18 else *--------------v 3.3 changes 06/18/04---------------------------* * bounce bar is at the last file in the list, and there is more * * than 18 files. Need to wrap around to top of list when * * is pressed. * *---------------------------------------------------------------* curr_file = 1 curr_pos = 1 if num_files > 18 set color to (mColor) for JU_INDEX = 1 to 18 && re-fill file box with first 18 files in folder @ (fTop + JU_INDEX), (fLeft + 1) say dir_files[JU_INDEX] + REPLICATE(" ",12-LEN(dir_files[JU_INDEX])) next endif *---------------END OF v 3.3 changes----------------------------* endif endif PROCEDURE Jump_Up *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure is called from FM_RETRIEVE when the up arrow * * key is pressed. CURR_FILE and CURR_POS are either * * decremented 1 or reset to NUM_FILES. * *---------------------------------------------------------------* PRIVATE JU_INDEX, JU_POS && v 3.3 06/18/04 if curr_pos > 1 if curr_file = 1 curr_file = num_files curr_pos = num_files else curr_file = curr_file - 1 curr_pos = curr_pos - 1 endif else if curr_file > 1 dummy = SCROLL(fTop+1,fLeft+1,fBottom-1,fRight-1,-1) curr_pos = 1 curr_file = curr_file - 1 else *--------------v 3.3 changes 06/18/04---------------------------* * bounce bar is at the top of the file list and needs to wrap * * around to bottom of list when is pressed. * *---------------------------------------------------------------* curr_file = num_files if num_files > 18 && re-fill file box with the last 18 files in folder set color to (mColor) JU_POS = 1 for JU_INDEX = num_files-17 to num_files @ (fTop + JU_POS), (fLeft + 1) say dir_files[JU_INDEX] + REPLICATE(" ",12-LEN(dir_files[JU_INDEX])) JU_POS=JU_POS+1 next curr_pos = 18 else curr_pos = num_files endif *---------------END OF v 3.3 changes----------------------------* endif endif procedure DRAW_BAR *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure displays the file pointed to by CURR_POS in * * the inverse (cyan) color, and pads the remaining length with * * spaces. * *---------------------------------------------------------------* set color to (mCyanBox) @ (fTop + curr_pos), (fLeft + 1) SAY dir_files[curr_file] +; REPLICATE(" ",bar_size - LEN(dir_files[curr_file])) @ (fTop + curr_pos), (fLeft + 1) SAY "" set color to (mColor) procedure ERASE_BAR *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure displays the account pointed to by CURR_FILE * * in normal color mode. * *---------------------------------------------------------------* set color to (mColor) @ (fTop + curr_pos), (fLeft + 1) SAY dir_files[curr_file] +; REPLICATE(" ",bar_size - LEN(dir_files[curr_file])) procedure OPEN_FILE *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: (None) * * * * Procedures called: FILL_TABLE * * * * Functions called: (none) * * * * This procedure assigns DB_NAME with the current directory * * path plus FILENAME then opens the file. * *---------------------------------------------------------------* ** need to ask if current file should be saved before opening a new one. db_name = SUBSTR(curr_dir,1,LEN(curr_dir) - 5) + FileName set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) set color to (mCyanBlink) set cursor off @ 22,72 SAY "Reading" if Opened close databases endif use (db_name) Opened = .t. do fill_table WITH "current" set color to (mCyan) @ 00,35 SAY FileName + " " * @ 0,49 SAY "Transcations: " && ** 06.10.1999 Y2K ** @ 0,49 SAY "Transactions: " && ** 07.12.2000 changed typo "transcations:" ** @ 0,63 SAY STR(num_records,4) set color to (mBlack) @ 22,72 SAY " " return procedure FILL_TABLE *---------------------------------------------------------------* * Called from: OPEN_FILE * * PROCESS_SORT_FILE * * I0230_sort_import_account * * I0250_sort_current_account * * * * Parameters: fill_type = "current", "sort", * * "import", "results" * * "lead import", * * "sorted import" * * Procedures called: (none) * * * * Functions called: XCOM() * * * * This procedure copies the file stored in DB_NAME to one of * * the following tables: * * * * mTABLE - current file * * I01_import_in_table - import file * *---------------------------------------------------------------* PARAMETER fill_type PRIVATE index, temp, first_rec, skip_import_balance_rec index = 1 first_rec = .t. skip_import_balance_rec =.f. if fill_type = "lead import" skip_import_balance_rec = .t. && remove balance record before sorting endif if fill_type = "sorted import" && no balance record in sorted import file first_rec = .f. endif * if fill_type = "current" * first_rec = .f. * endif if fill_type = "results" && no balance record in sorted import file Curr_Balance = Bk_Bal_Num first_rec = .f. endif if this_is_sortfile && Balance record is not Curr_Balance = Bk_Bal_Num && included in sort file. first_rec = .f. endif do while !EOF() if first_rec if skip_import_balance_rec = .t. && skip balance record for import skip 1 && file first_rec = .f. skip_import_balance_rec = .f. else Bk_Bal_Num = AC_BALANCE && this section only executes Bk_Bal_Str = xcom(AC_BALANCE,10) && for the "retrieve file" option Bk_Date_Val = AC_DATE Bk_Date_Str = DTOC(AC_DATE) first_rec = .f. Curr_Balance = Bk_Bal_Num skip 1 endif else temp = "" * temp = temp + xcom(AC_BALANCE,10) && does this belong here? v 3.3 01/27/06 temp = DTOC(AC_DATE) + " " && Insert date if AC_PAID = .t. temp = temp + CHR(251) + " " && Insert PAID symbol else if fill_type = "sorted import" .and. I080_import_type = "BANK" && v 3.3 01/27/06 temp = temp + CHR(251) + " " && All Bank transactions assumed paid v 3.3 01/27/06 else temp = temp + " " endif endif if AC_CK_NUM = 0 temp = temp + " " + " " && **Y2k** else temp = temp + STR(AC_CK_NUM) + " " && **Y2K** endif temp = temp + AC_DESC + " " if AC_WTH_AMT = 0.00 temp = temp + " " + " " else temp = temp + xcom(AC_WTH_AMT,9) + " " endif if AC_DEP_AMT = 0.00 temp = temp + " " + " " else temp = temp + xcom(AC_DEP_AMT,9) + " " endif if AC_PAID = .t. temp = temp + xcom(AC_BALANCE,10) else Curr_Balance = Curr_Balance - AC_WTH_AMT Curr_Balance = Curr_Balance + AC_DEP_AMT temp = temp + xcom(Curr_Balance,10) endif if fill_type = "lead import" .or. fill_type = "sorted import" I01_import_in_table[index] = temp else mTable[index] = temp && **Y2K** endif skip 1 index = index + 1 endif enddo if fill_type = "lead import" .or. fill_type = "sorted import" I160_import_size = index - 1 else if fill_type= "current" I165_current_size = index - 1 tb_size = index else tb_size = index endif endif num_records = index - 1 && ** .06.10.1999 Y2K ** * xindex = tb_size - 1 return procedure FM_DIRECTORY *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure has not been coded yet. * *---------------------------------------------------------------* PROCEDURE FM_COPY *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure has not been coded yet * *---------------------------------------------------------------* procedure FM_DELETE *---------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure has not been coded yet. * *---------------------------------------------------------------* procedure INIT_ROWS *---------------------------------------------------------------* * Called from: MAINLINE * * INITIALIZE * * PROCESS_SORT_FILE * * FM_RETRIEVE * * FM_IMPORT * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure displays the most current account records to * * the screen. The balance record is also displayed with last * * bank balance, date, and current balance. * *---------------------------------------------------------------* PRIVATE row,trow if tb_size > 13 index = tb_size - 13 else index = 1 set color to (mBlack) @ 21,00 SAY REPLICATE(" ",80) endif set color to (mColor) row = 8 do while index < tb_size @ row, 00 SAY mTable[index] row = row + 1 index = index + 1 enddo trow = row @ trow,00 SAY REPLICATE("Í",80) && paints double lines trow = trow + 1 set color to (mBlack) do while trow < 22 @ trow, 00 SAY REPLICATE(" ",80) trow = trow + 1 enddo xrow = row - 1 index = tb_size xindex = tb_size - 1 skip -1 set color to (mColor) * @ 2, 41 SAY Bk_Date_Str @ 2, 39 SAY Bk_Date_Str && **Y2K** @ 2, 66 SAY Bk_Bal_Str @ 3, 66 SAY xcom(Curr_Balance,10) && Display Current Balance set cursor on @ xrow, 00 SAY "" return function NEW_DIRECTORY *---------------------------------------------------------------* * Called from: FM_RETRIEVE * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * FIND_STRING && 02.19.2008 v 4.0 * * * * Return values: "file" - if file entered * * "dir" - if directory entered * * "none" - if ESC pressed * * * * This function clears the current screen and allows user to * * enter the new file pathname. * *---------------------------------------------------------------* PRIVATE InPath, new_path, var1, nHandle set color to (mBlack) clear do paint_top_row with " " do paint_message with "new_dir" * @ 09,05 SAY "Pathname of file: " + curr_dir && 02.19.2008 v 4.0 @ 09,08 SAY "New Directory:" && 02.19.2008 v 4.0 set color to (mGetColor) @ 8, 23, 10, 76 BOX "ÉÍ»º¼ÍȺ " InPath = curr_dir + REPLICATE(" ",50 - LEN(curr_dir)) do while .t. * @ 09,25 GET InPath && v 02.19.2008 v 4.0 DO FIND_STRING WITH 9,25,InPath,51,.F.,"NEWDIR" && 02.19.2008 v 4.0 * READ && 02.27.2008 v 4.0 if LastKey() <> 27 && ESC not pressed * new_path = AddExt(InPath) && V 4.0 02.27.2008 NEW_PATH = ADD_DIRECTORY_EXTENSION(INPATH) && V 4.0 02.27.2008 if FILE(new_path) curr_dir = new_path if SUBSTR(new_path,LEN(new_path) - 4,1) = "*" return "dir" else do find_fname WITH curr_dir && ** 04.11.2000 - added parameter to find_fname return "file" endif else *************** DE-BUGGING TOOL ******************* * if Opened * De_bug_String="TRUE" * ELSE * De_bug_String="FALSE" * ENDIF * @ 20,22 SAY "Opened=" + De_bug_String * @ 21,22 SAY "DB_NAME=" + DB_NAME * @ 22,22 SAY "CURR_DIR=" + CURR_DIR * @ 23,22 SAY NEW_PATH && v 4.0.9 1/25/2009 - commented out these last 2 lines of * mInkey = Inkey(0) && de-bugging tool *************************************************** do DirError endif else return "none" endif enddo FUNCTION ADD_DIRECTORY_EXTENSION *---------------------------------------------------------------* * Called from: NEW_DIRECTORY * * * * Parameters: PathStr * * * * Modules called: none * * * * This function was written on 02.27.2008 as part of the v 4.0 * * upgrade and behaves like AddExt(). It takes the new file * * directory string (PathStr), and adds the "/*.dbf" extension * * (if one doesn't already exist). However, this function only * * returns a directory (folder) name, but not a filename. * *---------------------------------------------------------------* PARAMETER PATHSTR PRIVATE PSIZE,WORKSTR WORKSTR = UPPER(TRIM(PATHSTR)) && removes all trailing spaces && and converts to upper case. PSIZE = LEN(WORKSTR) IF PSIZE = 1 && special case for root directory (i.e. a,b,c,...) RETURN WORKSTR + ":\*.DBF" ENDIF IF PSIZE > 5 IF SUBSTR(WORKSTR,PSIZE-5,6) = "\*.DBF" RETURN WORKSTR ENDIF ENDIF IF SUBSTR(PathStr,Psize,1) = "\" RETURN WORKSTR + "*.DBF" ELSE RETURN WORKSTR + "\*.DBF" ENDIF PROCEDURE DirError *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) set color to (mErrColor) * @ 24,00 SAY "Inavalid pathname, press a key." && v 4.0 02.27.2008 @ 24,00 SAY "The directory you entered contains no .DBF accounts, press a key." set cursor off mInkey = InKey(0) set cursor on do paint_message with "new_dir" set color to (mGetColor) FUNCTION AddExt *---------------------------------------------------------------* * Called from: NEW_DIRECTORY * * * * Parameters: PathStr * * * * Modules called: none * * * * This function takes the file directory string (PathStr), and * * adds the ".dbf" extension (if one doesn't already exist). * *---------------------------------------------------------------* PARAMETER PathStr PRIVATE Psize,WorkStr,dummy dummy = " " WorkStr = LOWER(TRIM(PathStr)) && removes all trailing spaces && and converts to lower case. Psize = LEN(WorkStr) if Psize > 3 if SUBSTR(WorkStr,(Psize - 3),4) = ".dbf" return WorkStr else if SUBSTR(PathStr,(Psize - 2),3) = "*.*" return SUBSTR(PathStr,1,(Psize - 1)) + "dbf" else if SUBSTR(PathStr,Psize,1) = "/" return PathStr + "*.dbf" else return WorkStr + ".dbf" endif endif endif endif PROCEDURE BreakHere *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETERS message @ 10,10 SAY message @ 11,10 SAY "press a key to continue." mInkey = Inkey(0) PROCEDURE Find_fName *---------------------------------------------------------------* * Called from: NEW_DIRECTORY * * SaveFile &&09.23.2000 * * B2200_SAVE_EXPORT && v 4.0 * * * * Parameters: DIR_STRING * * * * Procedures called: PAINT_MESSAGE * * * * Functions called: None * * * * Change Log: * * 04.11.2000 - Added DIR_STRING parameter * * v 4.0 - Changed value of DIR_STRING * * * * This procedure scans the parameter "DIR_STRING", and * * separates the filename from the path. * * * *---------------------------------------------------------------* PARAMETERS DIR_STRING PRIVATE pos,length length = LEN(DIR_STRING) pos = length do while .t. if pos > 0 if SUBSTR(DIR_STRING,pos,1) = "\" FileName = UPPER(SUBSTR(DIR_STRING,pos + 1,length - pos)) curr_dir = SUBSTR(DIR_STRING,1,pos) + "*.dbf" DIR_STRING = FileName && 9/16/07 v. 4.0 EXIT else pos = pos - 1 endif else EXIT endif enddo PROCEDURE fm_save *--------------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * SaveFile * * DirErr * * * * Functions called: None * * * * This procedure is called when the "save" option is chosen * * from the file menu. * * * * - 01/16/2009 V. 4.0.9 patch * * 1. Lifted block over "transactions:" by replacing GET-READ * * filename input with call to FIND_STRING. * * 2. Fixed v. 4.0 fatal error when saving to a new file name. * * 3. Inserted error checking for new filenames * * * *--------------------------------------------------------------------* PRIVATE InFile,De_bug_String, h409_InFile, H409_ERROR_CODE, H409_PATH, H409_FILENAME, H409_TRY_AGAIN H409_TRY_AGAIN=.t. set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80)y do paint_message with "fm_save" @ 24,00 SAY "Account to be saved: " if Opened Infile = TRIM(db_name) + REPLICATE(" ",50 - LEN(TRIM(db_name))) && V. 4.0 01/17/2008 - added call to TRIM else Infile = TRIM(curr_dir) + REPLICATE(" ",50 - LEN(TRIM(curr_dir))) && V. 4.0 01/17/2008 - added call to TRIM && ****************************************************** && * 10/22/96 - added logic here so that Infile would * && * contain the value of curr_dir if no file had been * && * selected yet (i.e. a new file) * && ****************************************************** endif * Infile = UPPER(Infile) && v. 4.0.9 - 1/18/09 do while .t. .and. H409_TRY_AGAIN set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && erase error message - V. 4.0.9 01/18/2009 set color to (mBlackGet) * @ 24,21 GET InFile && V. 4.0.9 01/16/2009 - replace GET-READ * READ do FIND_STRING with 24,21,InFile,58,.F.,"SAVE" && V. 4.0.9 01/16/2009 InFile = TRIM(InFile) if LastKey() <> 27 && ESC not pressed InFile = AddExt(Infile) if UPPER(InFile) = UPPER(db_name) do SaveFile with InFile EXIT else *************************************** * 1/18/09 - v. 4.0.9 * * Add error edits on new InFile * *************************************** H409_PATH=InFile H409_FILENAME="" H409_ERROR_CODE = B2400_VALID_EXPORT_PATH(H409_PATH,H409_FILENAME) && examine new file path IF H409_ERROR_CODE = 0 use c:\finance\accounts\format COPY TO (InFile) use (InFile) H409_InFile = InFile && V. 4.0.9 01/16/2009, H409_InFile remembers path do SaveFile with InFile && SaveFile removes path from InFile close databases if Opened db_name = H409_InFile && V. 4.0.9 01/16/2009 use (db_name) && DB_NAME is a global variable that holds the current path & filename endif EXIT ELSE H409_TRY_AGAIN = H409_FILE_ERROR(H409_ERROR_CODE,H409_PATH) ENDIF endif else EXIT && ESC key pressed endif enddo *************** DE-BUGGING TOOL ******************* * if Opened * De_bug_String="TRUE" * ELSE * De_bug_String="FALSE" * ENDIF * @ 20,22 SAY "Opened=" + De_bug_String * @ 21,22 SAY "DB_NAME=" + DB_NAME * @ 22,22 SAY "CURR_DIR=" + CURR_DIR * @ 23,22 SAY "Infile=" + Infile * mInkey = Inkey(0) *************************************************** FUNCTION H409_FILE_ERROR *---------------------------------------------------------------* * Called from: fm_save * * * * Parameters: H409_ERROR_TYPE * * H409_PATH * * * * Procedures called: None * * * * Functions called: INKEY() * * * *WRITTEN: 1/18/09 * * * * This function displays an error message that relates to * * H409_ERROR_TYPE. It returns TRUE (.t.) when the "Try Again?" * * prompt is answered with a "y" (yes). * * * * H409_ERROR_TYPE * * --------------- * * 0 - No errors * * 1 - Can't export, file already opened. * * 2 - Export filename too long. * * 3 - Must enter a filename. * * 4 - Filename must contain letters or numbers. * * 5 - illegal path name. * * 6 - path does not exist. * *---------------------------------------------------------------* PARAMETER H409_ERROR_TYPE, H409_PATH SET COLOR TO (MBLACK) @ 24,21 SAY H409_PATH && Shade the entered file SET COLOR TO (mErrColor) && white on red DO CASE CASE H409_ERROR_TYPE = 1 @ 23,0 SAY "!Can't export, account already opened. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE H409_ERROR_TYPE = 2 @ 23,0 SAY "!Filename is too long. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE H409_ERROR_TYPE = 3 @ 23,0 SAY "!Must enter a filename. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE H409_ERROR_TYPE = 4 @ 23,0 SAY "!Filename must contain letters or numbers. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE H409_ERROR_TYPE = 5 @ 23,0 SAY "!illegal pathname. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE H409_ERROR_TYPE = 6 @ 23,0 SAY "!path does not exist. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF ENDCASE PROCEDURE SaveFile *--------------------------------------------------------------------* * Called from: fm_save * * * * Parameters: sFileName * * * * Procedures called: update_file * * paint_top_row * * Find_fName * * * * Functions called: None * * * *--------------------------------------------------------------------* PARAMETERS sFileName set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) @ 24,00 SAY "Saving " set color to (mGetColor) @ 24,07 SAY sFileName ******************************************** * 04.11.2000 - added call to Find_fName * ******************************************** do Find_fName WITH sFileName do update_file mChanged = .f. && 09.23.2000 Opened = .t. && 09.23.2000 set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) ******************************************** * 04.11.2000 - added call to paint_top_row * ******************************************** do paint_top_row with " " PROCEDURE FM_IMPORT *--------------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: None * * * * Procedures called: I0000_find_I010_import_filename * * I0100_Import_Screen * * I0120_find_type_of_import * * I0200_Verify_Imports * * I0600_Import_Summary * * * * Functions called: None * * * * This procedure was designed as part of version 3.0 upgrade, and * * is called when the "import" option is chosen * * from the file menu. * *--------------------------------------------------------------------* PRIVATE I020_hold_filename, I025_hold_directory, I_save_screen I_save_screen = SaveScreen(00,00,24,79) hold_filename = filename hold_directory = curr_dir do I0000_find_I010_import_filename filename = hold_filename curr_dir = hold_directory if mInkey = 13 && RETURN key pressed do I0100_Import_Screen do I0120_find_type_of_import && v 3.2 upgrade do I0200_Verify_Imports if mInkey <> 27 && not pressed do I0600_Import_Summary endif endif RestScreen(00,00,24,79,I_save_screen) && clean-up do Init_Rows && display new account transactions and current balance do paint_top_row with " " && display # transactions set cursor on if Opened use (db_name) endif return PROCEDURE I0000_find_I010_import_filename *--------------------------------------------------------------------* * Called from: FM_IMPORT * * * * Parameters: (none) * * * * Procedures called: InitFScreen * * * * Functions called: ADIR() * * * * I0010_find_file was copied from FM_RETRIEVE, but needs * * modification to become portable with both import and * * retrieve (open) functions. * *--------------------------------------------------------------------* PRIVATE FileType * mSave_scr = SaveScreen(01,00,24,79) do InitFScreen set color to (mBlack) @ 22,00 SAY REPLICATE(" ",80) && --* Erases menu bar at bottom of screen *-- set color to (mCyan) @ 22,00 SAY "IMPORT FILE" set color to (mBlack) bar_size = 12 num_files = ADIR(curr_dir,dir_files) DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 if num_files > 0 do file_box curr_file = 1 curr_pos = 1 do draw_bar do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 28 && F1 (change dir) FileType = new_directory() if FileType = "file" num_files = ADIR(curr_dir,dir_files) DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 I010_import_filename = filename I015_import_directory = curr_dir EXIT else if FileType = "dir" do InitFScreen set color to (mBlack) @ 22,00 SAY REPLICATE(" ",80) && --* Erases menu bar at bottom of screen *-- set color to (mCyan) @ 22,00 SAY "IMPORT FILE" set color to (mBlack) I010_import_filename = filename I015_import_directory = curr_dir num_files = ADIR(curr_dir,dir_files) DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 if num_files > 0 do file_box curr_file = 1 curr_pos = 1 do draw_bar endif else EXIT endif endif case mInkey = 13 && RETURN I010_import_filename = dir_files[curr_file] I015_import_directory = curr_dir EXIT case mInkey = 24 && Down Arrow do erase_bar do jump_down do draw_bar case mInkey = 5 && Up Arrow do erase_bar do jump_up do draw_bar otherwise endcase enddo endif * RestScreen(01,00,24,79,mSave_scr) * set color to (mColor) * do init_rows set cursor on return PROCEDURE I0100_Import_Screen *--------------------------------------------------------------------* * Called from: FM_IMPORT * * * * Parameters: None * * * * Procedures called: * * * * Functions called: * * * *--------------------------------------------------------------------* set color to (mBlack) clear do Paint_Top_Row WITH "Import" do paint_message with "Import_menu" set cursor off set color to (mblack) @ 1,0 SAY REPLICATE("Í",80) @ 21,0 SAY REPLICATE("Í",80) @ 22,52 SAY "IMPORTING FROM:" set color to (mgreenhigh) @ 22,68 SAY I010_import_filename set color to (mblack) @ 24,0 SAY "Verifying transactions" PROCEDURE I0120_find_type_of_import *--------------------------------------------------------------------* * Called from: FM_IMPORT * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * (10.30.2000) This procedure will draw a dialog box to select one * * of the following import types: * * * * 1. Bank Transaction File I080_import_type = "BANK" * * 2. Merge with another account I080_import_type "MERGE" * *--------------------------------------------------------------------* set color to (mBlack) @ 6,24,11,55 BOX "ÉÍ»º¼ÍȺ " set color to (mBlackGet) @ 7,25 SAY "1. Bank Transaction File " set color to (mBlack) @ 8,25 SAY "2. Merge with another account" set color to (mBright) @ 10,29 SAY "select type of import" I080_import_type = "BANK" do while .t. mInkey = Inkey(0) do case case mInkey = 27 .or. mInkey =13 && ESC or RETURN EXIT case mInkey = 24 .or. mInkey = 5 && Down Arrow or Up Arrow if I080_import_type = "BANK" set color to (mBlack) @ 7,25 SAY "1. Bank Transaction File " set color to (mBlackGet) @ 8,25 SAY "2. Merge with another account" @ 8,25 SAY "" I080_import_type = "MERGE" else set color to (mBlack) @ 8,25 SAY "2. Merge with another account" set color to (mBlackGet) @ 7,25 SAY "1. Bank Transaction File " bar_position = 7 @ 7,25 SAY "" I080_import_type = "BANK" endif endcase enddo ********************************************************** * v 3.3 changes: reset screen color to black background * * with white lettering, and erase import type query * * box. (06/11/04) * ********************************************************** set color to (mBlack) @ 6,24 SAY REPLICATE(" ",50) @ 7,24 SAY REPLICATE(" ",50) @ 8,24 SAY REPLICATE(" ",50) @ 9,24 SAY REPLICATE(" ",50) @ 10,24 SAY REPLICATE(" ",50) @ 11,24 SAY REPLICATE(" ",50) PROCEDURE I0200_Verify_Imports *--------------------------------------------------------------------* * Called from: FM_IMPORT * * * * Parameters: (none) * * * * Procedures called: I0230_sort_import_account * * I0250_sort_current_account * * I0300_fill_compare_values * * I0500_process_verification_error_codes * * I0310_fill_import_values * * * * Functions called: (none) * * * * I100_error_code Explanation * * --------------- ----------- * * 0 match, amounts verified * * 1 no match, add to current? * * 2 no import for current, always keep current * * 3 match, deposit amounts differ * * 4 match, withdrawal amounts differ * * * * This procedure contains logic that matches the imported * * transactions with the current account file. The records are * * paired by check number and date. In cases of ATM and teller * * transactions, the records can only be matched by date. Maybe when * * ATM withdrawals are made from a machine owned by another * * bank, the actual date of the transaction won't match the post * * date. It's possible there's a big disk somewhere that keeps track * * of all ATM trasactions made on a certain day that gets sent to * * your bank overnight by Federal Express or UPS or something. * * ATM users can still use F.M., but check writers have a big * * advantage when reconciling their books with the bank's. If * * improvements are made, this procedure is where they will happen. * * Anyway, once a match is found, the withdrawl and deposit amounts * * are compared for accuracy and the error codes set appropriately. * * * *--------------------------------------------------------------------* I021_import_index=1 I022_curr_index=1 I023_results_index=1 I110_verify_screen_row = 2 I130_import_overwrite_count = 0 I135_overwrite_ignored_count = 0 I140_import_added_count = 0 I145_import_ignored_count = 0 I155_results_table_count = 0 I131_import_verified_count = 0 I075_add_all_non_matching = .f. I125_overwrite_all_diff_amounts = .f. I085_results_balance = 0.00 && v 3.3 01/28/06 *************** DE-BUGGING TOOL ******************* * if Opened * De_bug_String="TRUE" * ELSE * De_bug_String="FALSE" * ENDIF * @ 20,22 SAY "Opened=" + De_bug_String * @ 21,22 SAY "DB_NAME=" + DB_NAME * @ 22,22 SAY "CURR_DIR=" + CURR_DIR * @ 23,22 SAY "Infile=" + Infile * mInkey = Inkey(0) *************************************************** do I0230_sort_import_account if num_records > 0 do I0250_sort_current_account else I165_current_size = 0 endif do while (I021_import_index <= I160_import_size .or. I022_curr_index <= I165_current_size) .and. (mInkey <> 27) && v 3.3 clean-up ESC processing if I165_current_size > 0 && {current account NOT empty} do I0300_fill_compare_values &&& ****** LINE 1826 if I0310_import_ck_num = I0330_curr_ck_num if I0310_import_ck_num = 0 &&*** deposit or teller WITHDRAWAL/atm - need to compare dates if I0315_import_date = I0335_curr_date if I0320_import_wth_amt = I0340_curr_wth_amt if I0325_import_dep_amt = I0345_curr_dep_amt && **** v 3.1 logic added here I100_error_code = 0 && ** match found, amounts verified do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 I022_curr_index = I022_curr_index + 1 else I100_error_code = 3 &&** match, deposit amounts differ do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 I022_curr_index = I022_curr_index + 1 endif else *--------------------Begin v 3.3 changes 06/21/2004-------------------------------------* * At this point, logic has determined that the imported transaction is a Teller or ATM * * withdrawal with a date that matches a current transaction, but the amounts differ. * * It's still possible, however, that the current file has more transactions than the * * imported file for the same date, or visa-versa. Logic also understands that both * * imported and current files are sorted in acsending order (least to greatest) first * * by check number, then date, then withdrawal amount, then deposit. Because if this, * * F.M. can now simply compare the withdrawal amounts to see if there is a difference * * in number of transactions for the same date. * *---------------------------------------------------------------------------------------* if I0320_import_wth_amt < I0340_curr_wth_amt if I021_import_index > I160_import_size I100_error_code = 2 &&*** no import for current, always keep current do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 else I100_error_code = 4 &&*** match, withdrawal amounts differ ** v 3.3 &&*------------------ v. 4.0 - repaired typo -----------------------* &&* The following call to I0500_PROCESS_VERIFICATION_ERROR_CODES * &&* was commented out in error, causing all type 4 errors to be * &&* ignored. * &&*-----------------------------------------------------------------* do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 I022_curr_index = I022_curr_index + 1 && ** v 3.3 endif else if I022_curr_index > I165_current_size && ** is EOF? I100_error_code = 1 &&*** no match, add to current? do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 else &&*-------------Begin v 3.3 changes 06/21/04----------------------------------* &&* Here the dates match, but the imported withdrawal value is greater * &&* than the current. It's not for certain yet that there's a match. It's * &&* quite possible that the true match exists farther ahead in the current * &&* file, because the current file has more transactions for the same date. * &&* F.M. needs to look forward or "peek at" the current file until either the * &&* date changes (error code=4), or a match is found further ahead (error * &&* code=2). * &&* * &&* - error code 2 (no match for current, always keep current) * &&* - error code 4 (match, withdrawal amounts differ) * &&*---------------------------------------------------------------------------* do I0210_peek_current_withdrawals if I100_error_code = 2 &&*** no match for current, always keep current do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 else && error code = 4 &&*** match, withdrawal amounts differ do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 I021_import_index = I021_import_index + 1 && ** v 3.3 endif &&*--------------------------End v 3.3 changes---------------------------------* endif endif endif else &&** I0315_import_date NOT EQUAL TO I0335_curr_date if I0315_import_date < I0335_curr_date if I021_import_index > I160_import_size I100_error_code = 2 do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 else I100_error_code = 1 do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 endif else if I022_curr_index > I165_current_size I100_error_code = 1 do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 else I100_error_code = 2 do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 endif endif endif else && {check #s numbers match} if I0320_import_wth_amt = I0340_curr_wth_amt if I0325_import_dep_amt = I0345_curr_dep_amt I100_error_code = 0 else I100_error_code = 3 endif else I100_error_code = 4 endif do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 I022_curr_index = I022_curr_index + 1 endif else && {check #s do not match} if (I0310_import_ck_num < I0330_curr_ck_num .or.; I022_curr_index > I165_current_size) if I021_import_index > I160_import_size I100_error_code = 2 do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 else I100_error_code = 1 do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 endif else if I022_curr_index > I165_current_size I100_error_code = 1 do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 else I100_error_code = 2 do I0500_process_verification_error_codes I022_curr_index = I022_curr_index + 1 endif endif endif else && {current account is empty} do I0310_fill_import_values I100_error_code = 1 do I0500_process_verification_error_codes I021_import_index = I021_import_index + 1 endif enddo && DO-WHILE PROCEDURE I0210_peek_current_withdrawals *--------------------------------------------------------------------* * Called from: I0200_Verify_Imports * * * * Parameters: None * * * * Procedures called: None * * * * Functions called: None * * * * This procedure was written for the version 3.3 upgrade, and sets a * * pointer to "peek ahead" in the current file. If a match is found, * * then error code=2, else error code=4. It was added for cases when * * the current file has more transactions than the imported file for * * the same date. * *--------------------------------------------------------------------* PRIVATE I, I21_peek_index, I22_peek_date, I23_peek_amount, I24_string, I25_digit I21_peek_index = I022_curr_index + 1 I22_peek_date = CTOD(SUBSTR(mTable[I21_peek_index],1,10)) I24_string = "" for I = 50 to 58 I25_digit = SUBSTR(mTable[I21_peek_index],I,1) if I25_digit <> "," I24_string = I24_string + I25_digit endif next I23_peek_amount = VAL(I24_string) do while .t. if I0315_import_date = I22_peek_date if I0320_import_wth_amt < I23_peek_amount I21_peek_index = I21_peek_index + 1 I22_peek_date = CTOD(SUBSTR(mTable[I21_peek_index],1,10)) I24_string = "" for I = 50 to 58 I25_digit = SUBSTR(mTable[I21_peek_index],I,1) if I25_digit <> "," I24_string = I24_string + I25_digit endif next I23_peek_amount = VAL(I24_string) else I100_error_code = 2 &&*** found match farther ahead, even though amounts may not be equal ** v 3.3 EXIT endif else I100_error_code = 4 &&*** match, withdrawal amounts differ ** v 3.3 EXIT endif enddo PROCEDURE I0230_sort_import_account *--------------------------------------------------------------------* * Called from: I0200_Verify_Imports * * * * Parameters: (none) * * * * Procedures called: Fill_Table * * I0235_copy_import_file * * * * Functions called: * * * *--------------------------------------------------------------------* PRIVATE import_path import_path = SUBSTR(I015_import_directory,1,LEN(I015_import_directory) - 5) + I010_import_filename USE (import_path) do Fill_Table WITH "lead import" && removes balance record from imported file USE (SortInFile) do I0235_copy_import_file * COPY TO (SortInFile) SORT ON AC_CK_NUM/A, AC_DATE/A, AC_WTH_AMT/A , AC_DEP_AMT/A TO (SortOutFile) USE (SortOutFile) do Fill_Table WITH "sorted import" CLOSE DATABASES DELETE FILE (SortInFile) DELETE FILE (SortOutFile) return PROCEDURE I0235_copy_import_file *--------------------------------------------------------------------* * Called from: I0230_sort_import_account * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure copies I01_import_in_table[i] to (SortInFile). * *--------------------------------------------------------------------* PRIVATE i, sRow ZAP && Clear SortInFile for i = 1 to I160_import_size sRow = I01_import_in_table[i] APPEND BLANK REPLACE AC_DATE with CTOD(SUBSTR(sRow,1,10)) REPLACE AC_CK_NUM with VAL(SUBSTR(sRow,14,4)) REPLACE AC_DESC with SUBSTR(sRow,19,30) if SUBSTR(sRow,12,1) = " " REPLACE AC_PAID with .f. else REPLACE AC_PAID with .t. endif REPLACE AC_WTH_AMT with I0400_string_to_value(50,58,sRow) REPLACE AC_DEP_AMT with I0400_string_to_value(61,69,sRow) REPLACE AC_BALANCE with I0400_string_to_value(71,80,sRow) next COMMIT PROCEDURE I0250_sort_current_account *--------------------------------------------------------------------* * Called from: I0200_Verify_Imports * * * * Parameters: None * * * * Procedures called: Fill_Table * * * * Functions called: * * * *--------------------------------------------------------------------* USE (FormatFile) COPY TO (SortInFile) USE (SortInFile) filename = hold_filename curr_dir = hold_directory this_is_sortfile = .t. && do NOT include balance record with sortfile do update_file && copies mTable to open filename (SortInFile) SORT ON AC_CK_NUM/A, AC_DATE/A, AC_WTH_AMT/A, AC_DEP_AMT/A TO (SortOutFile) USE (SortOutFile) do Fill_Table WITH "current" CLOSE DATABASES DELETE FILE (SortInFile) DELETE FILE (SortOutFile) this_is_sortfile = .f. set cursor on if Opened use (db_name) endif return PROCEDURE I0300_fill_compare_values *--------------------------------------------------------------------* * Called from: I0200_Verify_Imports * *--------------------------------------------------------------------* PRIVATE I_import_index, I_curr_index, tString, tChar, i if I022_curr_index > I165_current_size I_curr_index = I165_current_size else I_curr_index = I022_curr_index endif if I021_import_index > I160_import_size I_import_index = I160_import_size else I_import_index = I021_import_index endif I0310_import_ck_num = VAL(SUBSTR(I01_import_in_table[I_import_index],14,4)) I0315_import_date = CTOD(SUBSTR(I01_import_in_table[I_import_index],1,10)) * I0320_import_wth_amt = I0400_string_to_value(50,58,I01_import_in_table[I_import_index]) * I0325_import_dep_amt = I0400_string_to_value(61,69,I01_import_in_table[I_import_index]) tString = "" for i = 50 to 58 tChar = SUBSTR(I01_import_in_table[I_import_index],i,1) if tChar <> "," tString = tString + tChar endif next I0320_import_wth_amt = VAL(tString) tString = "" for i = 61 to 69 tChar = SUBSTR(I01_import_in_table[I_import_index],i,1) if tChar <> "," tString = tString + tChar endif next I0325_import_dep_amt = VAL(tString) I0330_curr_ck_num = VAL(SUBSTR(mTable[I_curr_index],14,4)) I0335_curr_date = CTOD(SUBSTR(mTable[I_curr_index],1,10)) * I0340_curr_wth_amt = I0400_string_to_value(50,58,mTable[I_curr_index]) * I0345_curr_dep_amt = I0400_string_to_value(61,69,mTable[I_curr_index]) tString = "" for i = 50 to 58 tChar = SUBSTR(mTable[I_curr_index],i,1) if tChar <> "," tString = tString + tChar endif next I0340_curr_wth_amt = VAL(tString) tString = "" for i = 61 to 69 tChar = SUBSTR(mTable[I_curr_index],i,1) if tChar <> "," tString = tString + tChar endif next I0345_curr_dep_amt = VAL(tString) PROCEDURE I0310_fill_import_values *--------------------------------------------------------------------* * Called from: I0200_Verify_Imports * *--------------------------------------------------------------------* PRIVATE tString, tChar, i if I021_import_index > I160_import_size I_import_index = I160_import_size else I_import_index = I021_import_index endif I0310_import_ck_num = VAL(SUBSTR(I01_import_in_table[I_import_index],14,4)) I0315_import_date = CTOD(SUBSTR(I01_import_in_table[I_import_index],1,10)) tString = "" for i = 50 to 58 tChar = SUBSTR(I01_import_in_table[I_import_index],i,1) if tChar <> "," tString = tString + tChar endif next * I0320_import_wth_amt = I0400_string_to_value(50,58,I01_import_in_table[I_import_index]) I0320_import_wth_amt = VAL(tString) tString = "" for i = 61 to 69 tChar = SUBSTR(I01_import_in_table[I_import_index],i,1) if tChar <> "," tString = tString + tChar endif next * I0325_import_dep_amt = I0400_string_to_value(61,69,I01_import_in_table[I_import_index]) I0325_import_dep_amt = VAL(tString) FUNCTION I0400_string_to_value *---------------------------------------------------------------* * Called from: I0300_fill_compare_values * * Parameters: start, finish, row string * * Procedures called: (none) * * Functions called: (none) * * (copied from "un_comma") * *---------------------------------------------------------------* PARAMETER start, finish, row_string PRIVATE tString, tChar, i tString = "" for i = start to finish tChar = SUBSTR(row_string,i,1) if tChar <> "," tString = tString + tChar endif next return VAL(tString) PROCEDURE I0500_process_verification_error_codes *--------------------------------------------------------------------* * Called from: I0200_Verify_Imports * * * * Parameters: None * * * * Procedures called: * * * * Functions called: * * * * I100_error_code Explanation * * --------------- ----------- * * 0 match, amounts verified * * 1 no match, add to current? * * 2 no import for current, always keep current * * 3 match, deposit amounts differ * * 4 match, withdrawal amounts differ * *--------------------------------------------------------------------* do I0510_fill_verify_line do case case I100_error_code = 0 && match, amounts verified. if I110_verify_screen_row > 20 I120_scroll_up = SCROLL(2,00,20,79,1) I110_verify_screen_row = 20 endif @ I110_verify_screen_row, 0 SAY I115_verify_line_out do I0550_build_results_table with "matched" I131_import_verified_count = I131_import_verified_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 case I100_error_code = 1 && no match, add to current? do I0520_import_error_1 case I100_error_code = 2 do I0550_build_results_table with "current" case I100_error_code = 3 do I0530_import_error_3and4 case I100_error_code = 4 do I0530_import_error_3and4 endcase PROCEDURE I0510_fill_verify_line *----------------------------------------------------------------------* * Called from: I0500_process_verification_error_codes * * * * Parameters: None * * * * Procedures called: * * * * Functions called: * * * * I100_error_code Explanation * * --------------- ----------- * * 0 match, amounts verified * * 1 no match, add to current? * * 2 no import for current, always keep current * * 3 match, deposit amounts differ * * 4 match, withdrawal amounts differ * * * * This procedure fills the global string varible * * I115_verify_line_out. All verification lines begin with the date, * * PAID indicater, and check number. Depending on the error code, it * * finishes with one of the following messages: * * * * I100_error_code * * --------------- * * 0 " match, amounts verified." * * 1 " no match, add to current? (Y/N/Y to All)" * * 2 {no message displays} * * 3 "DEP 99,999.99 currently 99,999.99, overwrite? (Y/N/Y to All)" * * 4 "WTH 99,999.99 currently 99,999.99, overwrite? (Y/N/Y to All)" * *----------------------------------------------------------------------* PRIVATE I_curr_index, I_import_index if I022_curr_index > I165_current_size I_curr_index = I165_current_size else I_curr_index = I022_curr_index endif if I021_import_index > I160_import_size I_import_index = I160_import_size else I_import_index = I021_import_index endif I115_verify_line_out = "" I115_verify_line_out = SUBSTR(I01_import_in_table[I_import_index],1,10) + " " && date I115_verify_line_out = I115_verify_line_out +; SUBSTR(I01_import_in_table[I_import_index],12,1) + " " && mark paid I115_verify_line_out = I115_verify_line_out +; SUBSTR(I01_import_in_table[I_import_index],14,4) + " " && check number ********************* v. 4.0 01/30/2008 ******************** * First check I100_ERROR_CODE to find out type of * * error, because an import withdrawal amount equal to zero * * doesn't always qualify a "WTH" error type. * ************************************************************ if I100_error_code = 4 && v. 4.0 01/30/2008 I115_verify_line_out = I115_verify_line_out + "WTH " +; SUBSTR(I01_import_in_table[I_import_index],50,9) else if I100_error_code = 3 I115_verify_line_out = I115_verify_line_out + "DEP " +; SUBSTR(I01_import_in_table[I_import_index],61,9) else if I0320_import_wth_amt > 0 I115_verify_line_out = I115_verify_line_out + "WTH " +; SUBSTR(I01_import_in_table[I_import_index],50,9) else I115_verify_line_out = I115_verify_line_out + "DEP " +; SUBSTR(I01_import_in_table[I_import_index],61,9) endif endif endif *********** END of v. 4.0 changes ************************** do case case I100_error_code = 0 I115_verify_line_out = I115_verify_line_out + " match, amounts verified." case I100_error_code = 1 I115_verify_line_out = I115_verify_line_out + " no match, add to current? (Y/N/Y to All)" case I100_error_code = 2 && **** no import for current, always keep current && **** skip screen output && **** build table with current case I100_error_code = 3 I115_verify_line_out = I115_verify_line_out + " currently " +; SUBSTR(mTable[I_curr_index],61,9) +; &&***** line 2080 ", overwrite? (Y/N/Y to All)" case I100_error_code = 4 I115_verify_line_out = I115_verify_line_out + " currently " +; SUBSTR(mTable[I_curr_index],50,9) +; ", overwrite? (Y/N/Y to All)" endcase PROCEDURE I0520_import_error_1 *-------------------------------------------------------------------------------------* * Called from: I0500_process_verification_error_codes * * * * Parameters: (none) * * * * Procedures called: I0550_build_results_table * * * * Functions called: SCROLL() * * * * This procedure is called when no match is found, and the import record is added. * * * * CAPTAIN'S LOG * * --------- --- * * v 3.4 12.29.2006 * * Added punctuatuion mark to end of error message. * *-------------------------------------------------------------------------------------* if I110_verify_screen_row > 20 I120_scroll_up = SCROLL(2,00,20,79,1) I110_verify_screen_row = 20 endif if I075_add_all_non_matching = .t. do I0550_build_results_table with "import" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) @ I110_verify_screen_row, 32 SAY REPLICATE(" ",47) * @ I110_verify_screen_row, 32 SAY "no match, added" @ I110_verify_screen_row, 32 SAY "no match, added." && ** v 3.4 12.29.2006 I140_import_added_count = I140_import_added_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 else set color to (mgreenhigh) @ I110_verify_screen_row, 0 SAY I115_verify_line_out *--------------------------------------------------------------------------------* * v 3.3 changes 06/12/04: Highlight "Y", "N" and "A". (set color to (mBright)) * *--------------------------------------------------------------------------------* set color to (mBright) @ I110_verify_screen_row, (LEN(I115_verify_line_out) - 13) SAY "Y" @ I110_verify_screen_row, (LEN(I115_verify_line_out) - 11) SAY "N" @ I110_verify_screen_row, (LEN(I115_verify_line_out) - 4) SAY "A" @ I110_verify_screen_row, LEN(I115_verify_line_out) SAY "" set color to (mblack) set cursor on do while .t. mInkey = Inkey(0) do case case mInkey = 89 .or. mInkey = 121 && "Y" or "y" do I0550_build_results_table with "import" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) @ I110_verify_screen_row, 32 SAY REPLICATE(" ",47) @ I110_verify_screen_row, 32 SAY "no match, added." I140_import_added_count = I140_import_added_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 EXIT case mInkey = 78 .or. mInkey = 110 && "N" or "n" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) @ I110_verify_screen_row, 32 SAY REPLICATE(" ",47) @ I110_verify_screen_row, 32 SAY "no match, ignored." I145_import_ignored_count = I145_import_ignored_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 EXIT case mInkey = 65 .or. mInkey = 97 && "A" or "a" do I0550_build_results_table with "import" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) @ I110_verify_screen_row, 32 SAY REPLICATE(" ",47) @ I110_verify_screen_row, 32 SAY "no match, added." I140_import_added_count = I140_import_added_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 I075_add_all_non_matching = .t. EXIT case mInkey = 27 && ESC EXIT endcase enddo endif PROCEDURE I0530_import_error_3and4 *-------------------------------------------------------------------------------------* * Called from: I0500_process_verification_error_codes * * * * Parameters: (none) * * * * Procedures called: I0550_build_results_table * * * * Functions called: SCROLL() * * * * This procedure is called when records match, but their withdrawal or deposit * * amounts are different. * * * * CAPTAIN'S LOG * * --------- --- * * v 3.4 12.29.2006 fix - Finished "match, amounts differ, overwritten with import " * * message with a ".". * * * *-------------------------------------------------------------------------------------* && {check numbers match, but amounts differ} if I110_verify_screen_row > 20 I120_scroll_up = SCROLL(2,00,20,79,1) I110_verify_screen_row = 20 endif @ I110_verify_screen_row, 32 SAY REPLICATE(" ",47) if I125_overwrite_all_diff_amounts = .t. do I0550_build_results_table with "overwrite" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) * @ I110_verify_screen_row, 32 SAY "match, amounts differ, overwritten with import " @ I110_verify_screen_row, 32 SAY "match, amounts differ, overwritten with import. " && v 3.4 12.29.2006 I130_import_overwrite_count = I130_import_overwrite_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 else set color to (mgreenhigh) @ I110_verify_screen_row, 0 SAY I115_verify_line_out *--------------------------------------------------------------------------------* * v 3.3 changes 06/12/04: Highlight "Y", "N" and "A". (set color to (mBright)) * *--------------------------------------------------------------------------------* set color to (mBright) @ I110_verify_screen_row, (LEN(I115_verify_line_out) - 13) SAY "Y" @ I110_verify_screen_row, (LEN(I115_verify_line_out) - 11) SAY "N" @ I110_verify_screen_row, (LEN(I115_verify_line_out) - 4) SAY "A" @ I110_verify_screen_row, LEN(I115_verify_line_out) SAY "" *-------------------------END OF v 3.3 changes-----------------------------------* set color to (mblack) set cursor on do while .t. mInkey = Inkey(0) do case case mInkey = 89 .or. mInkey = 121 && "Y" or "y" do I0550_build_results_table with "overwrite" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) * @ I110_verify_screen_row, 32 SAY "match, amounts differ, overwritten with import " @ I110_verify_screen_row, 32 SAY "match, amounts differ, overwritten with import. " && v 3.4 12.29.2006 I130_import_overwrite_count = I130_import_overwrite_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 EXIT case mInkey = 78 .or. mInkey = 110 && "N" or "n" do I0550_build_results_table with "matched" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) @ I110_verify_screen_row, 32 SAY REPLICATE(" ",47) @ I110_verify_screen_row, 32 SAY "match, amounts differ, ignored." I135_overwrite_ignored_count = I135_overwrite_ignored_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 EXIT case mInkey = 65 .or. mInkey = 97 && "A" or "a" do I0550_build_results_table with "overwrite" @ I110_verify_screen_row, 0 SAY SUBSTR(I115_verify_line_out,1,31) * @ I110_verify_screen_row, 32 SAY "match, amounts differ, overwritten with import " @ I110_verify_screen_row, 32 SAY "match, amounts differ, overwritten with import. " && v 3.4 12.29.2006 I130_import_overwrite_count = I130_import_overwrite_count + 1 I110_verify_screen_row = I110_verify_screen_row + 1 I125_overwrite_all_diff_amounts = .t. EXIT case mInkey = 27 && ESC EXIT endcase enddo endif PROCEDURE I0550_build_results_table *--------------------------------------------------------------------* * Called from: I0500_process_verification_error_codes * * * * Parameters: "import","overwrite","current", * * "matched" * * * * Procedures called: I0560_Insert_paid_symbol * * * * Functions called: (none) * * * * I100_error_code Explanation * * --------------- ----------- * * 0 match, amounts verified * * 1 no match, add to current? * * 2 no import for current, always keep current * * 3 match, deposit amounts differ * * 4 match, withdrawal amounts differ * *--------------------------------------------------------------------* PARAMETER I150_build_type PRIVATE I_curr_index, I_import_index if I022_curr_index > I165_current_size I_curr_index = I165_current_size else I_curr_index = I022_curr_index endif if I021_import_index > I160_import_size I_import_index = I160_import_size else I_import_index = I021_import_index endif do case case I150_build_type = "matched" && (match, amounts verified) if I080_import_type = "BANK" I02_import_results_table[I023_results_index] = SUBSTR(mTable[I_curr_index],1,11) +; CHR(251) +; && insert "PAID" symbol v 3.3 01/28/06 SUBSTR(mTable[I_curr_index],13,68) && v 3.3 01/22/06 * SUBSTR(mTable[I_curr_index],13,66) && v 3.3 01/22/06 (changed length to 66) else && (I080_import_type = "MERGE") I02_import_results_table[I023_results_index] = mTable[I_curr_index] && When merging files, and a match is && found, always build the new file && using the current transaction endif case I150_build_type = "current" && (no match for current transaction, always keep current file's transactions) I02_import_results_table[I023_results_index] = mTable[I_curr_index] case I150_build_type = "import" && (add import to new current file) if I080_import_type = "BANK" I01_import_in_table[I_import_index] = SUBSTR(I01_import_in_table[I_import_index],1,11) +; CHR(251) +; && Insert PAID symbol v 3.3 01/28/06 SUBSTR(I01_import_in_table[I_import_index],13,67) endif do I0580_Calculate_Import_Balance WITH I_import_index && v 3.3 01/28/06 I02_import_results_table[I023_results_index] = SUBSTR(I01_import_in_table[I_import_index],1,70) +; xcom(I085_results_balance,10) && v 3.3 01/28/06 insert new balance case I150_build_type = "overwrite" do I0560_Insert_paid_symbol && v.3.3 if I100_error_code = 3 && overwrite deposit if I080_import_type = "BANK" I02_import_results_table[I023_results_index] = SUBSTR(mTable[I_curr_index],1,11) +; && keep current date & check # SUBSTR(I01_import_in_table[I_import_index],12,1) +; && insert bank's "PAID" indicator SUBSTR(mTable[I_curr_index],13,48) +; && current description SUBSTR(I01_import_in_table[I_import_index],61,9) +; && overwrite deposit SUBSTR(mTable[I_curr_index],70,10) && keep current balance else && (I080_import_type = "MERGE") I02_import_results_table[I023_results_index] = SUBSTR(mTable[I_curr_index],1,11) +; && keep current date & check # SUBSTR(mTable[I_curr_index],12,1) +; && keep current "PAID" indicator SUBSTR(mTable[I_curr_index],13,48) +; && keep current description and withdrawal SUBSTR(I01_import_in_table[I_import_index],61,9) +; && overwrite deposit SUBSTR(mTable[I_curr_index],70,10) && keep current balance endif else && overwrite withdrawal if I080_import_type = "BANK" I02_import_results_table[I023_results_index] = SUBSTR(mTable[I_curr_index],1,11) +; && keep current date & check # SUBSTR(I01_import_in_table[I_import_index],12,1) +; && insert bank's "PAID" indicator SUBSTR(mTable[I_curr_index],13,37) +; && keep current description SUBSTR(I01_import_in_table[I_import_index],50,9) +; && overwrite withdrawal SUBSTR(mTable[I_curr_index],59,21) && keep current deposit and balance else && (I080_import_type = "MERGE") I02_import_results_table[I023_results_index] = SUBSTR(mTable[I_curr_index],1,11) +; && keep current date & check # SUBSTR(mTable[I_curr_index],12,1) +; && keep current "PAID" indicator SUBSTR(mTable[I_curr_index],13,37) +; && keep current description SUBSTR(I01_import_in_table[I_import_index],50,9) +; && overwrite withdrawal SUBSTR(mTable[I_curr_index],59,21) && keep current deposit and balance endif endif endcase I085_results_balance = I0400_string_to_value(71,80,I02_import_results_table[I023_results_index]) && v 3.3 01/28/06 I023_results_index = I023_results_index + 1 I155_results_table_count = I155_results_table_count + 1 PROCEDURE I0560_Insert_paid_symbol *---------------------------------------------------------------* * Called from: I0550_build_results_table * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * Not all bank .QIF files populate the "PAID" parameter, so * * here F.M. adds the "PAID" check symbol to all imported bank * * transactions. When merging the imported file with the * * current one, the "PAID" symbol is unchanged. In both cases, * * the current file's transaction DESCRIPTION column will never * * be overwritten by the imported transaction's DESCRIPTION. * * * * i.e. * * if import_type = "BANK" * * {add the "PAID" check symbol} * * else * * {do nothing, because import_type = "MERGE"} * * endif * * * *---------------------------------------------------------------* if I080_import_type = "BANK" I01_import_in_table[I_import_index] = SUBSTR(I01_import_in_table[I_import_index],1,11) +; CHR(251) +; SUBSTR(I01_import_in_table[I_import_index],13,67) endif PROCEDURE I0580_Calculate_Import_Balance *---------------------------------------------------------------* * Called from: I0550_build_results_table * * * * Parameters: I58_Index * * * * Procedures called: (none) * * * * Functions called: I0400_string_to_value() * * * * This procedure was added for the v 3.3 upgrade on 01/28/06, * * and calculates the balance field when a new import * * transaction is added to the current file. * *---------------------------------------------------------------* PARAMETERS I58_Index PRIVATE I58_WTH_AMOUNT, I58_DEP_AMOUNT I58_WTH_AMOUNT = I0400_string_to_value(50,58,I01_import_in_table[I58_Index]) I58_DEP_AMOUNT = I0400_string_to_value(61,69,I01_import_in_table[I58_Index]) if I58_WTH_AMOUNT = 0.00 && (import is a deposit) I085_results_balance = I085_results_balance + I58_DEP_AMOUNT else && (import is a withdrawal) I085_results_balance = I085_results_balance - I58_WTH_AMOUNT endif PROCEDURE I0600_Import_Summary *---------------------------------------------------------------* * Called from: FM_IMPORT * * * * Parameters: (none) * * * * Procedures called: I0700_transfer_imports_to_current * * I0800_resort_current_account * * * * Functions called: (none) * *---------------------------------------------------------------* if I110_verify_screen_row > 6 I120_scroll_up = SCROLL(2,00,20,79,(I110_verify_screen_row-6)) endif I146_total_matched = I131_import_verified_count +; I130_import_overwrite_count +; I135_overwrite_ignored_count I147_total_not_found = I140_import_added_count + I145_import_ignored_count @ 7, 6 SAY "SUMMARY" @ 9, 0 SAY "Matched" @ 9, 17 SAY SUBSTR(STR(I146_total_matched),LEN(STR(I146_total_matched))-2,3) @ 11, 2 SAY "verified" @ 11, 12 SAY SUBSTR(STR(I131_import_verified_count),LEN(STR(I131_import_verified_count))-2,3) @ 12, 2 SAY "overwrote" @ 12, 12 SAY SUBSTR(STR(I130_import_overwrite_count),LEN(STR(I130_import_overwrite_count))-2,3) @ 13, 2 SAY "ignored" @ 13, 12 SAY SUBSTR(STR(I135_overwrite_ignored_count),LEN(STR(I135_overwrite_ignored_count))-2,3) @ 15, 0 SAY "Not Found" @ 15, 17 SAY SUBSTR(STR(I147_total_not_found),LEN(STR(I147_total_not_found))-2,3) @ 17, 2 SAY "added" @ 17, 12 SAY SUBSTR(STR(I140_import_added_count),LEN(STR(I140_import_added_count))-2,3) @ 18, 2 SAY "ignored" @ 18, 12 SAY SUBSTR(STR(I145_import_ignored_count),LEN(STR(I145_import_ignored_count))-2,3) @ 20, 0 SAY "Total Imports" @ 20, 17 SAY SUBSTR(STR(I160_import_size),LEN(STR(I160_import_size))-2,3) set color to (mgreenhigh) @ 24, 0 SAY "Verification complete. Import into current account? (y/n)" set color to (mBright) && v 3.3 03/08/06 @ 24, 53 SAY "y" && v 3.3 03/08/06 @ 24, 55 SAY "n" && v 3.3 03/08/06 @ 24, 57 SAY "" && v 3.3 03/08/06 set color to (mblack) do while .t. mInkey = Inkey(0) if mInkey = 89 .or. mInkey = 121 && "Y" or "y" do I0700_transfer_imports_to_current if I140_import_added_count > 0 .or.; I131_import_verified_count > 0 .or.; I130_import_overwrite_count > 0 mChanged = .t. endif EXIT else do I0800_resort_current_account && "N" or "n" {do NOT import results into currrent} EXIT endif enddo PROCEDURE I0700_transfer_imports_to_current *---------------------------------------------------------------* * Called from: I0600_Import_Summary * * * * Parameters: (none) * * * * Procedures called: I0750_fill_results_sort_file * * Fill_Table * * * * Functions called: (none) * *---------------------------------------------------------------* *PRIVATE table_size, i && v 3.3 01/28/06 USE (FormatFile) COPY TO (SortInFile) USE (SortInFile) do I0750_fill_results_sort_file SORT ON AC_DATE/A, AC_CK_NUM/A TO (SortOutFile) USE (SortOutFile) do Fill_Table WITH "results" CLOSE DATABASES DELETE FILE (SortInFile) DELETE FILE (SortOutFile) PROCEDURE I0750_fill_results_sort_file *---------------------------------------------------------------* * Called from: I0700_transfer_imports_to_current * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * *---------------------------------------------------------------* PRIVATE I0750_I, size, sRow ZAP * do add_balance_rec && to sort file! size = I023_results_index - 1 I0750_I = 1 for I0750_I = 1 to size sRow = I02_import_results_table[I0750_I] && v 3.3 01/27/06 crashes when I0750_I=64 APPEND BLANK REPLACE AC_DATE with CTOD(SUBSTR(sRow,1,10)) REPLACE AC_CK_NUM with VAL(SUBSTR(sRow,14,4)) REPLACE AC_DESC with SUBSTR(sRow,19,30) if SUBSTR(sRow,12,1) = " " REPLACE AC_PAID with .f. else REPLACE AC_PAID with .t. endif REPLACE AC_WTH_AMT with I0400_string_to_value(50,58,sRow) REPLACE AC_DEP_AMT with I0400_string_to_value(61,69,sRow) REPLACE AC_BALANCE with I0400_string_to_value(71,80,sRow) next COMMIT PROCEDURE I0800_resort_current_account *--------------------------------------------------------------------* * Called from: I0600_Import_Summary * *--------------------------------------------------------------------* USE (FormatFile) COPY TO (SortInFile) USE (SortInFile) do I0850_fill_current_sort_file SORT ON AC_DATE/A, AC_CK_NUM/A TO (SortOutFile) USE (SortOutFile) do I0875_fill_mTable CLOSE DATABASES DELETE FILE (SortInFile) DELETE FILE (SortOutFile) PROCEDURE I0850_fill_current_sort_file *--------------------------------------------------------------------* * Called from: I0800_resort_current_account * *--------------------------------------------------------------------* PRIVATE i, size, sRow ZAP * do add_balance_rec && to sort file! for i = 1 to I165_current_size sRow = mTable[i] APPEND BLANK REPLACE AC_DATE with CTOD(SUBSTR(sRow,1,10)) REPLACE AC_CK_NUM with VAL(SUBSTR(sRow,14,4)) REPLACE AC_DESC with SUBSTR(sRow,19,30) if SUBSTR(sRow,12,1) = " " REPLACE AC_PAID with .f. else REPLACE AC_PAID with .t. endif REPLACE AC_WTH_AMT with I0400_string_to_value(50,58,sRow) REPLACE AC_DEP_AMT with I0400_string_to_value(61,69,sRow) REPLACE AC_BALANCE with I0400_string_to_value(71,80,sRow) next COMMIT PROCEDURE I0875_fill_mTable *--------------------------------------------------------------------* * Called from: I0800_resort_current_account * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure populates mTable[] with the sorted results table * * file (SortInFile), and calculates the new current balance. * *--------------------------------------------------------------------* PRIVATE index, temp index = 1 Curr_Balance = Bk_Bal_Num do while !EOF() temp = "" * temp = temp + xcom(AC_BALANCE,10) && does this belong here? temp = DTOC(AC_DATE) + " " if AC_PAID = .t. temp = temp + CHR(251) + " " else temp = temp + " " endif if AC_CK_NUM = 0 temp = temp + " " + " " && **Y2k** else temp = temp + STR(AC_CK_NUM) + " " && **Y2K** endif temp = temp + AC_DESC + " " if AC_WTH_AMT = 0.00 temp = temp + " " + " " else temp = temp + xcom(AC_WTH_AMT,9) + " " endif if AC_DEP_AMT = 0.00 temp = temp + " " + " " else temp = temp + xcom(AC_DEP_AMT,9) + " " endif * if AC_PAID = .t. && v 3.3 01/28/06 commented out temp = temp + xcom(AC_BALANCE,10) * else * Curr_Balance = Curr_Balance - AC_WTH_AMT * Curr_Balance = Curr_Balance + AC_DEP_AMT * temp = temp + xcom(Curr_Balance,10) * endif mTable[index] = temp skip 1 index = index + 1 enddo && END LOOP Curr_Balance = I085_results_balance && v 3.3 01/28/06 tb_size = index num_records = index - 1 *--------------------GET FUNCTION-------------------------* PROCEDURE get_function *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE dummy set cursor on do while .t. mInkey = Inkey(0) do case case mInkey = 5 && Up arrow if xrow > 8 xrow = xrow - 1 xindex = xindex - 1 @ xrow, 00 SAY "" else if xindex > 1 dummy = SCROLL(8,00,20,79,-1) xindex = xindex - 1 @ xrow, 00 SAY mTable[xindex] @ xrow, 00 SAY "" endif endif case mInkey = 24 && Down Arrow if xrow < 20 .and. xindex < (tb_size - 1) xrow = xrow + 1 xindex = xindex + 1 @ xrow, 00 SAY "" else if xindex < (tb_size - 1) dummy = SCROLL(8,00,20,79,1) xindex = xindex + 1 @ xrow, 00 SAY mTable[xindex] @ xrow, 00 SAY "" endif endif case mInkey = -2 .or. mInkey = -4 .or. mInkey = -6 .or.; mInkey = -8 .or. mInkey = 27 .or. mInkey = -1 EXIT otherwise endcase enddo PROCEDURE edit_menu *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * EM_BAR * * EM_RETIEVE * * EM_SAVE * * EM_DIRECTORY * * EM_COPY * * EM_DELETE * * * * Functions called: EM_LEFT * * EM_RIGHT * * * * * * This procedure displays the EDIT menu at the bottom of the * * screen. It also processes the chosen file option. * *---------------------------------------------------------------* PRIVATE em_position do paint_message with "emenu" set color to (mBlack) @ 23,00 SAY "Browse Change Delete Mark paid" set color to (mBright) @ 23,00 SAY "B" @ 23,09 SAY "C" @ 23,18 SAY "D" @ 23,27 SAY "M" em_position = 1 do em_bar WITH "draw", em_position do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow do em_bar WITH "erase", em_position em_position = em_left(em_position) do em_bar WITH "draw", em_position case mInkey = 4 && Right Arrow do em_bar WITH "erase", em_position em_position = em_right(em_position) do em_bar WITH "draw", em_position case mInkey = 66 .or. mInkey = 98 && "B" or "b" em_position = 1 EXIT case mInkey = 67 .or. mInkey = 99 && "C" or "c" em_position = 2 EXIT case mInkey = 68 .or. mInkey = 100 && "D" or "d" em_position = 3 EXIT case mInkey = 77 .or. mInkey = 109 && "M" or "m" em_position = 4 EXIT otherwise endcase enddo if mInkey <> 27 && ESC not pressed do case case em_position = 1 do em_browse case em_position = 2 do em_change case em_position = 3 do em_delete case em_position = 4 do em_mark_paid endcase endif set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) set color to (mColor) *--------------------- PROCEDURE em_bar *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *--------------------- PARAMETERS type, position if type = "draw" set color to (mCyan) else set color to (mBlack) endif do case case position = 1 @ 23,00 SAY "Browse" set color to (mBlack) if type = "draw" @ 24,00 SAY "Browse through account transactions." set color to (mCyan) @ 23,00 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,00 SAY "B" endif case position = 2 @ 23,09 SAY "Change" set color to (mBlack) if type = "draw" @ 24,00 SAY "Change contents of transaction." set color to (mCyan) @ 23,09 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,09 SAY "C" endif case position = 3 @ 23,18 SAY "Delete" set color to (mBlack) if type = "draw" @ 24,00 SAY "Delete transaction." set color to (mCyan) @ 23,18 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,18 SAY "D" endif case position = 4 @ 23,27 SAY "Mark paid" set color to (mBlack) if type = "draw" @ 24,00 SAY "Mark transaction paid." set color to (mCyan) @ 23,27 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,27 SAY "M" endif endcase *--------------------- FUNCTION em_left *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *--------------------- PARAMETERS position PRIVATE new_position if position = 1 new_position = 4 else new_position = position - 1 endif return new_position *--------------------- FUNCTION em_right *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *--------------------- PARAMETERS position PRIVATE new_position if position = 4 new_position = 1 else new_position = position + 1 endif return new_position PROCEDURE em_browse *---------------------------------------------------------------* * Called from: EM_MENU * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * SCROLL_SCREEN * * * * This procedure positions the cursor at the last row of the * * account file, and allows the user to scroll through all * * transactions by pressing the up or down arrow keys. * *---------------------------------------------------------------* do paint_message with "em_browse" do scroll_screen with "em_browse" PROCEDURE em_change *---------------------------------------------------------------* * Called from: EM_MENU * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * SCROLL_SCREEN * * UPDATE_ROW * * * * This procedure positions the cursor at the current row of * * the account file, and allows the user to scroll through all * * transactions by pressing the up or down arrow keys. A * * record is then selected for change by pressing ENTER. After * * the transaction is changed, the balance for all unpaid * * transactions will be updated. The user quits the Change * * screen by pressing ESC. * * * * 07.18.2000 - added private variables "savexrow" and * * and "savexindex". * * * *---------------------------------------------------------------* PRIVATE OldWITHDRAWAL, OldDeposit, savexrow, savexindex do while .t. do paint_message with "em_change" savexrow = xrow && ** 07.18.2000 savexindex = xindex && ** 07.18.2000 do scroll_screen with "em_change" if mInkey = 13 && ** ENTER key ** @ 24,00 SAY REPLICATE(" ",80) @ 24,00 SAY "Type changes then press ENTER. (ESC for menu)" * 06.09.1999 Y2K OldWITHDRAWAL = un_comma(49,57,xIndex) * 06.09.1999 Y2K OldDeposit = un_comma(60,68,xIndex) OldWITHDRAWAL = un_comma(50,58,xIndex) OldDeposit = un_comma(61,69,xIndex) do update_row xrow = savexrow && ** 07.18.2000 xindex = savexindex && ** 07.18.2000 if ! paid * 06.09.1999 Y2K if un_comma(49,57,xIndex) <> OldWITHDRAWAL .or. ; * 06.09.1999 Y2K un_comma(60,68,xIndex) <> OldDeposit if un_comma(50,58,xIndex) <> OldWITHDRAWAL .or. ; un_comma(61,69,xIndex) <> OldDeposit do change_balances endif endif else if mInkey = 27 && ** ESC key ** xrow = savexrow && ** 07.18.2000 xindex = savexindex && ** 07.18.2000 EXIT endif endif enddo PROCEDURE balance_acct *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: None * * * * Modules called: PAINT_MESSAGE * * GETDATE * * GETDOLLARS * * XCOM * * CHANGE_BALANCES * * * * This procedure is called when the "Balance" option is * * chosen from the main menu. The bank balance and date are * * input using the GETDATE and GETDOLLARS functions. After * * these values are typed in, a new current balance is * * calculated for all unpaid transactions, and displayed * * below the bank balance. * *---------------------------------------------------------------* do paint_message with "mm_balance" @ 24,00 SAY "Enter date of new balance. (ESC to quit)" * 06.09.1999 Y2K Bk_Date_Val = GETDATE(2,41,Bk_Date_Val) Bk_Date_Val = GETDATE(2,39,Bk_Date_Val,"Balance") &&10.17.2000 added 4th parameter to GETDATE Bk_Date_Str = DTOC(Bk_Date_Val) set color to (mColor) * 06.09.1999 Y2K @ 2, 41 SAY Bk_Date_Str @ 2, 39 SAY Bk_Date_Str if mInkey <> 27 set color to (mBlack) @ 24,00 SAY "Enter date of new balance. (ESC to quit)" @ 24,00 SAY "Enter new balance. (ESC to quit) " Bk_Bal_Num = GETDOLLARS(2,66,Bk_Bal_Num,10) Bk_Bal_Str = xcom(Bk_Bal_Num,10) set color to (mColor) @ 2, 66 SAY Bk_Bal_Str if mInkey <> 27 do change_balances mChanged = .t. endif endif PROCEDURE recalc_bal *---------------------------------------------------------------* * Called from: change_balances * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, size, sRow set color to (mCyanBlink) set cursor off @ 22,70 SAY "Balancing" set color to (mColor) Curr_Balance = Bk_Bal_Num size = tb_size - 1 for i = 1 to size sRow = mTable[i] * 06.09.1999 Y2K if SUBSTR(sRow,10,1) = " " && check if marked paid if SUBSTR(sRow,12,1) = " " && check if marked paid * 06.09.1999 Y2K Curr_Balance = Curr_Balance - un_comma(49,57,i) * 06.09.1999 Y2K Curr_Balance = Curr_Balance + un_comma(60,68,i) Curr_Balance = Curr_Balance - un_comma(50,58,i) Curr_Balance = Curr_Balance + un_comma(61,69,i) * 06.29.1999 Y2K mTable[i] = SUBSTR(mTable[i],1,69) + XCOM(Curr_Balance,10) mTable[i] = SUBSTR(mTable[i],1,70) + XCOM(Curr_Balance,10) endif next set color to (mBlack) @ 22,70 SAY " " set cursor on PROCEDURE change_balances *---------------------------------------------------------------* * Called from: balance_acct * * em_change * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *------------------------- do recalc_bal set color to (mColor) @ 3, 66 SAY xcom(Curr_Balance,10) * @ 2, 66 SAY Bk_Bal_Str @ 2, 66 SAY xcom(Bk_Bal_Num,10) do PaintRows with (xIndex - (xrow - 8)) @ xrow, 00 SAY "" mChanged = .t. PROCEDURE PaintRows *---------------------------------------------------------------* * Called from: CHANGE_BALANCES * * * * Parameters: StartIndex * * This parameter contains the * * table index of the first physical * * line to be displayed (row = 8) * * * * Procedures called: none * *---------------------------------------------------------------* PARAMETERS StartIndex PRIVATE row,index,EndIndex if StartIndex + 12 < tb_size EndIndex = StartIndex + 12 else EndIndex = Tb_Size - 1 endif set color to (mColor) row = 8 index = StartIndex do while .t. if index > EndIndex EXIT else @ row, 00 SAY mTable[index] row = row + 1 index = index + 1 endif enddo return PROCEDURE print_acct *---------------------------------------------------------------* * Called from: MAINLINE * * * * * * This is a skeleton for a procedure that will eventually * * print the contents of the account file in memory. * * * *---------------------------------------------------------------* procedure SEARCH_MENU *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: (none) * * * * Procedures called: PAINT_TOP_ROW * * PAINT_MESSAGE * * search_SCREEN * * A0100_EDIT_SEARCH_VALUES * * INIT_SEARCH_VALUES * * B1000_PROCESS_SEARCH * * * * * * Functions called: sm_left * * sm_right * * * * This procedure allows to list only certain account records * * using SQL type search criteria. * * * *** 09.28.2000 - begin coding * * * *---------------------------------------------------------------* private Sm_position DO INIT_SEARCH_VALUES set color to (mBlack) clear DO PAINT_TOP_ROW WITH "Search" do paint_message with "SEARCH_MENU" do search_SCREEN DO A0100_EDIT_SEARCH_VALUES DO WHILE .T. do paint_message with "SEARCH_MENU" set color to (mBlack) @ 23,00 SAY "Edit Search Search Account Search Multiple Accounts" set color to (mBright) @ 23,00 SAY "E" @ 23,17 SAY "S" @ 23,44 SAY "M" sm_position = 1 do sm_bar WITH "draw", Sm_position do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow do sm_bar WITH "erase", sm_position sm_position = sm_left(sm_position) do sm_bar WITH "draw", sm_position case mInkey = 4 && Right Arrow do sm_bar WITH "erase", sm_position sm_position = sm_right(sm_position) do sm_bar WITH "draw", sm_position case mInkey = 69 .or. mInkey = 101 && "E" or "e" sm_position = 1 EXIT case mInkey = 83 .or. mInkey = 115 && "S" or "s" sm_position = 2 EXIT case mInkey = 77 .or. mInkey = 109 && "M" or "m" sm_position = 3 EXIT otherwise endcase enddo && end inner bounce bar search menu loop if mInkey = 27 EXIT else && return pressed do case case sm_position = 1 do A0100_EDIT_SEARCH_VALUES case sm_position = 2 mSave_scr2 = SaveScreen(01,00,24,79) do B1000_PROCESS_SEARCH RestScreen(01,00,24,79,mSave_scr2) * case sm_position = 3 && here's where the multiple files code goes * do sm_delete endcase endif enddo set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) set color to (mColor) PROCEDURE sm_bar *---------------------------------------------------------------* * Called from: SEARCH_MENU * * * * Parameters: type "draw","erase" * * position 1=Edit Search * * 2=Search Account * * 3=Search Multiple Accounts * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure displays an inverse video bar over one of * * these search menu options: * * * * Edit Search Search Account Search Multiple Accounts * * * *---------------------------------------------------------------* PARAMETERS type, position if type = "draw" set color to (MSEARCHGET) else set color to (mBlack) endif do case case position = 1 @ 23,00 SAY "Edit Search" set color to (mBlack) if type = "draw" @ 24,00 SAY "Add or change search values." set color to (MSEARCHGET) @ 23,00 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,00 SAY "E" endif case position = 2 @ 23,17 SAY "Search Account" set color to (mBlack) if type = "draw" @ 24,00 SAY "Find all transactions in current account that match search expression." set color to (MSEARCHGET) @ 23,17 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,17 SAY "S" endif case position = 3 @ 23,37 SAY "Search Multiple Accounts" set color to (mBlack) if type = "draw" @ 24,00 SAY "Match selection criteria to multiple account files." set color to (mSearchGet) @ 23,37 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,44 SAY "M" endif endcase FUNCTION sm_left *---------------------------------------------------------------* * Called from: SEARCH_MENU * *---------------------------------------------------------------* PARAMETERS position PRIVATE new_position if position = 1 new_position = 3 else new_position = position - 1 endif return new_position FUNCTION sm_right *---------------------------------------------------------------* * Called from: SEARCH_MENU * *---------------------------------------------------------------* PARAMETERS position PRIVATE new_position if position = 3 new_position = 1 else new_position = position + 1 endif return new_position PROCEDURE A0100_EDIT_SEARCH_VALUES *---------------------------------------------------------------* * Called from: SEARCH_MENU * * * * Parameters: (none) * * * * Procedures called: FIND_Q_OPERATOR * * FIND_SEARCH_AND_OR * * DISPLAY_DATE_SRCH_ENTRY * * FIND_STRING * * DISPLAY_CHECKNUM_SRCH_ENTRY * * DISPLAY_DESC_SRCH_ENTRY * * TREASURE_HUNT * * DISPLAY_WITHD_SRCH_ENTRY * * SHOW_DEPOS_SRCH_ENTRY * * * * * * Functions called: A0500_FIND_DATE * * * * This procedure traverses the search entry screen matrix and * * finds the input values. This procedure quits back to the * * search menu when "ESC" is pressed. * *---------------------------------------------------------------* PRIVATE ROW,COL,A_HUNDRED_THOUSAND_DOLLARS,FOUND,TODAYS_DATE A_HUNDRED_THOUSAND_DOLLARS=8 TODAYS_DATE=" / / " COL=16 ROW=DATE_DEPTH SET COLOR TO (MBROWN) @22,0 SAY "EDIT SEARCH" SET COLOR TO (MBLACK) @24,0 SAY " accepts input and moves to next entry, back to Search Menu." do while .t. IF MINKEY=27 EXIT ELSE DO CASE *---------------------------------------------------------------------------------------- CASE ROW = DATE_DEPTH && dates...dates?.....DAAAATES!!!!! *------------------------------------ do case CASE COL=16 && find operator DO FIND_Q_OPERATOR WITH ROW,COL,SDATE_OPERATOR1 FOUND=!(SDATE_OPERATOR1=REPLICATE(" ",LEN(SDATE_OPERATOR1))) IF FOUND COL=19 ELSE ROW=CHECK_DEPTH COL=16 ENDIF CASE COL=19 && find date SDATE_STR1=A0500_FIND_DATE(ROW,COL,SDATE_STR1) FOUND=!SDATE_STR1=" / / " IF FOUND COL=31 ELSE ROW=CHECK_DEPTH COL=16 ENDIF CASE COL=31 && find "AND" or "OR" DO FIND_SEARCH_AND_OR WITH ROW,COL,SDATE_AND_OR FOUND=!(SDATE_AND_OR=REPLICATE(" ",LEN(SDATE_AND_OR))) IF FOUND COL=37 ELSE ROW=CHECK_DEPTH && I wonder if Bill Gates Dates...Dates? COL=16 ENDIF CASE COL=37 DO FIND_Q_OPERATOR WITH ROW,COL,SDATE_2ND_OP FOUND=!(SDATE_2ND_OP=REPLICATE(" ",LEN(SDATE_2ND_OP))) IF FOUND COL=40 ELSE ROW=CHECK_DEPTH && cosmic DATEs!! cosmic DATEs!! COL=16 ENDIF CASE COL=40 A075_DATE_STR2=A0500_FIND_DATE(ROW,COL,A075_DATE_STR2) FOUND=!A075_DATE_STR2=" / / " ROW=CHECK_DEPTH COL=16 ENDCASE DO DISPLAY_DATE_SRCH_ENTRY WITH ROW,SDATE_OPERATOR1,SDATE_STR1,; SDATE_AND_OR,SDATE_2ND_OP,A075_DATE_STR2 *--------------------------------------------------------------------------------------------* CASE ROW = CHECK_DEPTH && wondering about check numbers here... *----------------------------------------- DO CASE CASE COL=16 && find operator DO FIND_Q_OPERATOR WITH ROW,COL,SCHECK_OPERATOR1 FOUND=!(SCHECK_OPERATOR1=REPLICATE(" ",LEN(SCHECK_OPERATOR1))) IF FOUND COL=19 ELSE ROW=DESC1_DEPTH && skipping to description while not concerned about COL=16 && those check numba's ENDIF CASE COL=19 && find check number do FIND_STRING with ROW,COL,SCHECK_NUM1,4,.T.,"SEARCH" FOUND=!(SCHECK_NUM1=REPLICATE(" ",LEN(SCHECK_NUM1))) IF FOUND COL=31 ELSE ROW=DESC1_DEPTH COL=16 ENDIF CASE COL=31 DO FIND_SEARCH_AND_OR WITH ROW,COL,SCHECK_AND_OR FOUND=!(SCHECK_AND_OR=REPLICATE(" ",LEN(SCHECK_AND_OR))) IF FOUND COL=37 ELSE ROW=DESC1_DEPTH COL=16 ENDIF CASE COL=37 DO FIND_Q_OPERATOR WITH ROW,COL,SCHECK_2ND_OP FOUND=!(SCHECK_2ND_OP=REPLICATE(" ",LEN(SCHECK_2ND_OP))) IF FOUND COL=40 ELSE ROW=DESC1_DEPTH COL=16 ENDIF CASE COL=40 DO FIND_STRING with ROW,COL,S2ND_CHECKNUM,4,.T.,"SEARCH" FOUND=!(S2ND_CHECKNUM=REPLICATE(" ",LEN(S2ND_CHECKNUM))) ROW=DESC1_DEPTH COL=16 ENDCASE && hurraaay!!...check numbers done..... DO DISPLAY_CHECKNUM_SRCH_ENTRY WITH ROW,SCHECK_OPERATOR1,SCHECK_NUM1,; SCHECK_AND_OR,SCHECK_2ND_OP,S2ND_CHECKNUM *------------------------------------------------------------------------------------------ CASE ROW = DESC1_DEPTH .or. ROW = DESC2_DEPTH .OR. ROW = DESC_OP_DEPTH && find descriptions... *----------------------------- DO CASE CASE COL=16 IF ROW = DESC1_DEPTH && first description line DO FIND_Q_OPERATOR WITH ROW,COL,SDESC_OPERATOR1 FOUND=!(SDESC_OPERATOR1=REPLICATE(" ",LEN(SDESC_OPERATOR1))) ELSE DO FIND_Q_OPERATOR WITH ROW,COL,SDESC_2ND_OP FOUND=!(SDESC_OPERATOR1=REPLICATE(" ",LEN(SDESC_2ND_OP))) ENDIF IF FOUND COL=19 && travel to description value entry area of matrix... ELSE ROW=WITHD_DEPTH COL=16 && jumping to WITHDRAWAL entries ENDIF CASE COL=19 && find description value IF ROW=DESC1_DEPTH DO FIND_STRING with ROW,COL,SDESC1,30,.F.,"SEARCH" FOUND=!(SDESC1=REPLICATE(" ",LEN(SDESC1))) IF FOUND ROW=DESC1_DEPTH+1 && now find operand COL=31 ELSE ROW=WITHD_DEPTH && travel to WITHDRAWAL entry if COL=16 && no description was input ENDIF ELSE && must be on second description line DO FIND_STRING with ROW,COL,SDESC2,30,.F.,"SEARCH" ROW=WITHD_DEPTH COL=16 ENDIF CASE COL=31 && ROW must be DESC_OP_DEPTH here... DO FIND_SEARCH_AND_OR WITH ROW,COL,SDESC_AND_OR FOUND=!(SDESC_AND_OR=REPLICATE(" ",LEN(SDESC_AND_OR))) IF FOUND ROW=DESC2_DEPTH ELSE ROW=WITHD_DEPTH ENDIF COL=16 && jumping to WITHDRAWAL entries ENDCASE && next destination-> find WITHDRAWAL entries.... DO DISPLAY_DESC_SRCH_ENTRY WITH ROW,SDESC_OPERATOR1,SDESC1,SDESC_AND_OR,; = " " SDESC_2ND_OP,SDESC2 *------------------------------------------------------------------------------------- CASE ROW = WITHD_DEPTH && WITHDRAWAL amount search values.... *------------------------------------------- DO CASE CASE COL=16 DO FIND_Q_OPERATOR WITH ROW,COL,SWITHD_OPERATOR1 FOUND=!(SWITHD_OPERATOR1=REPLICATE(" ",LEN(SWITHD_OPERATOR1))) IF FOUND COL=19 ELSE COL=16 ROW=DEPOS_DEPTH ENDIF CASE COL=19 SAWITHD_AMT1=TREASURE_HUNT(A_HUNDRED_THOUSAND_DOLLARS,ROW,COL,SAWITHD_AMT1) FOUND=!(SAWITHD_AMT1=" .00") IF FOUND COL=31 ELSE ROW=DEPOS_DEPTH COL=16 ENDIF CASE COL=31 DO FIND_SEARCH_AND_OR WITH ROW,COL,SWITHD_AND_OR FOUND=!(SWITHD_AND_OR=REPLICATE(" ",LEN(SWITHD_AND_OR))) IF FOUND COL=37 && find second WITHDRAWAL operator ELSE ROW=DEPOS_DEPTH COL=16 && travel to deposit search criteria input ENDIF CASE COL=37 DO FIND_Q_OPERATOR WITH ROW,COL,SWITHD_2ND_OP FOUND=!(SWITHD_2ND_OP=REPLICATE(" ",LEN(SWITHD_2ND_OP))) IF FOUND COL=40 ELSE COL=16 ROW=DEPOS_DEPTH ENDIF CASE COL=40 SWAMT_IN_2 = TREASURE_HUNT(A_HUNDRED_THOUSAND_DOLLARS,ROW,COL,SWAMT_IN_2 ) FOUND=!(SWAMT_IN_2=" .00") ROW=DEPOS_DEPTH COL=16 ENDCASE DO DISPLAY_WITHD_SRCH_ENTRY WITH SWITHD_OPERATOR1,SAWITHD_AMT1,; SWITHD_AND_OR,SWITHD_2ND_OP,SWAMT_IN_2 *------------------------------------------------------------------------------------------ CASE ROW = DEPOS_DEPTH && time to find deposit attributes *------------------------------------------------- DO CASE CASE COL=16 DO FIND_Q_OPERATOR WITH ROW,COL,SDEPOS_OPERATOR1 FOUND=!(SDEPOS_OPERATOR1=REPLICATE(" ",LEN(SDEPOS_OPERATOR1))) IF FOUND COL=19 ELSE ROW=DATE_DEPTH COL=16 && determine if search entries have ended... ENDIF CASE COL=19 SADEPOS_AMT1 = TREASURE_HUNT(A_HUNDRED_THOUSAND_DOLLARS,ROW,COL,SADEPOS_AMT1) FOUND=!(SADEPOS_AMT1=" .00") IF FOUND COL=31 ELSE ROW=DATE_DEPTH COL=16 ENDIF CASE COL=31 DO FIND_SEARCH_AND_OR WITH ROW,COL,SDEPOS_AND_OR FOUND=!(SDEPOS_AND_OR=REPLICATE(" ",LEN(SDEPOS_AND_OR))) IF FOUND COL=37 ELSE ROW=DATE_DEPTH COL=16 && BACK TO TOP ENDIF CASE COL=37 DO FIND_Q_OPERATOR WITH ROW,COL,SDEPOS_2ND_OP FOUND=!(SDEPOS_2ND_OP=" ") IF FOUND COL=40 ELSE ROW=DATE_DEPTH COL=16 && determine if search entries have ended... ENDIF CASE COL=40 SDAMT_IN_2 = TREASURE_HUNT(A_HUNDRED_THOUSAND_DOLLARS,ROW,COL,SDAMT_IN_2 ) FOUND=!(SDAMT_IN_2=" .00") ROW=DATE_DEPTH COL=16 ENDCASE DO SHOW_DEPOS_SRCH_ENTRY WITH SDEPOS_OPERATOR1,SADEPOS_AMT1,; SDEPOS_AND_OR,SDEPOS_2ND_OP,SDAMT_IN_2 ENDCASE ENDIF ENDDO PROCEDURE INIT_SEARCH_VALUES *---------------------------------------------------------------* * Called from: SEARCH_MENU * * * * Parameters: (none) * * Procedures called: (none) * * Functions called: (none) * * * * This procedure initaializes variables associated with the * * search option.... * *---------------------------------------------------------------* DATE_DEPTH =6 CHECK_DEPTH =8 DESC1_DEPTH =10 DESC2_DEPTH =12 DESC_OP_DEPTH =11 WITHD_DEPTH =14 DEPOS_DEPTH =16 CHANGE_DEPTH =19 SDATE_OPERATOR1 = " " SDATE_STR1 = " / / " SDATE_AND_OR = " " SDATE_2ND_OP = " " A075_DATE_STR2 = " / / " SCHECK_OPERATOR1 = " " SCHECK_NUM1 = " " SCHECK_AND_OR = " " SCHECK_2ND_OP = " " S2ND_CHECKNUM = " " SDESC_OPERATOR1 = " " SDESC1 = REPLICATE(" ",30) SDESC_AND_OR = " " SDESC_2ND_OP = " " SDESC2 = REPLICATE(" ",30) SWITHD_OPERATOR1 = " " SAWITHD_AMT1 = " .00" SWITHD_AND_OR = " " SWITHD_2ND_OP = " " SWAMT_IN_2 = " .00" SDEPOS_OPERATOR1 = " " SADEPOS_AMT1 = " .00" SDEPOS_AND_OR = " " SDEPOS_2ND_OP = " " SDAMT_IN_2 = " .00" ROW=DATE_DEPTH COL=16 A_HUNDRED_THOUSAND_DOLLARS=8 && decimal places, excluding the "."! TODAYS_DATE=DATE() FOUND=.F. SEARCH_FINISHED_OPTION="MAKE CHANGES" procedure search_SCREEN *---------------------------------------------------------------* * Called from: SEARCH_MENU * * * * Parameters: (none) * * Procedures called: (none) * * Functions called: (none) * * * * This procedure paints the headers and expression symbol * * legend for the search input screen... * *---------------------------------------------------------------* @ 3,1 SAY "SEARCH AREAS" @ 4,1 SAY "------ -----" @ 3,22 SAY "SEARCH EXPRESSIONS" @ 4,22 SAY "------ -----------" @ 5,57 SAY "EXPRESSION SYMBOLS" @ 6,57 SAY "---------- -------" @ DATE_DEPTH,1 say "DATE" @ CHECK_DEPTH,1 say "CHECK NUMBER" @ DESC1_DEPTH,1 say "DESCRIPTION" @ WITHD_DEPTH,1 say "AMT WITHDRAWAL" @ DEPOS_DEPTH,1 say "AMT DEPOSIT" @ 8,57 say "EQ - Equal to" @ 9,57 say "GR - Greater than" @ 10,57 say "GE - Greater than" @ 11,57 say " or equal to" @ 12,57 say "CT - Contains *" @ 13,57 say "LS - Less than" @ 14,57 say "LE - Less than" @ 15,57 say " or equal to" @ 17,57 say "* - Exclusive to" @ 18,57 say "DESCRIPTION area" set color to (msearchBlankLine) @ DATE_DEPTH,16 say "__" @ DATE_DEPTH,19 say "__/__/____" && Date search input fields @ DATE_DEPTH,31 say "___" @ DATE_DEPTH,37 say "__" @ DATE_DEPTH,40 say "__/__/____" @ CHECK_DEPTH,16 say "__" @ CHECK_DEPTH,19 say "____" @ CHECK_DEPTH,31 say "___" @ CHECK_DEPTH,37 say "__" @ CHECK_DEPTH,40 say "____" @ DESC1_DEPTH,16 say "__" @ DESC1_DEPTH,19 say replicate("_",30) @ DESC1_DEPTH+1,31 say "___" @ DESC2_DEPTH,16 say "__" @ DESC2_DEPTH,19 say replicate("_",30) @ WITHD_DEPTH,16 say "__" @ WITHD_DEPTH,19 say "______.__" && Amount WITHDRAWAL search input fields @ WITHD_DEPTH,31 say "___" @ WITHD_DEPTH,37 say "__" @ WITHD_DEPTH,40 say "______.__" @ DEPOS_DEPTH,16 say "__" @ DEPOS_DEPTH,19 say "______.__" && Amount Deposit search input fields @ DEPOS_DEPTH,31 say "___" @ DEPOS_DEPTH,37 say "__" @ DEPOS_DEPTH,40 say "______.__" *procedure QUIT_search PROCEDURE DISPLAY_DATE_SRCH_ENTRY *---------------------------------------------------------------* * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * SDATE_OPERATOR1 * * SDATE_STR1 ("mm/dd/yyyy") * * SDATE_AND_OR * * SDATE_2ND_OP * * A075_DATE_STR2 ("mm/dd/yyyy") * * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure is called after all inputs on the date line * * have been entered. If a blank is found in either the operator* * or operand fields, the rest of the line is blanked out, as * * well as the values they represent, and the cursor is * * positioned at the next line (check number). * *---------------------------------------------------------------* PARAMETERS ROW,SDATE_OPERATOR1,SDATE_STR1,SDATE_AND_OR,SDATE_2ND_OP,A075_DATE_STR2 SET COLOR TO (MsearchBLANKLINE) IF SDATE_OPERATOR1 = REPLICATE(" ",LEN(SDATE_OPERATOR1)) @ DATE_DEPTH,16 say "__" @ DATE_DEPTH,19 say "__/__/____" && if the first boolean expression (OPERATOR) @ DATE_DEPTH,31 say "___" && isn't entered, the the rest of the line @ DATE_DEPTH,37 say "__" && remains blank. @ DATE_DEPTH,40 say "__/__/____" SDATE_STR1 =" / / " SDATE_AND_OR =REPLICATE(" ",LEN(SDATE_AND_OR)) SDATE_2ND_OP =REPLICATE(" ",LEN(SDATE_2ND_OP)) A075_DATE_STR2=" / / " ELSE @ DATE_DEPTH,16 say SDATE_OPERATOR1 IF SDATE_STR1 = " / / " IF ROW = CHECK_DEPTH @ DATE_DEPTH,16 say "__" @ DATE_DEPTH,19 say "__/__/____" && if the first boolean expression (OPERATOR) @ DATE_DEPTH,31 say "___" && isn't entered, the the rest of the line @ DATE_DEPTH,37 say "__" && remains blank. @ DATE_DEPTH,40 say "__/__/____" SDATE_OPERATOR1=" " SDATE_STR1 =" / / " SDATE_AND_OR =REPLICATE(" ",LEN(SDATE_AND_OR)) SDATE_2ND_OP =REPLICATE(" ",LEN(SDATE_2ND_OP)) A075_DATE_STR2=" / / " ELSE @ DATE_DEPTH,19 SAY "__/__/____" ENDIF ELSE @ DATE_DEPTH,19 SAY SDATE_STR1 IF SDATE_AND_OR = REPLICATE(" ",LEN(SDATE_AND_OR)) @ DATE_DEPTH,31 say "___" @ DATE_DEPTH,37 say "__" @ DATE_DEPTH,40 say "__/__/____" SDATE_AND_OR = REPLICATE(" ",LEN(SDATE_AND_OR)) SDATE_2ND_OP =REPLICATE(" ",LEN(SDATE_2ND_OP)) A075_DATE_STR2=" / / " ELSE @ DATE_DEPTH,31 SAY SDATE_AND_OR IF SDATE_2ND_OP = REPLICATE(" ",LEN(SDATE_2ND_OP)) @ DATE_DEPTH,37 say "__" @ DATE_DEPTH,40 say "__/__/____" IF ROW=CHECK_DEPTH && erase 2nd operand if no 2nd operator @ DATE_DEPTH,31 say "___" SDATE_AND_OR = REPLICATE(" ",LEN(SDATE_AND_OR)) ENDIF ELSE @ DATE_DEPTH,37 say SDATE_2ND_OP @ DATE_DEPTH,40 say A075_DATE_STR2 ENDIF ENDIF ENDIF ENDIF PROCEDURE DISPLAY_CHECKNUM_SRCH_ENTRY *---------------------------------------------------------------* * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * SCHECK_OPERATOR1 * * SCHECK_NUM1 (4 character string ("9999") * * SCHECK_AND_OR * * SCHECK_2ND_OP * * S2ND_CHECKNUM (4 character string ("9999")* * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure is called after all check number inputs * * have been entered. If a blank is found in either the operator* * or operand fields, the rest of the line is blanked out, as * * well as the memory variables they represent, and the cursor * * is positioned at the next line (description values). * * * * Note: Something should be said about the difference in * * ---- naming conventions for the variables representing the * * entered check numbers (SCHECK_NUM1,S2ND_CHECKNUM). The* * reason for the unorthadox naming scheme has to do with* * a compiler error I encountered with Clipper '87. * * When the .prg clipper program being compiled gets very* * large, the symbol table seems to overflow against * * other variables with simular names. In essence, a * * character field represented by "FM_RUN_OVER" might * * share the same memory space as a field titled * * "FM_RUN_DOWN", as the first 7 characters of the field * * name are both "FM_RUN_". This also explains why * * numeric codes such as "A0500" are being used to * * distinguish procedure and field values. * *---------------------------------------------------------------* PARAMETERS ROW,SCHECK_OPERATOR1,SCHECK_NUM1,SCHECK_AND_OR,SCHECK_2ND_OP,S2ND_CHECKNUM SET COLOR TO (MsearchBLANKLINE) IF SCHECK_OPERATOR1 = REPLICATE(" ",LEN(SCHECK_OPERATOR1)) @ CHECK_DEPTH,16 say "__" @ CHECK_DEPTH,19 say "____" && if the first boolean expression (OPERATOR) @ CHECK_DEPTH,31 say "___" && isn't entered, the the rest of the line @ CHECK_DEPTH,37 say "__" && remains blank or is erased. @ CHECK_DEPTH,40 say "____" SCHECK_NUM1 =REPLICATE(" ",LEN(SCHECK_NUM1)) SCHECK_AND_OR =REPLICATE(" ",LEN(SCHECK_AND_OR)) SCHECK_2ND_OP =REPLICATE(" ",LEN(SCHECK_2ND_OP)) S2ND_CHECKNUM =REPLICATE(" ",LEN(S2ND_CHECKNUM)) ELSE @ CHECK_DEPTH,16 say SCHECK_OPERATOR1 IF SCHECK_NUM1 = REPLICATE(" ",LEN(SCHECK_NUM1)) IF ROW = DESC1_DEPTH @ CHECK_DEPTH,16 say "__" @ CHECK_DEPTH,19 say "____" && blank entire row if 1st check# not entered @ CHECK_DEPTH,31 say "___" && and entry has moved to description. @ CHECK_DEPTH,37 say "__" @ CHECK_DEPTH,40 say "____" SCHECK_OPERATOR1 = REPLICATE(" ",LEN(SCHECK_OPERATOR1)) SCHECK_AND_OR =REPLICATE(" ",LEN(SCHECK_AND_OR)) SCHECK_2ND_OP =REPLICATE(" ",LEN(SCHECK_2ND_OP)) S2ND_CHECKNUM =REPLICATE(" ",LEN(S2ND_CHECKNUM)) ELSE @ CHECK_DEPTH,19 SAY "____" ENDIF ELSE && both 1st op and check number have entered @ CHECK_DEPTH,19 SAY SCHECK_NUM1 IF SCHECK_AND_OR = REPLICATE(" ",LEN(SCHECK_AND_OR)) @ CHECK_DEPTH,31 say "___" @ CHECK_DEPTH,37 say "__" @ CHECK_DEPTH,40 say "____" SCHECK_AND_OR = REPLICATE(" ",LEN(SCHECK_AND_OR)) SCHECK_2ND_OP = REPLICATE(" ",LEN(SCHECK_2ND_OP)) S2ND_CHECKNUM = REPLICATE(" ",LEN(S2ND_CHECKNUM)) ELSE @ CHECK_DEPTH,31 SAY SCHECK_AND_OR && 1st op, check#, and operand entered IF SCHECK_2ND_OP = REPLICATE(" ",LEN(SCHECK_2ND_OP)) @ CHECK_DEPTH,37 say "__" @ CHECK_DEPTH,40 say "____" IF ROW=DESC1_DEPTH && erase operand(AND/OR) if no 2nd operator @ CHECK_DEPTH,31 say "___" SCHECK_AND_OR = REPLICATE(" ",LEN(SCHECK_AND_OR)) ENDIF ELSE @ CHECK_DEPTH,37 say SCHECK_2ND_OP IF S2ND_CHECKNUM = REPLICATE(" ",LEN(S2ND_CHECKNUM)) IF ROW=DESC1_DEPTH @ CHECK_DEPTH,31 say "___" && if no 2nd check# entered, and new @ CHECK_DEPTH,37 say "__" && entry line, then erase last three @ CHECK_DEPTH,40 say "____" && (operand,2nd op,2nd check#) SCHECK_AND_OR = REPLICATE(" ",LEN(SCHECK_AND_OR)) SCHECK_2ND_OP =REPLICATE(" ",LEN(SCHECK_2ND_OP)) S2ND_CHECKNUM =REPLICATE(" ",LEN(S2ND_CHECKNUM)) ELSE @ CHECK_DEPTH,40 say "___" ENDIF ELSE @ CHECK_DEPTH,40 say S2ND_CHECKNUM ENDIF ENDIF ENDIF ENDIF ENDIF PROCEDURE DISPLAY_DESC_SRCH_ENTRY *---------------------------------------------------------------* * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * SDESC_OPERATOR1 * * SDESC1 (30 character string) * * SDESC_AND_OR * * SDESC_2ND_OP * * SDESC2 (30 character string) * * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure is called after all inputs for description * * have been entered. If a blank is found in either the operator* * or operand fields, the rest of the line is blanked out, as * * well as the memory variables they represent, and the cursor * * is positioned at the next line (amount WITHDRAWAL). * *---------------------------------------------------------------* PARAMETERS ROW,SDESC_OPERATOR1,SDESC1,SDESC_AND_OR,SDESC_2ND_OP,SDESC2 SET COLOR TO (MsearchBLANKLINE) IF SDESC_OPERATOR1 = REPLICATE(" ",LEN(SDESC_OPERATOR1)) @ DESC1_DEPTH,16 say "__" @ DESC1_DEPTH,19 say REPLICATE("_",LEN(SDESC1)) @ DESC1_DEPTH+1,31 say "___" && special k for description operand - next row @ DESC2_DEPTH,16 say "__" @ DESC2_DEPTH,19 say REPLICATE("_",LEN(SDESC1)) SDESC1 =REPLICATE(" ",LEN(SDESC1)) SDESC_AND_OR =REPLICATE(" ",LEN(SDESC_AND_OR)) SDESC_2ND_OP =REPLICATE(" ",LEN(SDESC_2ND_OP)) SDESC2 =REPLICATE(" ",LEN(SDESC2)) ELSE @ DESC1_DEPTH,16 say SDESC_OPERATOR1 && 1st operator entered IF SDESC1 = REPLICATE(" ",LEN(SDESC1)) IF ROW = WITHD_DEPTH && already on next line, so erase all description entries @ DESC1_DEPTH,16 say "__" @ DESC1_DEPTH,19 say REPLICATE("_",LEN(SDESC1)) @ DESC1_DEPTH+1,31 say "___" && erase screen entries @ DESC2_DEPTH,16 say "__" @ DESC2_DEPTH,19 say REPLICATE("_",LEN(SDESC1)) SDESC_OPERATOR1 = REPLICATE(" ",LEN(SDESC_OPERATOR1)) SDESC_AND_OR =REPLICATE(" ",LEN(SDESC_AND_OR)) && erase memory SDESC_2ND_OP =REPLICATE(" ",LEN(SDESC_2ND_OP)) SDESC2 =REPLICATE(" ",LEN(SDESC2)) ELSE @ DESC1_DEPTH,19 SAY "____" ENDIF ELSE && both 1st op and description have entered @ DESC1_DEPTH,19 SAY SDESC1 IF SDESC_AND_OR = REPLICATE(" ",LEN(SDESC_AND_OR)) @ DESC1_DEPTH+1,31 say "___" @ DESC2_DEPTH,16 say "__" @ DESC2_DEPTH,19 say REPLICATE("_",LEN(SDESC2)) SDESC_AND_OR = REPLICATE(" ",LEN(SDESC_AND_OR)) SDESC_2ND_OP = REPLICATE(" ",LEN(SDESC_2ND_OP)) SDESC2 = REPLICATE(" ",LEN(SDESC2)) ELSE && 1st op, description, and operand entered @ DESC1_DEPTH+1,31 SAY SDESC_AND_OR IF SDESC_2ND_OP = REPLICATE(" ",LEN(SDESC_2ND_OP)) @ DESC2_DEPTH,16 say "__" @ DESC2_DEPTH,19 say REPLICATE("_",LEN(SDESC2)) IF ROW=WITHD_DEPTH && erase operand(AND/OR) if no 2nd operator @ DESC1_DEPTH+1,31 say "___" SDESC_AND_OR = REPLICATE(" ",LEN(SDESC_AND_OR)) ENDIF ELSE @ DESC2_DEPTH,16 say SDESC_2ND_OP IF SDESC2 = REPLICATE(" ",LEN(SDESC2)) IF ROW=WITHD_DEPTH @ DESC1_DEPTH+1,31 say "___" && if 2nd desc not entered, and new @ CHECK_DEPTH,37 say "__" && entry line, then erase last three @ CHECK_DEPTH,40 say "____" && (operand,2nd op,2nd description) SDESC_AND_OR = REPLICATE(" ",LEN(SDESC_AND_OR)) SDESC_2ND_OP = REPLICATE(" ",LEN(SDESC_2ND_OP)) SDESC2 = REPLICATE(" ",LEN(SDESC2)) ELSE @ DESC2_DEPTH,19 say REPLICATE("_",LEN(SDESC2)) ENDIF ELSE @ DESC2_DEPTH,19 say SDESC2 ENDIF ENDIF ENDIF ENDIF ENDIF PROCEDURE DISPLAY_WITHD_SRCH_ENTRY *---------------------------------------------------------------* * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * SWITHD_OPERATOR1 * * SAWITHD_AMT1 * * WITHD_AND_OR * * SWITHD_2ND_OP * * SWAMT_IN_2 * * Procedures called: (none) * * Functions called: (none) * * * * This procedure is called after all inputs for WITHDRAWAL * * amounts enter. If a blank is found in either the operator * * or operand fields, the rest of the line is blanked out, as * * well as the memory variables they represent, and the cursor * * is positioned at the next line (amount deposit). * *---------------------------------------------------------------* PARAMETERS SWITHD_OPERATOR1,SAWITHD_AMT1,WITHD_AND_OR,SWITHD_2ND_OP,SWAMT_IN_2 SET COLOR TO (MsearchBLANKLINE) IF SWITHD_OPERATOR1 = REPLICATE(" ",LEN(SWITHD_OPERATOR1)) @ WITHD_DEPTH,16 say "__" @ WITHD_DEPTH,19 say "______.__" && if the first boolean expression (OPERATOR) @ WITHD_DEPTH,31 say "___" && isn't entered, the the rest of the line @ WITHD_DEPTH,37 say "__" && remains blank or is erased. @ WITHD_DEPTH,40 say "______.__" SAWITHD_AMT1 =" .00" && null dollar amount SWITHD_AND_OR =REPLICATE(" ",LEN(SWITHD_AND_OR)) SWITHD_2ND_OP =REPLICATE(" ",LEN(SWITHD_2ND_OP)) SWAMT_IN_2 =" .00" ELSE @ WITHD_DEPTH,16 say SWITHD_OPERATOR1 IF SAWITHD_AMT1 = " .00" IF ROW = DEPOS_DEPTH @ WITHD_DEPTH,16 say "__" @ WITHD_DEPTH,19 say "______.__" && blank entire row if 1st WITHDRAWAL amount @ WITHD_DEPTH,31 say "___" && not entered and input line has moved @ WITHD_DEPTH,37 say "__" && to description. @ WITHD_DEPTH,40 say "______.__" SWITHD_OPERATOR1 = REPLICATE(" ",LEN(SWITHD_OPERATOR1)) SWITHD_AND_OR =REPLICATE(" ",LEN(SWITHD_AND_OR)) SWITHD_2ND_OP =REPLICATE(" ",LEN(SWITHD_2ND_OP)) SWAMT_IN_2 =" .00" ENDIF @ WITHD_DEPTH,19 SAY "______.__" ELSE && both 1st op and WITHDRAWAL amount have entered... @ WITHD_DEPTH,19 SAY SAWITHD_AMT1 IF SWITHD_AND_OR = REPLICATE(" ",LEN(SWITHD_AND_OR)) && no operand entered... @ WITHD_DEPTH,31 say "___" @ WITHD_DEPTH,37 say "__" && erase operand, 2nd op, and WITHDRAWAL @ WITHD_DEPTH,40 say "______.__" && from screen... SWITHD_AND_OR = REPLICATE(" ",LEN(SWITHD_AND_OR)) SWITHD_2ND_OP = REPLICATE(" ",LEN(SWITHD_2ND_OP)) && erase operand, 2nd op, SWAMT_IN_2 = " .00" && and WITHDRAWAL from memory... ELSE @ WITHD_DEPTH,31 SAY SWITHD_AND_OR && 1st op, amount, and operand entered... IF SWITHD_2ND_OP = REPLICATE(" ",LEN(SWITHD_2ND_OP)) @ WITHD_DEPTH,37 say "__" @ WITHD_DEPTH,40 say "______.__" IF ROW=DEPOS_DEPTH @ WITHD_DEPTH,31 say "___" && erase operand (AND/OR) if no 2nd op, ENDIF && and entry has moved to deposit line... ELSE @ WITHD_DEPTH,37 say SWITHD_2ND_OP IF SWAMT_IN_2 = " .00" IF ROW=DEPOS_DEPTH @ WITHD_DEPTH,31 say "___" && if no 2nd amount entered, and new @ WITHD_DEPTH,37 say "__" && entry line, then erase last three @ WITHD_DEPTH,40 say "______.__" && (operand, 2nd op, 2nd amount) SWITHD_AND_OR = REPLICATE(" ",LEN(SWITHD_AND_OR)) SWITHD_2ND_OP = REPLICATE(" ",LEN(SWITHD_2ND_OP)) SWAMT_IN_2 = " .00" ELSE @ WITHD_DEPTH,40 say "______.__" ENDIF ELSE @ WITHD_DEPTH,40 say SWAMT_IN_2 ENDIF ENDIF ENDIF ENDIF ENDIF PROCEDURE SHOW_DEPOS_SRCH_ENTRY *---------------------------------------------------------------* * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * SDEPOS_OPERATOR1 * * SADEPOS_AMT1 * * SDEPOS_AND_OR * * SDEPOS_2ND_OP * * SDAMT_IN_2 * * Procedures called: (none) * * Functions called: (none) * * * * This procedure is called after all inputs for deposit * * amounts enter. If a blank is found in either the operator * * or operand fields, the rest of the line is blanked out, as * * well as the memory variables they represent, and the cursor * * is returned to the first input line (date) seeing as amount * * deposit is the last input line. Of course, pressing the * * "ESC" key will always return control to the search menu. * *---------------------------------------------------------------* PARAMETERS SDEPOS_OPERATOR1,SADEPOS_AMT1,SDEPOS_AND_OR,SDEPOS_2ND_OP,SDAMT_IN_2 SET COLOR TO (MsearchBLANKLINE) IF SDEPOS_OPERATOR1 = REPLICATE(" ",LEN(SDEPOS_OPERATOR1)) @ DEPOS_DEPTH,16 say "__" @ DEPOS_DEPTH,19 say "______.__" && if the first boolean expression (OPERATOR) @ DEPOS_DEPTH,31 say "___" && isn't entered, the the rest of the line @ DEPOS_DEPTH,37 say "__" && remains blank or is erased. @ DEPOS_DEPTH,40 say "______.__" SADEPOS_AMT1 =" .00" SDEPOS_AND_OR =REPLICATE(" ",LEN(SDEPOS_AND_OR)) SDEPOS_2ND_OP =REPLICATE(" ",LEN(SDEPOS_2ND_OP)) SDAMT_IN_2 =" .00" ELSE @ DEPOS_DEPTH,16 say SDEPOS_OPERATOR1 IF SADEPOS_AMT1 = " .00" IF ROW = DATE_DEPTH @ DEPOS_DEPTH,16 say "__" @ DEPOS_DEPTH,19 say "______.__" && blank entire row if 1st deposit amount @ DEPOS_DEPTH,31 say "___" && not entered and input line has moved back @ DEPOS_DEPTH,37 say "__" && to top. @ DEPOS_DEPTH,40 say "______.__" SDEPOS_OPERATOR1 = REPLICATE(" ",LEN(SDEPOS_OPERATOR1)) SDEPOS_AND_OR =REPLICATE(" ",LEN(SDEPOS_AND_OR)) SDEPOS_2ND_OP =REPLICATE(" ",LEN(SDEPOS_2ND_OP)) SDAMT_IN_2 =" .00" ENDIF @ DEPOS_DEPTH,19 SAY "______.__" ELSE && both 1st op and deposit amount have entered... @ DEPOS_DEPTH,19 SAY SADEPOS_AMT1 IF SDEPOS_AND_OR = REPLICATE(" ",LEN(SDEPOS_AND_OR)) && no operand entered... @ DEPOS_DEPTH,31 say "___" @ DEPOS_DEPTH,37 say "__" && erase operand, 2nd op, and DEPOSrawl @ DEPOS_DEPTH,40 say "______.__" && from screen... SDEPOS_AND_OR = REPLICATE(" ",LEN(SDEPOS_AND_OR)) SDEPOS_2ND_OP = REPLICATE(" ",LEN(SDEPOS_2ND_OP)) && erase operand, 2nd op, SDAMT_IN_2 = " .00" && and deposit from memory... ELSE @ DEPOS_DEPTH,31 SAY SDEPOS_AND_OR && 1st op, amount, and operand entered... IF SDEPOS_2ND_OP = REPLICATE(" ",LEN(SDEPOS_2ND_OP)) @ DEPOS_DEPTH,37 say "__" @ DEPOS_DEPTH,40 say "______.__" IF ROW=DATE_DEPTH @ DEPOS_DEPTH,31 say "___" && erase operand (AND/OR) if no 2nd op, ENDIF && and entry has moved back to top... ELSE @ DEPOS_DEPTH,37 say SDEPOS_2ND_OP IF SDAMT_IN_2 = " .00" IF ROW=DATE_DEPTH @ DEPOS_DEPTH,31 say "___" && if no 2nd amount entered, and new @ DEPOS_DEPTH,37 say "__" && entry line, then erase last three @ DEPOS_DEPTH,40 say "______.__" && (operand, 2nd op, 2nd amount) SDEPOS_AND_OR = REPLICATE(" ",LEN(SDEPOS_AND_OR)) SDEPOS_2ND_OP = REPLICATE(" ",LEN(SDEPOS_2ND_OP)) SDAMT_IN_2 = " .00" ELSE @ DEPOS_DEPTH,40 say "______.__" ENDIF ELSE @ DEPOS_DEPTH,40 say SDAMT_IN_2 ENDIF ENDIF ENDIF ENDIF ENDIF procedure FIND_Q_OPERATOR *---------------------------------------------------------------* * Date Written: 10.10.2000 * * * * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * COL * * OPERATOR * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure finds the operator positioned at * * coordinates ROW,COL. "Operator" refers to the abbreviations * * (EQ=Equals, GT=greater than, etc.) that compare the field * * with the value it associates with. In other words, If one * * wished to view all transactions that contains the string * * "Pinkus", then FIND_Q_OPERATOR would return "CT" in * * accordance with the entered expression that follows: * * * * DESCRIPTION CT Pinkus * * * *---------------------------------------------------------------* parameters ROW, COL, OPERATOR private Q_ROW, Q_COL, type set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && --* Erases previous message *-- @ 23,00 say "Arrow keys change expression symbols in current entry...." type = 1 set color to (msearchGet) IF OPERATOR=REPLICATE(" ",LEN(OPERATOR)) && NO OPERATOR ENTERED @ROW,COL SAY REPLICATE("_",LEN(OPERATOR)) ELSE @ROW,COL SAY operator ENDIF @ROW,COL SAY "" do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT CASE mInkey = 9 .or. mInkey = 13 && TAB,ENTER EXIT case mInkey = 19 .or. mInkey = 24 && Left or Down Arrow if type = 1 type = 7 else if type = 4 if (ROW = DESC1_DEPTH .or. ROW = DESC2_DEPTH) type = type - 1 && include "CT" for DESCRIPTION field else type = type - 2 && skip "CT" for remaining input fields endif else type = type - 1 endif endif do PAINT_Q_TYPE with ROW,COL,TYPE,OPERATOR case mInkey = 4 .or. mInkey = 5 && Right or Up Arrow if type = 7 type = 1 else if type = 2 if (ROW = DESC1_DEPTH .or. ROW = DESC2_DEPTH) type = type + 1 && include "CT" for DESCRIPTION field else type = type + 2 && skip "CT" for remaining input fields endif else type = type + 1 endif endif do PAINT_Q_TYPE with ROW,COL,TYPE,OPERATOR endcase enddo procedure FIND_SEARCH_AND_OR *---------------------------------------------------------------* * Date Written: 10.10.2000 * * * * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * COL * * SRCH_AND_OR * * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure finds the operand positioned at * * coordinates ROW,COL. "Operand" refers to the ("AND" or "OR ")* * boolean connectors that conjugate mutiple expressions. * *---------------------------------------------------------------* parameters ROW,COL,SRCH_AND_OR set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && --* Erases previous message *-- @23,00 say "Arrow keys transform present value from 'AND' to 'OR' to space...." set color to (msearchGet) IF SRCH_AND_OR=REPLICATE(" ",LEN(SRCH_AND_OR)) && NO SRCH_AND_OR ENTERED @ROW,COL SAY REPLICATE("_",LEN(SRCH_AND_OR)) ELSE @ROW,COL SAY SRCH_AND_OR ENDIF @ROW,COL SAY "" do while .t. mInkey = Inkey(0) do case case mInkey = 27 EXIT case mInkey = 9 .or. mInkey = 13 && TAB,ENTER EXIT case mInkey = 19 .or. mInkey = 24 && Left or Down Arrow if SRCH_AND_OR = " " SRCH_AND_OR = "AND" else if SRCH_AND_OR = "AND" SRCH_AND_OR ="OR " else SRCH_AND_OR =" " endif endif IF SRCH_AND_OR=REPLICATE(" ",LEN(SRCH_AND_OR)) && NO SRCH_AND_OR ENTERED @ROW,COL SAY REPLICATE("_",LEN(SRCH_AND_OR)) ELSE @ROW,COL SAY SRCH_AND_OR ENDIF @ROW,COL SAY "" case mInkey = 4 .or. mInkey = 5 && Right or Up Arrow if SRCH_AND_OR = " " SRCH_AND_OR = "OR " else if SRCH_AND_OR = "OR " SRCH_AND_OR ="AND" else SRCH_AND_OR =" " endif endif IF SRCH_AND_OR=REPLICATE(" ",LEN(SRCH_AND_OR)) && NO SRCH_AND_OR ENTERED @ROW,COL SAY REPLICATE("_",LEN(SRCH_AND_OR)) ELSE @ROW,COL SAY SRCH_AND_OR ENDIF @ROW,COL SAY "" endcase enddo procedure PAINT_Q_TYPE *---------------------------------------------------------------* * Date Written: 10.17.2000 * * * * Called from: FIND_Q_OPERATOR * * * * Parameters: ROW,COL,TYPE,OPERATOR * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure paints the operator abbreviation consistent * * with the numeric TYPE at position ROW,COL. The dual * * charactered symbol is related to its numeric equvilent as * * follows: * * * * TYPE: 1 2 3 4 5 6 7 * * OPERATOR: __ EQ CT GR LS GE LE * * * * Notice TYPE=1 causes the system to interpret the current * * field in question not be processed for searching purposes. * *---------------------------------------------------------------* parameters ROW,COL,TYPE,OPERATOR do case case type = 1 OPERATOR = " " @ROW,COL say "__" case type = 2 OPERATOR = "EQ" @ROW,COL say "EQ" case type = 3 OPERATOR = "CT" @ROW,COL say "CT" case type = 4 OPERATOR = "GR" @ROW,COL say "GR" case type = 5 OPERATOR = "LS" @ROW,COL say "LS" case type = 6 OPERATOR = "GE" @ROW,COL say "GE" case type = 7 OPERATOR = "LE" @ROW,COL say "LE" endcase @ROW,COL say "" && reposition cursor to start of input field FUNCTION A0500_FIND_DATE *---------------------------------------------------------------* * Date Written: 10.28.2000 * * * * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: ROW * * COL * * IN_DATE ("MM/DD/YYYY") * * * * Procedures called: A0550_PAINT_THE_DATE * * * * Functions called: (none) * * * * This function recieves IN_DATE, displays it at (ROW,COL) and * * allows input to find the new date value. After the new date * * value is entered, A0500_FIND_DATE returns the value as a 10 * * character string ("MM/DD/YYYY"). * *---------------------------------------------------------------* PARAMETERS ROW,COL,IN_DATE PRIVATE LENGTH,LINE,POSITION,PLACE,LEFT_END,RIGHT_END,THE_STRING,A10_FIRST_KEY LENGTH=LEN(IN_DATE) && establish identification LINE=ROW LEFT_END=COL RIGHT_END=LEFT_END+(LENGTH-1) POSITION=LEFT_END A10_FIRST_KEY=.T. set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && --* Erases previous message *-- @ 23,00 say "Numeric keys enter date here...." SET COLOR TO (mSearchGet) @LINE,LEFT_END SAY IN_DATE IF IN_DATE = " / / " THE_STRING=REPLICATE(" ",LENGTH-2) ELSE THE_STRING=SUBSTR(IN_DATE,1,2)+; && REMOVES "/" FROM IN_DATE SUBSTR(IN_DATE,4,2) + SUBSTR(IN_DATE,7,4) && (THE_STRING="MMDDYYYY") ENDIF @LINE,LEFT_END say "" PLACE=1 do while .t. mInkey = Inkey(0) do case case mInkey = 27 .or. mInkey=13 .or. mInkey=9 .or. mInkey=271 EXIT &&ESC or ENTER or TAB RIGHT or TAB LEFT case mInkey = 19 && Left Arrow IF PLACE > 1 PLACE=PLACE-1 ENDIF case mInkey = 4 && Right Arrow A10_FIRST_KEY=.F. IF PLACE < 8 PLACE=PLACE+1 ENDIF case mInkey=7 && delete key A10_FIRST_KEY=.F. if PLACE < 8 FIRST_HALF = SUBSTR(THE_STRING,1,PLACE-1) SECOND_HALF = SUBSTR(THE_STRING,PLACE+1,8-PLACE) + " " else FIRST_HALF = SUBSTR(THE_STRING,1,7) SECOND_HALF = " " endif THE_STRING = FIRST_HALF + SECOND_HALF case mInkey=8 && backspace key if PLACE > 2 FIRST_HALF=substr(THE_STRING,1,PLACE-2) else FIRST_HALF="" endif SECOND_HALF=substr(THE_STRING,PLACE,(8 - PLACE)+1) if PLACE>1 THE_STRING = FIRST_HALF + SECOND_HALF + " " PLACE=PLACE-1 else THE_STRING = FIRST_HALF + SECOND_HALF endif otherwise IF numeric(chr(mInkey)) && this phrase only allows numeric input IF A10_FIRST_KEY THE_STRING=REPLICATE(" ",8) A10_FIRST_KEY=.F. ENDIF THE_NUMBER_TYPED=CHR(mInkey) && in a numeric environment if PLACE > 1 FIRST_HALF=SUBSTR(THE_STRING,1,PLACE-1) else FIRST_HALF="" endif if PLACE < 8 SECOND_HALF=SUBSTR(THE_STRING,PLACE,8-PLACE) else SECOND_HALF="" endif THE_STRING = FIRST_HALF + THE_NUMBER_TYPED + SECOND_HALF if PLACE < 8 PLACE=PLACE + 1 endif endif endcase DO A0550_PAINT_THE_DATE WITH THE_STRING,LINE,LEFT_END DO CASE && POSITION CURSOR CASE PLACE>=5 && YEAR @ LINE,PLACE+LEFT_END+1 SAY "" CASE PLACE=3 .OR. PLACE=4 && DAY @ LINE,PLACE+LEFT_END SAY "" CASE PLACE=1 .OR. PLACE=2 && MONTH @ LINE,PLACE+LEFT_END-1 SAY "" ENDCASE enddo && end loop RETURN SUBSTR(THE_STRING,1,2)+"/"+SUBSTR(THE_STRING,3,2)+"/"+; SUBSTR(THE_STRING,5,4) PROCEDURE A0550_PAINT_THE_DATE PARAMETERS THE_STRING,LINE,LEFT_END @ LINE,LEFT_END SAY SUBSTR(THE_STRING,1,2)+"/"+SUBSTR(THE_STRING,3,2)+"/"+; SUBSTR(THE_STRING,5,4) function TREASURE_HUNT *---------------------------------------------------------------* * Date Written: 10.19.2000 * * Author: I. Forgot * * * * Called from: A0100_EDIT_SEARCH_VALUES * * * * Parameters: HOW_MUCH (contains length of dollar amount* * string without decimal point or * * commas for thousanths fields. * * i.e. for "999,999.99", * * HOW_MUCH=8) * * LATITUDE (ROW) * * LONGITUDE (COL) * * IN_DOLLARS (dollar amount as character * * string) * * * * Procedures called: PAINT_THE_DOLLAR * * SQUISH_AND_NO_CENTS * * * * Functions called: SPACELESS_JUSTIFY * * * * This function returns a string of length HOW_MUCH that * * contains the dollar value input at LATITUDE,LONGITUDE. * * Likewise, this function returns MONEY! * *---------------------------------------------------------------* parameters HOW_MUCH,LATITUDE,LONGITUDE,IN_DOLLARS private LENGTH,LINE,POSITION,PLACE,LEFT_END,RIGHT_END,THE_STRING LENGTH=HOW_MUCH && establish identification LINE=LATITUDE LEFT_END=LONGITUDE RIGHT_END=LEFT_END+(LENGTH-1) POSITION=LEFT_END set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && --* Erases previous message *-- @ 23,00 say "Numeric keys and the '.' symbol enter dollar amount here...." SET COLOR TO (mSearchGet) IF IN_DOLLARS = " .00" @LINE,LEFT_END SAY " . " THE_STRING=REPLICATE(" ",LENGTH) ELSE @LINE,LEFT_END say IN_DOLLARS THE_STRING=SUBSTR(IN_DOLLARS,1,LEN(IN_DOLLARS)-3)+; SUBSTR(IN_DOLLARS,LEN(IN_DOLLARS)-1,2) && REMOVE "." ENDIF @LINE,LEFT_END say "" do while .t. mInkey = Inkey(0) do case case mInkey = 27 .or. mInkey=13 .or. mInkey=9 .or. mInkey=271 FOUND=!(THE_STRING=REPLICATE(" ",LENGTH)) EXIT &&ESC or ENTER or TAB RIGHT or TAB LEFT case mInkey = 19 && Left Arrow do PAINT_THE_DOLLAR with THE_STRING,LINE,LEFT_END &&treasure hunt if POSITION > LEFT_END POSITION=POSITION-1 ENDIF IF POSITION=RIGHT_END-1 @LINE,RIGHT_END SAY "" &&SPECIAL K BECAUSE OF "PAINT_THE_DOLLAR" ELSE IF POSITION=RIGHT_END-2 &&SKIP DA "." @LINE,RIGHT_END-2 SAY "" ELSE @LINE,POSITION SAY "" ENDIF ENDIF case mInkey = 4 && Right Arrow if POSITION < RIGHT_END POSITION = POSITION +1 endif do PAINT_THE_DOLLAR with THE_STRING,LINE,LEFT_END IF POSITION > RIGHT_END-2 && COMPENSATE FOR "." IN PAINT_THE_DOLLAR @LINE,POSITION+1 SAY "" ELSE @LINE,POSITION SAY "" ENDIF case mInkey=7 && delete key if POSITION < RIGHT_END PLACE=(POSITION-LEFT_END)+1 FIRST_HALF = SUBSTR(THE_STRING,1,PLACE-1) SECOND_HALF = SUBSTR(THE_STRING,PLACE+1,LENGTH-PLACE) + " " else FIRST_HALF = SUBSTR(THE_STRING,1,LENGTH-1) SECOND_HALF = " " endif THE_STRING = FIRST_HALF + SECOND_HALF do PAINT_THE_DOLLAR with THE_STRING,LINE,LEFT_END IF POSITION=LENGTH-2 @LINE,POSITION-1 say "" ELSE @LINE,POSITION SAY "" ENDIF case mInkey=8 && backspace key PLACE=(POSITION - LEFT_END)+1 if PLACE > 2 FIRST_HALF=substr(THE_STRING,1,PLACE-2) else FIRST_HALF="" endif SECOND_HALF=substr(THE_STRING,PLACE,(LENGTH - PLACE)+1) if POSITION>LEFT_END THE_STRING = FIRST_HALF + SECOND_HALF + " " POSITION=POSITION-1 else THE_STRING = FIRST_HALF + SECOND_HALF endif do PAINT_THE_DOLLAR with THE_STRING,LINE,LEFT_END IF POSITION=LENGTH-2 @LINE,POSITION-1 say "" ELSE @LINE,POSITION SAY "" ENDIF case mInkey = 46 && Decimal Point do SQUISH_AND_NO_CENTS with THE_STRING do PAINT_THE_DOLLAR with THE_STRING,LINE,LEFT_END POSITION=RIGHT_END-1 @LINE,POSITION+1 SAY "" otherwise if numeric(chr(mInkey)) && this phrase only allows numeric input THE_NUMBER_TYPED=CHR(mInkey) && in a numeric environment PLACE=(POSITION - LEFT_END)+1 if PLACE > 1 FIRST_HALF=SUBSTR(THE_STRING,1,PLACE-1) else FIRST_HALF="" endif if PLACE < LENGTH SECOND_HALF=SUBSTR(THE_STRING,PLACE,LENGTH-PLACE) else SECOND_HALF="" endif THE_STRING = FIRST_HALF + THE_NUMBER_TYPED + SECOND_HALF @LINE,LEFT_END say THE_STRING if POSITION < RIGHT_END POSITION = POSITION + 1 endif do PAINT_THE_DOLLAR with THE_STRING,LINE,LEFT_END IF POSITION=LENGTH-2 @LINE,POSITION-1 say "" ELSE IF POSITION=RIGHT_END @LINE,POSITION+1 say "" else @LINE,POSITION SAY "" endif ENDIF endif endcase enddo && end loop IF THE_STRING = REPLICATE(" ",LEN(THE_STRING)) FOUND=.F. ELSE FOUND=.T. ENDIF RETURN SPACELESS_JUSTIFY(THE_STRING) FUNCTION SPACELESS_JUSTIFY *--------------------------------------------------------* * SPACELESS_JUSTIFY WILL REMOVE VOIDS OF SPACE FROM * * A POTENTIALLY DISASTOROUS ENTRY!! * *--------------------------------------------------------* PARAMETERS SYSTEM_ENTRY PRIVATE I,CLEAN,DOLLARS,CENTS CLEAN="" && NOT DIRTY CENTS = SUBSTR(SYSTEM_ENTRY,LEN(SYSTEM_ENTRY)-1,2) DOLLARS=SUBSTR(SYSTEM_ENTRY,1,LEN(SYSTEM_ENTRY)-2) FOR I=1 TO LEN(DOLLARS) IF !(SUBSTR(DOLLARS,I,1)= " ") CLEAN=CLEAN+SUBSTR(DOLLARS,I,1) && WASH DOLLARS.... ENDIF NEXT CLEAN=CLEAN+"." FOR I=1 TO LEN(CENTS) IF SUBSTR(CENTS,I,1)=" " CLEAN=CLEAN+"0" && WASH CENTS..... ELSE CLEAN=CLEAN+SUBSTR(CENTS,I,1) &&spaceless justify!! ENDIF NEXT CLEAN=REPLICATE(" ",((LEN(SYSTEM_ENTRY)+1) - LEN(CLEAN)))+CLEAN RETURN CLEAN && AND SEND BACK CLEAN!! procedure SQUISH_AND_NO_CENTS *------------------------------------------------------------------------------* * SQUISH_AND_NO_CENTS is called when the decimal point key is pressed. * * Basically, the function takes all numbers to the left of the decimal point * * (dollars),"squishes" them together, and presses them up against the decimal * * point (i.e. all gaps and leading spaces are removed.). The cents field is * * then filled with ".00". * *------------------------------------------------------------------------------* parameters THE_STRING private THE_WORKS,COUNTER,PLACE THE_WORKS=THE_STRING PLACE=LEN(THE_WORKS)-2 COUNTER=0 DO WHILE PLACE>0 .AND. SUBSTR(THE_WORKS,PLACE,1) = " " COUNTER=COUNTER+1 &&COUNT HOW MANY SPACES,IF ANY,LIE BEFORE THY SPOT PLACE=PLACE-1 ENDDO IF COUNTER>0 THE_STRING=REPLICATE(" ",COUNTER)+SUBSTR(THE_WORKS,1,LEN(THE_WORKS)-(COUNTER+2))+"00" ELSE THE_STRING=SUBSTR(THE_WORKS,1,LEN(THE_WORKS)-2) + "00" &&SQUISH AND ZERO CENTS!!! ENDIF procedure PAINT_THE_DOLLAR **************************************** * ADDS "." TO THE_STRING AND DISPLAYS * * THE DOLLAR VALUE. * **************************************** parameters THE_STRING,ROW,COL private LENGTH,THE_WORKS THE_WORKS = SUBSTR(THE_STRING,1,LEN(THE_STRING)-2) + "." + ; SUBSTR(THE_STRING,LEN(THE_STRING)-1,2) @ROW,COL say THE_WORKS procedure FIND_STRING *---------------------------------------------------------------* * Called from: A0100_EDIT_SEARCH_VALUES * * B2000_EXPORT_SEARCH_RESULTS * * NEW_DIRECTORY && V 4.0 - 02.27.2008 * * FM_SAVE && V 4.0.9 - 01.16.2009 * * * * Parameters: LINE (number 0-24 positions row) * * COL (number 0-79 positions column) * * THE_STRING (current value of string to be * * found. This value is updated * * the the string found.) * * LENGTH (length of string to find) * * MUST_B_NUMBER (.t. or .f.) * * SCREEN_TYPE ("SEARCH","EXPORT","SUMMARY", * * "NEWDIR", "SAVE") * * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure displays THE_STRING at LINE,COL and allows * * entry of a new string. In accordance, this function behaves * * similar to the Clipper "GET" function. * * * * 9/14/07 v 4.0 - Added SCREEN_TYPE Parameter for new * * Search->Export function * * 2/19/08 v 4.0 - Added "NEWDIR" SCREEN_TYPE * * * * 1/16/09 v 4.0.9 - Added "SAVE" SCREEN_TYPE * *---------------------------------------------------------------* parameters LINE,COL,THE_STRING,LENGTH,MUST_B_NUMBER,SCREEN_TYPE private LEFT_END,RIGHT_END,POSITION,PLACE,FIRST_HALF,SECOND_HALF,THE_NUMBER_TYPED if SCREEN_TYPE = "SEARCH" .or. SCREEN_TYPE = "SUMMARY" && 9/14/07 v. 4.0 set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && --* Erases previous message *-- @ 23,00 say "Typed words, symbols, and phrases describe this area...." endif IF SCREEN_TYPE = "EXPORT" && 9/16/07 v. 4.0 SET COLOR TO (mGreenHigh) && Bright green on black ELSE IF SCREEN_TYPE = "NEWDIR" && 2/19/08 v. 4.0 SET COLOR TO (mGetColor) && White on Cyan ELSE IF SCREEN_TYPE = "SAVE" && 1/17/09 v. 4.0.9 SET COLOR TO (mBright) ELSE SET COLOR TO (msearchGet) && Bright white on green ENDIF ENDIF ENDIF LEFT_END=COL && establish definitions RIGHT_END=LEFT_END+(LENGTH-1) POSITION=LEFT_END * THE_STRING=THE_STRING+REPLICATE(" ",30-LEN(THE_STRING)) && fill unused area with space @LINE,LEFT_END say replicate(" ",LENGTH) @LINE,LEFT_END say THE_STRING @LINE,POSITION say "" do while .t. mInkey = Inkey(0) do case case mInkey = 27 .or. mInkey=13 .or. mInkey=9 .or. mInkey=271 .or. mInkey=13 EXIT &&ESC or ENTER or TAB RIGHT or TAB LEFT case mInkey = 19 && Left Arrow if POSITION > LEFT_END POSITION = POSITION - 1 endif @LINE,POSITION say "" case mInkey = 4 && Right Arrow if POSITION < RIGHT_END POSITION=POSITION + 1 endif @LINE,POSITION say "" case mInkey=7 && delete key if POSITION < RIGHT_END PLACE=(POSITION-LEFT_END)+1 FIRST_HALF = SUBSTR(THE_STRING,1,PLACE-1) SECOND_HALF = SUBSTR(THE_STRING,PLACE+1,LENGTH-PLACE) + " " else FIRST_HALF = SUBSTR(THE_STRING,1,LENGTH-1) SECOND_HALF = " " endif THE_STRING = FIRST_HALF + SECOND_HALF @LINE,LEFT_END say THE_STRING @LINE,POSITION say "" case mInkey=8 && backspace key PLACE=(POSITION - LEFT_END)+1 if PLACE > 2 FIRST_HALF=substr(THE_STRING,1,PLACE-2) else FIRST_HALF="" endif SECOND_HALF=substr(THE_STRING,PLACE,(LENGTH - PLACE)+1) if POSITION>LEFT_END THE_STRING = FIRST_HALF + SECOND_HALF + " " POSITION=POSITION-1 else THE_STRING = FIRST_HALF + SECOND_HALF endif @LINE,LEFT_END say THE_STRING @LINE,POSITION say "" otherwise IF (MUST_B_NUMBER .AND. numeric(chr(mInkey))) .OR. !MUST_B_NUMBER PLACE=(POSITION - LEFT_END)+1 if PLACE > 1 FIRST_HALF=SUBSTR(THE_STRING,1,PLACE-1) else FIRST_HALF="" endif if PLACE < LENGTH SECOND_HALF=SUBSTR(THE_STRING,PLACE,LENGTH-PLACE) else SECOND_HALF="" endif THE_STRING = FIRST_HALF + CHR(mInkey) + SECOND_HALF @LINE,LEFT_END say THE_STRING if POSITION < RIGHT_END POSITION = POSITION + 1 endif @LINE,POSITION say "" ENDIF endcase enddo && end loop IF MUST_B_NUMBER THE_STRING=REPLICATE(" ",LENGTH-LEN(STRtRAN(THE_STRING," ",1,"")))+; STRtRAN(THE_STRING," ",1,"") && rt. justify numbers ENDIF set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) && --* Erases previous message *-- PROCEDURE B1000_PROCESS_SEARCH *---------------------------------------------------------------* * Called from: SEARCH_MENU * * * * Parameters: (none) * * * * Procedures called: B1010_SEARCH_OUT_SCREEN * * B1100_EVALUATE_EXPRESSION * * B1020_SHOW_EXPRESSION * * B1200_SHOW_SEARCH_PAGE * * B2000_EXPORT_SEARCH_RESULTS * * * * Functions called: (none) * * * * This procedure assigns tasks associated with the display of * * output contracted by the search criteria found in * * A0100_EDIT_SEARCH_VALUES. * * * * ENHANCEMENTS * * ------------ * * 08/27/2007 v. 4.0 * * - begin coding changes for "Export results to file" * * option * * - Added call to procedure B2000_EXPORT_SEARCH_RESULTS * *---------------------------------------------------------------* PRIVATE B010_FOUND,B007_NUM_PAGES,B008_CURR_PAGE,B101_TOT_WITHD,B102_TOT_DEPOS B007_NUM_PAGES=0 B008_CURR_PAGE=0 B101_TOT_WITHD=0.00 B102_TOT_DEPOS=0.00 B010_FOUND=0 DO B1010_SEARCH_OUT_SCREEN DO B1100_EVALUATE_EXPRESSION WITH B010_FOUND,B101_TOT_WITHD,B102_TOT_DEPOS DO B1020_SHOW_EXPRESSION WITH B010_FOUND,B101_TOT_WITHD,B102_TOT_DEPOS IF B010_FOUND<10 .AND. B010_FOUND>0 B007_NUM_PAGES=1 ELSE IF MOD(B010_FOUND,10)>0 && if the number of transactions found is not && evenly divisible by 10... B007_NUM_PAGES=INT(B010_FOUND/10)+1 && how many pages total? ELSE && 10,20,30,....number of transactions B007_NUM_PAGES=INT(B010_FOUND/10) ENDIF ENDIF IF B010_FOUND=0 @15,22 say "(Search found no transactions)" SET COLOR TO (MSEARCHBLANKLINE) @ 1,13 SAY SUBSTR(STR(B010_FOUND),LEN(STR(B010_FOUND))-2,3) @ 22,72 SAY SUBSTR(STR(B008_CURR_PAGE),LEN(STR(B008_CURR_PAGE))-1,2) @ 22,78 SAY SUBSTR(STR(B007_NUM_PAGES),LEN(STR(B007_NUM_PAGES))-1,2) MINKEY=INKEY(0) ELSE B008_CURR_PAGE=1 DO B1200_SHOW_SEARCH_PAGE WITH B008_CURR_PAGE,B007_NUM_PAGES,B010_FOUND DO WHILE .T. && this loop controls the page up and page down scrollling feature... MINKEY=INKEY(0) DO CASE CASE MINKEY=27 && EXIT CASE MINKEY=18 &&PAGE UP IF B008_CURR_PAGE>1 B008_CURR_PAGE=B008_CURR_PAGE-1 DO B1200_SHOW_SEARCH_PAGE WITH B008_CURR_PAGE,B007_NUM_PAGES,B010_FOUND ENDIF CASE MINKEY=3 &&PAGE DOWN IF B008_CURR_PAGE to view, eXport results to file, back to menu" && v 4.0 08/21/2007 SET COLOR TO (mGreenHigh) && v 4.0 08/21/2007 @ 24,31 say "X" && v 4.0 08/21/2007 SET COLOR TO (MBLACK) && v 4.0 08/21/2007 set cursor on PROCEDURE B1020_SHOW_EXPRESSION *---------------------------------------------------------------* * Called from: B1000_PROCESS_SEARCH * * * * Parameters: B010_FOUND * * B101_TOT_WITHD * * B102_TOT_DEPOS * * * * Procedures called: (none) * * * * Functions called: XCOM - formats total amounts * * * * This procedure combs through the search parameters and * * gives a composite notation in the upper left portion of the * * search result screen. Amounts are also output in the totals * * box. * * * *10/30/07 v 4.0 * * * * Message added for when no search criteria entered. (i.e. all * * records are selected) * * * *1/17/09 v 4.0.9 * * Fixed display of "records for:" when only 1 record is found. * *---------------------------------------------------------------* PARAMETERS B010_FOUND,B101_TOT_WITHD,B102_TOT_DEPOS PRIVATE ROW,B001_FIRST,B002_SECOND,NET_AMOUNT, B102_NO_QUERY_ENTERED ROW=1 B001_FIRST="" B002_SECOND="" NET_AMOUNT=0.00 B102_NO_QUERY_ENTERED=.T. && 10/30/07 V. 4.0 * IF B010_FOUND=1 * @ROW,0 SAY "Search found record for:" * ELSE * @ROW,0 SAY "Search found records for:" * ENDIF @ROW,0 SAY "Search found record(s) for:" && v. 4.0.9 1/17/09 ROW=ROW+1 SET COLOR TO (MSEARCHBLANKLINE) NET_AMOUNT=B102_TOT_DEPOS-B101_TOT_WITHD @3,68 SAY XCOM(B102_TOT_DEPOS,10) @4,68 SAY XCOM(B101_TOT_WITHD,10) @6,68 SAY XCOM(NET_AMOUNT,10) SET COLOR TO (MBLACK) IF !(SDATE_OPERATOR1=REPLICATE(" ",LEN(SDATE_OPERATOR1))) && Date line B001_FIRST="Date " + SDATE_OPERATOR1 + " " + SDATE_STR1 + " " IF !(SDATE_AND_OR=REPLICATE(" ",LEN(SDATE_AND_OR))) B002_SECOND=SDATE_AND_OR + " Date " + SDATE_2ND_OP + " " + A075_DATE_STR2 ENDIF @ROW,0 SAY B001_FIRST + B002_SECOND ROW=ROW+1 B002_SECOND="" B102_NO_QUERY_ENTERED=.F. && 10/30/07 V. 4.0 ENDIF IF !(SCHECK_OPERATOR1=" ") && check number line B001_FIRST="Check Number "+ SCHECK_OPERATOR1 + " " + SCHECK_NUM1 + " " IF !(SCHECK_AND_OR=" ") B002_SECOND=SCHECK_AND_OR+" Check Number "+SCHECK_2ND_OP+" "+S2ND_CHECKNUM ENDIF @ROW,0 SAY B001_FIRST + B002_SECOND ROW=ROW+1 B002_SECOND="" B102_NO_QUERY_ENTERED=.F. && 10/30/07 V. 4.0 ENDIF IF !(SDESC_OPERATOR1=" ") && description line B001_FIRST="Description "+SDESC_OPERATOR1+ " '"+TRIM(SDESC1)+"' " IF !(SDESC_AND_OR=" ") B002_SECOND=SDESC_AND_OR @ROW,0 SAY B001_FIRST + B002_SECOND @ROW+1,0 SAY "Description "+SDESC_2ND_OP+" '"+TRIM(SDESC2)+"'" ROW=ROW+2 B002_SECOND="" && special k for description field ELSE @ROW,0 SAY B001_FIRST ROW=ROW+1 ENDIF B102_NO_QUERY_ENTERED=.F. && 10/30/07 V. 4.0 ENDIF IF !(SWITHD_OPERATOR1=" ") B001_FIRST="WITHDRAWAL "+SWITHD_OPERATOR1+" "+SAWITHD_AMT1 IF !(SWITHD_AND_OR=" ") B002_SECOND=SWITHD_AND_OR+" WITHDRAWAL "+SWITHD_2ND_OP+" "+SWAMT_IN_2 ENDIF @ROW,0 SAY B001_FIRST + B002_SECOND ROW=ROW+1 B002_SECOND="" B102_NO_QUERY_ENTERED=.F. && 10/30/07 V. 4.0 ENDIF IF !(SDEPOS_OPERATOR1=" ") B001_FIRST="Deposit "+SDEPOS_OPERATOR1+" "+SADEPOS_AMT1 IF !(SDEPOS_AND_OR=" ") B002_SECOND=SDEPOS_AND_OR+" Deposit "+SDEPOS_2ND_OP+" "+SDWAMT_IN_2 ENDIF @ROW,0 SAY B001_FIRST + B002_SECOND ROW=ROW+1 B002_SECOND="" B102_NO_QUERY_ENTERED=.F. && 10/30/07 V. 4.0 ENDIF SET COLOR TO (mBright) IF B102_NO_QUERY_ENTERED && 10/30/07 V. 4.0 @2,0 SAY "(No search values entered, all records selected.)" ENDIF PROCEDURE B1030_REDRAW_SEARCH_RESULTS_SIL *---------------------------------------------------------------* * Called from: B1000_PROCESS_SEARCH * * * * Parameters: (none) * * * * Procedures called: (none) * * Functions called: (none) * * * *WRITTEN: 10/29/07 v. 4.0 * * * * This procedure erases the EXPORT file entry screen, and * * re-draws the bottom 3 rows of the SEARCH RESULTS screen. * *---------------------------------------------------------------* set color to (MBLACK) && black background, white text @ 22,0 SAY REPLICATE(" ",80) @ 23,0 SAY REPLICATE(" ",80) @ 24,0 SAY REPLICATE(" ",80) do paint_message with "SEARCH_RESULTS" @ 22,59 SAY "Showing page of " @ 24,0 say " to view, eXport results to file, back to menu" SET COLOR TO (mGreenHigh) @ 24,31 say "X" SET COLOR TO (MSEARCHBLANKLINE) @ 22,72 SAY SUBSTR(STR(B008_CURR_PAGE),LEN(STR(B008_CURR_PAGE))-1,2) @ 22,78 SAY SUBSTR(STR(B007_NUM_PAGES),LEN(STR(B007_NUM_PAGES))-1,2) SET COLOR TO (MBLACK) set cursor on @ 24,0 say "" PROCEDURE B1100_EVALUATE_EXPRESSION *---------------------------------------------------------------* * Called from: B1000_PROCESS_SEARCH * * * * Parameters: B010_FOUND * * B101_TOT_WITHD * * B102_TOT_DEPOS * * * * Procedures called: (none) * * Functions called: B1110_COMPARE_VAL * * B1120_COMPARE_STR * * un_comma * * * * This procedure performs a sequential examination of the the * * account that currently resides in memory (mTable). For each * * table element, the selection criteria is applied, and a * * descision forms resulting in the acceptence or dismissal of * * the transaction in question. At the same time, a new table * * (SRCH_TABLE) is constructed containing only subjects that * * pass the given tests. Various counters keep score. * *---------------------------------------------------------------* PARAMETERS B010_FOUND,B101_TOT_WITHD,B102_TOT_DEPOS PRIVATE TICKER,TOP,SATISFIED,TB_DATE,TB_CKNUM,TB_DESC,TB_WITHD,TB_DEPOS TOP=TB_SIZE-1 && TB_SIZE is global and accumulated in procedure ADD_ROWS B010_FOUND=0 FOR TICKER=1 TO TOP && start loop to traverse all transactions in current memory... TB_WITHD=un_comma(50,58,TICKER) && memory stored as a TB_DEPOS=un_comma(61,69,TICKER) && string is transformed into a numeric value SATISFIED=.T. IF SDATE_OPERATOR1<>" " && evaluate Date... TB_DATE=CTOD(SUBSTR(MTABLE[TICKER],1,10)) && mTable holds all rows in current memory IF SDATE_2ND_OP<>" " && if both date search expressions entered... IF SDATE_AND_OR="AND" SATISFIED=B1110_COMPARE_VAL(TB_DATE,CTOD(SDATE_STR1),SDATE_OPERATOR1) .AND.; B1110_COMPARE_VAL(TB_DATE,CTOD(A075_DATE_STR2),SDATE_2ND_OP) ELSE SATISFIED=B1110_COMPARE_VAL(TB_DATE,CTOD(SDATE_STR1),SDATE_OPERATOR1) .OR.; B1110_COMPARE_VAL(TB_DATE,CTOD(A075_DATE_STR2),SDATE_2ND_OP) ENDIF ELSE && compare 1st date expression only SATISFIED=B1110_COMPARE_VAL(TB_DATE,CTOD(SDATE_STR1),SDATE_OPERATOR1) ENDIF ENDIF IF SATISFIED && evaluate check number IF SCHECK_OPERATOR1<>" " TB_CKNUM=SUBSTR(MTABLE[TICKER],14,4) IF SCHECK_2ND_OP<>" " IF SCHECK_AND_OR="AND" SATISFIED=B1120_COMPARE_STR(TB_CKNUM,SCHECK_NUM1,SCHECK_OPERATOR1); .AND.; B1120_COMPARE_STR(TB_CKNUM,S2ND_CHECKNUM,SCHECK_2ND_OP) ELSE SATISFIED=B1120_COMPARE_STR(TB_CKNUM,SCHECK_NUM1,SCHECK_OPERATOR1); .OR.; B1120_COMPARE_STR(TB_CKNUM,S2ND_CHECKNUM,SCHECK_2ND_OP) ENDIF ELSE && only evaluate the first check number SATISFIED=B1120_COMPARE_STR(TB_CKNUM,SCHECK_NUM1,SCHECK_OPERATOR1) ENDIF ENDIF ENDIF IF SATISFIED && evaluate description IF SDESC_OPERATOR1<>" " TB_DESC=SUBSTR(MTABLE[TICKER],19,30) IF SDESC_2ND_OP<>" " IF SDESC_AND_OR="AND" SATISFIED=B1120_COMPARE_STR(TB_DESC,SDESC1,SDESC_OPERATOR1); .AND.; B1120_COMPARE_STR(TB_DESC,SDESC2,SDESC_2ND_OP) ELSE SATISFIED=B1120_COMPARE_STR(TB_DESC,SDESC1,SDESC_OPERATOR1); .OR.; B1120_COMPARE_STR(TB_DESC,SDESC2,SDESC_2ND_OP) ENDIF ELSE && only evaluate the first description SATISFIED=B1120_COMPARE_STR(TB_DESC,SDESC1,SDESC_OPERATOR1) ENDIF ENDIF ENDIF IF SATISFIED && evaluate WITHDRAWAL amount IF SWITHD_OPERATOR1<>" " IF SWITHD_2ND_OP<>" " IF SWITHD_AND_OR="AND" SATISFIED=B1110_COMPARE_VAL(TB_WITHD,VAL(SAWITHD_AMT1),SWITHD_OPERATOR1); .AND.; B1110_COMPARE_VAL(TB_WITHD,VAL(SWAMT_IN_2),SWITHD_2ND_OP) ELSE SATISFIED=B1110_COMPARE_VAL(TB_WITHD,VAL(SAWITHD_AMT1),SWITHD_OPERATOR1); .OR.; B1110_COMPARE_VAL(TB_WITHD,VAL(SWAMT_IN_2),SWITHD_2ND_OP) ENDIF ELSE && only 1 WITHDRAWAL amount was entered SATISFIED=B1110_COMPARE_VAL(TB_WITHD,VAL(SAWITHD_AMT1),SWITHD_OPERATOR1) ENDIF ENDIF ENDIF IF SATISFIED && evaluate deposit amount IF SDEPOS_OPERATOR1<>" " IF SDEPOS_2ND_OP<>" " IF SDEPOS_AND_OR="AND" SATISFIED=B1110_COMPARE_VAL(TB_DEPOS,VAL(SADEPOS_AMT1),SDEPOS_OPERATOR1); .AND.; B1110_COMPARE_VAL(TB_DEPOS,VAL(SWAMT_IN_2),SDEPOS_2ND_OP) ELSE SATISFIED=B1110_COMPARE_VAL(TB_DEPOS,VAL(SADEPOS_AMT1),SDEPOS_OPERATOR1); .OR.; B1110_COMPARE_VAL(TB_DEPOS,VAL(SWAMT_IN_2),SDEPOS_2ND_OP) ENDIF ELSE SATISFIED=B1110_COMPARE_VAL(TB_DEPOS,VAL(SAWITHD_AMT1),SDEPOS_OPERATOR1) ENDIF ENDIF ENDIF IF SATISFIED && all search conditions agree with the current memory values B101_TOT_WITHD=B101_TOT_WITHD+TB_WITHD && accumulate accumulators B102_TOT_DEPOS=B102_TOT_DEPOS+TB_DEPOS B010_FOUND=B010_FOUND+1 && increment counter SRCH_TABLE[B010_FOUND]=MTABLE[TICKER] && add transaction to new table ENDIF NEXT && return to loop orgin and examine next record FUNCTION B1110_COMPARE_VAL *---------------------------------------------------------------* * Called from: B1100_EVALUATE_EXPRESSION * * * * Parameters: B010_NUMBER * * B011_SEARCH_VAL * * B012_OPERATOR * * * * Procedures called: (none) * * Functions called: (none) * * * * This function holds B011_SEARCH_VAL as the standard where * * B010_NUMBER is judged. B1110_COMPARE_VAL's reply is a mirror * * reflexion of B010_NUMER's relationship with B011_SEARCH_VAL * * as determined by B012_OPERATOR. * *---------------------------------------------------------------* PARAMETERS B010_NUMBER,B011_SEARCH_VAL,B012_OPERATOR DO CASE CASE B012_OPERATOR="EQ" RETURN B010_NUMBER = B011_SEARCH_VAL CASE B012_OPERATOR="GR" RETURN B010_NUMBER > B011_SEARCH_VAL CASE B012_OPERATOR="GE" RETURN B010_NUMBER >= B011_SEARCH_VAL CASE B012_OPERATOR="LS" RETURN B010_NUMBER < B011_SEARCH_VAL CASE B012_OPERATOR="LE" RETURN B010_NUMBER <= B011_SEARCH_VAL ENDCASE FUNCTION B1120_COMPARE_STR *------------------------------------------------------------------------------* * The function of B1120_COMPARE_STR is identical to that of B1110_COMPARE_VAL * * contrasting only with the variable types they compare. * *------------------------------------------------------------------------------* PARAMETERS B020_STRING,B021_SEARCH_STRING,B022_OPERATOR PRIVATE B015_LOWCASE_STRING, B017_LOWCASE_SEARCH_VAL B015_LOWCASE_STRING=LOWER(B020_STRING) && search not case sensitive, so B017_LOWCASE_SEARCH_VAL=LOWER(B021_SEARCH_STRING) && convert both strings to lower case... DO CASE CASE B022_OPERATOR="EQ" RETURN B015_LOWCASE_STRING = B017_LOWCASE_SEARCH_VAL CASE B022_OPERATOR="GR" RETURN B015_LOWCASE_STRING > B017_LOWCASE_SEARCH_VAL CASE B022_OPERATOR="GE" RETURN B015_LOWCASE_STRING >= B017_LOWCASE_SEARCH_VAL CASE B022_OPERATOR="LS" RETURN B015_LOWCASE_STRING < B017_LOWCASE_SEARCH_VAL CASE B022_OPERATOR="LE" RETURN B015_LOWCASE_STRING <= B017_LOWCASE_SEARCH_VAL CASE B022_OPERATOR="CT" RETURN CONTAINED_IN(B015_LOWCASE_STRING,B017_LOWCASE_SEARCH_VAL) ENDCASE PROCEDURE B1200_SHOW_SEARCH_PAGE *---------------------------------------------------------------* * Called from: B1000_PROCESS_SEARCH * * * * Parameters: B008_CURR_PAGE * * B007_NUM_PAGES * * B010_FOUND (number of transactions found) * * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure displays a list from 1 to 10 transactions that* * begin with the current page to show (B008_CURR_PAGE). These * * transactions are 80 byte strings stored in the table named * * SRCH_TABLE. * *---------------------------------------------------------------* PARAMETERS B008_CURR_PAGE,B007_NUM_PAGES,B010_FOUND PRIVATE I,START,FINISH,B52_DEPTH B52_DEPTH=11 SET COLOR TO (MSEARCHBLANKLINE) START=(B008_CURR_PAGE-1)*10+1 FINISH=START+9 FOR I=START TO FINISH IF I<=B010_FOUND @ B52_DEPTH,0 SAY SRCH_TABLE[I] ELSE @ B52_DEPTH,0 SAY REPLICATE(" ",80)&& BLANK ROW ENDIF B52_DEPTH=B52_DEPTH+1 NEXT **************************************************** * Here shows how many total records were found, * * and what page is currently displayed. * **************************************************** @ 1,13 SAY SUBSTR(STR(B010_FOUND),LEN(STR(B010_FOUND))-2,3) @ 22,72 SAY SUBSTR(STR(B008_CURR_PAGE),LEN(STR(B008_CURR_PAGE))-1,2) @ 22,78 SAY SUBSTR(STR(B007_NUM_PAGES),LEN(STR(B007_NUM_PAGES))-1,2) PROCEDURE B2000_EXPORT_SEARCH_RESULTS *---------------------------------------------------------------* * Called from: B1000_PROCESS_SEARCH * * * * Parameters: (none) * * * * Procedures called: B2100_PAINT_EXPORT_SCREEN * * B2200_SAVE_EXPORT * * FIND_STRING * * B2800_EXPORT_SELECTION_SCREEN * * * * Functions called: AddExt * * B2300_FILE_ERROR() * * B2400_VALID_EXPORT_PATH() * * * * This procedure is called when "X" for "eXport to file" is * * chosen from the Search results screen. Part of v 4.0 * * upgrade. * * * *08/27/2007 * * 1. Paint Export File Screen * * * *08/28/2007 * * 2. Find name of Export file (FIND_STRING) * * 3. Examine filename and path for syntax errors * * 4. Write export file to disk * *---------------------------------------------------------------* PRIVATE TRY_AGAIN, B20_FILENAME, B20_ERROR_CODE, B20_YES_OR_NO_ENTERED B20_FILENAME = "" * B2100B_EXPORT_PATH = CURR_DIR && 10/31/07 TRY_AGAIN = .T. B20_ERROR_CODE = 0 DO B2800_EXPORT_SELECTION_SCREEN DO WHILE LASTKEY() <> 27 .AND. TRY_AGAIN && not pressed and file error needs resolving B2100B_EXPORT_PATH = CURR_DIR && 10/31/07 DO B2100_PAINT_EXPORT_SCREEN DO FIND_STRING WITH 23,23,B2100B_EXPORT_PATH,56,.F.,"EXPORT" && Find export filename DO B2150_REMOVE_SPACES WITH B2100B_EXPORT_PATH IF LASTKEY() <> 27 .AND. LEN(B2100B_EXPORT_PATH) > 0 && 10/29/07 processing B2100B_EXPORT_PATH = AddExt(B2100B_EXPORT_PATH) && Add .DBF extension - 9/14/07 IF UPPER(B2100B_EXPORT_PATH) = UPPER(DB_NAME) TRY_AGAIN = B2300_FILE_ERROR(1) && !Error - can't export to current open file ELSE && No file errors! (i.e. file name is valid) IF FILE(B2100B_EXPORT_PATH) && Export path and filename already exists B20_ERROR_CODE = B2400_VALID_EXPORT_PATH(B2100B_EXPORT_PATH,B20_FILENAME) && check if export path is valid IF B20_ERROR_CODE = 0 && file already exists, display warning. 11/06/07 v. 4.0 B20_YES_OR_NO_ENTERED = .F. DO WHILE LASTKEY() <> 27 .AND. !B20_YES_OR_NO_ENTERED @ 24,0 SAY "Folder already contains " +; B21_GLOBAL_EXPORT_FILENAME +; ". Replace existing file?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed, write file to disk USE (B2100B_EXPORT_PATH) DO B2200_SAVE_EXPORT WITH B2100B_EXPORT_PATH,B20_FILENAME B20_YES_OR_NO_ENTERED = .T. TRY_AGAIN = .F. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed B20_YES_OR_NO_ENTERED = .T. TRY_AGAIN = .F. ENDIF ENDIF ENDDO ELSE TRY_AGAIN = B2300_FILE_ERROR(B20_ERROR_CODE) && !File path has Errors ENDIF ELSE && Export file path is new B20_ERROR_CODE = B2400_VALID_EXPORT_PATH(B2100B_EXPORT_PATH,B20_FILENAME) && examine new export file path for errors IF B20_ERROR_CODE = 0 USE c:\finance\accounts\format COPY TO (B2100B_EXPORT_PATH) ********************************************************** * Here, the program may crash when B2100B_EXPORT_PATH is * * a root path with no sub folders. Some networks will * * not allow writing to the root path (i.e. "c:\") * ********************************************************** USE (B2100B_EXPORT_PATH) DO B2200_SAVE_EXPORT WITH B2100B_EXPORT_PATH,B20_FILENAME TRY_AGAIN = .F. ELSE TRY_AGAIN = B2300_FILE_ERROR(B20_ERROR_CODE) && !File path has Errors ENDIF ENDIF CLOSE DATABASES && Close export file * FILENAME = B20_HOLD_FILENAME && 9/19/07 V. 4.0 IF OPENED && Need to re-open the current file USE (DB_NAME) && DB_NAME is a global variable that holds the current path & filename ENDIF ENDIF ELSE IF LEN(B2100B_EXPORT_PATH) = 0 && export file string is empty - 10/30/07 V. 4.0 TRY_AGAIN = B2300_FILE_ERROR(3) ENDIF ENDIF && 10/29/07 key processing ENDDO PROCEDURE B2100_PAINT_EXPORT_SCREEN *---------------------------------------------------------------* * Called from: B2000_EXPORT_SEARCH_RESULTS * * * * Parameters: (none) * * * * Procedures called: (none) * * Functions called: (none) * * * * This procedure paints SIL and file prompts at bottom of * * screen. Part of v 4.0 upgrade. * *---------------------------------------------------------------* SET COLOR TO (MBLACK) @ 22,0 SAY REPLICATE(" ",80) && Clear bottom three rows @ 23,0 SAY REPLICATE(" ",80) @ 24,0 SAY REPLICATE(" ",80) set color to (mDARKGREEN) if B20_EXPORT_TYPE="REGULAR" @ 22,0 say "REGULAR EXPORT" && New SIL v 4.0 01/15/2008 else @ 22,0 say "PAYPAL EXPORT" && New SIL v 4.0 01/15/2008 endif SET COLOR TO (MBLACK) && grey on black @ 23,0 say "Enter export filename:" @ 24,0 say " for menu" PROCEDURE B2150_REMOVE_SPACES *---------------------------------------------------------------* * Called from: B2000_EXPORT_SEARCH_RESULTS * * * * Parameters: B215_STRING * * * * Procedures called: (none) * * * * Functions called: SUBSTR() * * * *WRITTEN: 10/31/07 v. 4.0 * * * * This procedure removes all space characters (" ") from * * B215_STRING. * * * *---------------------------------------------------------------* PARAMETER B215_STRING PRIVATE I, B215_LENGTH, B215_TEMP_STRING, B215_CHAR B215_TEMP_STRING = "" B215_LENGTH = LEN(B215_STRING) IF B215_LENGTH > 0 FOR I = 1 to B215_LENGTH B215_CHAR = SUBSTR(B215_STRING,I,1) IF !(B215_CHAR = " ") B215_TEMP_STRING = B215_TEMP_STRING + B215_CHAR ENDIF NEXT ENDIF B215_STRING = B215_TEMP_STRING PROCEDURE B2200_SAVE_EXPORT *---------------------------------------------------------------* * Called from: B2000_EXPORT_SEARCH_RESULTS * * * * Parameters: B22_DB_NAME - contains export file's path * * and file name. * * (added 9/17/07) * * B22_FILENAME * * * * Procedures called: ADD_BALANCE_REC * * Find_fName * * * * Functions called: CTOD() - converts string to DATE vale * * SUBSTR() * * VAL() * * B2250_EXPORT_UN_COMMA() * * * *WRITTEN: 9/14/07 * * This procedure saves the search results table (SRCH_TABLE[]) * * to the export file. * * * *---------------------------------------------------------------* PARAMETERS B22_DB_NAME,B22_FILENAME PRIVATE I, sROW, teststring teststring="" ZAP && Clears opened export file DO ADD_BALANCE_REC && insert balance record first FOR I = 1 to B010_FOUND && B010_FOUND = # transactions found sROW = SRCH_TABLE[I] APPEND BLANK REPLACE AC_DATE with CTOD(SUBSTR(sROW,1,10)) REPLACE AC_CK_NUM with VAL(SUBSTR(sROW,14,4)) REPLACE AC_DESC with SUBSTR(sROW,19,30) if SUBSTR(sRow,12,1) = " " REPLACE AC_PAID with .f. else REPLACE AC_PAID with .t. endif *************** DE-BUGGING TOOL ******************* * teststring=un_comma(50,58,i) * @ 22,22 SAY "AC_WTH_AMT =" + teststring * mInkey = Inkey(0) *************************************************** **************************************************** * Insert logic here to swap withdrawal and deposit * * amounts when B20_EXPORT_TYPE="PAYPAL"-01/15/2008 * **************************************************** if B20_EXPORT_TYPE="REGULAR" REPLACE AC_WTH_AMT with B2250_EXPORT_UN_COMMA(50,58,i) REPLACE AC_DEP_AMT with B2250_EXPORT_UN_COMMA(61,69,i) else && i.e. B20_EXPORT_TYPE="PAYPAL" REPLACE AC_DEP_AMT with B2250_EXPORT_UN_COMMA(50,58,i) REPLACE AC_WTH_AMT with B2250_EXPORT_UN_COMMA(61,69,i) endif REPLACE AC_BALANCE with B2250_EXPORT_UN_COMMA(71,80,i) NEXT COMMIT && {writes file to disk} * DO Find_fName WITH B22_DB_NAME && Removes directory path from CURR_DIR (commented out 10/27/07) SET COLOR TO (mGreenHigh) @ 23,0 SAY REPLICATE(" ",80) @ 24,0 SAY REPLICATE(" ",80) * @ 24,0 SAY B22_DB_NAME + " saved. Press any key to continue." @ 24,0 SAY REPLICATE(" ",80) @ 24,0 SAY B21_GLOBAL_EXPORT_FILENAME + " saved. Press any key to continue." && 10/31/07 mInkey = Inkey(0) FUNCTION B2250_EXPORT_UN_COMMA *---------------------------------------------------------------* * Date Written: 01.10.2008 v 4.0 upgrade * * * * Called from: B2200_SAVE_EXPORT * * * * Parameters: start * * finish * * row_num * * * * Procedures called: (none) * * * * Functions called: SUBSTR() * * VAL() * * * * This function is identical to un_comma(), except tRow is * * assigned to the search results table (SRCH_TABLE[]) instead * * of the current file table (mTable[]). B2250_EXPORT_UN_COMMA * * receives coordinates that locate dollar values on the * * specified row. The function removes commas from amounts * * greater than 999.99, and returns the amount in type VAL. * *---------------------------------------------------------------* PARAMETER start, finish, row_num PRIVATE tRow, tString, tChar, i tRow = SRCH_TABLE[row_num] tString = "" for i = start to finish tChar = SUBSTR(tRow,i,1) if tChar <> "," tString = tString + tChar endif next return VAL(tString) FUNCTION B2300_FILE_ERROR *---------------------------------------------------------------* * Called from: B2000_EXPORT_SEARCH_RESULTS * * * * Parameters: B23_ERROR_TYPE * * * * Procedures called: (none) * * * * Functions called: INKEY() * * * *WRITTEN: 9/17/07 * * * * This function displays an error message that relates to * * B23_ERROR_TYPE. It returns TRUE (.t.) when the "Try Again?" * * prompt is answered with a "y" (yes). * * * * B23_ERROR_TYPE * * -------------- * * 0 - No errors * * 1 - Can't export, file already opened. * * 2 - Export filename too long. * * 3 - Must enter a filename. * * 4 - Filename must contain letters or numbers. * * 5 - illegal path name. * * 6 - path does not exist. * *---------------------------------------------------------------* PARAMETER B23_ERROR_TYPE * SET COLOR TO (mGreenHigh) SET COLOR TO (MBLACK) && grey on black @ 23,0 say "Enter export filename:" && re-draw file prompt set color to (MSEARCHBLANKLINE) && Dark green on black @ 23,23 SAY B2100B_EXPORT_PATH && Shade the entered export SET COLOR TO (mErrColor) DO CASE CASE B23_ERROR_TYPE = 1 @ 24,0 SAY "!Can't export, account already opened. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE B23_ERROR_TYPE = 2 @ 24,0 SAY "!Filename is too long. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE B23_ERROR_TYPE = 3 @ 24,0 SAY "!Must enter a filename. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE B23_ERROR_TYPE = 4 @ 24,0 SAY "!Filename must contain letters or numbers. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE B23_ERROR_TYPE = 5 @ 24,0 SAY "!illegal pathname. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF CASE B23_ERROR_TYPE = 6 @ 24,0 SAY "!path does not exist. Try again?(y/n)" mInkey = Inkey(0) IF mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed RETURN .t. ELSE IF mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed RETURN .f. ENDIF ENDIF ENDCASE FUNCTION B2400_VALID_EXPORT_PATH *---------------------------------------------------------------* * Called from: B2000_EXPORT_SEARCH_RESULTS * * * * Parameters: EXPORT_PATH * * B24_FILENAME * * * * Procedures called: B2500_SPLIT_EXPORT_PATH * * * * Functions called: B2700_LEGAL_PATH() * * B2600_LEGAL_CHARACTERS() * * * *WRITTEN: 9/19/07 * * This procedure examines B24_EXPORT_PATH, and returns a * * numeric error code. * * * * Conditions of correct syntax * * ---------------------------- * * - EXPORT_PATH must contain only alphanumeric * * characters (a...z, 0...9) * * - The exception for rule #1: (":","/",".") * * - length of filename must be 12 characters or less * * * * B24_ERROR_CODE(s) * * ----------------- * * 0 - No errors * * 1 - Can't export, file already opened. * * 2 - Export filename too long * * 3 - No filename was entered * * 4 - filename can only contain letters or numbers * * 5 - illegal path name * * 6 - path does not exist * *---------------------------------------------------------------* PARAMETERS B24_EXPORT_PATH, B24_FILENAME PRIVATE B24_FOLDER, B24_POS, B24_LENGTH_FNAME, B24_PATH_ERROR_CODE B24_FOLDER ="" B24_FILENAME ="" B24_PATH_ERROR_CODE = 0 DO B2500_SPLIT_EXPORT_PATH WITH B24_EXPORT_PATH, B24_FOLDER, B24_FILENAME B21_GLOBAL_EXPORT_FILENAME = B24_FILENAME && 11/02/07 V. 4.0 B24_PATH_ERROR_CODE = B2700_LEGAL_PATH(B24_FOLDER) IF (B24_PATH_ERROR_CODE = 0) && file path O.K., now examine filename B24_LENGTH_FNAME=LEN(B24_FILENAME) IF B24_LENGTH_FNAME > 12 RETURN 2 && Export filename too long ELSE IF B24_LENGTH_FNAME < 1 RETURN 3 && No export filename entered ELSE IF B24_FILENAME ="*" .OR. SUBSTR(B24_FILENAME,1,1) = "." && No export filename entered RETURN 3 ELSE RETURN B2600_LEGAL_CHARACTERS(B24_FILENAME) ENDIF ENDIF ENDIF ELSE RETURN B24_PATH_ERROR_CODE ENDIF PROCEDURE B2500_SPLIT_EXPORT_PATH *---------------------------------------------------------------* * Called from: B2400_VALID_EXPORT_PATH * * * * Parameters: B25_PATH_STRING * * B25_FOLDER * * B25_FILENAME * * * * Procedures called: (none) * * * * Functions called: (none) * * * *WRITTEN: 9/20/07 V. 4.0 upgrade * * * * This procedure takes B25_PATH_STRING and sparates B25_FOLDER * * from B25_FILENAME. * * i.e. * * when B25_PATH_STRING = "c:\finance\accounts\export.dbf" * * then * * B25_FOLDER = "c:\finance\accounts\" * * AND * * B25_FILENAME = "export.dbf" * * * *---------------------------------------------------------------* PARAMETERS B25_PATH_STRING, B25_FOLDER, B25_FILENAME PRIVATE POS,LENGTH,FOUND LENGTH = LEN(B25_PATH_STRING) POS = LENGTH FOUND = .F. IF LENGTH > 0 DO WHILE POS > 0 .AND. !FOUND && Traverse B25_PATH_STRING backwards from the end, until "\" is found IF SUBSTR(B25_PATH_STRING,POS,1) = "\" B25_FOLDER = UPPER(SUBSTR(B25_PATH_STRING,1,POS)) B25_FILENAME = UPPER(SUBSTR(B25_PATH_STRING,POS + 1,LENGTH - POS)) FOUND = .T. ELSE POS = POS - 1 ENDIF ENDDO ENDIF FUNCTION B2600_LEGAL_CHARACTERS *---------------------------------------------------------------* * Called from: B2400_VALID_EXPORT_PATH * * * * Parameters: B26_FILENAME * * * * Procedures called: (none) * * * * Functions called: (none) * * * *WRITTEN: 9/29/07 V. 4.0 upgrade * * * * This procedure examines B26_FILENAME for legal characters, * * and returns one of the following error codes: * * * * 0 - no errors * * 4 - illegal character in export filename * * * *---------------------------------------------------------------* PARAMETERS B26_FILENAME PRIVATE B26_POS, B26_LENGTH B26_POS=1 B26_LENGTH=LEN(B26_FILENAME) DO WHILE !(B26_POS > B26_LENGTH) && Scan B26_FILENAME for illegal characters IF ( (ASC(SUBSTR(B26_FILENAME,B26_POS,1)) > 64) .AND.; && check if between "A...Z" (ASC(SUBSTR(B26_FILENAME,B26_POS,1)) < 91) ) B26_POS = B26_POS + 1 && character is OK, examine the next ELSE IF ( (ASC(SUBSTR(B26_FILENAME,B26_POS,1)) > 96) .AND.; && check if between "a...z" (ASC(SUBSTR(B26_FILENAME,B26_POS,1)) < 123) ) B26_POS = B26_POS + 1 && character is OK, examine the next ELSE IF ( (ASC(SUBSTR(B26_FILENAME,B26_POS,1)) > 47) .AND.; && check if between "0...9" (ASC(SUBSTR(B26_FILENAME,B26_POS,1)) < 58) ) B26_POS = B26_POS + 1 && character is OK, examine the next ELSE IF SUBSTR(B26_FILENAME,B26_POS,1) = "." B26_POS = B26_POS + 1 && character is OK, examine the next ELSE RETURN 4 && Error - illegal character ENDIF ENDIF ENDIF ENDIF ENDDO RETURN 0 && No errors FUNCTION B2700_LEGAL_PATH *---------------------------------------------------------------* * Called from: B2400_VALID_EXPORT_PATH * * * * Parameters: B27_PATH {root drive + folders} * * * * Procedures called: (none) * * * * Functions called: B2600_LEGAL_CHARACTERS() * * * *WRITTEN: 10/17/07 V. 4.0 upgrade * * * * This procedure examines B27_PATH, and returns one of the * * following error codes: * * * * 0 - no errors * * 5 - illegal path name * * 6 - path does not exist 11/07/07 v. 4.0 * *---------------------------------------------------------------* PARAMETERS B27_PATH PRIVATE B27_POS, B27_LENGTH, B27_SUB_FOLDER, B27_TEST_PATH B27_LENGTH=LEN(B27_PATH) B27_SUB_FOLDER="" B27_TEST_PATH="" && 11/07/07 V. 4.0 ********************************************************* * Rules for legal path syntax: * * ---------------------------- * * 1. path name must contain 3 or more characters * * 2. the first 3 characters must be "x:\", where * * "x" is a letter from "a" to "z". * * 3. After the first 3 characters, the remaining * * path string must contain only letters, * * numbers, or space delimited by a single back * * slash (\). * * * ********************************************************* IF (B27_LENGTH < 3) RETURN 5 && illegal because less than 3 characters ELSE IF ( (ASC(SUBSTR(B27_PATH,1,1)) > 64) .AND.; && is disk drive name is between "A...Z"? (ASC(SUBSTR(B27_PATH,1,1)) < 91) ); .OR.; ( (ASC(SUBSTR(B27_PATH,1,1)) > 96) .AND.; && is disk drive name is between "a...z" (ASC(SUBSTR(B27_PATH,1,1)) < 123) ) IF ( SUBSTR(B27_PATH,2,1) = ":" ) .AND. ( SUBSTR(B27_PATH,3,1) = "\" ) IF (B27_LENGTH = 3) RETURN 0 && root drive O.K., no sub folders ELSE && subfolder was entered B27_POS = 4 DO WHILE !(B27_POS > B27_LENGTH) && root directory O.K., scan folders B27_SUB_FOLDER = SUBSTR(B27_PATH,B27_POS,1) DO WHILE !(B27_POS > B27_LENGTH) .AND.; !(SUBSTR(B27_PATH,B27_POS,1) = "\") && find sub folders, delimeted by "\" B27_POS=B27_POS+1 IF !(SUBSTR(B27_PATH,B27_POS,1) = "\") && remove "\" from folder string B27_SUB_FOLDER = B27_SUB_FOLDER + SUBSTR(B27_PATH,B27_POS,1) ENDIF ENDDO B27_POS=B27_POS+1 && skip "/" IF (B2600_LEGAL_CHARACTERS(B27_SUB_FOLDER) = 4) && examine sub folder RETURN 5 && illegal character in sub folder ENDIF ENDDO && sub folder O.K., find next sub folder *************** DE-BUGGING TOOL ******************* * IF FILE("C:\FINANCE\ACCOUNTS\*.DBF") * @ 22,22 SAY "AHHH!" * ELSE * @ 22,22 SAY "Awwww!" * ENDIF *@ 22,22 SAY B27_PATH *mInkey = Inkey(0) *************************************************** ********************************************************************* * 11/07/07 v. 4.0 - Here, we know the pathname syntax is * * correct. Now, see if the path exists. * ********************************************************************* B27_TEST_PATH = B27_PATH + "*.DBF" IF FILE(B27_TEST_PATH) RETURN 0 && directory syntax O.K., path exists and contains .DBF files ELSE ********************************************************************* * 12/06/07 v. 4.0 - Here, the following 2 conditions are possible: * * 1. the path doesn't exist * * 2. the path exists, but contains no .DBF files * * * ********************************************************************* RETURN 6 && directory syntax O.K., path does NOT exist ENDIF ENDIF ELSE RETURN 5 && illegal root drive syntax (no ":" or "/") ENDIF ELSE RETURN 5 && illegal root drive name (must be {a...z} or {A...Z}) ENDIF ENDIF PROCEDURE B2800_EXPORT_SELECTION_SCREEN *---------------------------------------------------------------* * Date Written: 01/12/2008 * * * * Called from: B2000_EXPORT_SEARCH_RESULTS * * * * Parameters: (none) * * * * Procedures called: * * * * Functions called: SaveScreen() * * RestScreen() * * * * This procedure will process a selection dialog box to choose * * the desired export type. The global string variable * * B20_EXPORT_TYPE is then assigned one of the following: * * * * 1. Regular B20_EXPORT_TYPE="REGULAR" * * 2. Bank to Paypal B20_EXPORT_TYPE="PAYPAL" * *---------------------------------------------------------------* PRIVATE B28_SAVE_SCREEN B28_SAVE_SCREEN = SaveScreen(12,27,17,51) set color to (mDARKGREEN) @ 22,0 say "EXPORT SELECTION" && New SIL v 4.0 01/15/2008 set color to (mBlack) @ 23,0 SAY REPLICATE(" ",80) @ 24,0 SAY REPLICATE(" ",80) set color to (mBlackGet) && draw dialog box with Black text, white background @ 12,27,17,51 BOX "ÉÍ»º¼ÍȺ " set color to (mBlack) && white text, black background @ 13,28 SAY "1. Regular " && draws inverse bounce bar on "Regular" set color to (mBlackGet) @ 14,28 SAY "2. Bank to Paypal " @ 16,28 SAY "Select type of Export" B20_EXPORT_TYPE = "REGULAR" @ 13,28 SAY "" && puts cursor blinking on "Regular" do while .t. mInkey = Inkey(0) do case case mInkey = 27 .or. mInkey =13 && ESC or RETURN EXIT case mInkey = 24 .or. mInkey = 5 && Down Arrow or Up Arrow if B20_EXPORT_TYPE = "REGULAR" set color to (mBlackGet) @ 13,28 SAY "1. Regular " set color to (mBlack) @ 14,28 SAY "2. Bank to Paypal " @ 14,28 SAY "" B20_EXPORT_TYPE = "PAYPAL" else set color to (mBlack) @ 13,28 SAY "1. Regular " set color to (mBlackGet) @ 14,28 SAY "2. Bank to Paypal " @ 13,28 SAY "" B20_EXPORT_TYPE = "REGULAR" endif endcase enddo RestScreen(12,27,17,51,B28_SAVE_SCREEN) ********************* FUNCTION *********************** ********************* ISDIR( ) *********************** && added 12/13/07 v 4.0 *From philb@iag.net Thu Aug 08 21:54:00 1996 *Path: news.iag.net!news.sgi.com!swrinde!cs.utexas.edu!ennfs.eas.asu.edu!noao!CS.Arizona.EDU!ruby.ucc.nau.edu!news *From: Joseph Enfield *Newsgroups: comp.lang.clipper *Subject: IsDirectory(), IsDrive() Functions... *Date: Thu, 08 Aug 1996 10:29:58 -0700 *Organization: Northern Arizona University *Lines: 162 *Message-ID: <320A2416.70D0@dana.ucc.nau.edu> *NNTP-Posting-Host: ts3-12.ppp.nau.edu *Mime-Version: 1.0 *Content-Type: text/plain; charset=us-ascii *Content-Transfer-Encoding: 7bit *X-Mailer: Mozilla 2.0 (Win16; I) *I wrote these functions a little while back, and thought I would share them... *I am not a great Assembler programmer, so the Assembler code does only the most *basic element of the process... Perhaps someone with more knowledge in assembler *could clean up the code, put some error checking in, and repost the code... :) *The ASM source compiles under Borlands TASM V2.0... *Functions: IsDir(), _IsDir(), DriveList(), _IsDrive() *These functions work fine under the Lantastic Peer-to-Peer network... *Other networks have not been tested... I do not use a protected mode *linker, and have no idea how to program for such a linker... Therefore, *the code may not work under blinker, etc.. *No warranty expressed or implied, blah, blah, blah... This code is *Public Domain, with no restrictions placed on its (Mis)use, Except that *improvements to the code must be placed back into the public domain, So *everyone can benefit. :) ********************* FUNCTION *********************** ********************* ISDIR( ) *********************** *Parameter: cDir = Drive+Path Example: C:\DOS *Returns: Logical Value indicating whether the path exists * or not. *Uses: FT_Default() by Ted Means, from the Nanfor Lib. * _IsDir() ************************************************************** ********************* CLIPPER SOURCE *********************** *Function IsDir *PARAMETER cDir *PRIVATE lValue, cCurDrive *lValue = .f. *cCurDrive = FT_Default() *Default cDir to cCurDrive+":\"+CurDir(cCurDrive) *cDir := Upper(cDir) *If !(":" $ cDir) * cDir := cCurDrive+":"+cDir *Endif *If Len(cDir) > 3 .and. Right(cDir,1) == "\" * cDir := Left(cDir,Len(cDir)-1) *Endif *If FT_Default(Left(cDir,1))==Left(cDir,1) * lValue := _isDir(cDir+chr(0)) *Endif *FT_Default(cCurDrive) *Return(lValue) FUNCTION CONTAINED_IN *---------------------------------------------------------------* * Called from: B1100_EVALUATE_EXPRESSION * * * * Parameters: B025_WHOLE_STRING * * B030_FRAGMENT * * * * Procedures called: (none) * * Functions called: (none) * * * * This function is only relevant to the "description" query * * field. An examination is performed byte by byte, with each * * iteration forcing B030_FRAGMENT to reconcile with * * B025_WHOLE_STRING. CONTAINED_IN answers true only when an * * agreement is reached between B030_FRAGMENT and the * * corresponding section of B025_WHOLE_STRING. * *---------------------------------------------------------------* PARAMETERS B025_WHOLE_STRING,B030_FRAGMENT PRIVATE B035_I,WHOLE_LENGTH,FRAGMENT_LENGTH,MATCH_MADE,B040_TRIM_FRAG,B045_TRIM_WHOLE B035_I=1 MATCH_MADE=.F. B040_WORK_FRAGMENT=TRIM(B030_FRAGMENT) B045_WORK_WHOLE=TRIM(B025_WHOLE_STRING) WHOLE_LENGTH=LEN(B045_WORK_WHOLE) FRAGMENT_LENGTH=LEN(B040_WORK_FRAGMENT) IF FRAGMENT_LENGTH=WHOLE_LENGTH RETURN (B025_WHOLE_STRING=B030_FRAGMENT) ELSE IF FRAGMENT_LENGTH 0 do c1020_scan_folder WITH c100a_num_files do c1050_display_table WITH c100a_num_files c100c_cursor=4 c100b_table_pos = 1 @ c100c_cursor,0 say "" && paint cursor else @ 8,28 say "(No accounts in folder)" endif do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 28 && F1 (change folder) do FIND_STRING WITH 22,39,c100c_curr_folder,40,.F.,"SUMMARY" c100c_curr_folder=TRIM(c100c_curr_folder) * set color to (mGreenHigh) set color to (mWhiteGet) @ 22,39 SAY REPLICATE(" ",40) @ 22,39 SAY c100c_curr_folder do c2000_erase_summary set color to (mWhiteGet) c100a_num_files = ADIR(c100c_curr_folder,dir_files,aSize,aModified,aTimes) NUM_FILES = c100a_num_files && 02.15.2008 v. 4.0 DO HIDE_UTILITY_FILES && 02.15.2008 v. 4.0 c100a_num_files=NUM_FILES && 02.15.2008 v. 4.0 if c100a_num_files > 0 do c1020_scan_folder WITH c100a_num_files do c1050_display_table WITH c100a_num_files c100c_cursor=4 c100b_table_pos = 1 else @ 8,28 say "(No accounts in folder)" endif * CASE MINKEY=18 &&PAGE UP * case mInkey=3 &&page down case mInkey = 24 && Down Arrow if c100c_cursor = 18 if c100b_table_pos < c100a_num_files dummy = SCROLL(4,00,18,79,1) c100b_table_pos = c100b_table_pos + 1 @ c100c_cursor,0 say c1_sum_table[c100b_table_pos] DO c1060_show_view WITH c100b_table_pos,c100a_num_files endif else c100c_cursor = c100c_cursor +1 c100b_table_pos = c100b_table_pos + 1 endif case mInkey = 5 && Up Arrow if c100c_cursor = 4 if c100b_table_pos > 1 dummy = SCROLL(4,00,18,79,-1) c100b_table_pos = c100b_table_pos - 1 @ c100c_cursor,0 say c1_sum_table[c100b_table_pos] c100d_end = c100b_table_pos + 14 DO c1060_show_view WITH c100d_end,c100a_num_files endif else c100c_cursor = c100c_cursor - 1 c100b_table_pos = c100b_table_pos -1 endif endcase @ c100c_cursor,0 say "" && paint cursor enddo PROCEDURE C1010_SCREEN *---------------------------------------------------------------* * Called from: C1000_account_summary * * * * Parameters: (none) * * * * Procedures called: PAINT_TOP_ROW * * paint_message * * Functions called: (none) * * * * This procedure paints all column headers for the account * * well as the net difference. * *---------------------------------------------------------------* set color to (mBlack) set cursor off clear DO PAINT_TOP_ROW WITH "Summary" do paint_message with "account_summary" set color to (MBLACK) @ 1,00 SAY REPLICATE("Í",80) @ 3,00 SAY REPLICATE("Í",80) @ 19,00 SAY REPLICATE("Í",80) @ 21,00 SAY REPLICATE("Í",80) @ 2,00 say "Account" @ 2,19 say "Modified" @ 2,41 say "Size" @ 2,56 say "Records" @ 2,73 say "Balance" @ 20,0 SAY "viewing " @ 20,10 SAY "-" @ 20,14 SAY "of" @ 20,30 say "Totals=>" @ 22,30 say "Folder=>" @ 24,34 say " - previous screen" @ 24,60 say " - change folder" set color to (mWhiteGet) @ 22,39 say replicate(" ",40) @ 22,39 say curr_dir set cursor on ******************************* PROCEDURE c1020_scan_folder parameters c1_num_accts private c1_loop_ctnr c1_bytes_total = 0 c1_recs_total = 0 c1_bal_total = 0.00 if Opened close databases endif for c1_loop_ctnr = 1 to c1_num_accts do c1030_scan_acct with c1_loop_ctnr close databases next ****************************** PROCEDURE c1030_scan_acct parameters c2_tbl_index private c2_acct_name, c2_num_recs, c2_path, c2_last_balance c2_acct_name = dir_files[c2_tbl_index] c2_path = SUBSTR(c100c_curr_folder,1,LEN(c100c_curr_folder) - 5) + c2_acct_name c2_last_balance = 0.00 c2_num_recs=0 use (c2_path) if !EOF() skip 1 endif @ 4,0 say replicate(" ",40) do while !EOF() @ 4,0 say "scanning " + c2_acct_name + str(c2_num_recs,3) c2_num_recs = c2_num_recs +1 && count records c2_last_balance = AC_BALANCE skip 1 enddo c2_balance = xcom(c2_last_balance,10) &&*** get current balance from last record c1_bal_total = c1_bal_total + c2_last_balance c1_bytes_total = c1_bytes_total + aSize[c2_tbl_index] c1_recs_total = c1_recs_total + c2_num_recs * @ 11,1 say "here 2" c1_sum_table[c2_tbl_index] = c2_acct_name +; replicate(" ",(13-LEN(c2_acct_name)))+; DTOC(aModified[c2_tbl_index])+" "+; aTimes[c2_tbl_index]+replicate(" ",5)+; c1040_kbytes(aSize[c2_tbl_index])+; replicate(" ",13) +; str(c2_num_recs,3) +; replicate(" ",18-LEN(c2_balance))+; c2_balance *********************** function c1040_kbytes * returns kilobytes from number of bytes parameters cf1_bytes private cf1_work cf1_work = str(round((cf1_bytes/1000),1),6,1)+ " K" return cf1_work ********************************************** procedure c1050_display_table parameters c3_total_accts private c3_row, c3_index, c3_top_line, c3_print_line, c3_bottom_line c3_top_line = 4 c3_bottom_line = 18 c3_row = c3_top_line c3_index = 0 for c3_print_line = c3_top_line to c3_bottom_line if c3_index < c3_total_accts c3_index = c3_index + 1 @ c3_print_line,0 say c1_sum_table[c3_index] else @ c3_print_line,0 say replicate(" ",80) endif next DO c1060_show_view WITH c3_index,c3_total_accts @ 20,38 say c1040_kbytes(c1_bytes_total) @ 20,56 say str(c1_recs_total,6) @ 20,70 say xcom(c1_bal_total,10) PROCEDURE c1060_show_view PARAMETERS c6_end, c6_total PRIVATE c6_beginning if c6_total > 14 c6_beginning = c6_end - 14 else c6_beginning = 1 endif @ 20,8 SAY str(c6_beginning,2) @ 20,11 SAY str(c6_end,2) @ 20,17 SAY STR(c6_total,2) PROCEDURE c2000_erase_summary PRIVATE c7_row set color to (mBlack) set cursor off for c7_row=4 to 18 @ c7_row,00 say replicate(" ",80) next @ 20,8 SAY " " @ 20,11 SAY " " @ 20,39 SAY replicate(" ",40) set cursor on PROCEDURE sort_acct *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: None * * * * Procedures called: paint_message * * process_sort_file * * * * Functions called: ok_to_sort() * * * * This procedure will copy the current account to a sort work * * file, sort the file by date and check number, then copy the * * sorted file back to the current work space. * *---------------------------------------------------------------* do paint_message with "sa_sort" if ok_to_sort() do process_sort_file mChanged = .t. endif * return && COMMENTED OUT 01.17.2008 V. 4.0 (NO RETURN STATEMENT FOR PROCEDURES) FUNCTION ok_to_sort *---------------------------------------------------------------* * Called from: sort_acct * * * * This function asks the operator if they want to sort the * * account file. If so, the function returns TRUE. * *---------------------------------------------------------------* do while .t. * @ 24,00 SAY "This will take a minute. O.K to begin sort? (y/n)" && v 3.3 01/21/2006 @ 24,00 SAY "This will take a moment. O.K to begin sort? (y/n)" && v 3.3 01/21/2006 mInkey = Inkey(0) if mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed return .t. else if mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed return .f. endif endif enddo PROCEDURE process_sort_file *---------------------------------------------------------------* * Called from: sort_acct * * * * Parameters: None * * * * Procedures called: sorting_message * * update_file * * Fill_Table * * init_rows * * * * This procedure will save the current file, sort it to a sort * * work file, and reload the sorted file back into memory. * *---------------------------------------------------------------* PRIVATE De_bug_String De_bug_String="" do sorting_message USE (FormatFile) COPY TO (SortInFile) USE (SortInFile) this_is_sortfile = .t. do update_file SORT ON AC_DATE/A, AC_CK_NUM/A TO (SortOutFile) USE (SortOutFile) do Fill_Table WITH "sort" CLOSE DATABASES DELETE FILE (SortInFile) DELETE FILE (SortOutFile) do Init_Rows this_is_sortfile = .f. set cursor on if Opened use (db_name) endif * return && COMMENTED OUT 01.17.2008 V. 4.0 (NO RETURN STATEMENT FOR PROCEDURES) PROCEDURE sorting_message *---------------------------------------------------------------* * Displays flashing "Sorting" message. * *---------------------------------------------------------------* set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) set color to (mCyanBlink) set cursor off @ 22,72 SAY "Sorting" PROCEDURE em_delete *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PROCEDURE em_mark_paid *---------------------------------------------------------------* * Called from: EM_MENU * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * SCROLL_SCREEN * * UPDATE_ROW * * * * This procedure positions the cursor at the current row of * * the account file, and allows the user to scroll through all * * transactions by pressing the up or down arrow keys. A * * record is then marked paid by pressing ENTER. To unmark * * a transaction, press ENTER again. * *---------------------------------------------------------------* do while .t. do paint_message with "em_mark" do scroll_screen with "em_mark" if mInkey = 13 * 06.09.1999 Y2K if SUBSTR(mTable[xindex],10,1) = CHR(251) * 06.09.1999 Y2k mTable[xIndex] = SUBSTR(mTable[xindex],1,9) + " " +; * 06.09.1999 Y2K SUBSTR(mTable[xindex],11,69) * 06.09.1999 Y2K else * 06.09.1999 Y2K mTable[xIndex] = SUBSTR(mTable[xindex],1,9) + CHR(251) +; * 06.09.1999 Y2K SUBSTR(mTable[xindex],11,69) * 06.09.1999 Y2K endif if SUBSTR(mTable[xindex],12,1) = CHR(251) mTable[xIndex] = SUBSTR(mTable[xindex],1,11) + " " +; SUBSTR(mTable[xindex],13,68) else mTable[xIndex] = SUBSTR(mTable[xindex],1,11) + CHR(251) +; SUBSTR(mTable[xindex],13,68) endif set color to (mColor) @ xrow, 00 SAY mTable[xindex] mChanged = .t. * do change_balances else if mInkey = 27 EXIT endif endif enddo *----------------------- PROCEDURE scroll_screen *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *----------------------- PARAMETERS ScreenType PRIVATE dummy set color to (mColor) set cursor on @ xrow,00 SAY "" && position cursor && at current row. do while .t. mInkey = Inkey(0) do case case mInkey = 5 && Up arrow if xrow > 8 xrow = xrow - 1 xindex = xindex - 1 @ xrow, 00 SAY "" else if xindex > 1 dummy = SCROLL(8,00,20,79,-1) xindex = xindex - 1 @ xrow, 00 SAY mTable[xindex] @ xrow, 00 SAY "" endif endif case mInkey = 24 && Down Arrow if xrow < 20 .and. xindex < (tb_size - 1) xrow = xrow + 1 xindex = xindex + 1 @ xrow, 00 SAY "" else if xindex < (tb_size - 1) dummy = SCROLL(8,00,20,79,1) xindex = xindex + 1 @ xrow, 00 SAY mTable[xindex] @ xrow, 00 SAY "" endif endif case mInkey = 27 && ESC pressed EXIT case mInkey = 13 && ENTER pressed if ScreenType <> "em_browse" EXIT endif endcase enddo set color to (mBlack) PROCEDURE add_rows *---------------------------------------------------------------* * Called from: MAINLINE * * Initialize &&09.24.2000 * * fm_new &&09.24.2000 * * * * Parameters: None * * * * Modules called: MOVE_BOTTOM * * GET_ROW * * FMT_DATE * * FMT_CK_NUM * * FMT_WITHDRAWAL * * FMT_DEPOSIT * * FMT_BALANCE * * QUIT_ADD * * paint_top_row * *---------------------------------------------------------------* PRIVATE i, tRow, dummy do paint_message WITH "add" do move_bottom do while .t. do get_row if mInkey = 27 .or. mInkey = -2 && ESC or F3 pressed do quit_add EXIT else mChanged = .t. do fmt_date do fmt_ck_num do fmt_WITHDRAWAL do fmt_deposit do fmt_balance tRow = "" for i = 1 to 80 tRow = tRow + row_tb[i] next mTable[tb_size] = tRow if xrow < 20 @ xrow, 00 SAY tRow xrow = xrow + 1 @ xrow ,00 SAY REPLICATE(" ",80) @ xrow + 1,00 SAY REPLICATE("Í",80) else dummy = SCROLL(8,00,19,79,1) @ 19,00 SAY tRow endif tb_size = tb_size + 1 num_records = num_records + 1 && ** 06.10.1999 Y2K ** do paint_top_row with " " && ** 06.10.1999 Y2K ** endif enddo PROCEDURE move_bottom *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* set color to (mColor) if tb_size > 12 do move_full_screen else do move_half_screen endif PROCEDURE move_full_screen *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE row index = tb_size - 12 row = 8 do while index < tb_size @ row, 00 SAY mTable[index] row = row + 1 index = index + 1 enddo xrow = 20 xindex = tb_size - 1 return PROCEDURE move_half_screen *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* xrow = xrow + 1 @ xrow + 1,00 SAY REPLICATE("Í",80) return PROCEDURE quit_add *---------------------------------------------------------------* * This is called when is pressed. If the screen is not * * full, then the input line is erased, and the double bar is * * moved up one line. Also, the "add" message is erased. * *---------------------------------------------------------------* if xrow < 20 set color to (mBlack) @ xrow + 1,00 SAY REPLICATE(" ",80) set color to (mColor) @ xrow ,00 SAY REPLICATE("Í",80) endif do paint_message WITH "erase" PROCEDURE get_row *---------------------------------------------------------------* * Called from: ADD_ROWS * * * * Parameters: None * * * * Modules called: INIT_ROW_TB * * GET_DATE * * GET_CK_NUM * * GET_DESC * * GET_WITHDRAWAL * * GET_DEPOSIT * * EDIT_ROW * * DISPLAY_ERR * * ERASE_ERR * * * * This procedure is called when the user presses the "ADD" * * key (F5). The logic allows user to enter 1 account * * transaction, and physically displays the data to the screen. * * The following procedures are called from GET_ROW: * *---------------------------------------------------------------* do init_row_tb xcol = 0 set color to (mYellow) @ xrow, xcol SAY blank_row set cursor on @ xrow, xcol SAY "" mInkey = 0 do while .t. do case * .06.09.1999 Y2K case xcol < 11 case xcol < 13 && 12 or less do get_date * .06.09.1999 Y2K case xcol > 10 .and. xcol < 17 case xcol > 12 .and. xcol < 18 do get_ck_num * .06.09.1999 Y2K case xcol > 16 .and. xcol < 48 case xcol > 17 .and. xcol < 49 do get_desc * .06.09.1999 Y2K case xcol > 47 .and. xcol < 59 case xcol > 48 .and. xcol < 60 do get_WITHDRAWAL * .06.09.1999 Y2K case xcol > 58 case xcol > 59 do get_deposit endcase if mInkey = 27 .or. mInkey = -2 && ESC or F3 pressed EXIT else if mInkey = 13 && RETURN pressed do edit_row if Err_found do Display_err else do Erase_err EXIT endif endif endif enddo set color to (mColor) PROCEDURE init_row_tb *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i for i = 1 to 80 row_tb[i] = " " next PROCEDURE get_date *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow if xcol > 0 xcol = xcol - 1 endif case mInkey = 4 && Right Arrow xcol = xcol + 1 case mInkey = 9 && TAB Right * 06.09.1999 Y2K xcol = 11 xcol = 13 case mInkey = 271 && TAB Left xcol = 0 otherwise if VALID(mInkey) do case case xcol = 0 .or. xcol = 3 .or. xcol = 6 .or.; xcol = 7 .or. xcol = 8 && 06.09.1999 Y2K add @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) xcol = xcol + 1 case xcol = 1 .or. xcol = 4 row_tb[xcol + 1] = CHR(mInkey) @ xrow,xcol SAY CHR(mInkey) xcol = xcol + 2 case xcol = 9 row_tb[xcol+ 1] = CHR(mInkey) @ xrow,xcol SAY CHR(mInkey) * 06.09.1999 Y2K xcol = 11 xcol = 13 otherwise endcase endif endcase @ xrow,xcol SAY "" * 06.09.1999 Y2K if xcol > 10 if xcol > 12 EXIT endif enddo PROCEDURE get_ck_num *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow xcol = xcol - 1 case mInkey = 4 && Right Arrow xcol = xcol + 1 case mInkey = 9 && TAB Right * 06.09.1999 Y2K xcol = 17 xcol = 18 case mInkey = 271 && TAB Left *@ 1,1 SAY "TAB Left=" mInkey *mInkey = Inkey(0) * 06.09.1999 Y2K if xcol > 11 * 06.09.1999 Y2K xcol = 11 * 06.09.1999 Y2K else * 06.09.1999 Y2K xcol = 0 * 06.09.1999 Y2K endif if xcol > 13 xcol = 13 else xcol = 0 endif otherwise if VALID(mInkey) do case * 06.09.1999 Y2K case xcol > 10 .and. xcol < 14 case xcol > 12 .and. xcol < 16 @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) xcol = xcol + 1 * 06.09.1999 Y2K case xcol = 14 case xcol = 16 row_tb[xcol + 1] = CHR(mInkey) @ xrow,xcol SAY CHR(mInkey) * 06.09.1999 Y2K xcol = 17 xcol = 18 otherwise endcase endif endcase @ xrow,xcol SAY "" * 06.09.1999 Y2K if xcol > 16 .or. xcol < 11 if xcol > 17 .or. xcol < 13 EXIT endif enddo PROCEDURE get_desc *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow xcol = xcol - 1 case mInkey = 4 && Right Arrow xcol = xcol + 1 case mInkey = 9 && TAB Right * 06.09.1999 Y2K xcol = 48 xcol = 49 case mInkey = 271 && TAB Left * 06.09.1999 Y2K if xcol > 17 * 06.09.1999 Y2K xcol = 17 * 06.09.1999 Y2K else * 06.09.1999 Y2K xcol = 11 * 06.09.1999 Y2K endif if xcol > 18 xcol = 18 else xcol = 13 endif otherwise if VALID(mInkey) do case * 06.09.1999 Y2K case xcol > 16 .and. xcol < 46 case xcol > 17 .and. xcol < 47 @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) xcol = xcol + 1 * 06.09.1999 Y2K case xcol = 46 case xcol = 47 row_tb[xcol + 1] = CHR(mInkey) @ xrow,xcol SAY CHR(mInkey) xcol = 49 otherwise endcase endif endcase @ xrow,xcol SAY "" * 06.09.1999 Y2K if xcol > 47 .or. xcol < 17 if xcol > 48 .or. xcol < 18 EXIT endif enddo PROCEDURE get_WITHDRAWAL *---------------------------------------------------------------* * Called from: get_row * * * * Parameters: (none) * * * * Procedures called: (none) * * * * Functions called: SQUEEZE() * * * * This procedure... * * * * CAPTAIN'S LOG * * --------- --- * * 12.29.2006 - Fix problem when TAB Left * * crashes the program during ADD, CHANGE. * * Variable "col" changed to "xcol". * *---------------------------------------------------------------* do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow xcol = xcol - 1 case mInkey = 4 && Right Arrow xcol = xcol + 1 case mInkey = 9 && TAB Right * 06.09.1999 Y2K xcol = 59 xcol = 60 case mInkey = 271 && TAB Left * 06.09.1999 Y2K if xcol > 48 * 06.09.1999 Y2K xcol = 48 * 06.09.1999 Y2K else * 06.09.1999 Y2K xcol = 17 * 06.09.1999 Y2K endif * if col > 49 if xcol > 49 && v 3.4 12.29.2006 - variable "col" changed to "xcol" xcol = 49 else xcol = 18 endif case mInkey = 46 && Decimal Point * 06.09.1999 Y2K xcol = SQUEEZE(48,53) xcol = SQUEEZE(49,54) otherwise if VALID(mInkey) do case * 06.09.1999 Y2K case (xcol > 47 .and. xcol < 53) .or. xcol = 55 case (xcol > 48 .and. xcol < 54) .or. xcol = 56 @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) xcol = xcol + 1 * 06.09.1999 Y2K case xcol = 53 case xcol = 54 @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) * 06.09.1999 Y2K xcol = 55 xcol = 56 * 06.09.1999 Y2K case xcol = 56 case xcol = 57 row_tb[xcol + 1] = CHR(mInkey) @ xrow,xcol SAY CHR(mInkey) * 06.09.1999 Y2K xcol = 59 xcol = 60 otherwise endcase endif endcase @ xrow,xcol SAY "" * 06.09.1999 Y2K if xcol > 57 .or. xcol < 48 if xcol > 58 .or. xcol < 49 EXIT endif enddo PROCEDURE get_deposit *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow xcol = xcol - 1 case mInkey = 4 && Right Arrow if xcol = 79 xcol = 0 else xcol = xcol + 1 endif case mInkey = 9 && TAB Right xcol = 0 case mInkey = 271 && TAB Left * 06.09.1999 Y2K if xcol > 59 * 06.09.1999 Y2K xcol = 59 * 06.09.1999 Y2K else * 06.09.1999 Y2K xcol = 48 * 06.09.1999 Y2K endif if xcol > 60 xcol = 60 else xcol = 49 endif case mInkey = 46 && Decimal Point Key * 06.09.1999 Y2K xcol = SQUEEZE(59,64) xcol = SQUEEZE(60,65) otherwise if VALID(mInkey) do case * 06.09.1999 Y2K case (xcol > 58 .and. xcol < 64) .or. xcol = 66 case (xcol > 59 .and. xcol < 65) .or. xcol = 67 @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) xcol = xcol + 1 * 06.09.1999 Y2K case xcol = 64 case xcol = 65 @ xrow,xcol SAY CHR(mInkey) row_tb[xcol + 1] = CHR(mInkey) * 06.09.1999 Y2K xcol = 66 xcol = 67 * 06.09.1999 Y2K case xcol = 67 case xcol = 68 row_tb[xcol + 1] = CHR(mInkey) @ xrow,xcol SAY CHR(mInkey) xcol = 0 otherwise endcase endif endcase @ xrow,xcol SAY "" * 06.09.1999 Y2K if xcol < 59 if xcol < 60 EXIT endif enddo PROCEDURE show_array *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i for i = 0 to 79 @ 2, i SAY row_tb[i + 1] next PROCEDURE display_err *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* @ 22,00 SAY REPLICATE(" ",80) @ 22,25 SAY Err_Msg xcol = Err_pos @ xrow, xcol SAY "" PROCEDURE erase_err *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* set color to (mBlack) @ 22,11 SAY REPLICATE(" ",70) set color to (mColor) PROCEDURE edit_row *---------------------------------------------------------------* * Called from: GET_ROW * * * * Parameters: None * * * * Modules called: EDIT_DATE * * EDIT_CK_NUM * * EDIT_WITHDRAWAL * * EDIT_DEPOSIT * *---------------------------------------------------------------* Err_found = .f. do edit_date if !Err_found do edit_ck_num if !Err_found do edit_WITHDRAWAL if !Err_found do edit_deposit endif endif endif PROCEDURE edit_date *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, sDate, sMonth, sDay, sYear, sNum,; nMonth, nDay, nYear sDate = "" * 06.09.1999 Y2K for i = 1 to 8 for i = 1 to 10 if row_tb[i] = " " sDate = sDate + "0" else sDate = sDate + row_tb[i] endif next sMonth = SUBSTR(sDate,1,2) sDay = SUBSTR(sDate,4,2) * 06.09.1999 Y2K sYear = SUBSTR(sDate,7,2) sYear = SUBSTR(sDate,7,4) set decimals to 0 if NUMERIC(sMonth) .and. NUMERIC(sDay) .and. NUMERIC(sYear) nMonth = VAL(sMonth) if nMonth = 00 .or. nMonth > 12 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 else nDay = VAL(sDay) if (nMonth = 01 .or. nMonth = 03 .or. nMonth = 05 .or.; nMonth = 07 .or. nMonth = 08 .or. nMonth = 10 .or.; nMonth = 12) .and. nDay > 31 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 else if (nMonth = 04 .or. nMonth = 06 .or.; nMonth = 09 .or. nMonth = 11) .and.; nDay > 30 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 else nYear = VAL(sYear) if (nYear = 1994 .or. nYear = 1996 .or.; nYear = 2000 .or. nYear = 2004) && (or I'm Dead) if (nMonth = 02) .and. (nDay > 29) Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 endif else if nDay > 28 .and. nMonth = 02 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 endif endif endif endif endif else Err_Msg = "DATE MUST BE NUMERIC" Err_found = .t. Err_Pos = 0 endif PROCEDURE edit_ck_num *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, sCk_num; sCk_Num = "" * 06.09.1999 Y2K for i = 12 to 15 for i = 14 to 17 if row_tb[i] = " " sCk_num = sCk_Num + "0" else sCk_Num = sCk_Num + row_tb[i] endif next if !NUMERIC(sCk_Num) Err_Msg = "CHECK NUMBER MUST BE NUMERIC" Err_found = .t. * 06.09.1999 Y2K Err_Pos = 11 Err_Pos = 13 endif PROCEDURE edit_WITHDRAWAL *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, sWITHDRAWAL sWITHDRAWAL = "" * 06.09.1999 Y2K for i = 49 to 58 for i = 50 to 59 if row_tb[i] = " " .or. row_tb[i] = "." sWITHDRAWAL = sWITHDRAWAL + "0" else sWithdrwl = sWITHDRAWAL + row_tb[i] endif next if !NUMERIC(sWITHDRAWAL) Err_Msg = "AMOUNT WITHDRAWAL MUST BE NUMERIC" Err_found = .t. * 06.09.1999 Y2K Err_Pos = 47 Err_Pos = 48 else * 06.09.1999 Y2K if ENTERED(48,56) .and. ENTERED(59,66) if ENTERED(49,57) .and. ENTERED(60,67) Err_Msg = "MUST ENTER EITHER WITHDRAWAL OR DEPOSIT" Err_found = .t. * 06.09.1999 Y2K Err_Pos = 47 Err_Pos = 48 endif endif PROCEDURE edit_deposit *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, sDeposit sDeposit = "" * 06.09.1999 Y2K for i = 60 to 67 for i = 61 to 68 if row_tb[i] = " " .or. row_tb[i] = "." sDeposit = sDeposit + "0" else sDeposit = sDeposit + row_tb[i] endif next if !NUMERIC(sDeposit) Err_Msg = "AMOUNT DEPOSIT MUST BE NUMERIC" Err_found = .t. * 06.09.1999 Y2K Err_Pos = 59 Err_Pos = 60 endif PROCEDURE fmt_date *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i * 06.09.1999 Y2K for i = 1 to 8 for i = 1 to 10 do case * 06.09.1999 Y2K i = 7 .or. i = 8 case i = 1 .or. i = 2 .or. i = 4 .or. i = 5 .or.; i = 7 .or. i = 8 .or. i = 9 .or. i = 10 if row_tb[i] = " " row_tb[i] = "0" endif case i = 3 .or. i = 6 row_tb[i] = "/" otherwise endcase next PROCEDURE fmt_ck_num *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, j, sCh_num sCk_Num = "" * 06.09.1999 Y2K for i = 12 to 15 for i = 14 to 17 sCk_Num = sCk_Num + row_tb[i] next set decimals to 0 if VAL(sCk_Num) = 0 sCk_Num = " " else sCk_Num = STR(VAL(sCk_Num)) sCh_Num = SUBSTR(sCk_Num,7,4) && ?? endif j = 1 * 06.09.1999 Y2K for i = 12 to 15 for i = 14 to 17 row_tb[i] = SUBSTR(sCk_Num,j,1) j = j + 1 next PROCEDURE fmt_WITHDRAWAL *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, j, sWITHDRAWAL, nWITHDRAWAL sWITHDRAWAL = "" * 06.09.1999 Y2K for i = 49 to 57 for i = 50 to 58 * 06.09.1999 Y2K if i = 55 if i = 56 sWITHDRAWAL = sWITHDRAWAL + "." else sWITHDRAWAL = sWITHDRAWAL + row_tb[i] endif next set decimals to 2 nWITHDRAWAL = VAL(sWITHDRAWAL) if nWITHDRAWAL = 0.00 sWITHDRAWAL = REPLICATE(" ",9) else sWITHDRAWAL = xcom(nWITHDRAWAL,9) if row_tb[10] <> CHR(251) && Check if marked "PAID" Curr_Balance = Curr_Balance - nWITHDRAWAL endif endif j = 1 * 06.09.1999 Y2K for i = 49 to 57 for i = 50 to 58 row_tb[i] = SUBSTR(sWITHDRAWAL,j,1) j = j + 1 next PROCEDURE fmt_deposit *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, j, sDeposit, nDeposit sDeposit = "" * 06.09.1999 Y2K for i = 60 to 68 for i = 61 to 69 * 06.09.1999 Y2K if i = 66 if i = 67 sDeposit = sDeposit + "." else sDeposit = sDeposit + row_tb[i] endif next set decimals to 2 nDeposit = VAL(sDeposit) if nDeposit = 0.00 sDeposit = REPLICATE(" ",9) else sDeposit = xcom(nDeposit,9) if row_tb[10] <> CHR(251) && if transaction is Curr_Balance = Curr_Balance + nDeposit && marked "PAID", don't endif && calculate new balance. endif j = 1 * 06.09.1999 Y2K for i = 60 to 68 for i = 61 to 69 row_tb[i] = SUBSTR(sDeposit,j,1) j = j + 1 next PROCEDURE fmt_balance *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, j, sBalance * 06.09.1999 Y2K if row_tb[10] <> CHR(251) if row_tb[12] <> CHR(251) && Check if marked "PAID" sBalance = xcom(Curr_Balance,10) else * 06.09.1999 Y2K sBalance = SUBSTR(mTable[xindex],70,10) sBalance = SUBSTR(mTable[xindex],71,10) endif j = 1 * 06.09.1999 Y2K for i = 70 to 79 for i = 71 to 80 row_tb[i] = SUBSTR(sBalance,j,1) j = j + 1 next set color to (mColor) @ 3, 66 SAY sBalance *----------------------UPDATE ROW---------------------------* PROCEDURE update_row *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i, tRow do highlight_row paid = .t. * 06.09.1999 Y2K if SUBSTR(mTable[xIndex],10,1) = " " if SUBSTR(mTable[xIndex],12,1) = " " && check if marked paid paid = .f. endif mInkey = 0 xcol = 0 do while .t. do case * .06.09.1999 Y2K case xcol < 11 case xcol < 13 && 12 or less do get_date * .06.09.1999 Y2K case xcol > 10 .and. xcol < 17 case xcol > 12 .and. xcol < 18 do get_ck_num * .06.09.1999 Y2K case xcol > 16 .and. xcol < 48 case xcol > 17 .and. xcol < 49 do get_desc * .06.09.1999 Y2K case xcol > 47 .and. xcol < 59 case xcol > 48 .and. xcol < 60 do get_WITHDRAWAL * .06.09.1999 Y2K case xcol > 58 case xcol > 59 do get_deposit endcase if mInkey = 27 && ESC pressed EXIT else if mInkey = 13 && RETURN pressed do edit_row if Err_found do Display_err else do Erase_err EXIT endif endif endif enddo set color to (mColor) if mInkey <> 27 .and. mInkey <> -2 && ESC and F3 not pressed mChanged = .t. do fmt_date do fmt_ck_num do fmt_WITHDRAWAL do fmt_deposit if ! paid do fmt_balance endif tRow = "" for i = 1 to 80 tRow = tRow + row_tb[i] next mTable[xindex] = tRow endif @ xrow, 00 SAY mTable[xindex] @ xrow, 00 SAY "" PROCEDURE highlight_row *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PRIVATE i for i = 1 to 80 row_tb[i] = SUBSTR(mTable[xindex],i,1) next set color to (mYellow) @ xrow, 00 SAY mTable[xindex] set cursor on @ xrow, 00 SAY "" PROCEDURE update_file *--------------------------------------------------------------------* * Called from: FILE_MENU * * * * Parameters: None * * * * Procedures called: add_balance_rec * * * * * * Functions called: None * * * *--------------------------------------------------------------------* PRIVATE i, size, sRow ZAP if .not. this_is_sortfile && Don't add balance record do add_balance_rec && to sort file! endif *@ 5,6 say "tb_size=" *@ 5,16 say tb_size size = tb_size - 1 for i = 1 to size sRow = mTable[i] APPEND BLANK * .06.09.1999 Y2K REPLACE AC_DATE with CTOD(SUBSTR(sRow,1,8)) REPLACE AC_DATE with CTOD(SUBSTR(sRow,1,10)) * .06.09.1999 Y2K REPLACE AC_CK_NUM with VAL(SUBSTR(sRow,12,4)) REPLACE AC_CK_NUM with VAL(SUBSTR(sRow,14,4)) * .06.09.1999 Y2K REPLACE AC_DESC with SUBSTR(sRow,18,30) REPLACE AC_DESC with SUBSTR(sRow,19,30) * .06.09.1999 Y2K if SUBSTR(sRow,10,1) = " " if SUBSTR(sRow,12,1) = " " REPLACE AC_PAID with .f. else REPLACE AC_PAID with .t. endif * .06.09.1999 Y2K REPLACE AC_WTH_AMT with un_comma(49,57,i) * .06.09.1999 Y2K REPLACE AC_DEP_AMT with un_comma(60,68,i) * .06.09.1999 Y2K REPLACE AC_BALANCE with un_comma(70,79,i) REPLACE AC_WTH_AMT with un_comma(50,58,i) REPLACE AC_DEP_AMT with un_comma(61,69,i) REPLACE AC_BALANCE with un_comma(71,80,i) next COMMIT PROCEDURE add_balance_rec *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* APPEND BLANK REPLACE AC_DATE with CTOD(Bk_Date_Str) REPLACE AC_BALANCE with Bk_Bal_Num PROCEDURE quit_program *---------------------------------------------------------------* * Called from: MAINLINE * * * * Parameters: none * * * * Modules called: SAVE_CHANGES() * * FM_SAVE * *---------------------------------------------------------------* if mChanged if save_changes() do fm_save endif endif set color to (mBlack) @ 22,00 SAY REPLICATE(" ",80) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) do while .t. @ 24,00 SAY "Quit Financial Manager? (y/n)" mInkey = Inkey(0) if mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed EXIT else if mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed EXIT endif endif enddo close databases PROCEDURE paint_message PARAMETERS screen_type *---------------------------------------------------------------* * Called from: ADD_ROW * * sa_screen * * * * Parameter values: "add" * * "erase" * * "mmenu" (main menu) * * "fmenu" (file menu) * * "emenu" (edit menu) * * "fm_retrieve" (retrieve file) * * "fm_save" (save file) * * "em_browse" (browse) * * "em_change" (change) * * "em_mark" (mark paid) * * "new_dir" (new directory) * * "mm_balance" (calc. balance) * * "sa_sort" (sort screen) * * "SEARCH_MENU" (search account) * * "SEARCH_RESULTS" * * "account_summary" * * "Import_menu" * *---------------------------------------------------------------* set color to (mBlack) @ 22,00 SAY REPLICATE(" ",80) && --* Erases menu bar at bottom of screen *-- set color to (mCyan) do case case screen_type = "add" @ 22,00 SAY "ADD" set color to (mBlack) @ 24,00 SAY "Enter new transaction. (ESC for menu)" case screen_type = "erase" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) set color to (mColor) case screen_type = "mmenu" @ 22,00 SAY "MAIN MENU" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "fmenu" @ 22,00 SAY "FILE MENU" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "emenu" @ 22,00 SAY "EDIT MENU" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "fm_retrieve" @ 22,00 SAY "RETRIEVE FILE" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "fm_save" @ 22,00 SAY "SAVE" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "new_dir" @ 22,00 SAY "DIRECTORY" set color to (mBlack) @ 24,00 SAY REPLICATE(" ",80) * @ 24,00 SAY "Enter new path of file." && 02.19.2008 v 4.0 @ 24,00 SAY "Enter new directory." && 02.19.2008 v 4.0 case screen_type = "em_browse" @ 22,00 SAY "BROWSE" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) @ 24,00 SAY "Use " + CHR(24) + CHR(25) + " to scroll. (ESC for menu)" case screen_type = "em_change" @ 22,00 SAY "CHANGE" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) @ 24,00 SAY "Use " + CHR(24) + CHR(25) + " to scroll. (ENTER to change, ESC for menu)" case screen_type = "em_mark" @ 22,00 SAY "MARK PAID" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) @ 24,00 SAY "Use " + CHR(24) + CHR(25) + " to scroll. (ENTER to mark and unmark, ESC for menu)" case screen_type = "mm_balance" @ 22,00 SAY "BALANCE" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "sa_sort" @ 22,00 SAY "SORT" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) case screen_type = "SEARCH_MENU" set color to (mdarkgreen) @ 22,00 SAY "SEARCH MENU" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY "The ENTER key accepts input and moves to next entry." CASE SCREEN_TYPE = "SEARCH_RESULTS" set color to (mDARKGREEN) @ 22,00 SAY "SEARCH RESULTS" set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) CASE SCREEN_TYPE = "account_summary" @ 22,00 SAY "Accounts Summary" set color to (mBlack) @ 22,44 say replicate(" ",36) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) CASE SCREEN_TYPE = "Import_menu" && v 3.0 set color to (mGreenTop) @ 22,00 SAY "IMPORT" set color to (mBlack) @ 22,44 say replicate(" ",36) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) endcase ****************** * FUNCTIONS * ****************** FUNCTION main_menu *---------------------------------------------------------------* * Called from: mainline * * * * Parameters: none * * * * Modules called: none * * * * This function draws a bonce bar menu to the bottom of the * * screen, and returns the numeric value of the option chosen. * *---------------------------------------------------------------* PRIVATE mm_position do paint_message with "mmenu" set color to (mBlack) @ 23,00 SAY "File Add Edit Balance Print Search Sort Summary Quit" set color to (mBright) @ 23,00 SAY "F" @ 23,07 SAY "A" @ 23,13 SAY "E" @ 23,20 SAY "B" @ 23,30 SAY "P" @ 23,38 SAY "S" &&10.25.2000 @ 23,48 SAY "o" @ 23,55 SAY "u" &&04.13.2001 @ 23,64 SAY "Q" mm_position = 1 do mm_bar WITH "draw", mm_position do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow do mm_bar WITH "erase", mm_position mm_position = mm_left(mm_position) do mm_bar WITH "draw", mm_position case mInkey = 4 && Right Arrow do mm_bar WITH "erase", mm_position mm_position = mm_right(mm_position) do mm_bar WITH "draw", mm_position case mInkey = 70 .or. mInkey = 102 && "F" or "f" && Right Arrow mm_position = 1 EXIT case mInkey = 65 .or. mInkey = 97 && "A" or "a" && Right Arrow mm_position = 2 EXIT case mInkey = 69 .or. mInkey = 101 && "E" or "e" && Right Arrow mm_position = 3 EXIT case mInkey = 66 .or. mInkey = 98 && "B" or "b" && Right Arrow mm_position = 4 EXIT case mInkey = 80 .or. mInkey = 112 && "P" or "p" && Right Arrow mm_position = 5 EXIT case mInkey = 83 .or. mInkey = 115 && "S" or "s" && Right Arrow mm_position = 6 EXIT case mInkey = 79 .or. mInkey = 111 && "O" or "o" && Right Arrow mm_position = 7 EXIT case mInkey = 85 .or. mInkey = 117 && "U" or "u" && Right Arrow mm_position = 8 EXIT case mInkey = 81 .or. mInkey = 113 && "Q" or "q" && Right Arrow mm_position = 9 EXIT otherwise endcase enddo set color to (mBlack) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) set color to (mColor) return mm_position *--------------------- PROCEDURE mm_bar *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* * 07/26/02 - v 3.0 revisions * *---------------------------------------------------------------* PARAMETERS type, position if type = "draw" set color to (mCyan) else set color to (mBlack) endif do case case position = 1 @ 23,00 SAY "File" set color to (mBlack) if type = "draw" * @ 24,00 SAY "Retrieve Save Directory Copy Delete" * @ 24,00 SAY "New Retrieve Save Directory Copy Delete" &&09.25.2000 @ 24,00 SAY "New Retrieve Save Import Directory Copy Delete" && v 3.0 set color to (mCyan) @ 23,00 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,00 SAY "F" endif case position = 2 @ 23,07 SAY "Add" set color to (mBlack) if type = "draw" @ 24,00 SAY "Add new transaction to account." set color to (mCyan) @ 23,07 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,07 SAY "A" endif case position = 3 @ 23,13 SAY "Edit" set color to (mBlack) if type = "draw" @ 24,00 SAY "Browse Change Delete Mark paid" set color to (mCyan) @ 23,13 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,13 SAY "E" endif case position = 4 @ 23,20 SAY "Balance" set color to (mBlack) if type = "draw" @ 24,00 SAY "Enter new balance and date." set color to (mCyan) @ 23,20 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,20 SAY "B" endif case position = 5 @ 23,30 SAY "Print" set color to (mBlack) if type = "draw" @ 24,00 SAY "List file to screen or printer." set color to (mCyan) @ 23,30 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,30 SAY "P" endif case position = 6 @ 23,38 SAY "Search" set color to (mBlack) if type = "draw" @ 24,00 SAY "List or print transactions using selection criteria." set color to (mCyan) @ 23,38 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,38 SAY "S" endif case position = 7 @ 23,47 SAY "Sort" set color to (mBlack) if type = "draw" @ 24,00 SAY "Sort current file by date and check number." set color to (mCyan) * @ 23,46 SAY "" @ 23,47 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,48 SAY "o" endif case position = 8 && 04.13.2001 @ 23,54 SAY "Summary" set color to (mBlack) if type = "draw" @ 24,00 SAY "View summary of all accounts in folder." set color to (mCyan) @ 23,54 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,55 SAY "u" endif case position = 9 @ 23,64 SAY "Quit" set color to (mBlack) if type = "draw" @ 24,00 SAY "End session." set color to (mCyan) @ 23,64 SAY "" else @ 24,00 SAY REPLICATE(" ",80) set color to (mBright) @ 23,64 SAY "Q" endif endcase *--------------------- FUNCTION mm_left *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *--------------------- PARAMETERS position PRIVATE new_position if position = 1 new_position = 9 && 04.13.2001 else new_position = position - 1 endif return new_position *--------------------- FUNCTION mm_right *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *--------------------- PARAMETERS position PRIVATE new_position if position = 9 new_position = 1 else new_position = position + 1 endif return new_position FUNCTION GETDATE *---------------------------------------------------------------* * Called from: BALANCE_ACCT * * * * Parameters: DateRow,DateCol,DateVal,GetScreen * * * * Modules called: none * * * * Functions called: ISDATE * * SWITCH * * * * This function acts like the Clipper GET command, and returns * * the date value input at DateCol,DateRow. * *---------------------------------------------------------------* PARAMETER DateRow,DateCol,DateVal,GetScreen PRIVATE tCol,tRow,DateString if GetScreen = "Search" * set color to (msearchBlankLine) set color to (msearchGet) else set color to (mYellow) endif tCol = DateCol tRow = DateRow DateString = DTOC(DateVal) @ tRow,tCol SAY DateString @ tRow,tCol SAY "" do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN if ! ISDATE(DateString) do Display_err else do Erase_err FOUND=.T. EXIT endif case mInkey = 19 && Left Arrow if tCol > 0 tCol = tCol - 1 endif case mInkey = 4 && Right Arrow tCol = tCol + 1 otherwise if VALID(mInkey) do case case tCol = DateCol .or.; tCol = DateCol + 3 .or.; tCol = DateCol + 6 .or.; tCol = DateCol + 7 .or.; && ** 04.10.2000 Y2K added tCol = DateCol + 8 && ** checks for DateCol+7 and 8 DateString = SWITCH(DateString,tCol + 1 - DateCol,CHR(mInkey)) tCol = tCol + 1 case tCol = DateCol + 1 .or.; tCol = DateCol + 4 DateString = SWITCH(DateString,tCol + 1 - DateCol,CHR(mInkey)) tCol = tCol + 2 * 06.09.1999 Y2K case tCol = DateCol + 7 case tCol = DateCol + 9 DateString = SWITCH(DateString,tCol + 1 - DateCol,CHR(mInkey)) if ! ISDATE(DateString) do Display_err else do Erase_err EXIT endif endcase endif endcase @ DateRow,DateCol SAY DateString @ tRow,tCol SAY "" enddo return CtoD(DateString) FUNCTION SWITCH *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETERS sString,position,sChar PRIVATE size size = LEN(sString) return SUBSTR(sString,1,position - 1) + sChar + ; SUBSTR(sString,position + 1,size - position) FUNCTION FILLDATE *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETER fString PRIVATE i * 06.09.1999 Y2K for i = 1 to 8 for i = 1 to 10 do case case i = 1 .or. i = 2 .or. i = 4 .or. i = 5 .or.; i = 7 .or. i = 8 .or. i = 9 .or. i = 10 * 06.09.1999 Y2K i = 7 .or. i = 8 if SUBSTR(fString,i,1) = " " fString = SWITCH(fString,i,"0") endif case i = 3 .or. i = 6 fString = SWITCH(fString,i,"/") endcase next RETURN fString FUNCTION IsDate *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETER sDate PRIVATE i, sMonth, sDay, sYear, sNum,; nMonth, nDay, nYear, ErrFound sDate = FILLDATE(sDate) sMonth = SUBSTR(sDate,1,2) sDay = SUBSTR(sDate,4,2) * 06.09.1999 Y2K sYear = SUBSTR(sDate,7,2) sYear = SUBSTR(sDate,7,4) set decimals to 0 Err_Found = .f. if NUMERIC(sMonth) .and. NUMERIC(sDay) .and. NUMERIC(sYear) nMonth = VAL(sMonth) if nMonth = 00 .or. nMonth > 12 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 else nDay = VAL(sDay) if (nMonth = 01 .or. nMonth = 03 .or. nMonth = 05 .or.; nMonth = 07 .or. nMonth = 08 .or. nMonth = 10 .or.; nMonth = 12) .and. nDay > 31 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 else if (nMonth = 04 .or. nMonth = 06 .or.; nMonth = 09 .or. nMonth = 11) .and.; nDay > 30 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 else nYear = VAL(sYear) * 06.09.1999 Y2K if (nYear = 92 .or. nYear = 96) if (nYear = 1992 .or. nYear = 1996 .or.; nYear = 2000 .or. nYear = 2004) if (nMonth = 02) .and. (nDay > 29) Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 endif else if nDay > 28 .and. nMonth = 02 Err_Msg = "INVALID DATE" Err_found = .t. Err_Pos = 0 endif endif endif endif endif else Err_Msg = "DATE MUST BE NUMERIC" Err_found = .t. Err_Pos = 0 endif if Err_Found = .f. RETURN .t. else RETURN .f. endif FUNCTION GETDOLLARS *---------------------------------------------------------------* * Called from: BALANCE_ACCT * * * * Parameters: InCol,InRow,Amount,size * * * * Modules called: none * * * * This function acts like the Clipper GET command, and returns * * the dollar value input at InCol,InRow. * *---------------------------------------------------------------* PARAMETERS InRow,InCol,Amount,size PRIVATE tCol,tRow,DolString,firstkey set color to (mYellow) firstkey = .t. DolString = STR(Amount,size,2) tCol = InCol tRow = InRow @ tRow,tCol SAY DolString @ tRow,tCol SAY "" do while .t. mInkey = Inkey(0) do case case mInkey = 27 && ESC EXIT case mInkey = 13 && RETURN EXIT case mInkey = 19 && Left Arrow if tcol > InCol tcol = tcol - 1 endif case mInkey = 4 && Right Arrow if tcol < (InCol + size) tcol = tcol + 1 endif case mInkey = 46 && Decimal Point Key DolString = SMASH(DolString) tCol = InCol + size - 2 otherwise if VALID(mInkey) if firstkey DolString = CHR(mInkey) +; REPLICATE(" ",size - 4) + ". " tCol = tCol + 1 firstkey = .f. else DolString = SWITCH(DolString,tCol + 1 - InCol,CHR(mInkey)) if tCol = InCol + size - 4 && Decimal position tCol = tCol + 2 else if tCol < (InCol + size - 1) && if not last position tCol = tCol + 1 endif endif endif endif endcase @ InRow,InCol SAY DolString @ tRow,tCol SAY "" enddo return VAL( DolString ) FUNCTION SMASH *---------------------------------------------------------------* * Parameters: dString * * * * Modules called: none * * * * This function is called when the decimal point key is * * pressed. SMASH pushes all numbers to the left of the decimal * * position as far right as possible, and fills the cents with * * zeros. * *---------------------------------------------------------------* PARAMETER dString PRIVATE i,j,sNum,mLen,size size = LEN(dString) sNum = SUBSTR(dString,1,size - 3) && cut off decimal and cents sNum = TRIM(sNum) && remove trailing spaces j = (size - 3) - LEN(sNum) sNum = REPLICATE(" ",j) + sNum && fill with leading spaces sNum = sNum + ".00" && add cents return sNum FUNCTION valid *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETER mKey if mKey > 31 .and. mKey < 127 return .t. else return .f. endif FUNCTION SQUEEZE *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETER left,right PRIVATE i,j,sNum,mLen sNum = "" for i = left to right sNum = sNum + row_tb[i + 1] next sNum = TRIM(sNum) j = 6 - LEN(sNum) sNum = REPLICATE(" ",j) + sNum j = 1 for i = left to right row_tb[i + 1] = SUBSTR(sNum,j,1) @ xrow, i SAY row_tb[i + 1] j = j + 1 next j = right + 2 return j FUNCTION NUMERIC *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETER tString PRIVATE i,j i = LEN(tString) j = 1 if i > 0 do while !(j > i) if (ASC(SUBSTR(tString,j,1)) > 47) .and.; (ASC(SUBSTR(tString,j,1)) < 58) j = j + 1 else return .f. endif enddo endif return .t. FUNCTION ENTERED *---------------------------------------------------------------* * Called from: * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* *--------------------------------------------* * CALLED FROM: edit_WITHDRAWAL * *--------------------------------------------* PARAMETER start, finish PRIVATE i, found found = .f. i = start do while !(i > finish) .and. !found found = (ASC(row_tb[i + 1]) > 47) .and.; && Looks for number (ASC(row_tb[i + 1]) < 58) i = i + 1 enddo return found FUNCTION xcom *---------------------------------------------------------------* * Called from: FMT_BALANCE * * * * Parameters: NUMBER (dollar amount) * * LENGTH (desired length of formatted string) * * * * Modules called: none * * * * This function takes a numeric dollar value and inserts a * * comma if the value is greater than 999.99 or less than * * -999.99 * *---------------------------------------------------------------* PARAMETER number, length PRIVATE snumber, size snumber = STR(number,length,2) size = LEN(snumber) do case case size = 13 if number > 999.99 .or. number < -999.99 snumber = SUBSTR(snumber,5,3) + "," + SUBSTR(snumber,8,6) else snumber = SUBSTR(snumber,4,10) endif case size = 10 if number > 999.99 .or. number < -999.99 snumber = SUBSTR(snumber,2,3) + "," + SUBSTR(snumber,5,6) endif case size = 9 if length = 10 if number > 999.99 snumber = SUBSTR(snumber,1,3) + "," + SUBSTR(snumber,4,6) else snumber = " " + snumber endif else if number > 999.99 snumber = SUBSTR(snumber,2,2) + "," + SUBSTR(snumber,4,6) else snumber = SUBSTR(snumber,1,length) endif endif case size = 8 if number > 999.99 snumber = SUBSTR(snumber,1,2) + "," + SUBSTR(snumber,3,6) else snumber = " " + snumber endif otherwise endcase return snumber FUNCTION save_changes *---------------------------------------------------------------* * Called from: MAINLINE * * quit_program * * * * Parameters: None * * * * Procedures called: PAINT_MESSAGE * * * * Functions called: None * * * * This function asks if the changes made should be saved to * * disk. If the reply is "y", then a command is issued * * to type the name of the file to save. * *---------------------------------------------------------------* set color to (mBlack) @ 22,00 SAY REPLICATE(" ",80) @ 23,00 SAY REPLICATE(" ",80) @ 24,00 SAY REPLICATE(" ",80) do while .t. @ 24,00 SAY "Save current account to disk? (y/n)" &&09.24.2000 mInkey = Inkey(0) if mInkey = 89 .or. mInkey = 121 && "Y" or "y" pressed return .t. else if mInkey = 78 .or. mInkey = 110 && "N" or "n" pressed return .f. endif endif enddo FUNCTION un_comma *---------------------------------------------------------------* * Called from: EM_CHANGE * * RECALC_BAL * * B1100_EVALUATE_EXPRESSION * * UPDATE_FILE * * * * Parameters: * * * * Procedures called: (none) * * * * Functions called: (none) * * * * This procedure... * *---------------------------------------------------------------* PARAMETER start, finish, row_num PRIVATE tRow, tString, tChar, i tRow = mTable[row_num] tString = "" for i = start to finish tChar = SUBSTR(tRow,i,1) if tChar <> "," tString = tString + tChar endif next return VAL(tString)