From 8d4abaa99403699aa5b5f02e899d2ea33980f913 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Dec 2004 09:21:43 +0000 Subject: more RT integration --- httemplate/view/cust_main/billing.html | 119 +++++++++++++++++++++++++++++ httemplate/view/cust_main/contacts.html | 131 ++++++++++++++++++++++++++++++++ httemplate/view/cust_main/misc.html | 75 ++++++++++++++++++ httemplate/view/cust_main/tickets.html | 54 +++++++++++++ 4 files changed, 379 insertions(+) create mode 100644 httemplate/view/cust_main/billing.html create mode 100644 httemplate/view/cust_main/contacts.html create mode 100644 httemplate/view/cust_main/misc.html create mode 100644 httemplate/view/cust_main/tickets.html (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html new file mode 100644 index 000000000..18a203bd6 --- /dev/null +++ b/httemplate/view/cust_main/billing.html @@ -0,0 +1,119 @@ +<% + my( $cust_main ) = @_; + my @invoicing_list = $cust_main->invoicing_list; +%> + +Billing information +(Bill now) +<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> + + Tax exempt + <%= $cust_main->tax ? 'yes' : 'no' %> + + + Postal invoices + + <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> + + + + Email invoices + + <%= join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no' %> + + + + Billing type + + +<% if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { %> + + Credit card <%= $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %> + + + + Card number + <%= $cust_main->payinfo_masked %> + + + Expiration + <%= $cust_main->paydate %> + + + Name on card + <%= $cust_main->payname %> + + +<% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { + my( $account, $aba ) = split('@', $cust_main->payinfo ); +%> + + Electronic check <%= $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %> + + + + ABA/Routing code + <%= $aba %> + + + Account number + <%= $account %> + + + Bank name + <%= $cust_main->payname %> + + +<% } elsif ( $cust_main->payby eq 'LECB' ) { + $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; + my $payinfo = "$1-$2-$3"; +%> + + Phone bill billing + + + + Phone number + <%= $payinfo %> + + +<% } elsif ( $cust_main->payby eq 'BILL' ) { %> + + Billing + + + + <% if ( $cust_main->payinfo ) { %> + + P.O. + <%= $cust_main->payinfo %> + + <% } %> + + + Expiration + <%= $cust_main->paydate %> + + + Attention + <%= $cust_main->payname %> + + +<% } elsif ( $cust_main->payby eq 'COMP' ) { %> + + Complimentary + + + + Authorized by + <%= $cust_main->payinfo %> + + + Expiration + <%= $cust_main->paydate %> + + +<% } %> + + + diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html new file mode 100644 index 000000000..456d117a6 --- /dev/null +++ b/httemplate/view/cust_main/contacts.html @@ -0,0 +1,131 @@ +<% + my( $cust_main ) = @_; + my $conf = new FS::Conf; +%> + +Billing address +<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> + + Contact name + + <%= $cust_main->last. ', '. $cust_main->first %> + +<% if ( $conf->exists('show_ss') ) { %> + SS# + <%= $cust_main->ss || ' ' %> +<% } %> + + + Company + <%= $cust_main->company %> + + + Address + <%= $cust_main->address1 %> + +<% if ( $cust_main->address2 ) { %> + +   + <%= $cust_main->address2 %> + +<% } %> + + City + <%= $cust_main->city %> + State + <%= $cust_main->state %> + Zip + <%= $cust_main->zip %> + + + Country + <%= $cust_main->country %> + +<% + my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day Phone' + : FS::Msgcat::_gettext('daytime'); + my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ + ? 'Night Phone' + : FS::Msgcat::_gettext('night'); +%> + + <%= $daytime_label %> + + <%= $cust_main->daytime || ' ' %> + + + + <%= $night_label %> + + <%= $cust_main->night || ' ' %> + + + + Fax + + <%= $cust_main->fax || ' ' %> + + + + +<% if ( defined $cust_main->dbdef_table->column('ship_last') ) { + my $pre = $cust_main->ship_last ? 'ship_' : ''; +%> + +
+Service address +<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> + + Contact name + + <%= $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %> + + + + Company + <%= $cust_main->get("${pre}company") %> + + + Address + <%= $cust_main->get("${pre}address1") %> + +<% if ( $cust_main->get("${pre}address2") ) { %> + +   + <%= $cust_main->get("${pre}address2") %> + +<% } %> + + City + <%= $cust_main->get("${pre}city") %> + State + <%= $cust_main->get("${pre}state") %> + Zip + <%= $cust_main->get("${pre}zip") %> + + + Country + <%= $cust_main->get("${pre}country") %> + + + <%= $daytime_label %> + + <%= $cust_main->get("${pre}daytime") || ' ' %> + + + + <%= $night_label %> + + <%= $cust_main->get("${pre}night") || ' ' %> + + + + Fax + + <%= $cust_main->get("${pre}fax") || ' ' %> + + + + +<% } %> diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html new file mode 100644 index 000000000..69e120573 --- /dev/null +++ b/httemplate/view/cust_main/misc.html @@ -0,0 +1,75 @@ +<% + my( $cust_main ) = @_; +%> + +<%= ntable("#cccccc") %><%= &ntable("#cccccc",2) %> + + Customer number + <%= $cust_main->custnum %> + + +<% + my @agents = qsearch( 'agent', {} ); + my $agent; + unless ( scalar(@agents) == 1 ) { + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); +%> + + + Agent + <%= $agent->agentnum %>: <%= $agent->agent %> + + +<% + } else { + $agent = $agents[0]; + } + + my @referrals = qsearch( 'part_referral', {} ); + unless ( scalar(@referrals) == 1 ) { + my $referral = qsearchs('part_referral', { + 'refnum' => $cust_main->refnum + } ); +%> + + + Advertising source + <%= $referral->refnum %>: <%= $referral->referral%> + + +<% } %> + + + Order taker + <%= $cust_main->otaker %> + + + Referring Customer + + +<% + my $referring_cust_main = ''; + if ( $cust_main->referral_custnum + && ( $referring_cust_main = + qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) + ) + ) { +%> + +<%=$cust_main->referral_custnum %>: +<%= + ( $referring_cust_main->company + ? $referring_cust_main->company. ' ('. + $referring_cust_main->last. ', '. $referring_cust_main->first. + ')' + : $referring_cust_main->last. ', '. $referring_cust_main->first + ) +%> + +<% } %> + + + + + + diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html new file mode 100644 index 000000000..61c94d61f --- /dev/null +++ b/httemplate/view/cust_main/tickets.html @@ -0,0 +1,54 @@ +<% + my( $cust_main ) = @_; + + my $conf = new FS::Conf; + my $num = 10; + + my @tickets = (); + unless ( $conf->config('ticket_system-custom_priority_field') ) { + + @tickets = + @{ FS::TicketSystem->customer_tickets($cust_main->custnum, $num) }; + + } else { + + foreach my $priority ( + $conf->config('ticket_system-custom_priority_field-values'), '' + ) { + last if scalar(@tickets) >= $num; + push @tickets, + @{ FS::TicketSystem->customer_tickets( $cust_main->custnum, + $num - scalar(@tickets), + $priority, + ) + }; + } + + } + +%> + +Highest priority tickets +(View all tickets for this customer) +(New ticket for this customer) +<%= table() %> + + # + Subject + Priority + Queue + Status + +<% foreach my $ticket ( @tickets ) { + my $href = FS::TicketSystem->href_ticket($ticket->{id}); +%> + + ><%= $ticket->{id} %> + ><%= $ticket->{subject} %> + <%= $ticket->{content} || $ticket->{priority} %> + <%= $ticket->{name} %> + <%= $ticket->{status} %> + +<% } %> + + -- cgit v1.2.1 From 57323a695e58b58cc8892784d356995f6e41bfcd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Dec 2004 21:33:57 +0000 Subject: set default requestor to email invoice addresses --- httemplate/view/cust_main/tickets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index 61c94d61f..d6ddfa64c 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -30,7 +30,7 @@ Highest priority tickets (View all tickets for this customer) -(New ticket for this customer) +(New ticket for this customer) <%= table() %> # -- cgit v1.2.1 From c21b6e69583bec632de7fcd340c29982c868f73d Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Dec 2004 07:51:00 +0000 Subject: voiding of echeck payments instead of refunds --- httemplate/view/cust_main/order_pkg.html | 39 +++ httemplate/view/cust_main/packages.html | 350 ++++++++++++++++++++++++ httemplate/view/cust_main/payment_history.html | 357 +++++++++++++++++++++++++ httemplate/view/cust_main/quick-charge.html | 32 +++ 4 files changed, 778 insertions(+) create mode 100644 httemplate/view/cust_main/order_pkg.html create mode 100755 httemplate/view/cust_main/packages.html create mode 100644 httemplate/view/cust_main/payment_history.html create mode 100644 httemplate/view/cust_main/quick-charge.html (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/order_pkg.html b/httemplate/view/cust_main/order_pkg.html new file mode 100644 index 000000000..ac2d05df2 --- /dev/null +++ b/httemplate/view/cust_main/order_pkg.html @@ -0,0 +1,39 @@ +<% + my( $cust_main ) = @_; +%> + + + +
+ + + + + + + +
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html new file mode 100755 index 000000000..c5a0706d6 --- /dev/null +++ b/httemplate/view/cust_main/packages.html @@ -0,0 +1,350 @@ +<% + my( $cust_main ) = @_; + my $conf = new FS::Conf; + + my $packages = get_packages($cust_main, $conf); +%> + +Packages +( Bulk order and cancel packages (preserves services) ) + +<% if ( @$packages ) { %> + + + + + + + + +<% +foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { + my $rowspan = 0; + + if ($pkg->{cancel}) { + $rowspan = 0; + } else { + foreach my $svcpart (@{$pkg->{svcparts}}) { + $rowspan += $svcpart->{count}; + $rowspan++ if ($svcpart->{count} < $svcpart->{quantity}); + } + } +%> + + + + +<% + #foreach (qw(setup last_bill next_bill susp expire cancel)) { + # print qq! \n!; + #} + print "'. + ''; + unless ( $pkg->{setup} ) { + print ''; + } else { + print "'; + print "' + if $pkg->{'last_bill'}; + print "' + if $pkg->{'susp'}; + } + + } else { + + if ( $pkg->{susp} ) { #status: suspended + print ''. + ''; + unless ( $pkg->{setup} ) { + print ''; + } else { + print "'; + } + print "' + if $pkg->{'last_bill'}; + # next bill ?? + print "' + if $pkg->{'expire'}; + print ''; + + } else { #status: active + + unless ( $pkg->{setup} ) { #not setup + + print ''; + print ''; + } + + } else { #setup + + unless ( $pkg->{freq} ) { + print "". + ''; + } else { + print ''. + ''; + } + + } + + print "' + if $pkg->{'last_bill'}; + print "' + if $pkg->{'next_bill'}; + print "' + if $pkg->{'expire'}; + if ( $pkg->{freq} ) { + print ''; + } + + } + + } + + print "
PackageStatusServices
> + <%=$pkg->{pkgnum}%>: + <%=$pkg->{pkg}%> - <%=$pkg->{comment}%>
+<% unless ($pkg->{cancel}) { %> + ( <%=pkg_change_link($pkg)%> ) + ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) +<% } %> +
! . pkg_datestr($pkg,$_,$conf) . qq!". &itable(''); + + sub myfreq { + my $part_pkg = shift; + my $freq = $part_pkg->freq_pretty; + $freq =~ s/ / /g; + $freq; + } + + if ( $pkg->{cancel} ) { #status: cancelled + + print '
Cancelled '. pkg_datestr($pkg,'cancel',$conf). '
Never billed
Setup ". + pkg_datestr($pkg, 'setup',$conf). '
Last bill ". + pkg_datestr($pkg, 'last_bill',$conf). '
Suspended ". + pkg_datestr($pkg, 'susp',$conf). '
Suspended '. pkg_datestr($pkg,'susp',$conf). '
Never billed
Setup ". + pkg_datestr($pkg, 'setup',$conf). '
Last bill ". + pkg_datestr($pkg, 'last_bill',$conf). '
Expires ". + pkg_datestr($pkg, 'expire',$conf). '
( '. pkg_unsuspend_link($pkg). + ' | '. pkg_cancel_link($pkg). ' )
Not yet billed ('; + unless ( $pkg->{freq} ) { + print 'one-time charge)
( '. pkg_cancel_link($pkg). + ' )'; + } else { + print 'billed '. myfreq($pkg->{part_pkg}). ')
One-time charge
Billed '. + pkg_datestr($pkg,'setup',$conf). '
Active'. + ', billed '. myfreq($pkg->{part_pkg}). '
Setup '. + pkg_datestr($pkg, 'setup',$conf). '
Last bill ". + pkg_datestr($pkg, 'last_bill',$conf). '
Next bill ". + pkg_datestr($pkg, 'next_bill',$conf). '
Expires ". + pkg_datestr($pkg, 'expire',$conf). '
( '. pkg_suspend_link($pkg). + ' | '. pkg_cancel_link($pkg). ' )
\n"; + + if ($rowspan == 0) { print qq!\n!; next; } + + my $cnt = 0; + foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { + foreach my $service (@{$svcpart->{services}}) { + print '' if ($cnt > 0); +%> + <%=svc_link($svcpart,$service)%> + <%=svc_label_link($svcpart,$service)%>
( <%=svc_unprovision_link($service)%> ) + +<% + $cnt++; + } + if ($svcpart->{count} < $svcpart->{quantity}) { + print qq!\n! if ($cnt > 0); + print qq! !.svc_provision_link($pkg, $svcpart, $conf).qq!\n\n!; + } + } +} +print ''; +} + +#end display packages +%> + +<% +#subroutines + +sub get_packages { + my $cust_main = shift or return undef; + my $conf = shift; + + my @packages = (); + + foreach my $cust_pkg ( + $conf->exists('hidecancelledpackages') + ? $cust_main->ncancelled_pkgs + : $cust_main->all_pkgs + ) { + + my $part_pkg = $cust_pkg->part_pkg; + + my %pkg = (); + + #to get back to the original object... should use it in the first place!! + $pkg{cust_pkg} = $cust_pkg; + $pkg{part_pkg} = $part_pkg; + + $pkg{pkgnum} = $cust_pkg->pkgnum; + $pkg{pkg} = $part_pkg->pkg; + $pkg{pkgpart} = $part_pkg->pkgpart; + $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{freq} = $part_pkg->freq; + $pkg{setup} = $cust_pkg->getfield('setup'); + $pkg{last_bill} = $cust_pkg->getfield('last_bill'); + $pkg{next_bill} = $cust_pkg->getfield('bill'); + $pkg{susp} = $cust_pkg->getfield('susp'); + $pkg{expire} = $cust_pkg->getfield('expire'); + $pkg{cancel} = $cust_pkg->getfield('cancel'); + + + my %svcparts = map { + $_->svcpart => { + $_->part_svc->hash, + 'quantity' => $_->quantity, + 'count' => $cust_pkg->num_cust_svc($_->svcpart), + #'services' => [], + }; + } $part_pkg->pkg_svc; + + foreach my $cust_svc ( $cust_pkg->cust_svc ) { + #warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; + my $svc = { + 'svcnum' => $cust_svc->svcnum, + 'label' => ($cust_svc->label)[1], + }; + + #false laziness with above, to catch extraneous services. whole + #damn thing should be OO... + my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= { + $cust_svc->part_svc->hash, + 'quantity' => 0, + 'count' => $cust_pkg->num_cust_svc($cust_svc->svcpart), + #'services' => [], + } ); + + push @{$svcpart->{services}}, $svc; + + } + + $pkg{svcparts} = [ values %svcparts ]; + + push @packages, \%pkg; + + } + + return \@packages; + +} + +sub svc_link { + + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svcpart->{svc}!; + +} + +sub svc_label_link { + + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svc->{label}!; + +} + +sub svc_provision_link { + my ($pkg, $svcpart, $conf) = @_; + ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; + my $num_left = $svcpart->{quantity} - $svcpart->{count}; + my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}"; + + my $url; + if ( $svcpart->{svcdb} eq 'svc_external' + && $conf->exists('svc_external-skip_manual') + ) { + $url = "${p}edit/process/$svcpart->{svcdb}.cgi?". + "pkgnum=$pkg->{pkgnum}&". + "svcpart=$svcpart->{svcpart}"; + } else { + $url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart"; + } + + my $link = qq!!. + "Provision $svc_nbsp ($num_left)"; + if ( $conf->exists('legacy_link') ) { + $link .= '
'. + qq!!. + "Link to legacy $svc_nbsp ($num_left)"; + } + $link; +} + +sub svc_unprovision_link { + my $svc = shift or return ''; + qq!Unprovision!; +} + +# This should be generalized to use config options to determine order. +sub pkgsort_pkgnum_cancel { + if ($a->{cancel} and $b->{cancel}) { + return ($a->{pkgnum} <=> $b->{pkgnum}); + } elsif ($a->{cancel} or $b->{cancel}) { + return (-1) if ($b->{cancel}); + return (1) if ($a->{cancel}); + return (0); + } else { + return($a->{pkgnum} <=> $b->{pkgnum}); + } +} + +sub pkg_datestr { + my($pkg, $field, $conf) = @_ or return ''; + return ' ' unless $pkg->{$field}; + my $format = $conf->exists('pkg_showtimes') + ? '%D %l:%M:%S%P %z' + : '%b %o, %Y'; + ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; + $strip; +} + +sub pkg_change_link { + my $pkg = shift or return ''; + return qq!!. + qq!Change package!; +} + +sub pkg_suspend_link { + my $pkg = shift or return ''; + return qq!Suspend!; +} + +sub pkg_unsuspend_link { + my $pkg = shift or return ''; + return qq!Unsuspend!; +} + +sub pkg_cancel_link { + my $pkg = shift or return ''; + qq!!. + qq!Cancel now | !. + qq!Cancel later!; +} + +sub pkg_dates_link { + my $pkg = shift or return ''; + qq!Edit dates!; +} + +sub pkg_customize_link { + my $pkg = shift or return ''; + my $custnum = shift; + qq!Customize!; +} + +%> diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html new file mode 100644 index 000000000..0f3a98702 --- /dev/null +++ b/httemplate/view/cust_main/payment_history.html @@ -0,0 +1,357 @@ +<% + my( $cust_main ) = @_; + my $conf = new FS::Conf; + my $custnum = $cust_main->custnum; +%> + +

Payment History
+Post cash/check payment +| Process credit card payment +| Process electronic check (ACH) payment +
Post credit +
+ +<% +#get payment history +my @history = (); + +#invoices +foreach my $cust_bill ($cust_main->cust_bill) { + my $pre = ( $cust_bill->owed > 0 ) + ? 'Open ' + : ''; + my $post = ( $cust_bill->owed > 0 ) ? '' : ''; + my $invnum = $cust_bill->invnum; + push @history, { + 'date' => $cust_bill->_date, + 'desc' => qq!!. $pre. + "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'. + $post. '', + 'charge' => $cust_bill->charged, + }; +} + +#payments (some false laziness w/credits) +foreach my $cust_pay ($cust_main->cust_pay) { + + my $payby = $cust_pay->payby; + + my $payinfo; + if ( $payby eq 'CARD' ) { + $payinfo = $cust_pay->payinfo_masked; + } elsif ( $payby eq 'CHEK' && $cust_pay->payinfo =~ /^(\d+)\@(\d+)$/ ) { + $payinfo = "ABA $2, Acct# $1"; + } else { + $payinfo = $cust_pay->payinfo; + } + my @cust_bill_pay = $cust_pay->cust_bill_pay; + my @cust_pay_refund = $cust_pay->cust_pay_refund; + + my $target = "$payby$payinfo"; + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^CHEK$/Electronic check /; + $payby =~ s/^BILL$//; + $payby =~ s/^(CARD|COMP)$/$1 /; + my $info = $payby ? " ($payby$payinfo)" : ''; + + my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); + if ( scalar(@cust_bill_pay) == 0 + && scalar(@cust_pay_refund) == 0 ) { + #completely unapplied + $pre = 'Unapplied '; + $post = ''; + $apply = qq! (apply)'; + } elsif ( scalar(@cust_bill_pay) == 1 + && scalar(@cust_pay_refund) == 0 + && $cust_pay->unapplied == 0 ) { + #applied to one invoice, the usual situation + $desc = ' applied to Invoice #'. $cust_bill_pay[0]->invnum; + } elsif ( scalar(@cust_bill_pay) == 0 + && scalar(@cust_pay_refund) == 1 + && $cust_pay->unapplied == 0 ) { + #applied to one refund + $desc = ' refunded on '. time2str("%D", $cust_pay_refund[0]->_date); + } else { + #complicated + $desc = '
'; + foreach my $app ( sort { $a->_date <=> $b->_date } + ( @cust_bill_pay, @cust_pay_refund ) ) { + if ( $app->isa('FS::cust_bill_pay') ) { + $desc .= '  '. + '$'. $app->amount. + ' applied to Invoice #'. $app->invnum. + '
'; + #' on '. time2str("%D", $cust_bill_pay->_date). + } elsif ( $app->isa('FS::cust_pay_refund') ) { + $desc .= '  '. + '$'. $app->amount. + ' refunded on'. time2str("%D", $app->_date). + '
'; + } else { + die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; + } + } + if ( $cust_pay->unapplied > 0 ) { + $desc .= '  '. + '$'. + $cust_pay->unapplied. ' unapplied'. + qq! (apply)'. + '
'; + } + } + + my $refund = ''; + my $refund_days = $conf->config('card_refund-days') || 120; + if ( $cust_pay->closed !~ /^Y/i + && $cust_pay->payby =~ /^(CARD|CHEK)$/ + && time-$cust_pay->_date < $refund_days*86400 + && $cust_pay->unrefunded > 0 + ) { + $refund = qq! (refund)!; + } + + my $void = ''; + if ( $cust_pay->closed !~ /^Y/i + && $cust_pay->payby ne 'CARD' + && ( $cust_pay->payby ne 'CHEK' || $conf->exists('echeck-void') ) + ) { + $void = qq! (void)!; + } + + my $delete = ''; + if ( $cust_pay->closed !~ /^Y/i && $conf->exists('deletepayments') ) { + $delete = qq! (delete)!; + } + + my $unapply = ''; + if ( $cust_pay->closed !~ /^Y/i + && $conf->exists('unapplypayments') + && scalar(@cust_bill_pay) ) { + $unapply = qq! (unapply)!; + } + + push @history, { + 'date' => $cust_pay->_date, + 'desc' => $pre. "Payment$post$info$desc". + "$apply$refund$void$delete$unapply", + 'payment' => $cust_pay->paid, + 'target' => $target, + }; +} + +#voided payments +foreach my $cust_pay_void ($cust_main->cust_pay_void) { + + my $payby = $cust_pay_void->payby; + my $payinfo = $payby eq 'CARD' + ? $cust_pay_void->payinfo_masked + : $cust_pay_void->payinfo; + + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^CHEK$/Electronic check /; + $payby =~ s/^BILL$//; + $payby =~ s/^(CARD|COMP)$/$1 /; + my $info = $payby ? " ($payby$payinfo)" : ''; + + push @history, { + 'date' => $cust_pay_void->_date, + 'desc' => "Payment $info voided ". + time2str("%D", $cust_pay_void->void_date). + " by ". $cust_pay_void->otaker. '', + 'void_payment' => $cust_pay_void->paid, + }; + +} + +#credits (some false laziness w/payments) +foreach my $cust_credit ($cust_main->cust_credit) { + + my @cust_credit_bill = $cust_credit->cust_credit_bill; + my @cust_credit_refund = $cust_credit->cust_credit_refund; + + my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); + if ( scalar(@cust_credit_bill) == 0 + && scalar(@cust_credit_refund) == 0 ) { + #completely unapplied + $pre = 'Unapplied '; + $post = ''; + $apply = qq! (apply)'; + } elsif ( scalar(@cust_credit_bill) == 1 + && scalar(@cust_credit_refund) == 0 + && $cust_credit->credited == 0 ) { + #applied to one invoice, the usual situation + $desc = ' applied to Invoice #'. $cust_credit_bill[0]->invnum; + } elsif ( scalar(@cust_credit_bill) == 0 + && scalar(@cust_credit_refund) == 1 + && $cust_credit->credited == 0 ) { + #applied to one refund + $desc = ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); + } else { + #complicated + $desc = '
'; + foreach my $app ( sort { $a->_date <=> $b->_date } + ( @cust_credit_bill, @cust_credit_refund ) ) { + if ( $app->isa('FS::cust_credit_bill') ) { + $desc .= '  '. + '$'. $app->amount. + ' applied to Invoice #'. $app->invnum. + '
'; + #' on '. time2str("%D", $app->_date). + } elsif ( $app->isa('FS::cust_credit_refund') ) { + $desc .= '  '. + '$'. $app->amount. + ' refunded on'. time2str("%D", $app->_date). + '
'; + } else { + die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; + } + } + if ( $cust_credit->credited > 0 ) { + $desc .= '  $'. + $cust_credit->credited. ' unapplied'. + qq! (apply)'. + '
'; + } + } +# + my $delete = ''; + if ( $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits') ) { + $delete = qq! (!. + qq!delete)!; + } + + my $unapply = ''; + if ( $cust_credit->closed !~ /^Y/i + && $conf->exists('unapplycredits') + && scalar(@cust_credit_bill) ) { + $unapply = qq! (!. + qq!unapply)!; + } + + push @history, { + 'date' => $cust_credit->_date, + 'desc' => $pre. "Credit$post by ". $cust_credit->otaker. + ' ('. $cust_credit->reason. ')'. + "$desc$apply$delete$unapply", + 'credit' => $cust_credit->amount, + }; + +} + +#refunds +foreach my $cust_refund ($cust_main->cust_refund) { + + my $payby = $cust_refund->payby; + my $payinfo = $payby eq 'CARD' + ? $cust_refund->payinfo_masked + : $cust_refund->payinfo; + + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^CHEK$/Electronic check /; + $payby =~ s/^(CARD|COMP)$/$1 /; + + push @history, { + 'date' => $cust_refund->_date, + 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker, + 'refund' => $cust_refund->refund, + }; + +} + +%> + +<%= table() %> + + Date + Description + Charge + Payment + In-house
Credit
+ Refund + Balance + + +<% +#display payment history + +my %target; +my $balance = 0; +foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { + + my $charge = exists($item->{'charge'}) + ? sprintf('$%.2f', $item->{'charge'}) + : ''; + my $payment = exists($item->{'payment'}) + ? sprintf('- $%.2f', $item->{'payment'}) + : ''; + $payment ||= sprintf('- $%.2f', $item->{'void_payment'}) + if exists($item->{'void_payment'}); + my $credit = exists($item->{'credit'}) + ? sprintf('- $%.2f', $item->{'credit'}) + : ''; + my $refund = exists($item->{'refund'}) + ? sprintf('$%.2f', $item->{'refund'}) + : ''; + + my $target = exists($item->{'target'}) ? $item->{'target'} : ''; + + $balance += $item->{'charge'} if exists $item->{'charge'}; + $balance -= $item->{'payment'} if exists $item->{'payment'}; + $balance -= $item->{'credit'} if exists $item->{'credit'}; + $balance += $item->{'refund'} if exists $item->{'refund'}; + $balance = sprintf("%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + ( my $showbalance = '$'. $balance ) =~ s/^\$\-/- \$/; + +%> + + + + <% unless ( !$target || $target{$target}++ ) { %> + + <% } %> + <%= time2str("%D",$item->{'date'}) %> + <% if ( $target && $target{$target} == 1 ) { %> + + <% } %> + + + <%= $item->{'desc'} %> + <%= $charge %> + <%= $payment %> + <%= $credit %> + <%= $refund %> + <%= $showbalance %> + + +<% } %> + + + diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html new file mode 100644 index 000000000..e62949e56 --- /dev/null +++ b/httemplate/view/cust_main/quick-charge.html @@ -0,0 +1,32 @@ +<% + my( $cust_main ) = @_; + my $conf = new FS::Conf; +%> + +
+ +Description: + Amount: + <% + + #false laziness w/ edit/part_pkg.cgi + if ( $conf->exists('enable_taxclasses') ) { + print ''; + } else { + print ''; + } + +%> + + +
+ -- cgit v1.2.1 From 979005a72a338e4b8d2fa6bd6e6be63d8a3194ab Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 12 Dec 2004 18:51:31 +0000 Subject: fix form action url for template --- httemplate/view/cust_main/quick-charge.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html index e62949e56..0b51586d1 100644 --- a/httemplate/view/cust_main/quick-charge.html +++ b/httemplate/view/cust_main/quick-charge.html @@ -3,7 +3,7 @@ my $conf = new FS::Conf; %> -
+ Description:  Amount: -- cgit v1.2.1 From f7afca1829f8496509d10806439c37fcc1349135 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 29 Dec 2004 12:00:08 +0000 Subject: historical (immutable) invoice details about services and other history infrastructure --- httemplate/view/cust_main/packages.html | 58 +++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index c5a0706d6..068a8276f 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -5,8 +5,38 @@ my $packages = get_packages($cust_main, $conf); %> -Packages -( Bulk order and cancel packages (preserves services) ) +Packages + +<%= include('order_pkg.html', $cust_main ) %> + +<% if ( $conf->config('payby-default') ne 'HIDE' ) { %> + <%= include('quick-charge.html', $cust_main ) %> +<% } %> + +Bulk order and cancel packages (preserves services) +

+ +<% if ( @$packages ) { %> +Current packages +<% } %> + +<% if ( $cust_main->num_cancelled_pkgs ) { + if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me + || ( $conf->exists('hidecancelledpackages') + && ! $cgi->param('showcancelledpackages') + ) + ) + { + $cgi->param('showcancelledpackages', 1); +%> + ( show +<% } else { + $cgi->param('showcancelledpackages', 0); +%> + ( hide +<% } %> + cancelled packages ) +<% } %> <% if ( @$packages ) { %> @@ -159,12 +189,14 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { } } } -print ''; -} - #end display packages %> + +<% } else { %> +
+<% } %> + <% #subroutines @@ -173,12 +205,18 @@ sub get_packages { my $conf = shift; my @packages = (); + my $method; + if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me + || ( $conf->exists('hidecancelledpackages') + && ! $cgi->param('showcancelledpackages') ) + ) + { + $method = 'ncancelled_pkgs'; + } else { + $method = 'all_pkgs'; + } - foreach my $cust_pkg ( - $conf->exists('hidecancelledpackages') - ? $cust_main->ncancelled_pkgs - : $cust_main->all_pkgs - ) { + foreach my $cust_pkg ( $cust_main->$method() ) { my $part_pkg = $cust_pkg->part_pkg; -- cgit v1.2.1 From b5fbaadb1cb2893660e460a1d4a3cabe02774de7 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Mar 2005 14:31:50 +0000 Subject: - bring prepaid support into this century (close: Bug#1124) - finally get rid of fs_signup (everything is in fs_selfservice now) (Bug#413) - organize main menu sysadmin section so it is slightly less confusing --- httemplate/view/cust_main/payment_history.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 0f3a98702..db01ebbcf 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -50,6 +50,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^CHEK$/Electronic check /; + $payby =~ s/^PREP$/Prepaid card /; $payby =~ s/^BILL$//; $payby =~ s/^(CARD|COMP)$/$1 /; my $info = $payby ? " ($payby$payinfo)" : ''; -- cgit v1.2.1 From 18c025613fa052cf4ba8d484f1296cc2a1719a24 Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 21 Mar 2005 22:13:39 +0000 Subject: Added support for FAX invoice destinations using a HylaFAX server. Faxing plain text invoices is not supported. --- httemplate/view/cust_main/billing.html | 8 +++++++- httemplate/view/cust_main/tickets.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 18a203bd6..561fff992 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -16,10 +16,16 @@ Billing information <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> + + FAX invoices + + <%= ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> + + Email invoices - <%= join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no' %> + <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index d6ddfa64c..ea70d701d 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -30,7 +30,7 @@ Highest priority tickets (View all tickets for this customer) -(New ticket for this customer) +(New ticket for this customer) <%= table() %> # -- cgit v1.2.1 From 2b49cbe76b94c6c1561aa2bf37beba7d47591190 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Aug 2005 13:22:27 +0000 Subject: customer edit: abstract out billing info to billing.html, re-do payment type selection with HTML::Widgets::SelectLayers, add Switch/Solo/Maestro support for start date & issue #. customer view: re-order fields for consistency. selfservice API: support paystart_month, paystart_year, payissue and payip in MyAccount::process_payment and ::edit_info and Signup::new_customer, FS::cust_main::realtime_bop: support paystart_month paystart_year payissue payip fields --- httemplate/view/cust_main/billing.html | 97 ++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 29 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 561fff992..30397fd3e 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -6,28 +6,7 @@ Billing information (Bill now) <%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> - - Tax exempt - <%= $cust_main->tax ? 'yes' : 'no' %> - - - Postal invoices - - <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> - - - - FAX invoices - - <%= ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> - - - - Email invoices - - <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> - - + Billing type @@ -41,10 +20,37 @@ Billing information Card number <%= $cust_main->payinfo_masked %> + +<% +#false laziness w/elements/select-month_year.html & edit/cust_main/billing.html +my( $mon, $year ); +my $date = $cust_main->paydate || '12-2037'; +if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format + ( $mon, $year ) = ( $2, $1 ); +} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $mon, $year ) = ( $1, $3 ); +} else { + warn "unrecognized expiration date format: $date"; + ( $mon, $year ) = ( '', '' ); +} +%> Expiration - <%= $cust_main->paydate %> - + <%= "$mon/$year" %> + + +<% if ( $cust_main->paystart_month ) { %> + + Start date + <%= $cust_main->paystart_month. '/'. $cust_main->paystart_year %> + +<% } elsif ( $cust_main->payissue ) { %> + + Issue # + <%= $cust_main->payissue %> + +<% } %> + Name on card <%= $cust_main->payname %> @@ -96,10 +102,6 @@ Billing information <% } %> - - Expiration - <%= $cust_main->paydate %> - Attention <%= $cust_main->payname %> @@ -114,12 +116,49 @@ Billing information Authorized by <%= $cust_main->payinfo %> + +<% +#false laziness w/above etc. +my( $mon, $year ); +my $date = $cust_main->paydate || '12-2037'; +if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format + ( $mon, $year ) = ( $2, $1 ); +} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $mon, $year ) = ( $1, $3 ); +} else { + warn "unrecognized expiration date format: $date"; + ( $mon, $year ) = ( '', '' ); +} +%> Expiration - <%= $cust_main->paydate %> + <%= "$mon/$year" %> <% } %> + + Tax exempt + <%= $cust_main->tax ? 'yes' : 'no' %> + + + Postal invoices + + <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> + + + + FAX invoices + + <%= ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> + + + + Email invoices + + <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> + + + -- cgit v1.2.1 From 0186436eb38e70da0a015e49dab67cec5f1a3467 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 21 Sep 2005 12:49:51 +0000 Subject: add prepaid support which sets RADIUS Expiration attribute, update customer view package UI --- httemplate/view/cust_main/packages.html | 280 ++++++++++++++++++++++---------- 1 file changed, 193 insertions(+), 87 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 068a8276f..ece1b62bb 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -5,6 +5,10 @@ my $packages = get_packages($cust_main, $conf); %> + + Packages <%= include('order_pkg.html', $cust_main ) %> @@ -71,12 +75,10 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) <% } %> -<% - #foreach (qw(setup last_bill next_bill susp expire cancel)) { - # print qq! ! . pkg_datestr($pkg,$_,$conf) . qq!\n!; - #} - print "". &itable(''); + > + +<% sub myfreq { my $part_pkg = shift; my $freq = $part_pkg->freq_pretty; @@ -84,92 +86,190 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { $freq; } - if ( $pkg->{cancel} ) { #status: cancelled - - print ''. - ''; - unless ( $pkg->{setup} ) { - print ''; - } else { - print "'; - print "' - if $pkg->{'last_bill'}; - print "' - if $pkg->{'susp'}; - } + #this should use cust_pkg->status and cust_pkg->statuscolor eventually + + my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4; + my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%'; + #false laziness w/edit/REAL_cust_pkg.cgi + my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until ); + unless ( $pkg->{'part_pkg'}->is_prepaid ) { + $billed_or_prepaid = 'billed'; + $last_bill_or_renewed = 'Last bill'; + $next_bill_or_prepaid_until = 'Next bill'; } else { + $billed_or_prepaid = 'prepaid'; + $last_bill_or_renewed = 'Renewed'; + $next_bill_or_prepaid_until = 'Prepaid until'; + } - if ( $pkg->{susp} ) { #status: suspended - print ''. - ''; - unless ( $pkg->{setup} ) { - print ''; - } else { - print "'; - } - print "' - if $pkg->{'last_bill'}; - # next bill ?? - print "' - if $pkg->{'expire'}; - print ''; - - } else { #status: active - - unless ( $pkg->{setup} ) { #not setup - - print ''; - print ''; - } - - } else { #setup - - unless ( $pkg->{freq} ) { - print "". - ''; - } else { - print ''. - ''; - } - - } - - print "' - if $pkg->{'last_bill'}; - print "' - if $pkg->{'next_bill'}; - print "' - if $pkg->{'expire'}; - if ( $pkg->{freq} ) { - print ''; - } +%> - } +<% if ( $pkg->{cancel} ) { %> - } + + + <%= pkg_datestr($pkg,'cancel',$conf) %> + + + <% unless ( $pkg->{setup} ) { %> + + + + + + <% } else { %> + + + + <%= pkg_datestr($pkg, 'setup',$conf) %> + + + <% if ( $pkg->{'last_bill'} ) { %> + + + <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% } %> + + <% if ( $pkg->{'susp'} ) { %> + + + <%= pkg_datestr($pkg, 'susp',$conf) %> + + <% } %> + + <% } %> + +<% } else { %> + + <% if ( $pkg->{susp} ) { %> + + + + <%= pkg_datestr($pkg,'susp',$conf) %> + + + <% unless ( $pkg->{setup} ) { %> + + + + + + <% } else { %> + + + + <%= pkg_datestr($pkg, 'setup',$conf) %> + + + <% } %> + + <% if ( $pkg->{'last_bill'} ) { %> + + + <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% } %> + + + + <% if ( $pkg->{'expire'} ) { %> + + + <%= pkg_datestr($pkg, 'expire',$conf) %> + + <% } %> - print "
Cancelled '. pkg_datestr($pkg,'cancel',$conf). '
Never billed
Setup ". - pkg_datestr($pkg, 'setup',$conf). '
Last bill ". - pkg_datestr($pkg, 'last_bill',$conf). '
Suspended ". - pkg_datestr($pkg, 'susp',$conf). '
Suspended '. pkg_datestr($pkg,'susp',$conf). '
Never billed
Setup ". - pkg_datestr($pkg, 'setup',$conf). '
Last bill ". - pkg_datestr($pkg, 'last_bill',$conf). '
Expires ". - pkg_datestr($pkg, 'expire',$conf). '
( '. pkg_unsuspend_link($pkg). - ' | '. pkg_cancel_link($pkg). ' )
Not yet billed ('; - unless ( $pkg->{freq} ) { - print 'one-time charge)
( '. pkg_cancel_link($pkg). - ' )'; - } else { - print 'billed '. myfreq($pkg->{part_pkg}). ')
One-time charge
Billed '. - pkg_datestr($pkg,'setup',$conf). '
Active'. - ', billed '. myfreq($pkg->{part_pkg}). '
Setup '. - pkg_datestr($pkg, 'setup',$conf). '
Last bill ". - pkg_datestr($pkg, 'last_bill',$conf). '
Next bill ". - pkg_datestr($pkg, 'next_bill',$conf). '
Expires ". - pkg_datestr($pkg, 'expire',$conf). '
( '. pkg_suspend_link($pkg). - ' | '. pkg_cancel_link($pkg). ' )
Cancelled 
>Never billed
Setup 
<%= $last_bill_or_renewed %> 
Suspended 
Suspended 
>Never billed
Setup 
<%= $last_bill_or_renewed %> 
Expires 
\n"; + + >( <%= pkg_unsuspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> ) + + <% } else { %> + + <% unless ( $pkg->{setup} ) { %> + + <% unless ( $pkg->{'freq'} ) { %> + + + >Not yet billed (one-time charge) + + + + >( <%= pkg_cancel_link($pkg) %> ) + + + <% } else { %> + + + >Not yet billed (<%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %>) + + + <% } %> + + <% } else { %> + + <% unless ( $pkg->{freq} ) { %> + + + >One-time charge + + + + Billed  + <%= pkg_datestr($pkg,'setup',$conf) %> + + + <% } else { %> + + + >Active, <%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %> + + + + Setup  + <%= pkg_datestr($pkg, 'setup',$conf) %> + + + <% } %> + + <% } %> + + <% if ( $pkg->{'last_bill'} ) { %> + + <%= $last_bill_or_renewed %>  + <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% } %> + + <% if ( $pkg->{'next_bill'} ) { %> + + <%= $next_bill_or_prepaid_until %>  + <%= pkg_datestr($pkg, 'next_bill',$conf) %> + + <% } %> + + <% if ( $pkg->{'expire'} ) { %> + + Expires  + <%= pkg_datestr($pkg, 'expire',$conf) %> + + <% } %> + + <% if ( $pkg->{freq} ) { %> + + >( <%= pkg_suspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> ) + + <% } %> + + <% } %> + +<% } %> + + + + +<% if ($rowspan == 0) { print qq!\n!; next; } my $cnt = 0; @@ -342,9 +442,15 @@ sub pkgsort_pkgnum_cancel { sub pkg_datestr { my($pkg, $field, $conf) = @_ or return ''; return ' ' unless $pkg->{$field}; - my $format = $conf->exists('pkg_showtimes') - ? '%D %l:%M:%S%P %z' - : '%b %o, %Y'; + my $format = '%b'. + ' %o,'. + ' %Y'; + #$format .= ' %l:%M:%S%P %z' + $format .= ' %l'. + ':'. + '%M'. + ' %P' + if $conf->exists('cust_pkg-display_times'); ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; $strip; } -- cgit v1.2.1 From 33aeb33a7fafaf099c679c6d7150b54b99e4810f Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Oct 2005 07:34:58 +0000 Subject: add cc-void option --- httemplate/view/cust_main/payment_history.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index db01ebbcf..6c475c5f2 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -118,14 +118,14 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $void = ''; if ( $cust_pay->closed !~ /^Y/i - && $cust_pay->payby ne 'CARD' + && ( $cust_pay->payby ne 'CARD' || $conf->exists('cc-void') ) && ( $cust_pay->payby ne 'CHEK' || $conf->exists('echeck-void') ) ) { $void = qq! ( Date: Fri, 7 Oct 2005 02:25:41 +0000 Subject: add require_taxclasses config flag --- httemplate/view/cust_main/quick-charge.html | 53 +++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html index 0b51586d1..9e4fb8c6e 100644 --- a/httemplate/view/cust_main/quick-charge.html +++ b/httemplate/view/cust_main/quick-charge.html @@ -6,26 +6,43 @@ Description: - Amount: - <% +Amount: +<% #false laziness w/ edit/part_pkg.cgi %> +<% if ( $conf->exists('enable_taxclasses') ) { %> + + '; - my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county') - or die dbh->errstr; - $sth->execute or die $sth->errstr; - foreach my $taxclass ( map $_->[0], @{$sth->fetchall_arrayref} ) { - print qq!!; - } - print ''; - } else { - print ''; - } + <% foreach my $taxclass ( @taxclasses ) { %> + + -- cgit v1.2.1 From ba78aad5a6ccc0b6e8264dcb71ad5f0dc1947326 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 7 Oct 2005 04:50:56 +0000 Subject: mask out echeck account #s too --- httemplate/view/cust_main/billing.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 30397fd3e..5786a0711 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -69,7 +69,7 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format Account number - <%= $account %> + <%= 'x'x(length($account)-2). substr($account,(length($account)-2)) %> Bank name -- cgit v1.2.1 From d1a885c65ac10e19bed0333a380dafeb42c2cef1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 8 Oct 2005 00:47:20 +0000 Subject: fix tax class selection in package add/edit too --- httemplate/view/cust_main/quick-charge.html | 41 ++++------------------------- 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html index 9e4fb8c6e..2fe3d5f3d 100644 --- a/httemplate/view/cust_main/quick-charge.html +++ b/httemplate/view/cust_main/quick-charge.html @@ -1,49 +1,18 @@ <% my( $cust_main ) = @_; - my $conf = new FS::Conf; %>
- -Description: -Amount: -<% #false laziness w/ edit/part_pkg.cgi %> -<% if ( $conf->exists('enable_taxclasses') ) { %> - - - <% - my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county') - or die dbh->errstr; - $sth->execute or die $sth->errstr; - my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref}; - my @taxclasses = grep $_, keys %taxclasses; - %> - - <% foreach my $taxclass ( @taxclasses ) { %> - -
-- cgit v1.2.1 From cccd0b7cd38a88c131e19981be38434f87abe194 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Oct 2005 15:21:37 +0000 Subject: add CASH and WEST payment types (payments only, not cust_main.payby) --- httemplate/view/cust_main/payment_history.html | 56 +++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 5 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 6c475c5f2..e58b6248e 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,13 +1,56 @@ <% my( $cust_main ) = @_; - my $conf = new FS::Conf; my $custnum = $cust_main->custnum; + + my $conf = new FS::Conf; + + my @payby = $conf->config('payby'); + #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) + @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless grep /\w/, @payby; + my %payby = map { $_=>1 } @payby; + + my $s = 0; + %>

Payment History
-Post cash/check payment -| Process credit card payment -| Process electronic check (ACH) payment + +<% if ( $payby{'BILL'} ) { %> + + <%= $s++ ? ' | ' : '' %> + Post check payment + +<% } %> + +<% if ( $payby{'CASH'} ) { %> + + <%= $s++ ? ' | ' : '' %> + Post cash payment + +<% } %> + +<% if ( $payby{'WEST'} ) { %> + + <%= $s++ ? ' | ' : '' %> + Post Western Union payment + +<% } %> + +<% if ( $payby{'CARD'} || $payby{'DCRD'} ) { %> + + <%= $s++ ? ' | ' : '' %> + Process credit card payment + +<% } %> + +<% if ( $payby{'CHEK'} || $payby{'DCHK'} ) { %> + + <%= $s++ ? ' | ' : '' %> + Process electronic check (ACH) payment + +<% } %> +
Post credit
@@ -51,8 +94,11 @@ foreach my $cust_pay ($cust_main->cust_pay) { $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^CHEK$/Electronic check /; $payby =~ s/^PREP$/Prepaid card /; + $payby =~ s/^CARD$/Credit card #/; + $payby =~ s/^COMP$/Complimentary by /; + $payby =~ s/^CASH$/Cash/; + $payby =~ s/^WEST$/Western Union/; $payby =~ s/^BILL$//; - $payby =~ s/^(CARD|COMP)$/$1 /; my $info = $payby ? " ($payby$payinfo)" : ''; my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); -- cgit v1.2.1 From 4ae2e675666602cc034b46622cccfd2e214de952 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Nov 2005 01:24:06 +0000 Subject: huh seem to have overlooked this --- httemplate/view/cust_main/tickets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index ea70d701d..72d68152a 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -30,7 +30,7 @@ Highest priority tickets (View all tickets for this customer) -(New ticket for this customer) +(New ticket for this customer) <%= table() %> # -- cgit v1.2.1 From f10cd68f08a6bfbd565a83b40bacc3f55a1265b3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Nov 2005 10:47:12 +0000 Subject: add MCRD payment type for manually processed ccards --- httemplate/view/cust_main/payment_history.html | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index e58b6248e..f794ccf4a 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -51,6 +51,13 @@ <% } %> +<% if ( $payby{'MCRD'} ) { %> + + <%= $s++ ? ' | ' : '' %> + Post manual credit card payment + +<% } %> +
Post credit
@@ -98,6 +105,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { $payby =~ s/^COMP$/Complimentary by /; $payby =~ s/^CASH$/Cash/; $payby =~ s/^WEST$/Western Union/; + $payby =~ s/^MCRD$/Manual credit card/; $payby =~ s/^BILL$//; my $info = $payby ? " ($payby$payinfo)" : ''; -- cgit v1.2.1 From bbf01f2a628d15c0ca557cf68235f25d6d233ee7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Nov 2005 12:41:43 +0000 Subject: ignore blank lines in payby config --- httemplate/view/cust_main/payment_history.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index f794ccf4a..0eef2ad1c 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -4,10 +4,10 @@ my $conf = new FS::Conf; - my @payby = $conf->config('payby'); + my @payby = grep /\w/, $conf->config('payby'); #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) - unless grep /\w/, @payby; + unless @payby; my %payby = map { $_=>1 } @payby; my $s = 0; -- cgit v1.2.1 From 54c73b7ed85f88ef688f68ef8e1b0961dec14f0c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Dec 2005 16:58:40 +0000 Subject: fill in reason if empty when applying a credit to a refund --- httemplate/view/cust_main/payment_history.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 0eef2ad1c..ec99b8c54 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -229,11 +229,24 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) { $payby =~ s/^(CARD|COMP)$/$1 /; my $info = $payby ? " ($payby$payinfo)" : ''; + my $unvoid = ''; + if ( $cust_pay_void->closed !~ /^Y/i && $conf->exists('unvoid') ) { + $unvoid = qq! (unvoid)!; + } + push @history, { 'date' => $cust_pay_void->_date, 'desc' => "Payment $info voided ". time2str("%D", $cust_pay_void->void_date). - " by ". $cust_pay_void->otaker. '', + " by ". $cust_pay_void->otaker. ''. $unvoid, 'void_payment' => $cust_pay_void->paid, }; @@ -313,7 +326,10 @@ foreach my $cust_credit ($cust_main->cust_credit) { push @history, { 'date' => $cust_credit->_date, 'desc' => $pre. "Credit$post by ". $cust_credit->otaker. - ' ('. $cust_credit->reason. ')'. + ( $cust_credit->reason + ? ' ('. $cust_credit->reason. ')' + : '' + ). "$desc$apply$delete$unapply", 'credit' => $cust_credit->amount, }; -- cgit v1.2.1