summaryrefslogtreecommitdiff
path: root/httemplate/search/elements/report_cust_pay_or_refund.html
blob: 9af4e33dce570aa40e46c84f1ccd165d7ab07ad4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<%doc>

Examples:

  include( 'elements/report_cust_pay_or_refund.html',
               'thing'          => 'pay',
               'name_singular'  => 'payment',
         )

  include( 'elements/report_cust_pay_or_refund.html',
               'thing'          => 'refund',
               'name_singular'  => 'refund',
         )

</%doc>
<% include('/elements/header.html', $title ) %>

<FORM ACTION="<% $table %>.html" METHOD="GET">
<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
<INPUT TYPE="hidden" NAME="unapplied" VALUE="<% $unapplied %>">

<TABLE BGCOLOR="#cccccc" CELLSPACING=0>

  <TR>
    <TH CLASS="background" COLSPAN=2 ALIGN="left">
      <FONT SIZE="+1">Search options</FONT>
    </TH>
  </TR>

  <TR>
    <TD ALIGN="right"><% ucfirst(PL($name_singular)) %> of type: </TD>
    <TD>
      <SELECT NAME="payby" onChange="payby_changed(this)">
        <OPTION VALUE="">all</OPTION>
        <OPTION VALUE="CARD">credit card (all)</OPTION>
        <OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION>
        <OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION>
        <OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION>
        <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION>
        <OPTION VALUE="CHEK">electronic check / ACH</OPTION>
        <OPTION VALUE="BILL">check</OPTION>
        <OPTION VALUE="PREP">prepaid card</OPTION>
        <OPTION VALUE="CASH">cash</OPTION>
        <OPTION VALUE="WEST">Western Union</OPTION>
        <OPTION VALUE="MCRD">manual credit card</OPTION>
      </SELECT>
    </TD>
  </TR>

  <SCRIPT TYPE="text/javascript">
  
    function payby_changed(what) {
      if ( what.options[what.selectedIndex].value == 'BILL' ) {
	document.getElementById('checkno_caption').style.color = '#000000';
        what.form.payinfo.disabled = false;
	what.form.payinfo.style.backgroundColor = '#ffffff';
      } else {
	document.getElementById('checkno_caption').style.color = '#bbbbbb';
        what.form.payinfo.disabled = true;
	what.form.payinfo.style.backgroundColor = '#dddddd';
      }
    }

  </SCRIPT>

  <TR>
    <TD ALIGN="right"><FONT ID="checkno_caption" COLOR="#bbbbbb">Check #: </FONT></TD>
    <TD>
      <INPUT TYPE="text" NAME="payinfo" DISABLED STYLE="background-color: #dddddd">
    </TD>
  </TR>

  <% include( '/elements/tr-select-agent.html',
                 'curr_value'    => scalar($cgi->param('agentnum')),
                 'label'         => 'for agent: ',
                 'disable_empty' => 0,
             )
  %>

  <% include( '/elements/tr-select-user.html' ) %>

  <TR>
    <TD ALIGN="right" VALIGN="center">Payment</TD>
    <TD>
      <TABLE>
        <% include( '/elements/tr-input-beginning_ending.html',
                      layout   => 'horiz',
                  )
        %>
      </TABLE>
    </TD>
  </TR>

% if ( $void ) {
    <TR>
      <TD ALIGN="right" VALIGN="center">Voided</TD>
      <TD>
        <TABLE>
          <% include( '/elements/tr-input-beginning_ending.html',
                        prefix => 'void',
                        layout => 'horiz',
                    )
          %>
        </TABLE>
      </TD>
    </TR>
% }

  <% include( '/elements/tr-input-lessthan_greaterthan.html',
                'label' => 'Amount',
		'field' => 'paid',
            )
  %>

% if ( $table eq 'cust_pay' ) { 
  <% include( '/elements/tr-checkbox.html',
                'label' => 'Include tax names',
		'field' => 'tax_names',
                'value' => 1,
            )
  %>
% }

</TABLE>

<BR>
<INPUT TYPE="submit" VALUE="Get Report">

</FORM>

<% include('/elements/footer.html') %>
<%init>

my %opt = @_;
my $table = 'cust_'.$opt{'thing'};
my $name_singular = $opt{'name_singular'};

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');

my $void = $cgi->param('void') ? 1 : 0;
my $unapplied = $cgi->param('unapplied') ? 1 : 0;

my $title = $void ? "Voided $name_singular report" :
            $unapplied ? "Unapplied $name_singular report" :
            "\u$name_singular report" ;
$table .= '_void' if $void;

</%init>