65 |
65 |
}
|
66 |
66 |
|
67 |
67 |
sub search {
|
68 |
|
$main::lxdebug->enter_sub();
|
69 |
|
|
70 |
|
my $form = $main::form;
|
71 |
|
my %myconfig = %main::myconfig;
|
72 |
|
my $locale = $main::locale;
|
73 |
|
|
74 |
|
my ($name, $account, $onload);
|
|
68 |
$::lxdebug->enter_sub;
|
75 |
69 |
|
76 |
70 |
assert_bp_access();
|
77 |
71 |
|
78 |
|
# $locale->text('Sales Invoices')
|
79 |
|
# $locale->text('Sales Orders')
|
80 |
|
# $locale->text('Purchase Orders')
|
81 |
|
# $locale->text('Quotations')
|
82 |
|
# $locale->text('RFQs')
|
83 |
|
# $locale->text('Checks')
|
84 |
|
# $locale->text('Receipts')
|
85 |
|
|
86 |
72 |
# setup customer/vendor selection
|
87 |
|
BP->get_vc(\%myconfig, \%$form);
|
88 |
|
|
89 |
|
if (@{ $form->{"all_$form->{vc}"} || [] }) {
|
90 |
|
map { $name .= "<option>$_->{name}--$_->{id}\n" }
|
91 |
|
@{ $form->{"all_$form->{vc}"} };
|
92 |
|
$name = qq|<select name=$form->{vc}><option>\n$name</select>|;
|
93 |
|
} else {
|
94 |
|
$name = qq|<input name=$form->{vc} size=35>|;
|
95 |
|
}
|
96 |
|
|
97 |
|
# $locale->text('Customer')
|
98 |
|
# $locale->text('Vendor')
|
|
73 |
BP->get_vc(\%::myconfig, $::form);
|
99 |
74 |
|
100 |
75 |
my %label = (
|
101 |
|
invoice =>
|
102 |
|
{ title => 'Sales Invoices', name => 'Customer', l_invnumber => 'Y' },
|
103 |
|
sales_order =>
|
104 |
|
{ title => 'Sales Orders', name => 'Customer', l_ordnumber => 'Y' },
|
105 |
|
purchase_order =>
|
106 |
|
{ title => 'Purchase Orders', name => 'Vendor', l_ordnumber => 'Y' },
|
107 |
|
sales_quotation =>
|
108 |
|
{ title => 'Quotations', name => 'Customer', l_quonumber => 'Y' },
|
109 |
|
request_quotation =>
|
110 |
|
{ title => 'RFQs', name => 'Vendor', l_quonumber => 'Y' },
|
111 |
|
check => { title => 'Checks', name => 'Vendor' },
|
112 |
|
receipt => { title => 'Receipts', name => 'Customer' });
|
113 |
|
|
114 |
|
$label{invoice}{invnumber} = qq|
|
115 |
|
<tr>
|
116 |
|
<th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
|
117 |
|
<td colspan=3><input name=invnumber size=20></td>
|
118 |
|
</tr>
|
119 |
|
|;
|
120 |
|
$label{invoice}{ordnumber} = qq|
|
121 |
|
<tr>
|
122 |
|
<th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
|
123 |
|
<td colspan=3><input name=ordnumber size=20></td>
|
124 |
|
</tr>
|
125 |
|
|;
|
126 |
|
$label{sales_quotation}{quonumber} = qq|
|
127 |
|
<tr>
|
128 |
|
<th align=right nowrap>| . $locale->text('Quotation Number') . qq|</th>
|
129 |
|
<td colspan=3><input name=quonumber size=20></td>
|
130 |
|
</tr>
|
131 |
|
|;
|
132 |
|
|
133 |
|
$label{check}{chknumber} = qq|
|
134 |
|
<tr>
|
135 |
|
<th align=right nowrap>| . $locale->text('Reference') . qq|</th>
|
136 |
|
<td colspan=3><input name=chknumber size=20></td>
|
137 |
|
</tr>
|
138 |
|
|;
|
139 |
|
|
140 |
|
$label{sales_order}{ordnumber} = $label{invoice}{ordnumber};
|
141 |
|
$label{purchase_order}{ordnumber} = $label{invoice}{ordnumber};
|
142 |
|
$label{request_quotation}{quonumber} = $label{sales_quotation}{quonumber};
|
143 |
|
$label{receipt}{rctnumber} = $label{check}{chknumber};
|
144 |
|
|
145 |
|
# do one call to text
|
146 |
|
$form->{title} =
|
147 |
|
$locale->text('Print') . " "
|
148 |
|
. $locale->text($label{ $form->{type} }{title});
|
149 |
|
|
150 |
|
if ($form->{type} =~ /(check|receipt)/) {
|
151 |
|
if (BP->payment_accounts(\%myconfig, \%$form)) {
|
152 |
|
$account = qq|
|
153 |
|
<tr>
|
154 |
|
<th align=right>| . $locale->text('Account') . qq|</th>
|
155 |
|
|;
|
156 |
|
|
157 |
|
if ($form->{accounts}) {
|
158 |
|
$account .= qq|
|
159 |
|
<td colspan=3><select name=account>
|
160 |
|
|;
|
161 |
|
foreach my $ref (@{ $form->{accounts} }) {
|
162 |
|
$account .= qq|
|
163 |
|
<option>$ref->{accno}--$ref->{description}
|
164 |
|
|;
|
165 |
|
}
|
166 |
|
|
167 |
|
$account .= qq|
|
168 |
|
</select>
|
169 |
|
|;
|
170 |
|
} else {
|
171 |
|
$account .= qq|
|
172 |
|
<td colspan=3><input name=account></td>
|
173 |
|
|;
|
174 |
|
|
175 |
|
}
|
176 |
|
|
177 |
|
$account .= qq|
|
178 |
|
</tr>
|
179 |
|
|;
|
180 |
|
|
181 |
|
}
|
182 |
|
}
|
183 |
|
|
184 |
|
# use JavaScript Calendar or not
|
185 |
|
$form->{jsscript} = 1;
|
186 |
|
my $jsscript = "";
|
187 |
|
my ($button1, $button2);
|
188 |
|
if ($form->{jsscript}) {
|
189 |
|
|
190 |
|
# with JavaScript Calendar
|
191 |
|
$button1 = qq|
|
192 |
|
<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
|
193 |
|
<input type=button name=transdatefrom id="trigger1" value=|
|
194 |
|
. $locale->text('button') . qq|></td>
|
195 |
|
|;
|
196 |
|
$button2 = qq|
|
197 |
|
<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
|
198 |
|
<input type=button name=transdateto name=transdateto id="trigger2" value=|
|
199 |
|
. $locale->text('button') . qq|></td>
|
200 |
|
|;
|
201 |
|
|
202 |
|
#write Trigger
|
203 |
|
$jsscript =
|
204 |
|
Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
|
205 |
|
"transdateto", "BL", "trigger2");
|
206 |
|
} else {
|
207 |
|
|
208 |
|
# without JavaScript Calendar
|
209 |
|
$button1 = qq|
|
210 |
|
<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
|
211 |
|
$button2 = qq|
|
212 |
|
<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
|
213 |
|
}
|
214 |
|
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
|
215 |
|
$form->header;
|
216 |
|
$onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
|
217 |
|
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
|
218 |
|
print qq|
|
219 |
|
<body onLoad="$onload">
|
220 |
|
|
221 |
|
<form method=post action=bp.pl>
|
222 |
|
|
223 |
|
<input type=hidden name=vc value=$form->{vc}>
|
224 |
|
<input type=hidden name=type value=$form->{type}>
|
225 |
|
<input type=hidden name=title value="$form->{title}">
|
226 |
|
|
227 |
|
<table width=100%>
|
228 |
|
<tr><th class=listtop>$form->{title}</th></tr>
|
229 |
|
<tr height="5"></tr>
|
230 |
|
<tr>
|
231 |
|
<td>
|
232 |
|
<table>
|
233 |
|
<tr>
|
234 |
|
<th align=right>Kunde</th>
|
235 |
|
<td colspan=3>$name</td>
|
236 |
|
</tr>
|
237 |
|
$account
|
238 |
|
$label{$form->{type}}{invnumber}
|
239 |
|
$label{$form->{type}}{ordnumber}
|
240 |
|
$label{$form->{type}}{quonumber}
|
241 |
|
$label{$form->{type}}{chknumber}
|
242 |
|
$label{$form->{type}}{rctnumber}
|
243 |
|
<tr>
|
244 |
|
<th align=right nowrap>| . $locale->text('From') . qq|</th>
|
245 |
|
$button1
|
246 |
|
<th align=right>| . $locale->text('Bis') . qq|</th>
|
247 |
|
$button2
|
248 |
|
</tr>
|
249 |
|
<input type=hidden name=sort value=transdate>
|
250 |
|
</table>
|
251 |
|
</td>
|
252 |
|
</tr>
|
253 |
|
<tr>
|
254 |
|
<td><hr size=3 noshade></td>
|
255 |
|
</tr>
|
256 |
|
</table>
|
257 |
|
|
258 |
|
<input type=hidden name=nextsub value=list_spool>
|
259 |
|
|
260 |
|
<br>
|
261 |
|
<input class=submit type=submit name=action value="|
|
262 |
|
. $locale->text('Continue') . qq|">
|
263 |
|
|
264 |
|
</form>
|
265 |
|
|
266 |
|
</body>
|
|
76 |
invoice => { title => $::locale->text('Sales Invoices'), invnumber => 1, ordnumber => 1 },
|
|
77 |
sales_order => { title => $::locale->text('Sales Orders'), ordnumber => 1, },
|
|
78 |
purchase_order => { title => $::locale->text('Purchase Orders'), ordnumber => 1, },
|
|
79 |
sales_quotation => { title => $::locale->text('Quotations'), quonumber => 1, },
|
|
80 |
request_quotation => { title => $::locale->text('RFQs'), quonumber => 1, },
|
|
81 |
check => { title => $::locale->text('Checks'), chknumber => 1, },
|
|
82 |
receipt => { title => $::locale->text('Receipts'), rctnumber => 1, },
|
|
83 |
);
|
267 |
84 |
|
268 |
|
$jsscript
|
|
85 |
my $bp_accounts = $::form->{type} =~ /check|receipt/
|
|
86 |
&& BP->payment_accounts(\%::myconfig, $::form);
|
269 |
87 |
|
270 |
|
</html>
|
271 |
|
|;
|
|
88 |
$::form->header;
|
|
89 |
print $::form->parse_html_template('bp/search', {
|
|
90 |
label => \%label,
|
|
91 |
show_accounts => $bp_accounts,
|
|
92 |
account_sub => sub { ("$_[0]{accno}--$_[0]{description}")x2 },
|
|
93 |
vc_keys => sub { "$_[0]{name}--$_[0]{id}" },
|
|
94 |
});
|
272 |
95 |
|
273 |
|
$main::lxdebug->leave_sub();
|
|
96 |
$::lxdebug->leave_sub;
|
274 |
97 |
}
|
275 |
98 |
|
276 |
99 |
sub remove {
|
bp/search in templates umgebaut