Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding the payperiod that included 12th of month
Message
 
To
17/07/2006 18:05:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01137078
Message ID:
01137408
Views:
13
>Hi. I am doing a payroll report. I was told to include the monthly pay period that includes the 12th of the month. We have a 14 day pay cycle.
>
>Q: how can I extract pay periods that just include the 12th? Note that I have a start date and end date for each period (as well as a check date) on each record.
>
>Thanks, Randy

Radical alternative number 9:-)
* 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
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform