X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fquick-charge.html;h=4d87fab28840eaf19a06d3531b7e6baf95bec535;hb=305196a8632844f0224ed58b59aae51e4c6a80cc;hp=ec1a58046219e1b270f8701e1a1ea9a8d33fee79;hpb=2457752a82358108aa078f175a4e866f1786299a;p=freeside.git
diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html
index ec1a58046..4d87fab28 100644
--- a/httemplate/edit/quick-charge.html
+++ b/httemplate/edit/quick-charge.html
@@ -1,5 +1,5 @@
<& /elements/header-popup.html, mt('One-time charge'), '',
- ( $cgi->param('error') ? '' : 'onload="addRow()"' ),
+ ( ($quotationnum || $cgi->param('error')) ? '' : 'onload="addRow()"' ),
&>
@@ -100,11 +100,13 @@ function bill_now_changed (what) {
onSubmit = "document.QuickChargeForm.submit.disabled=true; return validate_quick_charge();"
>
-
+
+
+
-% if ( $cust_pkg ) {
+% if ( $cust_pkg ) { #modify one-time charge
% my $field = '/elements/tr-input-text.html';
@@ -167,7 +169,22 @@ function bill_now_changed (what) {
noinit => 1,
}
&>
-% }
+
+ <& /elements/tr-checkbox.html,
+ label => emt('Invoice this charge separately'),
+ field => 'separate_bill',
+ value => 'Y',
+ curr_value => $cust_pkg->get('separate_bill'),
+ &>
+
+ <% mt('Tax exempt') |h %> |
+ param('setuptax') ? 'CHECKED' : '' %>> |
+
+
+ <& /elements/tr-select-taxclass.html, 'curr_value' => $part_pkg->get('taxclass') &>
+
+ <& /elements/tr-select-taxproduct.html, 'label' => emt('Tax product'), 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $part_pkg->get('taxproductnum') &>
+% }
% } else { # new one-time charge
@@ -209,63 +226,73 @@ function bill_now_changed (what) {
<& /elements/tr-select-pkg_class.html, 'curr_value' => $classnum &>
-
- <% mt('Invoice now') |h %> |
-
- param('bill_now') ? 'CHECKED' : '' %>
- onClick = "bill_now_changed(this);"
- onChange = "bill_now_changed(this);"
- >
- <% mt('with terms') |h %>
- <& /elements/select-terms.html,
- 'curr_value' => scalar($cgi->param('invoice_terms')),
- 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ),
- 'agentnum' => $cust_main->agentnum,
- &>
- |
-
+% unless ( $quotationnum ) {
-%# false laziness w/misc/order_pkg.html
-
- <% mt('Charge date') |h %> |
-
- param('bill_now')
- ? 'STYLE = "background-color:#dddddd" DISABLED'
- : ''
- %>
- >
-
- param('bill_now') ? '' : 'STYLE="display:none"' %>
- >
- (<% mt('leave blank to charge immediately') |h %>)
- |
-
+
+ <% mt('Invoice now') |h %> |
+
+ param('bill_now') ? 'CHECKED' : '' %>
+ onClick = "bill_now_changed(this);"
+ onChange = "bill_now_changed(this);"
+ >
+ <% mt('with terms') |h %>
+ <& /elements/select-terms.html,
+ 'curr_value' => scalar($cgi->param('invoice_terms')),
+ 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ),
+ 'agentnum' => $cust_or_prospect->agentnum,
+ &>
+ |
+
-
+% # false laziness w/misc/order_pkg.html
+
+ <% mt('Charge date') |h %> |
+
+ param('bill_now')
+ ? 'STYLE = "background-color:#dddddd" DISABLED'
+ : ''
+ %>
+ >
+
+ param('bill_now') ? '' : 'STYLE="display:none"' %>
+ >
+ (<% mt('leave blank to charge immediately') |h %>)
+ |
+
-% if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
+
+
+<& /elements/tr-checkbox.html,
+ label => emt('Invoice this charge separately'),
+ field => 'separate_bill',
+ value => 'Y'
+&>
+
+% }
+
+% if ( ! $quotationnum && $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
% my $what = lc(FS::payby->shortname($cust_main->payby));
<% mt("Disable automatic $what charge") |h %> |
@@ -300,13 +327,14 @@ function bill_now_changed (what) {
+% my $row = 0;
+% unless ($quotationnum) {
|
<% mt('Optional additional description (also printed on invoice):') |h %> |
-% my $row = 0;
-% foreach (@description) {
+% foreach (@description) {
|
@@ -321,8 +349,9 @@ function bill_now_changed (what) {
>
|
-% $row++;
-% }
+% $row++;
+% }
+% }
@@ -409,7 +438,7 @@ my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';
my $money_char = $conf->config('money_char') || '$';
-my ($cust_main, $cust_pkg);
+my( $cust_main, $cust_pkg, $prospect_main, $quotationnum ) = ( '', '', '', '' );
if ( $cgi->param('change_pkgnum') ) {
# change an existing one-time charge
die "access denied"
@@ -419,18 +448,37 @@ if ( $cgi->param('change_pkgnum') ) {
$cust_pkg = FS::cust_pkg->by_key($1) or die "pkgnum $1 not found";
$cust_main = $cust_pkg->cust_main;
} else {
- $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
- $cust_main = FS::cust_main->by_key($1) or die "custnum $1 not found";
+ if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
+ $quotationnum = $1;
+ }
+ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+ $cust_main = FS::cust_main->by_key($1) or die "custnum $1 not found";
+ }
+ if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
+ $prospect_main = FS::prospect_main->by_key($1) or die "prospectnum $1 not found";
+ }
+ die "custnum or prospectnum must be specified"
+ unless $cust_main || $prospect_main;
}
-my $custnum = $cust_main->custnum;
-# agent-virt
-if (!exists($curuser->agentnums_href->{$cust_main->agentnum})) {
- die "custnum $custnum not found";
+my $cust_or_prospect = $cust_main || $prospect_main;
+
+if ( $cust_main ) {
+ my $custnum = $cust_main->custnum;
+ # agent-virt
+ if (!exists($curuser->agentnums_href->{$cust_main->agentnum})) {
+ die "custnum $custnum not found";
+ }
+} elsif ( $prospect_main ) {
+ my $prospectnum = $prospect_main->prospectnum;
+ # agent-virt
+ if (!exists($curuser->agentnums_href->{$prospect_main->agentnum})) {
+ die "prospectnum $prospectnum not found";
+ }
}
my $format = "%m/%d/%Y %T %z (%Z)"; #false laziness w/REAL_cust_pkg.cgi?
-my $start_date = $cust_main->next_bill_date;
+my $start_date = $cust_main ? $cust_main->next_bill_date : '';
$start_date = $start_date ? time2str($format, $start_date) : '';
my $amount = '';
@@ -453,12 +501,12 @@ $cgi->param('pkg') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]*)$/
my $pkg = $1;
my $default_terms;
-if ( $cust_main->invoice_terms ) {
+if ( $cust_main && $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', $cust_main->agentnum)
+ ( $conf->config('invoice_default_terms', $cust_or_prospect->agentnum)
|| emt('Payable upon receipt')
)
);