* Beginning of Program SET EXACT ON Use TimeTicket index on emp_id+DTOS(TickDate) tag empdate && EMp_ID="0099" select TimeTicket set order empdate select employee set order to emp_id go top nPayMonth=7 nPayYear=2006 nFirstDateOfPeriod=1 nLastDateOfPeriod=12 cFirstDateOfPeriod=trans(nPayYear)+right("00"+trans(nPayMonth),2); +right("00"+trans(nFirstDayOfPeriod),2) cLastDateOfPeriod=trans(nPayYear)+right("00"+trans(nPayMonth),2); +right("00"+trans(nLastDayOfPeriod),2) do while not eof() &&Employee.DBF nTicketCount=0 lcEmp_id=right("0000"+transform(employee.emp_id),4) select TimeTicket set near on seek lcEmp_ID+cFirstDateOfPeriod && Will attempt point to the first record && day of pay period - even if it's not on && the date!! set near off do while not eof('TimeTicket') AND ; dtos(cTimeTicket.TickDate>=cFirstDateOfPeriod AND ; cTimeTicket.TickDate<=cLastDateOfPeriod AND ; lcEmpid=TimeTicket.emp_id) * Go write this ticket to the pay period or checkstub output and * and add this ticket to the employee's gross pay subtotal for * this pay period nTicketCount=nTicketCount+1 SKIP in TimeTicket enddo &&while dtos(cTimeTicket.TickDate>=cFirstDateOfPeriod AND ; && cTimeTicket.TickDate<=cLastDateOfPeriod AND ; && lcEmpid=TimeTicket.emp_id) if nTicketCount>0 && Got some finishing up to do * Go grand total and service liabilities for this employee's * pay period, write the output and print the check. else * Do nothing - nothing to process Endif * Point back to master select Employee skip in Employee enddo &&while not eof() &&Employee.DBF * Run the HR summary reports and executive reports for payperiod * archive * Go to Taco Cabana and get an "Al Carbon" * End of Program