% # don't allow changing these after the fact
% $field = '/elements/tr-fixed.html' if $billed;
<& $field,
- label => 'Amount',
- field => 'amount',
- value => sprintf('%.2f',$part_pkg->option('setup_fee')),
- size => 8,
- prefix => $money_char,
+ label => mt('Amount to charge'),
+ field => 'amount',
+ value => sprintf('%.2f',$part_pkg->option('setup_fee')),
+ size => 8,
+ prefix => $money_char,
&>
+% if ( $curuser->access_right('Edit package definition costs') ) {
+ <& $field,
+ label => mt('Cost'),
+ field => 'setup_cost',
+ value => sprintf('%.2f',$part_pkg->setup_cost),
+ size => 8,
+ prefix => $money_char,
+ &>
+% }
+
% if ( $conf->exists('invoice-unitprice') ) {
<& $field,
label => 'Quantity',
}
&>
% }
+
% } else { # new one-time charge
-<TR>
- <TD ALIGN="right"><% mt('Amount') |h %> </TD>
- <TD>
- <% $money_char %><INPUT TYPE = "text"
- NAME = "amount"
- SIZE = 6
- VALUE = "<% $amount %>"
- onChange = "return enable_quick_charge(event)"
- onKeyPress = "return enable_quick_charge(event)"
- >
- </TD>
-</TR>
+ <TR>
+ <TD ALIGN="right"><% mt('Amount to charge') |h %> </TD>
+ <TD>
+ <% $money_char %><INPUT TYPE = "text"
+ NAME = "amount"
+ SIZE = 8
+ VALUE = "<% $amount %>"
+ onChange = "return enable_quick_charge(event)"
+ onKeyPress = "return enable_quick_charge(event)"
+ >
+ </TD>
+ </TR>
+
+% if ( $curuser->access_right('Edit package definition costs') ) {
+ <& /elements/tr-input-text.html,
+ label => mt('Cost'),
+ field => 'setup_cost',
+ value => $setup_cost,
+ size => 8,
+ prefix => $money_char,
+ &>
+% }
% if ( $conf->exists('invoice-unitprice') ) {
<TR>
>
<% mt('with terms') |h %>
<& /elements/select-terms.html,
- 'curr_value' => scalar($cgi->param('invoice_terms')),
- 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ),
+ 'curr_value' => scalar($cgi->param('invoice_terms')),
+ 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ),
+ 'agentnum' => $cust_main->agentnum,
&>
</TD>
</TR>
$amount = $1;
}
+my $setup_cost = '';
+if ( $cgi->param('setup_cost') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ ) {
+ $setup_cost = $1;
+}
+
my $quantity = 1;
if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
$quantity = $1;
if ( $cust_main->invoice_terms ) {
$default_terms = emt("Customer default ([_1])", $cust_main->invoice_terms);
} else {
- $default_terms = emt("Default ([_1])",
- ($conf->config('invoice_default_terms') || emt('Payable upon receipt'))
- );
+ $default_terms =
+ emt( "Default ([_1])",
+ ( $conf->config('invoice_default_terms', $cust_main->agentnum)
+ || emt('Payable upon receipt')
+ )
+ );
}
my @description;
}
my $part_pkg;
+my $billed = 0;
if ( $cust_pkg ) { # set defaults
$part_pkg = $cust_pkg->part_pkg;
push @description, $part_pkg->option("additional_info$i",1);
}
}
+ $billed = $cust_pkg->get('setup') ? 1 : 0;
}
-my $billed = $cust_pkg->get('setup') ? 1 : 0;
-
</%init>