X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_bill_event.cgi;h=df09bab7ac1636b0b8e1184ea30da8944aaa35d4;hb=2ec94a2d96b62fd452556819eb594dea6be2c65d;hp=77aa828872deda8f7780a53f5c4e9359f48f16a6;hpb=9811b8ce65909a293810ddbcd8c9b5ca963fba01;p=freeside.git diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 77aa82887..df09bab7a 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -1,49 +1,12 @@ - -% -% -%if ( $cgi->param('eventpart') && $cgi->param('eventpart') =~ /^(\d+)$/ ) { -% $cgi->param('eventpart', $1); -%} else { -% $cgi->param('eventpart', ''); -%} -% -%my ($creason, $newcreasonT, $newcreason); -%my ($sreason, $newsreasonT, $newsreason); -% -% -%my ($query) = $cgi->keywords; -%my $action = ''; -%my $part_bill_event = ''; -%my $currentreasonclass = ''; -%if ( $cgi->param('error') ) { -% $part_bill_event = new FS::part_bill_event ( { -% map { $_, scalar($cgi->param($_)) } fields('part_bill_event') -% } ); -%} -%if ( $query && $query =~ /^(\d+)$/ ) { -% $part_bill_event ||= qsearchs('part_bill_event',{'eventpart'=>$1}); -%} else { -% $part_bill_event ||= new FS::part_bill_event {}; -%} -%$action ||= $part_bill_event->eventpart ? 'Edit' : 'Add'; -%my $hashref = $part_bill_event->hashref; -% -% - - <% include('/elements/header.html', "$action Invoice Event Definition", menubar( - 'Main Menu' => popurl(2), 'View all invoice events' => popurl(2). 'browse/part_bill_event.cgi', ) ) %> -% if ( $cgi->param('error') ) { - - Error: <% $cgi->param('error') %> -% } +<% include('/elements/error.html') %>
@@ -59,16 +22,11 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> For - {eventpart} ? '' : 'MULTIPLE SIZE=7'%>> % tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname; % foreach my $payby ( keys %payby ) { -% - - % } - - customers @@ -141,23 +99,40 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> %my $conf = new FS::Conf; %my $money_char = $conf->config('money_char') || '$'; % +%my $late_taxclass = ''; +%my $late_percent_taxclass = ''; +%if ( $conf->exists('enable_taxclasses') ) { +% $late_taxclass = +% '
Taxclass '. +% include('/elements/select-taxclass.html', +% 'curr_value' => '%%%late_taxclass%%%', +% 'name' => 'late_taxclass' ); +% $late_percent_taxclass = +% '
Taxclass '. +% include('/elements/select-taxclass.html', +% 'curr_value' => '%%%late_percent_taxclass%%%', +% 'name' => 'late_percent_taxclass' ); +%} +% %#this is pretty kludgy right here. %tie my %events, 'Tie::IxHash', % % 'fee' => { % 'name' => 'Late fee (flat)', -% 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', +% 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\', \'$%%%charge%%%\', \'%%%late_taxclass%%%\' );', % 'html' => % 'Amount '. -% '
Reason ', +% '
Reason '. +% $late_taxclass, % 'weight' => 10, % }, % 'fee_percent' => { % 'name' => 'Late fee (percentage)', -% 'code' => '$cust_main->charge( sprintf(\'%.2f\', $cust_bill->owed * %%%percent%%% / 100 ), \'%%%reason%%%\' );', +% 'code' => '$cust_main->charge( sprintf(\'%.2f\', $cust_bill->owed * %%%percent%%% / 100 ), \'%%%percent_reason%%%\', \'%%%percent%%% percent\', \'%%%late_percent_taxclass%%%\' );', % 'html' => % 'Percent %'. -% '
Reason ', +% '
Reason '. +% $late_percent_taxclass, % 'weight' => 10, % }, % 'suspend' => { @@ -206,6 +181,13 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % 'weight' => 30, % }, % +% 'credit' => { +% 'name' => "Create and apply a credit for the customer's balance (i.e. write off as bad debt)", +% 'code' => '$cust_main->credit( $cust_main->balance, \'%%%credit_reason%%%\' );', +% 'html' => '', +% 'weight' => 30, +% }, +% % 'realtime-card' => { % 'name' => 'Run card with a Business::OnlinePayment realtime gateway', % 'code' => '$cust_bill->realtime_card();', @@ -243,6 +225,12 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % 'weight' => 50, % }, % +% 'send_email' => { +% 'name' => 'Send invoice (email only)', +% 'code' => '$cust_bill->email();', +% 'weight' => 50, +% }, +% % 'send_alternate' => { % 'name' => 'Send invoice (email/print/fax) with alternate template', % 'code' => '$cust_bill->send(\'%%%templatename%%%\');', @@ -261,7 +249,11 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % % 'send_agent' => { % 'name' => 'Send invoice (email/print/fax) ', -% 'code' => '$cust_bill->send(\'%%%agent_templatename%%%\', [ %%%agentnum%%% ], \'%%%agent_invoice_from%%%\');', +% 'code' => '$cust_bill->send( \'%%%agent_templatename%%%\', +% [ %%%agentnum%%% ], +% \'%%%agent_invoice_from%%%\', +% %%%agent_balanceover%%% +% );', % 'html' => sub { % ' % @@ -280,6 +272,13 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % % % +% +% +% +% %
if balance (this invoice and previous) over +% +% '. $money_char. ' +%
'; % }, % 'weight' => 50, @@ -395,16 +394,10 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % % 'apply' => { % 'name' => 'Apply unapplied payments and credits', -% 'code' => '$cust_main->apply_payments; $cust_main->apply_credits; "";', +% 'code' => '$cust_main->apply_payments_and_credits; "";', % 'weight' => 70, % }, % -% 'collect' => { -% 'name' => 'Collect on invoices (normally only used with a Late Fee and Generate Invoice events)', -% 'code' => '$cust_main->collect();', -% 'weight' => 80, -% }, -% %; % @@ -491,7 +484,14 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
-<% include('/elements/tr-select-reason.html', 'creason', 'C', $creason, $newcreasonT, $newcreason) %> +<% include('/elements/tr-select-reason.html', + 'field' => 'creason', + 'reason_class' => 'C', + 'curr_value' => $creason, + 'init_type' => $newcreasonT, + 'init_newreason' => $newcreason + ) +%>
@@ -499,7 +499,14 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
-<% include('/elements/tr-select-reason.html', 'sreason', 'S', $sreason, $newsreasonT, $newsreason) %> +<% include('/elements/tr-select-reason.html', + 'field' => 'sreason', + 'reason_class' => 'S', + 'curr_value' => $sreason, + 'init_type' => $newsreasonT, + 'init_newreason' => $newsreason + ) +%>
@@ -512,7 +519,38 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
- - +<% include('/elements/footer.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +if ( $cgi->param('eventpart') && $cgi->param('eventpart') =~ /^(\d+)$/ ) { + $cgi->param('eventpart', $1); +} else { + $cgi->param('eventpart', ''); +} + +my ($creason, $newcreasonT, $newcreason); +my ($sreason, $newsreasonT, $newsreason); + +my ($query) = $cgi->keywords; +my $action = ''; +my $part_bill_event = ''; +my $currentreasonclass = ''; +if ( $cgi->param('error') ) { + $part_bill_event = new FS::part_bill_event ( { + map { $_, scalar($cgi->param($_)) } fields('part_bill_event') + } ); +} +if ( $query && $query =~ /^(\d+)$/ ) { + $part_bill_event ||= qsearchs('part_bill_event',{'eventpart'=>$1}); +} else { + $part_bill_event ||= new FS::part_bill_event {}; +} +$action ||= $part_bill_event->eventpart ? 'Edit' : 'Add'; +my $hashref = $part_bill_event->hashref; +