foxpro for windows 2.6
0 pts.
0
Q:
foxpro for windows 2.6
I want to store the data i enter into below program but the e_code is not geting stored in the table. Also i wanted to calculate the total no. of hours for each employee on monthly basis.


use empmast
index on e_code tag e_code of empmast
set order to e_code
wish='y'
*select b
use att
index on e_code to att1
go bottom
scatter memvar blank
e_code=m->e_code
*sele a
if seek(e_code)
&&m->e_code is already there in table
&& handle the code
endif
*sele b
do while wish='y'
scatter memvar blank
@ 5,2 say "Enter the Employees Code :" get m->e_code pict "999999" ;
message "Enter the Employee's Code";
Error "Employees Code cannot b blank"
read
seek e_code
if found()
scatter memvar blank
m->date=date()
@ 3,2 say "Today's Date:"
@ 3,20 say m->date pict"@E"
@ 7,2 say "Employees Name:" get m->E_Name pict "@!S20" ;
message "Enter the Employees Name " ;
Error "Employees Name cannot be blank"
@ 9,2 say "Employees Department:" get m->Dept pict"@!S15" ;
message "Enter the Department";
Error "Employees Department cannot be blank"
@ 11,2 say "Shift:" get m->Shift pict "9" ;
message "Enter the Shift" ;
Error "Shift cannot be blank"
@ 13,2 say "Job Code:" get m->Job_Code pict "9999999999" ;
message "Enter the Job_Code:" ;
Error "Job_code cannot be blank"
@ 15,2 say "Location :" get m->Loc pict "@!S20" ;
message "Enter the Location:";
Error "Location cannot be blank"
@ 17,2 say "No. of Hours:" get m->Hours ;
pict "99" valid !empty(m->Hours) ;
message "Enter No. of Hours Worked" ;
Error "Number of Hours cannot be Blank"
read
append blank
gather memvar
clear gets
@ 19,16 SAY "Do you want to add more records,Y/N?" get m->wish
read
clear gets
endif
enddo
clear gets

select date,e_code,e_name,dept,shift,sum(hours) from att group by e_code into table temp
use temp
do while !eof()
&&print your report formatting
skip
enddo
clear
ASKED: Oct 9 2007  10:15 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
6900 pts.
0
A:
 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0
  • AddThis Social Bookmark Button
1. Since your memory variable name (m->e_code) and the field name in table att (e_code)are same, e_code is not getting saved to your table. So change your memory variable name to something else say me_code
2. In your line number 10 you are giving wrong command as e_code = m->e_code as right now your m->e_code is blank and you are taking table field name = memory variable which is blank. Instead you should reverse this command as m->e_code = e_code
3. This will start saving your e_code in table appropriately.
4. Once this starts happening you can very easily calculate total no. of hours for any employee for any period by a simple command.
Last Answered: Jul 22 2008  8:20 AM GMT by Jaideepkhanduja   6900 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0