-----------------------------------------------------
|MemberId|ADPID|PayoutAmount|status|statuschanged|t
-----------------------------------------------------
|1 |101 |401.67 |Preissued|1206583466|2008-03-26 13:34:48
-----------------------------------------------------
|3 |101 |308.21 |Preissued|1206583466|2008-03-26 13:34:48
-----------------------------------------------------
|5 |101 |904.34 |Preissued|1206583466|2008-03-26 13:34:48
-----------------------------------------------------
|8 |101 |603.98 |Preissued|1206583466|2008-03-26 13:34:48
-----------------------------------------------------
####
File #, Amount, Check Number, Pay Date
101, 2218.20, 10108, 03/26/2008
####
File #, Amount, Check Number, Pay Date
101, 1313.86, 10108, 03/26/2008
####
# Wrote right now, not a copy and paste, so not exact...
open(FILE, "/path/to/apd/file.csv") or die "could not open file: $!";
my @_FILE = ;
close(FILE);
foreach my $_line (@_FILE) {
$_line =~ s/\s+//g;
my @_fileparts = split(/,/, $_line);
my $sth = $dbh->prepare(qq{SELECT * FROM `payouts` WHERE `status` = "Preissue" AND `adp_id` = ?});
$sth->execute($_fileparts[0]);
while(my $_pay = $sth->fetchrow_hashref()) {
# See this will not work because it may include the one record not included in this file record that I split, so I cannot update this check ID
}
$sth->finish();
}
####
$sth = $dbh->prepare(qq{ select * from payouts where SUM(amount) = ?});
$sth->execute($_fileparts[2]);