Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating multi-line invoice input screen

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
My foxpro 2.5 for DOS has been running our business since
1989 with good results. My staff now wants to be able to enter invoice info. item by item but then go back up several lines that have been READ and modify the input. As written currently after a line of fields has been read and
the gets got the data is appended to a file. Is there a way to reREAD previous fields and then append all the records?
I miss the old Compuserve forums.
Thanks
 
If I visualize this correctly, you could use either a Browse window which only writes the data when the window is exited, or you could have your Get variables being elements of an array and don't write the data until they exit the screen.

Robert Bradley

 
[tt]1. Do you have the source code to the program.?
If No
You will need a Fox Decompiler and a church full of prayers.
else
What type of of support are you looking for?
a. A contract programmer to rewite the code?
b. Some one to convert the program to a Windows version?
c. Some one to help you read the code.
endif

2. What happened to the Compuserve forum? It was there yesterday.
And, No you do not need to belong to Compuserve to access the FoxPro forum. AOL opened the forum to the public after they purchased Compuserve.
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Thanks for your replies.
I am an amateur programmer. I wrote this myself for my animal hospital beginning with dBase2, then kept improving on it over the years, upgrading as new versions came out, then when dBase4 came out and it looked like it was in trouble I switched to FoxPro and then gave up when visual rBase came along and Microsoft stopped. Still, as I said, the program is adequate for our needs. I thought that using a Browse window or arrays was the way to go to solve this problem but I have been unable to figure out how to do it. All I have to go on is the original documentation that came with Foxpro 2.5 and it's scant information for my talents. Robert, you have understood my question correctly. I guess I need some hints on how to get started with the Browse or array stuff. I will check out AOL too.
Thanks
 
Can you describe the major controls already on the form?

It seems like you just need to replace the existing single line of Gets with multiple lines.

For example, in your Setup code:
[tt]dimension Lines(5,4)[/tt]
which would represent having five lines with four columns (adjust this to the number of columns you presently have, and the ideal number of rows).

Put Gets on your screen, and have them Get the memvar that is appropriate; for example, the second row and third column would GET Lines(2,3). Dave, double-check me, as my FP2 skills are getting rusty, and I'm apt to inadvertantly work in some VFP.

Then when the Save button is hit, you'll loop through the array and save the data, something like this:

[tt]for nRow = 1 to 5 && max 5 rows
if empty(lines(nRow, 1)) && no data this line
loop
endif
insert into MyDBF values (lines(nRow,1), lines(nRow,2)...
endfor[/tt]


Robert Bradley

 
Robert, I think we're thinking along the same lines.

The routine is briefly this:
memvars:
mtotal
mgrandtotal=mtotal+mgrandtotal
mcost
munits
mprocedure
metc
open sale.dbf
open costs.dbf
@row,col say codeno, units, procedure, cost, total cost
get mcodeno
read
get munits
read
get cost & procedure from costs
do case based on value of codeno
case1
calculate discount, mcost changes
case2
don't get procedure & cost from costs.dbf, get from user input
read
.
.
otherwise
get procedure & cost from costs.dbf
endcase
total=munits*mcost
if codeno>=x
add to total
endif
select sale
append blank
replace with Gets from above
mgrandtotal updated
choices to add another line, delete the line, add new pet
start over, etc
loop
enddo

I've never used arrays although I have read the documentation about them a lot thinking they would be very useful.

Thanks
 
Robert, Your code is ok. The code sample is dBase3/FoxPlus vintage so there is a lot that can be done to reduce the code required with the newer features of FP.

1. I would scatter to an array or to memvars and rewrite screens to support it.
2. I would also ask to Save, Add, Delete before the append blank in case the user selected delete. David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top