>>>>INSERT INTO (cCursor4) ((cCursor4).c1, (cCursor4).c2, (cCursor4).c3, (cCursor4).c4, ; >>>> (cCursor4).c5, (cCursor4).c6, (cCursor4).c7, (cCursor4).c8, (cCursor4).c9, ; >>>> (cCursor4).c10) ; >>>> VALUES((cCursor).pp, (cCursor).fname, (cCursor).totpay, (cCursor).fica, (cCursor).retire_amt, ; >>>> (cCursor).health_ins, (cCursor).retiree_med, (cCursor).unempins, (cCursor).wrkcompins, ; >>>> (cCursor).total_salary) >>>> >>>>>>>>>>
do case &&in same pay period case not split messagebox('not split',0,'warning') ldFindDate = ldLTEDate &&find all records by this date value par = (ed-bd)+1 &&number of partial days being calculated for cCursor = SYS(2015) &&generate random name for cursor select pp, fname, totpay, fica, retire_amt, health_ins, retiree_med, ; unempins, wrkcompins, total_salary ; from payroll_tbl into cursor (cCursor) where payroll_tbl.bdate = ldBDate ; order by fname report form rep_bydate preview use &&pay period fall inbetween bdate and edate in the table -- split into 2 payperiods case split messagebox('split',0,'warning') cCursor = SYS(2015) &&generate random name for cursor will hold calc and info cCursor2 = sys(2015) &&random cursor 2 where edate in array is beginning cCursor3 = sys(2015) &&random cursor 3 where edate in array is ending cCursor4 = sys(2015) &&random cursor 4 print cursor create cursor (cCursor)( pp c(7), fname c(25), totpay n(8,2), fica n(8,2), retire_amt n(8,2), ; health_ins n(8,2), retiree_med n(8,2), unempins n(8,2), wrkcompins n(8,2), ; total_salary n(10,2), ssn c(9)) index on fname tag fname ppdays1 = (LowValue - bd) + 1 &&number of days in first pay period ppdays2 = (ed - HighValue) + 1 &&number of days in second pay period .init_total &&find pay periods involved select distinct pp from payroll_tbl where edate between (Lowvalue) and a__gen2(gpos2+1,1) ; into array a__gen10 a_cells = _tally *!* select pp, fname, totpay, fica, retire_amt, health_ins, retiree_med, ; *!* unempins, wrkcompins, total_salary, ssn ; *!* from payroll_tbl into cursor (cCursor2) where payroll_tbl.pp between a__gen10(1,1) and ; *!* a__gen10(a_cells,1) order by fname select pp, fname, (totpay)/ppdays1 as totpay, (fica)/ppdays1 as fica, (retire_amt)/ppdays1 as retire_amt, ; (health_ins)/ppdays1 as health_ins, (retiree_med)/ppdays1 as retiree_med, (unempins)/ppdays1 as unempins, ; (wrkcompins)/ppdays1 as wrkcompins, (total_salary)/ppdays1 as total_salary, ssn ; from payroll_tbl into cursor (cCursor2) where payroll_tbl.pp = a__gen10(1,1) order by fname select pp, fname, (totpay)/ppdays2 as totpay, (fica)/ppdays2 as fica, (retire_amt)/ppdays2 as retire_amt, ; (health_ins)/ppdays2 as health_ins, (retiree_med)/ppdays2 as retiree_med, (unempins)/ppdays2 as unempins, ; (wrkcompins)/ppdays2 as wrkcompins, (total_salary)/ppdays2 as total_salary, ssn ; from payroll_tbl into cursor (cCursor3) where payroll_tbl.pp = a__gen10(a_cells,1) order by fname &&create print cursor create cursor (cCursor4)(c1 c(7), c2 c(25), c3 c(8), c4 c(8), c5 c(8), ; c6 c(8), c7 c(8), c8 c(8), c9 c(8), c10 c(10)) select (cCursor) append from dbf((cCursor2)) append from dbf((cCursor3)) set order to fname browse first_sw = .t. scan if first_sw = .t. first_sw = .f. hldname = &cCursor..fname &&hold new person name and do total break and then move to print cursor insert into (cCursor4) (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) ; values(&cCursor..pp, &cCursor..fname, STR(&cCursor..totpay), STR(&cCursor..fica), ; STR(&cCursor..retire_amt), STR(&cCursor..health_ins), STR(&cCursor..retiree_med), ; STR(&cCursor..unempins), STR(&cCursor..wrkcompins), STR(&cCursor..total_salary)) else if (&cCursor).fname == hldname &&move information into print cursor insert into (cCursor4) (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) ; values(&cCursor..pp, &cCursor..fname, STR(&cCursor..totpay), STR(&cCursor..fica), ; STR(&cCursor..retire_amt), STR(&cCursor..health_ins), STR(&cCursor..retiree_med), ; STR(&cCursor..unempins), STR(&cCursor..wrkcompins), STR(&cCursor..total_salary)) else hldname = (&cCursor).fname &&hold new person name and do total break and then move to print cursor insert into (cCursor4) (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) ; values(&cCursor..pp, &cCursor..fname, STR(&cCursor..totpay), STR(&cCursor..fica), ; STR(&cCursor..retire_amt), STR(&cCursor..health_ins), STR(&cCursor..retiree_med), ; STR(&cCursor..unempins), STR(&cCursor..wrkcompins), STR(&cCursor..total_salary)) .init_total endif &&fname == hldname endif &&first_sw endscan select (cCursor4) browse use &&do some report endcase