in reply to Re: payroll, mysql and perl question
in thread payroll, mysql and perl question
I think I need to think that through, but it SHOULD work... but what if the payroll company messes up and he amounts do not match up... guess I could keep track of that in the while statement and if I never reach 0.00 set a flag for that record and don't update those records. Hmm, what do you think?my $_startingAmount = sprintf('%.2f', $fileparts [$_checkAmt]); my @potids = (); my $sth = $dbh->prepare(qq{SELECT * FROM `pot` WHERE `adpid` = ? AND ` +status` = "preissue" ORDER BYE `potid`}); $sth->execute($fileparts[$_emp_id]); while(my $_pot = $sth->fetchrow_hashref()) { if(sprintf('%.2f', $_pot->{amount}) <= $_startingAmount) { push(@potids, $_pot->{potid}); $_startingAmount -= $_pot->{amount}; last if $_startingAmount == 0.00; } next; } $sth->finish(); ## Now go update all the potid records in a foreach statement in @poti +ds
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: payroll, mysql and perl question
by graff (Chancellor) on Jan 02, 2008 at 19:44 UTC | |
by powerhouse (Friar) on Jan 02, 2008 at 23:30 UTC |