16 # &Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005
19 my $csv = Text
::CSV_XS
->new(
30 my $supplierid = $query->param('supplierid');
31 my @serialid = $query->param('serialid');
32 my $op = $query->param('op') || q{};
33 my $serialidcount = @serialid;
35 my %supplierlist = GetSuppliersWithLateIssues
;
38 my ($count, @lateissues);
40 ($count, @lateissues) = GetLateIssues
($supplierid);
41 for my $issue (@lateissues){
43 [ $issue->{'name'}, $issue->{'title'}, $issue->{'serialseq'}, $issue->{'planneddate'},];
48 my ($count2, @missingissues);
49 for (my $k=0;$k<@serialid;$k++){
50 ($count2, @missingissues) = GetLateOrMissingIssues
($supplierid, $serialid[$k]);
52 for (my $j=0;$j<@missingissues;$j++){
53 my @rows2 = ($missingissues[$j]->{'name'}, # lets build up a row
54 $missingissues[$j]->{'title'},
55 $missingissues[$j]->{'serialseq'},
56 $missingissues[$j]->{'planneddate'},
58 push (@loop2, \
@rows2);
60 $totalcount2 = $totalcount2 + $count2;
61 # update claim date to let one know they have looked at this missing item
62 updateClaim
($serialid[$k]);
68 if($missingissues[0]->{'name'}){ # if exists display supplier name in heading for neatness
69 # not necessarily needed as the name will appear in supplier column also
70 $heading = "FOR $missingissues[0]->{'name'}";
71 $filename = "_$missingissues[0]->{'name'}";
76 -type
=> 'application/vnd.ms-excel',
77 -attachment
=> "claims".$filename.".csv",
81 print "LATE ISSUES ".$heading."\n\n";
82 print "SUPPLIER,TITLE,ISSUE NUMBER,LATE SINCE\n";
84 for my $row ( @loop1 ) {
87 my $string = $csv->string;
93 if($serialidcount == 1){
94 print "MISSING ISSUE ".$heading."\n\n";
96 print "MISSING ISSUES ".$heading."\n\n";
98 print "SUPPLIER,TITLE,ISSUE NUMBER,LATE SINCE\n";
100 for my $row ( @loop2 ) {
102 $csv->combine(@
$row);
103 my $string = $csv->string;
110 print ",,Total Number Late, $count\n";
112 if($serialidcount == 1){
115 print ",,Total Number Missing, $totalcount2\n";