summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorivan <ivan>2010-01-30 08:55:12 +0000
committerivan <ivan>2010-01-30 08:55:12 +0000
commit2d5f9e43a60773a9b079e96c330cb9e0e089800a (patch)
tree999756a0c9f3b1f6db2347925091f7e6d0e54ce5 /httemplate/elements
parent76722f634186b9e6f164640700029e6f1bee5722 (diff)
discounts, RT#6679
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-discount.html20
-rw-r--r--httemplate/elements/tr-select-discount.html27
2 files changed, 47 insertions, 0 deletions
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'};
+
+</%init>
+
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 ) {
+
+ <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'discountnum' %>" VALUE="">
+
+% } else {
+
+ <TR>
+ <TD ALIGN="right"><% $opt{'label'} || '<B>Discount</B>' %></TD>
+ <TD>
+ <% include( '/elements/select-discount.html',
+ 'curr_value' => $discountnum,
+ %opt,
+ )
+ %>
+ </TD>
+ </TR>
+
+% }
+<%init>
+
+my %opt = @_;
+my $discountnum = $opt{'curr_value'} || $opt{'value'};
+
+$opt{'discount'} ||= [ qsearch( 'discount', { disabled=>'' } ) ];
+
+</%init>
+