more card display changes
[freeside.git] / httemplate / view / cust_main.cgi
index 1a04ff6..4796481 100755 (executable)
@@ -158,7 +158,7 @@ print '<TD VALIGN="top">';
     my $referral = qsearchs('part_referral', {
       'refnum' => $cust_main->refnum
     } );
-    print '<TR><TD ALIGN="right">Referral</TD><TD BGCOLOR="#ffffff">',
+    print '<TR><TD ALIGN="right">Advertising source</TD><TD BGCOLOR="#ffffff">',
           $referral->refnum, ": ", $referral->referral, '</TD></TR>';
   }
   print '<TR><TD ALIGN="right">Order taker</TD><TD BGCOLOR="#ffffff">',
@@ -206,8 +206,7 @@ print '<BR>';
 
   if ( $cust_main->payby eq 'CARD' ) {
     my $payinfo = $cust_main->payinfo;
-    $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4);
-
+    $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4));
     print 'Credit card</TD></TR>',
           '<TR><TD ALIGN="right">Card number</TD><TD BGCOLOR="#ffffff">',
           $payinfo, '</TD></TR>',
@@ -266,7 +265,14 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
         $part_pkg->comment;
 }
 
-print '</SELECT><INPUT TYPE="submit" VALUE="Order Package"><BR>';
+print '</SELECT><INPUT TYPE="submit" VALUE="Order Package"></FORM><BR>';
+
+print '<BR>'.
+  qq!<FORM ACTION="${p}edit/process/quick-charge.cgi" METHOD="POST">!.
+  qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!.
+  qq!Description:<INPUT TYPE="text" NAME="pkg">!.
+  qq! Amount:<INPUT TYPE="text" NAME="amount" SIZE=6>!.
+  qq!&nbsp;<INPUT TYPE="submit" VALUE="One-time charge"></FORM><BR>!;
 
 print <<END;
 <SCRIPT>
@@ -364,7 +370,8 @@ foreach my $package (@packages) {
 
   for ( qw( setup bill susp expire cancel ) ) {
     print "<TD ROWSPAN=$rowspan><FONT SIZE=-1>", ( $package->getfield($_)
-            ? time2str("%D", $package->getfield($_) )
+            ? time2str("%D</FONT><BR><FONT SIZE=-3>%l:%M:%S%P&nbsp;%z</FONT>",
+              $package->getfield($_) )
             :  '&nbsp'
           ), '</FONT></TD>',
     ;
@@ -459,7 +466,7 @@ foreach my $bill (@bills) {
                                              $payment->payinfo,
                                              $cust_bill_pay->amount,
                       );
-    $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4)
+    $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4))
       if $payby eq 'CARD';
     my $target = "$payby$payinfo";
     $payby =~ s/^BILL$/Check #/ if $payinfo;
@@ -489,7 +496,28 @@ foreach my $bill (@bills) {
   }
 }
 
-my @credits = grep { $_->credited > 0 }
+my @credits = grep { scalar(my @array = $_->cust_credit_refund) }
+           qsearch('cust_credit',{'custnum'=>$custnum});
+foreach my $credit (@credits) {
+  my($cref)=$credit->hashref;
+  my(@cust_credit_refund)=
+    qsearch('cust_credit_refund', { 'crednum'=> $cref->{crednum} } );
+  foreach my $cust_credit_refund (@cust_credit_refund) {
+    my $cust_refund = $cust_credit_refund->cust_credit;
+    my($date, $crednum, $amount, $reason, $app_date ) = (
+      $credit->_date,
+      $credit->crednum,
+      $cust_credit_refund->amount,
+      $credit->reason,
+      time2str("%D", $cust_credit_refund->_date),
+    );
+    push @history,
+      "$date\tCredit #$crednum: $reason<BR>".
+      "(applied to refund on $app_date)\t\t\t$amount\t";
+  }
+}
+
+@credits = grep { $_->credited  > 0 }
            qsearch('cust_credit',{'custnum'=>$custnum});
 foreach my $credit (@credits) {
   my($cref)=$credit->hashref;
@@ -521,7 +549,7 @@ foreach my $payment (@unapplied_payments) {
   my $payby = $payment->payby;
   my $payinfo = $payment->payinfo;
   #false laziness w/above
-  $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4)
+  $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4))
     if $payby eq 'CARD';
   my $target = "$payby$payinfo";
   $payby =~ s/^BILL$/Check #/ if $payinfo;