Tidy up.
authorszrj1m <szrj1m>
Mon, 22 Aug 2005 05:56:34 +0000 (05:56 +0000)
committerszrj1m <szrj1m>
Mon, 22 Aug 2005 05:56:34 +0000 (05:56 +0000)
stats.print.pl

index ceba030..944a140 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/perl\r
 \r
-\r
 use strict;\r
 use CGI;\r
 use C4::Output;\r
@@ -10,6 +9,16 @@ use C4::Interface::CGI::Output;
 use C4::Context;\r
 use Date::Manip;\r
 use C4::Stats;\r
+use Text::CSV_XS;\r
+\r
+my $csv = Text::CSV_XS->new(\r
+    {\r
+        'quote_char'  => '"',\r
+        'escape_char' => '"',\r
+        'sep_char'    => ',',\r
+        'binary'      => 1\r
+    }\r
+);\r
 \r
 my $input=new CGI;\r
 my $time=$input->param('time');\r
@@ -117,9 +126,8 @@ while ($i<$count ){
        push (@loop2, \@rows2);\r
        $i++;\r
        $totalcredits = $totalcredits + $credits[$i]->{'amount'};\r
-       ;\r
-\r
 }\r
+\r
 #takes off first char minus sign "-100.00"\r
 $totalcredits = substr($totalcredits, 1);\r
 \r
@@ -132,7 +140,7 @@ print "Branch, Datetime, Surame, Firstnames, Description, Type, Invoice amount,
 \r
 for my $row ( @loop1 ) {\r
 \r
-    my $csv->combine(@$row);\r
+    $csv->combine(@$row);\r
     my $string = $csv->string;\r
     print $string, "\n";\r
 }\r
@@ -141,7 +149,7 @@ print ",,,,,,,\n";
 \r
 for my $row ( @loop2 ) {\r
 \r
-    my $csv->combine(@$row);\r
+    $csv->combine(@$row);\r
     my $string = $csv->string;\r
     print $string, "\n";\r
 }\r
@@ -151,4 +159,3 @@ print ",,,,,,,\n";
 print ",,Total Amount Paid, $totalpaid\n";\r
 print ",,Total Number Written, $totalwritten\n";\r
 print ",,Total Amount Credits, $totalcredits\n";\r
-\r