- # The following lines were used to produce rather verbose reports
- #my ($sec,$min,$hour,$mday,$mon,$year) =
- # (localtime($_date) )[0,1,2,3,4,5];
- #$mon++;
- #$year -= 100 if $year >= 100;
- #$year = "0" . $year if $year < 10;
-
- my $invoice_amt =0;
- my $invoice_tax =0;
- my $invoice_compped =0;
- my(@cust_bill_pkgs)= $cust_bill->cust_bill_pkg;
- foreach my $cust_bill_pkg (@cust_bill_pkgs) {
-
- my $recur = $cust_bill_pkg->getfield('recur');
- my $setup = $cust_bill_pkg->getfield('setup');
- my $pkgnum = $cust_bill_pkg->getfield('pkgnum');
-
- if ($pkgnum == 0) {
- # The following line was used to produce rather verbose reports
- # printf(MAIL qq{\n%10s%15s%14.2f}, "$mon/$mday/$year", "Tax $invnum", $recur+$setup);
- $invoice_tax += $recur;
- $invoice_tax += $setup;
- } else {
- # The following line was used to produce rather verbose reports
- # printf(MAIL qq{\n%10s%15s%14.2f}, "$mon/$mday/$year", "Inv $invnum", $recur+$setup);
- $invoice_amt += $recur;
- $invoice_amt += $setup;
- }
-
- }
-
- my(@cust_bill_pays)= $cust_bill->cust_bill_pay;
- foreach my $cust_bill_pay (@cust_bill_pays) {
- my $payby = $cust_bill_pay->cust_pay->payby;
- my $paid = $cust_bill_pay->getfield('amount');
- if ($payby =~ 'COMP') {
- $invoice_compped += $paid;
- }
- }
-
- if (abs($invoice_compped - ($invoice_amt + $invoice_tax)) < 0.0001){
- $compped += $invoice_amt;
- $compped_tax += $invoice_tax;
- } elsif ($invoice_compped > 0) {
- printf(qq{\nInvoice %10d has inexpliciable complimentary payments of %14.9f\n}, $invnum, $invoice_compped);
- $other += $invoice_amt;
- $other_tax += $invoice_tax;
- } elsif ($invoice_tax > 0) {
- $total_tax += $invoice_tax;
- $taxed += $invoice_amt;
- } else {
- $untaxed += $invoice_amt;
- }
-
- }
+ # The following lines were used to produce rather verbose reports
+ #my ($sec,$min,$hour,$mday,$mon,$year) =
+ # (localtime($_date) )[0,1,2,3,4,5];
+ #$mon++;
+ #$year -= 100 if $year >= 100;
+ #$year = "0" . $year if $year < 10;
+
+ my $invoice_amt =0;
+ my $invoice_tax =0;
+ my $invoice_comped =0;
+ my(@cust_bill_pkgs)= $cust_bill->cust_bill_pkg;
+ foreach my $cust_bill_pkg (@cust_bill_pkgs) {
+
+ my $recur = $cust_bill_pkg->getfield('recur');
+ my $setup = $cust_bill_pkg->getfield('setup');
+ my $pkgnum = $cust_bill_pkg->getfield('pkgnum');
+
+ if ($pkgnum == 0) {
+ # The following line was used to produce rather verbose reports
+ # push @buf, ('', sprintf(qq{%10s%15s%14.2f}, "$mon/$mday/$year", "Tax $invnum", $recur+$setup));
+ $invoice_tax += $recur;
+ $invoice_tax += $setup;
+ } else {
+ # The following line was used to produce rather verbose reports
+ # push @buf, ('', sprintf(qq{%10s%15s%14.2f}, "$mon/$mday/$year", "Inv $invnum", $recur+$setup));
+ $invoice_amt += $recur;
+ $invoice_amt += $setup;
+ }
+
+ }
+
+ my(@cust_bill_pays)= $cust_bill->cust_bill_pay;
+ foreach my $cust_bill_pay (@cust_bill_pays) {
+ my $payby = $cust_bill_pay->cust_pay->payby;
+ my $paid = $cust_bill_pay->getfield('amount');
+ if ($payby =~ 'COMP') {
+ $invoice_comped += $paid;
+ }
+ }
+
+ if (abs($invoice_comped - ($invoice_amt + $invoice_tax)) < 0.0001){
+ $comped += $invoice_amt;
+ $comped_tax += $invoice_tax;
+ } elsif ($invoice_comped > 0) {
+ push @buf, sprintf(qq{\nInvoice %10d has inexpliciable complimentary payments of %14.9f\n}, $invnum, $invoice_comped);
+ $other += $invoice_amt;
+ $other_tax += $invoice_tax;
+ } elsif ($invoice_tax > 0) {
+ $total_tax += $invoice_tax;
+ $taxed += $invoice_amt;
+ } else {
+ $untaxed += $invoice_amt;
+ }
+
+ }