import torrus 1.0.9
[freeside.git] / httemplate / edit / part_bill_event.cgi
index 051ef10..c0ff386 100755 (executable)
@@ -22,16 +22,11 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
   <TR>
     <TD ALIGN="right">For </TD>
     <TD>
-      <SELECT NAME="payby">
+      <SELECT NAME="payby" <% $hashref->{eventpart} ? '' : 'MULTIPLE SIZE=7'%>>
 % tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname;
 %           foreach my $payby ( keys %payby ) {
-%        
-
-
           <OPTION VALUE="<% $payby %>"<% ($part_bill_event->payby eq $payby) ? ' SELECTED' : '' %>><% $payby{$payby} %></OPTION>
 % } 
-
-
       </SELECT> customers
     </TD>
   </TR>
@@ -83,7 +78,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %  join("\n", map {
 %    '<OPTION VALUE="'. $_->pkgpart. '"'.
 %    ( $selected{$_->pkgpart} ? ' SELECTED' : '' ).
-%    '>'. $_->pkg. ' - '. $_->comment
+%    '>'. $_->pkg_comment
 %  } qsearch('part_pkg', { 'disabled' => '' } ) ).
 %  '</SELECT>';
 %}
@@ -101,6 +96,18 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %  '</SELECT>';
 %}
 %
+%sub honor_dundate {
+%  my $label = shift;
+%  my $plandata = shift;
+%  '<TABLE>'.
+%  '<TR><TD ALIGN="right">Allow delay until dun date? </TD>'.
+%  qq(<TD><INPUT TYPE="checkbox" NAME="$label" VALUE="$label => 1," ).
+%    ( $plandata->{$label} eq "$label => 1," ? 'CHECKED' : '' ).
+%  '>'.
+%  '</TD></TR>'.
+%  '</TABLE>'
+%}
+%
 %my $conf = new FS::Conf;
 %my $money_char = $conf->config('money_char') || '$';
 %
@@ -109,11 +116,13 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %if ( $conf->exists('enable_taxclasses') ) {
 %  $late_taxclass =
 %    '<BR>Taxclass '.
-%    include('/elements/select-taxclass.html', '%%%late_taxclass%%%',
+%    include('/elements/select-taxclass.html',
+%              'curr_value' => '%%%late_taxclass%%%',
 %              'name' => 'late_taxclass' );
 %  $late_percent_taxclass =
 %    '<BR>Taxclass '.
-%    include('/elements/select-taxclass.html', '%%%late_percent_taxclass%%%',
+%    include('/elements/select-taxclass.html',
+%              'curr_value' => '%%%late_percent_taxclass%%%',
 %              'name' => 'late_percent_taxclass' );
 %}
 %
@@ -140,35 +149,36 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %  },
 %  'suspend' => {
 %    'name'   => 'Suspend',
-%    'code'   => '$cust_main->suspend(reason => %%%sreason%%%);',
+%    'code'   => '$cust_main->suspend(reason => %%%sreason%%%, %%%honor_dundate%%% );',
+%    'html'   => sub { &honor_dundate('honor_dundate', @_) },
 %    'weight' => 10,
 %    'reason' => 'S',
 %  },
 %  'suspend-if-balance' => {
 %    'name'   => 'Suspend if balance (this invoice and previous) over',
-%    'code'   => '$cust_bill->cust_suspend_if_balance_over( %%%balanceover%%%, reason => %%%sreason%%%, );',
-%    'html'   => " $money_char ". '<INPUT TYPE="text" SIZE="7" NAME="balanceover" VALUE="%%%balanceover%%%">',
+%    'code'   => '$cust_bill->cust_suspend_if_balance_over( %%%balanceover%%%, reason => %%%sreason%%%, %%%balance_honor_dundate%%% );',
+%    'html'   => sub { " $money_char ". '<INPUT TYPE="text" SIZE="7" NAME="balanceover" VALUE="%%%balanceover%%%"> '. &honor_dundate('balance_honor_dundate', @_) },
 %    'weight' => 10,
 %    'reason' => 'S',
 %  },
 %  'suspend-if-pkgpart' => {
 %    'name'   => 'Suspend packages',
-%    'code'   => '$cust_main->suspend_if_pkgpart({pkgparts => [%%%if_pkgpart%%%,], reason => %%%sreason%%%,});',
-%    'html'   => sub { &select_pkgpart('if_pkgpart', @_) },
+%    'code'   => '$cust_main->suspend_if_pkgpart({pkgparts => [%%%if_pkgpart%%%,], reason => %%%sreason%%%, %%%if_pkgpart_honor_dundate%%% });',
+%    'html'   => sub { &select_pkgpart('if_pkgpart', @_). &honor_dundate('if_pkgpart_honor_dundate', @_) },
 %    'weight' => 10,
 %    'reason' => 'S',
 %  },
 %  'suspend-unless-pkgpart' => {
 %    'name'   => 'Suspend packages except',
-%    'code'   => '$cust_main->suspend_unless_pkgpart({unless_pkgpart => [%%%unless_pkgpart%%%], reason => %%%sreason%%%,});',
-%    'html'   => sub { &select_pkgpart('unless_pkgpart', @_) },
+%    'code'   => '$cust_main->suspend_unless_pkgpart({unless_pkgpart => [%%%unless_pkgpart%%%], reason => %%%sreason%%%, %%%unless_pkgpart_honor_dundate%%% });',
+%    'html'   => sub { &select_pkgpart('unless_pkgpart', @_). &honor_dundate('unless_pkgpart_honor_dundate' => @_) },
 %    'weight' => 10,
 %    'reason' => 'S',
 %  },
 %  'cancel' => {
 %    'name'   => 'Cancel',
 %    'code'   => '$cust_main->cancel(reason => %%%creason%%%);',
-%    'weight' => 10,
+%    'weight' => 80, #10,
 %    'reason' => 'C',
 %  },
 %
@@ -181,7 +191,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %  'comp' => {
 %    'name' => 'Pay invoice with a complimentary "payment"',
 %    'code' => '$cust_bill->comp();',
-%    'weight' => 30,
+%    'weight' => 90, #30,
 %  },
 %
 %  'credit' => {
@@ -252,7 +262,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 {
 %        '<TABLE BORDER=0>
 %          <TR>
@@ -271,6 +285,13 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %              <INPUT TYPE="text" NAME="agent_invoice_from" VALUE="%%%agent_invoice_from%%%">
 %            </TD>
 %          </TR>
+%          <TR>
+%            <TD ALIGN="right">if balance (this invoice and previous) over
+%            </TD>
+%            <TD>
+%              '. $money_char. '<INPUT TYPE="text" SIZE="7" NAME="agent_balanceover" VALUE="%%%agent_balanceover%%%">
+%            </TD>
+%          </TR>
 %        </TABLE>';
 %    },
 %    'weight' => 50,
@@ -390,12 +411,6 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %    'weight'  => 70,
 %  },
 %
-%  'collect' => {
-%    'name' => 'Collect on invoices (normally only used with a <i>Late Fee</i> and <i>Generate Invoice</i> events)',
-%    'code' => '$cust_main->send();',
-%    'weight'  => 80,
-%  },
-%
 %;
 %
 <SCRIPT TYPE="text/javascript">var myreasons = new Array();</SCRIPT>
@@ -426,6 +441,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %>
 %  print '<TD>'. $html. '</TD>' if $html;
 %  print qq!</TR>!;
 %  print '</TABLE>';
+%  print qq!<HR WIDTH="90%">!;
 %}
 %
 %  if ($currentreasonclass eq 'C'){