From 2d5f9e43a60773a9b079e96c330cb9e0e089800a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 30 Jan 2010 08:55:12 +0000 Subject: discounts, RT#6679 --- httemplate/elements/select-discount.html | 20 ++++++++++++++++++++ httemplate/elements/tr-select-discount.html | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 httemplate/elements/select-discount.html create mode 100644 httemplate/elements/tr-select-discount.html (limited to 'httemplate/elements') diff --git a/httemplate/elements/select-discount.html b/httemplate/elements/select-discount.html new file mode 100644 index 000000000..e0b6e6cbe --- /dev/null +++ b/httemplate/elements/select-discount.html @@ -0,0 +1,20 @@ +<% include( '/elements/select-table.html', + 'table' => 'discount', + 'name_col' => 'description', + 'order_by' => 'ORDER BY discountnum', #XXX weight + 'value' => $discountnum, + 'empty_label' => '(none)', + 'hashref' => { 'disabled' => '' }, + %opt, + ) +%> +<%init> + +my %opt = @_; +my $discountnum = $opt{'curr_value'} || $opt{'value'}; + +$opt{'records'} = delete $opt{'discount'} + if $opt{'discount'}; + + + diff --git a/httemplate/elements/tr-select-discount.html b/httemplate/elements/tr-select-discount.html new file mode 100644 index 000000000..4ff8d1357 --- /dev/null +++ b/httemplate/elements/tr-select-discount.html @@ -0,0 +1,27 @@ +% if ( scalar(@{ $opt{'discount'} }) == 0 ) { + + + +% } else { + + + <% $opt{'label'} || 'Discount' %> + + <% include( '/elements/select-discount.html', + 'curr_value' => $discountnum, + %opt, + ) + %> + + + +% } +<%init> + +my %opt = @_; +my $discountnum = $opt{'curr_value'} || $opt{'value'}; + +$opt{'discount'} ||= [ qsearch( 'discount', { disabled=>'' } ) ]; + + + -- cgit v1.2.1