Foxpro for MS Dos

download Foxpro for MS Dos

of 27

Transcript of Foxpro for MS Dos

  • 8/13/2019 Foxpro for MS Dos

    1/27

    Foxpro for MS-DOS - Basic FoxPro 2.6 Commands

    FoxProis SEMI-RDBMS Unlike other RDBMS systems, inFoxProeach database can contain only one table.

    Hence, the single table is called as database in this tutorial

    InFoxPro,first four characters of any command is enough to execute

    For e.g.:- crea ==> create

    1. TO OPEN A DATABASE:

    Syn:

    use

    Ex:

    use book

    2.TO CLOSE THE DATABASE:

    Use

    To close the current opened database.

    Close all

    To close the all opened database.

    3. To CREATE NEW DATABASE:

    Syn:

    crea

    create

    Ex:

    crea book

    http://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxpro
  • 8/13/2019 Foxpro for MS Dos

    2/27

    4. To Modify Structure of the Database:

    Modify structure

    (Or)

    Modi stru

    5. To add new records in database

    Append is used to add the new record.

    Syn:

    append

    [Blank]

    [From ]

    Ex

    Append

    Append Blank

    - To add blank records.

    Append from first.dbf

    - To add the records from FIRST.DBF to SECOND.DBF

    - Same Structure is required for these databases

    6. To display the records in the current database

    Used to display the particular record.

    Syn:

    Display

    [All]

    [Structure]

  • 8/13/2019 Foxpro for MS Dos

    3/27

    [Status]

    [Memory]

    Ex:

    Display

    Display All

    Display All Records in page wise.

    7. To Display the structure of the database:

    Display Structure

    8. To display the status of the set commands:

    Display Status

    9. To display the status of the system memory variables.

    Display Memory

    10. To view the status barSet stat on

    11. To edit records

    EDIT

    - It list all the records one by one for editing.

    Any one of the record can be edited using 'FOR' as below

    EDIT FOR empname = "LEELA"

    EDIT FOR rollno = 103

    12. To delete records

    DELETE

    - To delete current record

    DELETE NEXT 4

    - To delete next 4 records

    After using the delete command the records marked with * (asterisk) mark, i.e., marked for deletion.

    RECALL

  • 8/13/2019 Foxpro for MS Dos

    4/27

    - It is used to recover the deleted records.

    e.g. RECALL

    RECALL NEXT 4

    PACK

    - To delete the records permanently. It is used after the delete command.

    BLANK

    - It can be used to empty the record instead of deleting.

    13. To delete all the records in the current database

    ZAP

    14. Navigation with Records

    GO or GOTO both do the same things inFoxpro.

    GO TOP

    Used to move the record pointer at the first record.

    GO BOTTOM:

    Used to move the record point at the last record.

    Go

    To go to a particular record

    Syn:- GO

    Eg:- GO 8

    Go to record 8

    SKIP

    - To skip number of records

    e.g. To skip 3 records - SKIP 3

    15. To List the records

    LIST - To list the records in screen, not in window

    It can be used with condition as below:

    LIST for val(price) > 100

    http://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxprohttp://www.livetolearn.in/site/programming/foxpro
  • 8/13/2019 Foxpro for MS Dos

    5/27

    LIST itemname, price+20

    - This command lists item name with price rupees 20 added.The changes are applied only to the view, it

    not saved in database.

    LIST product, price*2

    - price is multiplied with 2.

    16. To view the records as manipulatable view

    BROWSE - To browse the records

    BROWSE NOEDIT - To browse the records in read only view, The records can be marked for deletion

    using Ctrl + Tshortcut

    BROWSE NODELETE- To avoid deleting while browsing the records

    17. To display current record number?RECNO()

    18. To display the dbf files in the current directory

    DIR

    19. Hide or Show heading in list view

    SET HEADINGS OFF

    SET HEADINGS ON

    20. Printing

    SET PRINT ON

    - This command sends the out put to printer

    - To stop this use the command SET PRINT OFF

    SET PRINTER TO LPT1

    - To set the output printing port to LPT1

    21. Handling date and date format

    To display current system date

  • 8/13/2019 Foxpro for MS Dos

    6/27

    ?DATE()

    To set century on to display year in 4 digits.

    SET CENTURY ON

    SET CENTURY OFF

    To set date format

    dd/mm/yyyy => SET DATE BRIT

    mm/dd/yyy => SET DATE AMERICA

    yyyy/mm/dd => SET DATE JAPAN

    22. Replace command

    To replace the content of the specified field in the database table. i.e., This command can be used to

    remove the data in the particular field (nullifying / empty a field)

    e.g.

    REPLACE fieldname WITH ""

    - To replace with null value

    REPLACE fieldname WITH { / / }

    - To replace the date field with null value

    REPLACE ALL QUANTITY WITH 0

    - Replaces the data in the quatity fied with 0 in all the records.

    REPLACE ALL PRICE WITH PRICE+50

    - Adds 50 to the price field.

  • 8/13/2019 Foxpro for MS Dos

    7/27

    23. Blank

    To blank some or all the fields in the current record.

    BLANK

    - To blank all the fields in the current record

    BLANK FIELDS ,

    - To blank specified fields in the current record

    PROGRAM

    A Program is a set of instructions used to achieve the desired output.

    To create new program or to edit the existing one.

    MODI COMM

    OR MODIFY COMMAND

    NOTEcommand

    If ignore the particular line or command, NOTE can be used at the beginning of that line.

    Comment Line

    To add comments to the right of the Programming code , use &&

    Clear All Command

    This command is used to closes all databases files and releases all active memory variables,

    arrays menus or popup.

    Input / Output command

    ? | ?? | ??? [expr1?]

    ? - To print the expression in new line

    ?? - To print the expression in the same line

    ??? - The Output will going to the printer

    Example:

    ? "Hellow!"Sample Program

    NOTE prg for just print something on the screen

    Clear && To Clear the Screen or previous outputs

    ?"Welcome"

    ?"Hellow!"

  • 8/13/2019 Foxpro for MS Dos

    8/27

    ?? " World...!"

    ??? "Thank you

    Writing Programs

    * FoxPro has powerful built-in editor for writing and editing.

    * It can be invoked from the command window by using the MODIFY COMMAND.

    Syntax:

    MODIFY COMMAND

    Example:

    Modify Command journal

    (This program will automatically save with the extension .PRG)

    Press CTRL + W - To save and close the program window

    Executing Program

    Programs can be executed by DO command.

    Syntax:

    DO

    Example:

    Do journal

    When compile the executed file the FoxPro creates an object code program with .FXP extension. If

    there are any errors, creates a file an .ERR extension.

    INPUT command

    It is used to accept Numeric input from the user and store it into a memory variable.

    Syntax:

    INPUT [] TO

    Example:

    Store 0 to eno

    INPUT "Enter your Enrollment No : " TO eno

    ? Eno

    ACCEPT commandIt is used to accept character input from the user and store it into a memory variable.

    Syntax:

    ACCEPT [] TO

    Example:

    Store space (15) to NAM

  • 8/13/2019 Foxpro for MS Dos

    9/27

    ACCEPT "Enter the Name: " to NAM

    ? "Entered name:NAM

    Example 2

    clear

    SET TALK OFF

    Accept "Enter your nane :" to nam

    Input "enter your Age : " to age

    Accept " enter your city :" to cit

    Accept "Enter your Mail id : " to mail

    ? "******************************************"

    ? "NAME :: " ,nam

    ? "AGE :: " ,age

    ? "CITY :: " ,cit

    ? "MAIL ID:: " ,mail

    ? "******************************************"

    Setting/restoring the environment

    Every FoxPro program includes all commands required to establish the working environment

    and restore it to its prior state before the program terminates execution. This is achieved by issuing

    some set.

    Set notify on/off

    Enables the display of certain system messages.

    Set talk window

    Directors the display of system messages to an user-defined window instead of the system

    window. Sets notify should be ON.

    Set deleted on/off

    Processes records marked for deletion.

    Input and output in foxpro

    As we already know that data can be entered into tables through the APPEND/BROWSEcommands. Data entry for tables can also be done through programs. There arises a need to display

    and accept information in a formatted way.

    The @say command is used to place data at a particular screen location and to display data

    stored in fields or memory variables. The @get commands is used to retrieve data.

    Displaying data

  • 8/13/2019 Foxpro for MS Dos

    10/27

    @say command: -

    Syntax: -

    @SAY

    [Function]

    [Picture]

    [size

  • 8/13/2019 Foxpro for MS Dos

    11/27

    Y - Allows Only Y, y, N, n

    ! - Converts letters into uppercase.

    * - Displays asterisk in place of leading zeros.

    , - Display the comma

    . - Display the decimal Point.

    Function Clause

    You can include the function clause, the picture clause or both to control how is displayed or

    printed. A function clause affects the entire expression. It contains only the following function code.

    Function code & Purpose

    BLeftjustifies numeric data within the display region.

    Example:

    Clear

    Store 2750 to num

    @5,20 say num

    @6,20 say num function B

    CCr is displayed after a positive number to indicate a credit. Can be used with numeric data only.

    Example:-

    Clear

    Store 15432.00 to amt

    @5,20 say amt

    @6,20 say amt function c

    DUses the current set DATE format.

    Example:-

    Clear

    Store 230801 to num

    Store foxproprograming to tit

    @5,20 say num function D

    @6,20 say tit function D

    EEdits date type data as British dateExample:-

    Clear

    Store 230904 to num

    @6,20 say num function E

    TTrim leading and trailing blanks from

  • 8/13/2019 Foxpro for MS Dos

    12/27

    Example:-

    Clear

    @5,20 fox to tit

    @6,20 say tit function T

    XDB is displayed after negative numbers to indicate a debit. used only with numberic data.

    Example:-

    Clear

    Store -15432.00 to amt

    @5,20 say amt

    @6,20 say amt function X

    Z is displayed as all blanks if its numeric

    value is 0. used only with numeric data.

    Example:

    Clear

    Store o to amt

    @5,20 say amt

    @6,20 say amt function z

    ( Encloses negative numbers in parentheses. Used only with numeric data.

    Example:-

    Clear

    Store755 to amt

    @5,20 say amt

    @6,20 say amt function (

    ! Converts alphabetic characters to upper-case used with character data-only

    Example:-

    Clear

    Store foxpro programming to tit

    @6,20 say tit function !

    ^ Displays numeric data using scientific notation. Used with numeric data only.Example:-

    Clear

    Store 75815 to amt

    @6,20 say amt function ^

  • 8/13/2019 Foxpro for MS Dos

    13/27

    $

    Displays data in currently format. the currency symbol appears before or after the field value

    depending on the current setting of set currency. used with numeric data only.

    Example:-

    Clear

    Store 75815 to amt

    @6,20 say amt function $

    Picture expression can include the following characters:-

    X Allows any character.

    Y Allows logical Y, y, N and n only. Converts y and n to Y and N, respectively.

    ! Displays the current currency symbol specified by set currency. By default, the symbol is placedimmediately before or after the field.

    * Asterisks are displayed in front of the numeric value. Use with a dollar sign $ for check protection.

    . A decimal point specifies the decimal point position.

    , A comma is used to specifies digits to the left of the decimal point.

    Control Structures

    IF statement

    If Condition is True Executed and then False Not Executed.

    Syntax

    If (condition) then

    Statement-1

    End if

    Example

    clear

    mark =0

    @5,5 say " Enter the Mark : " get mark RANGE 0,100

    Read

    If mark >=40 Then

    @10,10 say " You have PASS"

    Endif

    If.else.endif:-

    The commands between if..end if will be executed only if condition is satisfied, otherwise the next

  • 8/13/2019 Foxpro for MS Dos

    14/27

    statement is executed. For every if there must be an end if. Every is matched with the nearest

    unmatched if.

    Syntax:-

    If

    Else

    End if

    Command sequence1 will be executed if a condition is true, if condition is false command

    sequence-2 will be executed. Control falls to the next statement in either case, if program I still in

    execution.

    Example 2

    clear

    Store 0 to x,y

    @5, 5 say " Enter the First value: " get x

    @7,5 say " Enter the Second value: " get y

    Read

    IF x > y Then

    @10, 10 say str(x) + is Greater than + ltrim (str(y))

    Else@10, 10 say str(x) + " is lesser than " + ltrim (str(y))

    Endif

    Example 3

    clear

    Store space(1) to x,ch

    @5, 5 say " Enter any Alphabet: " get x

    Read

    ch =chr(asc(x) +32) && To convert Upper into LowerIF ch="a" .or. ch="e" .or. ch="i" .or. ch="o" .or. ch="u" then

    @10,10 say ch + " is a VOWEL "

    Else

    @10,10 say ch + " is a CONSONANT"

    Endif

  • 8/13/2019 Foxpro for MS Dos

    15/27

    NESTED IF: (IF within IF)

    clear

    store 0 to x,y,z

    @5,5 say " Enter No1 : " get x

    @7,5 say " Enter No2 : " get y

    @9,5 say " Enter No3 : " get z

    Read

    If x > y then

    IF x>z then

    @ 15,5 say " X is Greater than y and z"

    Else

    @15,5 say "X is Greater than Y and Lesser than Z"

    Endif

    Else

    IF Y>Z then

    @ 15,5 say " Y is Greater than X and Z"

    Else

    @15,5 say "Y is Greater than X but not Z"

    Endif

    Endif

    DO CASE

    Case Commands are used to check for a specified condition

    Syntax:

    DO Case

    Case =

    Statement -1

    Case =

    Statement -2

    OtheriwseStatement -3

    End Case

    Example:

    clear

    store 0 to day

  • 8/13/2019 Foxpro for MS Dos

    16/27

    @5,5 say " Enter any number from 1 to 7 " get day

    Read

    DO CASE

    case day = 1

    @10,10 say "SUNDAY"

    case day = 2

    @10,10 say "MONDAY"

    case day = 3

    @10,10 say "TUESDAY"

    case day = 4

    @10,10 say "WEDNESDAY"

    case day = 5

    @10,10 say "THURSDAY"

    case day = 6

    @10,10 say "FRIDAY"

    case day = 7

    @10,10 say "SATURDAY"

    OTHERWISE

    @10,10 SAy "Invalid Input"

    EndCase

    FOR LOOP

    To repeatedly execute a series of lines in a Program. The lines of code b/w FOR and ENDOFR will be executed until the memory variable is equal to the

    final condition specified.

    Default STEP value is 1.Syntax

    FOR = TO STEP

    ................

    ................

    ENDFOR

    Example: 1

    CLEAR

    FOR I = 1 TO 10

  • 8/13/2019 Foxpro for MS Dos

    17/27

    ? I

    EndFor

    Example: 2

    To print the EVEN nos from 2 to 50

    CLEAR

    FOR I = 2 TO 50 STEP 2

    ? I

    EndFor

    Creating menu in Foxpro for DOS

    Posted on:12 February 2012

    By:KarthikeyanThis is an example of simple navigation menu programming inFoxpro 2.6

    1. set talk off2. set stat off3. set scor off4. set cent on5. set date brit6. do whil .t.7. clea8. @5,20 to 19,45 doub9. @6,25 say "MAIN MENU"10. @7,21 to 7,44 doub11. k=012. @ 9,25 prompt "DATA ENTRY"13. @11,25 prompt "REPORT PRINTING"14. @13,25 prompt "PROCESS"15. @15,25 prompt "EXIT"16. @17,25 prompt "QUIT to SYSTEM"17. menu to k18. do case19. case k=120. do dataent21. case k=222. do repoprn23. case k=324. * do proces25.

    case k=4

    26. exit27. case k=528. clos all29. clea all30. quit31. otherwise32. loop33. endcase34. enddo

    http://www.livetolearn.in/site/content/foxpro-programminghttp://www.livetolearn.in/site/content/foxpro-programming
  • 8/13/2019 Foxpro for MS Dos

    18/27

  • 8/13/2019 Foxpro for MS Dos

    19/27

    92. do othrprn93. case k2=594. exit95. otherwise96. loop97. endcase98. enddo99. clos all100. return

  • 8/13/2019 Foxpro for MS Dos

    20/27

    Simple Journal Entry program

    Posted on:28 September 2009

    By:Karthikeyan1. CLEA2. clea all3. settalk off4. use jour15. reply = "y"6. GO BOTTOM7. DOWHILEUPPER(REPLY)= "Y"8. STORE 0TOCRE, DEB9. STORE SPACE(10)TOP1, P210. STORE SPACE(15)TONR11. STORE CTOD(" / / ")TODATE112. @4,10SAY [DATE:]GETDATE113. @6,10SAY [PARTICULAR1 :]GETP114. @6,45SAY [DEBIT :]GETDEB15. @8,10SAY [PARTICULAR2 :]GETP216. @8,45SAY [CREDIT :]GETCRE17. @12,10SAY [NARRATION :]GETNR18. READ19. APPEND BLANK20. @18,10SAY [DOU CONTINUE(Y/N)?]GETREPLY21. READ22. REPL DATEWITHDATE123. REPL PART1 WITHP124. REPL PART2 WITHP225. REPL NAR WITHNR26. REPL DEBIT WITHDEB27. REPL CREDIT WITHCRE28. ENDDO29. CLEAR30. SETDEVI TOSCRE31. SETPRINTON32. SETPRIN TORESUME1.OUT33. @2,30SAY "JOURNAL ENTRIES"34. @3,0SAY REPLICATE ("-",75)35. @4,5SAY "DATE"36. @4,18SAY "PARTICULARS"37. @4,48SAY "DEBIT"38. @4,58SAY "CREDIT"39. @5,0SAY REPLICATE ("-",75)40. GO TOP41.42. ROW = 643. DOWHILE.NOT. EOF()44. @ROW,6SAY DATE45. @ROW,19SAY PART1 +[DR]46. @ROW+1,19SAY [TO]+PART2

  • 8/13/2019 Foxpro for MS Dos

    21/27

    47. @ROW+2,19SAY [(BEING ]+NAR+ [)]48. @ROW,45SAY DEBIT49. @ROW+1, 55SAY CREDIT50. IFROW >1851. WAIT ""52. @6,0CLEAR53. ROW = 654. ELSE55. ROW = ROW + 356. ENDIF57. SKIP58. ENDDO59. SETDEVI TOSCRE60. SETPRIN TO61. SETPRIN OFF

    Simple Ledger creation & Posting Program

    Posted on:28 September 2009

    By:Karthikeyan1. clear2. clea all3. settalk off4. use jour15. store space(15)toacname6. store 0tor,p, ds, cs, br, bl, mamt7. @10,10say "Account Name"getacname8. read9. clear10. setdevi toscre11. setprinton12. setprinttoledger.out13. @2,2say replicate("-",75)14. @3,3say "Date"15. @3,13say "Particulars"16. @3,28say "Amount"17. @3,41say "Date"18. @3,52say "Particulars"19. @3,67say "Amount"20. @4,2say replicate("-",75)21. @5,28say [Ledger for]+ alltrim(acname)22. @6,28say "-------------------"23. r = 724. p = 725. dowhile.not. eof()26. scan forupper(part1)= upper(alltrim(acname))27. @r,2say date28. @r,11say "To "+ part229. @r,26say credit

  • 8/13/2019 Foxpro for MS Dos

    22/27

    30. ds = ds + credit31. r = r+132. endscan33. scan forupper(part2)= upper(alltrim(acname))34. @p,40say date35. @p,50say "By "+ part136. @p,65say debit37. cs = cs + debit38. p = p+139. endscan40. enddo41.42. ifp>r43. br = p44. else45. br = r46. endif47.48. ifcs > ds49.

    bl = cs - ds50. mamt = cs

    51. @r+1,11say "To bal b/d"52. @r+1,26say bl53. @br+5,50say "By Bal c/d"54. @br+5,65say bl55. else56. bl = ds - cs57. mamt = ds58. @p+1, 50say "By bal c/d"59. @p+1, 66say bl60. @br+5,11say "To Bal b/d"61. @br+5,26say bl62. endif63.64. @br+2,26say "------------"65. @br+2,66say "------------"66. @br+3,26say mamt67. @br+3,66say mamt68. @br+4,26say "------------"69. @br+4,66say "------------"70. @br+6,2say replicate("-",75)71. setdevi toscre72. setprintto73. setprintoff74. return

    Trial Balance Program

    Posted on:28 September 2009

    By:Karthikeyan

  • 8/13/2019 Foxpro for MS Dos

    23/27

    1. clear2. clear all3. settalk off4. store space(1)toreply5. @3,5say "Do you continue?"getreply6. read7.

    use trial.dbf

    8. store space(20)top9. store 0tocr, db, sno10. dowhileupper(reply)="Y"11. clear12. @4,10say [SlNo]getsno13. @6,10say [Particular]getp14. @8,10say [Debit]getdb15. @10,10say [Credit]getcr16. read17. append blank18. repl slno withsno19. repl part withp20. repl debit withdb21. repl credit withcr22. @18,10say [Docontinue?]getreply23. read24. clear25. enddo26. setprinton27. setprinttotrial.out28. @2,30say "Trial Balance"29. @3,2say replicate("-",75)30. @4,2say "S.No."31. @4,13say "A/c Name"32. @4,28say "Debit Rs"33. @4,42say "Credit Rs"34. @5,1say repl("-",75)35.36. store 0tocs, ds, sus, l37. l = 638. dowhile.not. eof()39. @l,2say SLNO40. @l,7say part41. @l,22say debit42. @l,35say credit43. ifl >1844. wait ""45. @6,0clear46. l = 647. else48. l = l + 149. endif50. cs = cs + credit51. ds = ds + debit52. skip53. enddo

  • 8/13/2019 Foxpro for MS Dos

    24/27

    54. ifcs > ds55. sus = cs - ds56. @l,7say "Suspense A/c"57. @l,22say sus58. else59. ifds > cs60.

    sus = ds - cs

    61. cs = ds62. @l,7say "Suspense A/c"63. @l,35say sus64. endif65. endif66.67. @l+1,21say "---------------"68. @l+1,34say "---------------"69. @l+3,21say "---------------"70. @l+3,34say "---------------"71. @l+2,22say cs72. @l+2,35say cs73.74. setprintoff75. setprintto76. return

    Balance Sheet Program

    1. clea2. clear all3. set talk off4. @1,15 say "Trading A/c for the Year Ended"5. @2,2 say replicate("-",75)6. @3,7 say "Particulars"7. @3,45 say "Particulars"8.

    @4,2 say repl("-",75)9. store 0 to opst, pur, purret, tpur, tdeb, wage, wout, twage, carin

    10. @5,2 say "To Opening stock"11. @5,30 get opst12. @6,2 say "To purchase"13. @6,20 get pur14. @7,4 say "Purchase Ret."15. @7,20 get purret16. read17. tpur = pur - purret18. @7,30 say tpur19. @8,2 say "To wages"20. @8,20 get wage21. @9,4 say "Out.wages"22. @9,20 get wout23. read24. twage = wage + wout25. @9,30 say twage26. @10,2 say "To carriage inwards"27. @10,30 get carin28. read29. tdeb = opst + tpur + twage + carin30.

  • 8/13/2019 Foxpro for MS Dos

    25/27

    31. store 0 to sale, saleret, tsale, clstock, tcr32.33. @5,40 say "By Sales"34. @5,58 get sale35. @6,40 say "(-)Sales Return"36. @6,58 get saleret37. read38. tsale = sale - saleret39. @6,68 say tsale40. @7,40 say "By Closing Stock:"41. @7,68 get clstock42. read43. tcr = clstock + tsale44.45. store 0 to grpro, grloss, gramt46. grpro = tcr - tdeb47. if grpro < 048. grloss = abs(grpro)49. grpro = 050. @11,40 say "By Gross Loss:"51. @11,68 say grloss52. gramt = tdeb53. else54. @11,2 say "To Gross Profit:"55. @11,30 say grpro56. gramt = tcr57. endif58. @12,2 say repl("-",75)59. @13,30 say gramt60. @13,68 say gramt61. @14,2 say repl("-",75)62. wait""63.64. clear65.66. * Profit & Loss Account *67. @1,15 say "Profit & Loss A/c for the Year Ended"68. @2,2 say replicate("-",75)69. @3,7 say "Particulars"70. @3,45 say "Particulars"71. @4,2 say repl("-",75)72. if grloss = 073. @5,40 say "By Gross Profit B/D"74. @5,68 say grpro75. else76. @5,2 say "To Gross Loss b/d"77. @5,30 say grloss78. endif79. store 0 to sal, osal, tsal, rent, adv, pcr, pdb80. @6,2 say "To Salaries"81. @6,20 get sal82. @7,3 say "(+)Out.Salary"83. @7,20 get osal84. read85. tsal = sal + osal86. @7,30 say tsal87. @8,2 say "To Rent"

  • 8/13/2019 Foxpro for MS Dos

    26/27

    88. @8,30 get rent89. @9,2 say "To Advertise"90. @9,30 get adv91. read92. pdb = adv + rent + tsal + grloss93. store 0 to dis, odb, ndb, debts, netpro, pamt, netloss94. @6,40 say "By Disc. Receiv"95. @6,68 get dis96. @7,40 say "By Old debts"97. @7,58 get odb98. @8,40 say "(-) New debts"99. @8,58 get ndb100. read101. debts = odb - ndb102. @8,68 say debts103.104. pcr = debts + dis + grpro105. netpro = pcr - pdb106. if netpro > 0107. pamt = pcr108. @10,2 say "To Net profit"109. @10,30 say netpro110. else111. netloss = pdb - pcr112. pamt = pdb113. @10,42 say "To Net Loss:"114. @10,68 say netloss115. endif116. @11,2 say repl("-",75)117. @12,30 say pamt118. @12,68 say pamt119. @13,2 say repl("-",75)120. wait window121. clear122.123. **Balance Sheet**124. store 0 to ass, land, cashb, cashh, rsrv, cap, aint125. @2,25 say "Balance sheet for the year Ended"126. @3,2 say repl("-",75)127. @4,3 say "Liablities Amount"128. @4,48 say "Assets Amount"129. @5,2 say repl("-",75)130. @6,2 say "Capital"131. @6,20 get cap132. @7,2 say "Add. Int"133. @7,20 get aint134. read135. if netpro > 0136. @8,2 say "(+)Net pro"137. @8,20 say netpro138. cap = cap + aint + netpro139. else140. @8,2 say "(-)Net Loss:"141. @8,20 say netloss142. cap = cap + aint - netloss143. endif144. @8,30 say cap

  • 8/13/2019 Foxpro for MS Dos

    27/27

    145.146. @9,2 say "Reserve Fund"147. @9,30 get rsrv148. read149. liab = rsrv + cap150. @6,48 say "Cash in Hand:"151. @6,68 get cashh152. @7,48 say "Cash at Bank:"153. @7,68 get cashb154. @8,48 say "Land:"155. @8,68 get land156. ass = land + cashb + cashh157. @10,2 say repl("-",75)158. @11,30 say liab159. @11,68 say ass160. @12,2 say repl("-",75)161. wait window162. return