X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fquick-charge.html;h=eca6c78e5b4197f997a3f43c778f6bb116f8e428;hb=52bea6aecfcc8274fd852f626a0f751e1b5bd6a8;hp=7b88bcce9287f5106df88a73d23674d96e56ef94;hpb=d5f138a9521a7b30cd08c4b616b407304a3ebe95;p=freeside.git diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 7b88bcce9..eca6c78e5 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -111,13 +111,23 @@ function bill_now_changed (what) { % # 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', @@ -158,20 +168,31 @@ function bill_now_changed (what) { } &> % } + % } else { # new one-time charge - - <% mt('Amount') |h %> - - <% $money_char %> - - + + <% mt('Amount to charge') |h %> + + <% $money_char %> + + + +% 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') ) { @@ -200,8 +221,9 @@ function bill_now_changed (what) { > <% 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, &> @@ -416,6 +438,11 @@ if ( $cgi->param('amount') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ ) { $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; @@ -429,9 +456,12 @@ my $default_terms; 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; @@ -459,6 +489,6 @@ if ( $cust_pkg ) { # set defaults } } -my $billed = $cust_pkg->get('setup') ? 1 : 0; +my $billed = ($cust_pkg and $cust_pkg->get('setup')) ? 1 : 0;