Revision 4c6e9282
Von Sven Schöling vor mehr als 8 Jahren hinzugefügt
bin/mozilla/ic.pl | ||
---|---|---|
197 | 197 |
$lxdebug->leave_sub(); |
198 | 198 |
} |
199 | 199 |
|
200 |
#sub choice { |
|
201 |
# $lxdebug->enter_sub(); |
|
202 |
# |
|
203 |
# $auth->assert('part_service_assembly_edit'); |
|
204 |
# |
|
205 |
# our ($j, $lastndx); |
|
206 |
# my ($totop100); |
|
207 |
# |
|
208 |
# $form->{title} = $locale->text('Top 100 hinzufuegen'); |
|
209 |
# |
|
210 |
# $form->header; |
|
211 |
# |
|
212 |
# push @custom_hiddens, qw(searchitems title bom titel revers lastsort sort ndxs_counter extras); |
|
213 |
# push @custom_hiddens, qw(itemstatus l_linetotal l_partnumber l_description l_onhand l_unit l_sellprice l_linetotalsellprice); |
|
214 |
# my @HIDDENS = ( |
|
215 |
# +{ name => 'row', value => $j }, |
|
216 |
# +{ name => 'nextsub', value => 'item_selected' }, |
|
217 |
# +{ name => 'test', value => 'item_selected' }, |
|
218 |
# +{ name => 'lastndx', value => $lastndx }, |
|
219 |
# map(+{ name => $_, value => $form->{$_} }, @custom_hiddens), |
|
220 |
# ); |
|
221 |
# |
|
222 |
# my ($partnumber, $description, $unit, $sellprice, $soldtotal); |
|
223 |
# # if choice set data |
|
224 |
## if ($form->{ndx}) { |
|
225 |
## for my $i (0 .. $form->{ndxs_counter}) { |
|
226 |
## |
|
227 |
## # insert data into top100 |
|
228 |
## push @{ $form->{parts} }, |
|
229 |
## { number => "", |
|
230 |
## partnumber => $form->{"totop100_partnumber_$j"}, |
|
231 |
## description => $form->{"totop100_description_$j"}, |
|
232 |
## unit => $form->{"totop100_unit_$j"}, |
|
233 |
## sellprice => $form->{"totop100_sellprice_$j"}, |
|
234 |
## soldtotal => $form->{"totop100_soldtotal_$j"}, |
|
235 |
## }; |
|
236 |
## } #rof |
|
237 |
## } #fi |
|
238 |
# |
|
239 |
# $totop100 = ""; |
|
240 |
# |
|
241 |
# # set data for next page |
|
242 |
# for my $i (1 .. $form->{ndxs_counter}) { |
|
243 |
# $partnumber = $form->{"totop100_partnumber_$i"}; |
|
244 |
# $description = $form->{"totop100_description_$i"}; |
|
245 |
# $unit = $form->{"totop100_unit_$i"}; |
|
246 |
# $sellprice = $form->{"totop100_sellprice_$i"}; |
|
247 |
# $soldtotal = $form->{"totop100_soldtotal_$i"}; |
|
248 |
# |
|
249 |
# push @PARTS, { |
|
250 |
# totop100_partnumber => $form->{"totop100_partnumber_$i"}, |
|
251 |
# totop100_description => $form->{"totop100_description_$i"}, |
|
252 |
# totop100_unit => $form->{"totop100_unit_$i"}, |
|
253 |
# totop100_sellprice => $form->{"totop100_sellprice_$i"}, |
|
254 |
# totop100_soldtotal => $form->{"totop100_soldtotal_$i"}, |
|
255 |
# } |
|
256 |
# |
|
257 |
## $totop100 .= qq| |
|
258 |
##<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}> |
|
259 |
##<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}> |
|
260 |
##<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}> |
|
261 |
##<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}> |
|
262 |
##<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}> |
|
263 |
## |; |
|
264 |
# } #rof |
|
265 |
# |
|
266 |
# print $form->parse_html_template('ic/choice', +{ HIDDENS => \@HIDDENS, PARTS => \@PARTS }); |
|
267 |
# |
|
268 |
# $lxdebug->leave_sub(); |
|
269 |
#} #end choice |
|
270 |
|
|
271 |
#sub list { |
|
272 |
# $lxdebug->enter_sub(); |
|
273 |
# |
|
274 |
# $auth->assert('part_service_assembly_edit'); |
|
275 |
# |
|
276 |
# our ($lastndx); |
|
277 |
# our ($partnumber, $description, $unit, $sellprice, $soldtotal); |
|
278 |
# |
|
279 |
# my @sortorders = ("", "partnumber", "description", "all"); |
|
280 |
# my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)]; |
|
281 |
# IC->get_parts(\%myconfig, \%$form, $sortorder); |
|
282 |
# |
|
283 |
# $form->{title} = $locale->text('Top 100 hinzufuegen'); |
|
284 |
# |
|
285 |
# $form->header; |
|
286 |
# |
|
287 |
# print qq| |
|
288 |
# <h1>| . $locale->text('choice part') . qq|</h1> |
|
289 |
# <form method=post action=ic.pl> |
|
290 |
# <table width=100%> |
|
291 |
# <tr class=listheading> |
|
292 |
# <th> </th> |
|
293 |
# <th class=listheading>| . $locale->text('Part Number') . qq|</th> |
|
294 |
# <th class=listheading>| . $locale->text('Part Description') . qq|</th> |
|
295 |
# <th class=listheading>| . $locale->text('Unit of measure') . qq|</th> |
|
296 |
# <th class=listheading>| . $locale->text('Sell Price') . qq|</th> |
|
297 |
# <th class=listheading>| . $locale->text('soldtotal') . qq|</th> |
|
298 |
# </tr>|; |
|
299 |
# |
|
300 |
# my $j = 0; |
|
301 |
# my $i = $form->{rows}; |
|
302 |
# |
|
303 |
# for ($j = 1; $j <= $i; $j++) { |
|
304 |
# |
|
305 |
# print qq| |
|
306 |
# <tr class=listrow| . ($j % 2) . qq|>|; |
|
307 |
# if ($j == 1) { |
|
308 |
# print qq| |
|
309 |
# <td><input name=ndx class=radio type=radio value=$j checked></td>|; |
|
310 |
# } else { |
|
311 |
# print qq| |
|
312 |
# <td><input name=ndx class=radio type=radio value=$j></td>|; |
|
313 |
# } |
|
314 |
# print qq| |
|
315 |
# <td><input name="new_partnumber_$j" type=hidden value="$form->{"partnumber_$j"}">$form->{"partnumber_$j"}</td> |
|
316 |
# <td><input name="new_description_$j" type=hidden value="$form->{"description_$j"}">$form->{"description_$j"}</td> |
|
317 |
# <td><input name="new_unit_$j" type=hidden value="$form->{"unit_$j"}">$form->{"unit_$j"}</td> |
|
318 |
# <td><input name="new_sellprice_$j" type=hidden value="$form->{"sellprice_$j"}">$form->{"sellprice_$j"}</td> |
|
319 |
# <td><input name="new_soldtotal_$j" type=hidden value="$form->{"soldtotal_$j"}">$form->{"soldtotal_$j"}</td> |
|
320 |
# </tr> |
|
321 |
# |
|
322 |
# <input name="new_id_$j" type=hidden value="$form->{"id_$j"}">|; |
|
323 |
# } |
|
324 |
# |
|
325 |
# print qq| |
|
326 |
# |
|
327 |
#</table> |
|
328 |
# |
|
329 |
#<br> |
|
330 |
# |
|
331 |
# |
|
332 |
#<input type=hidden name=itemstatus value="$form->{itemstatus}"> |
|
333 |
#<input type=hidden name=l_linetotal value="$form->{l_linetotal}"> |
|
334 |
#<input type=hidden name=l_partnumber value="$form->{l_partnumber}"> |
|
335 |
#<input type=hidden name=l_description value="$form->{l_description}"> |
|
336 |
#<input type=hidden name=l_onhand value="$form->{l_onhand}"> |
|
337 |
#<input type=hidden name=l_unit value="$form->{l_unit}"> |
|
338 |
#<input type=hidden name=l_sellprice value="$form->{l_sellprice}"> |
|
339 |
#<input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}"> |
|
340 |
#<input type=hidden name=sort value="$form->{sort}"> |
|
341 |
#<input type=hidden name=revers value="$form->{revers}"> |
|
342 |
#<input type=hidden name=lastsort value="$form->{lastsort}"> |
|
343 |
# |
|
344 |
#<input type=hidden name=bom value="$form->{bom}"> |
|
345 |
#<input type=hidden name=titel value="$form->{titel}"> |
|
346 |
#<input type=hidden name=searchitems value="$form->{searchitems}"> |
|
347 |
# |
|
348 |
#<input type=hidden name=row value=$j> |
|
349 |
# |
|
350 |
#<input type=hidden name=nextsub value=item_selected> |
|
351 |
# |
|
352 |
#<input name=lastndx type=hidden value=$lastndx> |
|
353 |
# |
|
354 |
#<input name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|; |
|
355 |
# |
|
356 |
# my $totop100 = ""; |
|
357 |
# |
|
358 |
# if (($form->{ndxs_counter}) > 0) { |
|
359 |
# for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) { |
|
360 |
# |
|
361 |
# $partnumber = $form->{"totop100_partnumber_$i"}; |
|
362 |
# $description = $form->{"totop100_description_$i"}; |
|
363 |
# $unit = $form->{"totop100_unit_$i"}; |
|
364 |
# $sellprice = $form->{"totop100_sellprice_$i"}; |
|
365 |
# $soldtotal = $form->{"totop100_soldtotal_$i"}; |
|
366 |
# |
|
367 |
# $totop100 .= qq| |
|
368 |
#<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}> |
|
369 |
#<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}> |
|
370 |
#<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}> |
|
371 |
#<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}> |
|
372 |
#<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}> |
|
373 |
# |; |
|
374 |
# } #rof |
|
375 |
# } #fi |
|
376 |
# |
|
377 |
# print $totop100; |
|
378 |
# |
|
379 |
# print qq| |
|
380 |
#<input class=submit type=submit name=action value="| |
|
381 |
# . $locale->text('TOP100') . qq|"> |
|
382 |
# |
|
383 |
#</form> |
|
384 |
#|; |
|
385 |
# $lxdebug->leave_sub(); |
|
386 |
#} #end list() |
|
387 |
|
|
388 | 200 |
sub top100 { |
389 |
$lxdebug->enter_sub(); |
|
390 |
|
|
391 |
$auth->assert('part_service_assembly_edit'); |
|
392 |
|
|
393 |
if ($form->{ndx}) { |
|
394 |
$form->{ndxs_counter}++; |
|
395 |
|
|
396 |
if ($form->{ndxs_counter} > 0) { |
|
397 |
|
|
398 |
my $index = $form->{ndx}; |
|
399 |
|
|
400 |
$form->{"totop100_partnumber_$form->{ndxs_counter}"} = $form->{"new_partnumber_$index"}; |
|
401 |
$form->{"totop100_description_$form->{ndxs_counter}"} = $form->{"new_description_$index"}; |
|
402 |
$form->{"totop100_unit_$form->{ndxs_counter}"} = $form->{"new_unit_$index"}; |
|
403 |
$form->{"totop100_sellprice_$form->{ndxs_counter}"} = $form->{"new_sellprice_$index"}; |
|
404 |
$form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $form->{"new_soldtotal_$index"}; |
|
405 |
} #fi |
|
406 |
} #fi |
|
407 |
&addtop100(); |
|
408 |
$lxdebug->leave_sub(); |
|
409 |
} #end top100 |
|
410 |
|
|
411 |
sub addtop100 { |
|
412 |
$lxdebug->enter_sub(); |
|
413 |
|
|
414 |
$auth->assert('part_service_assembly_edit'); |
|
415 |
|
|
416 |
my ($revers, $lastsort, $callback, $option, $description, $sameitem, |
|
417 |
$partnumber, $unit, $sellprice, $soldtotal, $totop100, $onhand, $align); |
|
418 |
my (@column_index, %column_header, %column_data); |
|
419 |
my ($totalsellprice, $totallastcost, $totallistprice, $subtotalonhand, $subtotalsellprice, $subtotallastcost, $subtotallistprice); |
|
420 |
|
|
421 |
$form->{top100} = "top100"; |
|
422 |
$form->{l_soldtotal} = "Y"; |
|
423 |
$form->{soldtotal} = "soldtotal"; |
|
424 |
$form->{sort} = "soldtotal"; |
|
425 |
$form->{l_qty} = "N"; |
|
426 |
$form->{l_linetotal} = ""; |
|
427 |
$form->{revers} = 1; |
|
428 |
$form->{number} = "position"; |
|
429 |
$form->{l_number} = "Y"; |
|
430 |
|
|
431 |
$totop100 = ""; |
|
432 |
|
|
433 |
$form->{title} = $locale->text('Top 100'); |
|
434 |
|
|
435 |
$revers = $form->{revers}; |
|
436 |
$lastsort = $form->{lastsort}; |
|
437 |
|
|
438 |
if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) { |
|
439 |
$form->{revers} = 0; |
|
440 |
$form->{lastsort} = "partnumber"; |
|
441 |
$form->{sort} = "partnumber"; |
|
442 |
} #fi |
|
443 |
|
|
444 |
$callback = |
|
445 |
"$form->{script}?action=top100&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title=" |
|
446 |
. $form->escape($form->{title}, 1); |
|
447 |
|
|
448 |
# if we have a serialnumber limit search |
|
449 |
if ($form->{serialnumber} || $form->{l_serialnumber}) { |
|
450 |
$form->{l_serialnumber} = "Y"; |
|
451 |
unless ( $form->{bought} |
|
452 |
|| $form->{sold} |
|
453 |
|| $form->{rfq} |
|
454 |
|| $form->{quoted}) { |
|
455 |
$form->{bought} = $form->{sold} = 1; |
|
456 |
} |
|
457 |
} |
|
458 |
IC->all_parts(\%myconfig, \%$form); |
|
459 |
|
|
460 |
if ($form->{itemstatus} eq 'active') { |
|
461 |
$option .= $locale->text('Active') . " : "; |
|
462 |
} |
|
463 |
if ($form->{itemstatus} eq 'obsolete') { |
|
464 |
$option .= $locale->text('Obsolete') . " : "; |
|
465 |
} |
|
466 |
if ($form->{itemstatus} eq 'orphaned') { |
|
467 |
$option .= $locale->text('Orphaned') . " : "; |
|
468 |
} |
|
469 |
if ($form->{itemstatus} eq 'onhand') { |
|
470 |
$option .= $locale->text('On Hand') . " : "; |
|
471 |
$form->{l_onhand} = "Y"; |
|
472 |
} |
|
473 |
if ($form->{itemstatus} eq 'short') { |
|
474 |
$option .= $locale->text('Short') . " : "; |
|
475 |
$form->{l_onhand} = "Y"; |
|
476 |
} |
|
477 |
if ($form->{onorder}) { |
|
478 |
$form->{l_ordnumber} = "Y"; |
|
479 |
$callback .= "&onorder=$form->{onorder}"; |
|
480 |
$option .= $locale->text('On Order') . " : "; |
|
481 |
} |
|
482 |
if ($form->{ordered}) { |
|
483 |
$form->{l_ordnumber} = "Y"; |
|
484 |
$callback .= "&ordered=$form->{ordered}"; |
|
485 |
$option .= $locale->text('Ordered') . " : "; |
|
486 |
} |
|
487 |
if ($form->{rfq}) { |
|
488 |
$form->{l_quonumber} = "Y"; |
|
489 |
$callback .= "&rfq=$form->{rfq}"; |
|
490 |
$option .= $locale->text('RFQ') . " : "; |
|
491 |
} |
|
492 |
if ($form->{quoted}) { |
|
493 |
$form->{l_quonumber} = "Y"; |
|
494 |
$callback .= ""ed=$form->{quoted}"; |
|
495 |
$option .= $locale->text('Quoted') . " : "; |
|
496 |
} |
|
497 |
if ($form->{bought}) { |
|
498 |
$form->{l_invnumber} = "Y"; |
|
499 |
$callback .= "&bought=$form->{bought}"; |
|
500 |
$option .= $locale->text('Bought') . " : "; |
|
501 |
} |
|
502 |
if ($form->{sold}) { |
|
503 |
$form->{l_invnumber} = "Y"; |
|
504 |
$callback .= "&sold=$form->{sold}"; |
|
505 |
$option .= $locale->text('Sold') . " : "; |
|
506 |
} |
|
507 |
if ( $form->{bought} |
|
508 |
|| $form->{sold} |
|
509 |
|| $form->{onorder} |
|
510 |
|| $form->{ordered} |
|
511 |
|| $form->{rfq} |
|
512 |
|| $form->{quoted}) { |
|
513 |
|
|
514 |
$form->{l_lastcost} = ""; |
|
515 |
$form->{l_name} = "Y"; |
|
516 |
if ($form->{transdatefrom}) { |
|
517 |
$callback .= "&transdatefrom=$form->{transdatefrom}"; |
|
518 |
$option .= "\n<br>" |
|
519 |
. $locale->text('From') |
|
520 |
. " " |
|
521 |
. $locale->date(\%myconfig, $form->{transdatefrom}, 1); |
|
522 |
} |
|
523 |
if ($form->{transdateto}) { |
|
524 |
$callback .= "&transdateto=$form->{transdateto}"; |
|
525 |
$option .= "\n<br>" |
|
526 |
. $locale->text('To') |
|
527 |
. " " |
|
528 |
. $locale->date(\%myconfig, $form->{transdateto}, 1); |
|
529 |
} |
|
530 |
} |
|
531 |
|
|
532 |
$option .= "<br>"; |
|
533 |
|
|
534 |
if ($form->{partnumber}) { |
|
535 |
$callback .= "&partnumber=$form->{partnumber}"; |
|
536 |
$option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|; |
|
537 |
} |
|
538 |
if ($form->{ean}) { |
|
539 |
$callback .= "&partnumber=$form->{ean}"; |
|
540 |
$option .= $locale->text('EAN') . qq| : $form->{ean}<br>|; |
|
541 |
} |
|
542 |
if ($form->{partsgroup}) { |
|
543 |
$callback .= "&partsgroup=$form->{partsgroup}"; |
|
544 |
$option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|; |
|
545 |
} |
|
546 |
if ($form->{serialnumber}) { |
|
547 |
$callback .= "&serialnumber=$form->{serialnumber}"; |
|
548 |
$option .= $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|; |
|
549 |
} |
|
550 |
if ($form->{description}) { |
|
551 |
$callback .= "&description=$form->{description}"; |
|
552 |
$description = $form->{description}; |
|
553 |
$description =~ s/\n/<br>/g; |
|
554 |
$option .= $locale->text('Part Description') . qq| : $form->{description}<br>|; |
|
555 |
} |
|
556 |
if ($form->{make}) { |
|
557 |
$callback .= "&make=$form->{make}"; |
|
558 |
$option .= $locale->text('Make') . qq| : $form->{make}<br>|; |
|
559 |
} |
|
560 |
if ($form->{model}) { |
|
561 |
$callback .= "&model=$form->{model}"; |
|
562 |
$option .= $locale->text('Model') . qq| : $form->{model}<br>|; |
|
563 |
} |
|
564 |
if ($form->{drawing}) { |
|
565 |
$callback .= "&drawing=$form->{drawing}"; |
|
566 |
$option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|; |
|
567 |
} |
|
568 |
if ($form->{microfiche}) { |
|
569 |
$callback .= "µfiche=$form->{microfiche}"; |
|
570 |
$option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|; |
|
571 |
} |
|
572 |
if ($form->{l_soldtotal}) { |
|
573 |
$callback .= "&soldtotal=$form->{soldtotal}"; |
|
574 |
$option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|; |
|
575 |
} |
|
576 |
|
|
577 |
my @columns = $form->sort_columns( |
|
578 |
qw(number partnumber ean description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal) |
|
579 |
); |
|
580 |
|
|
581 |
if ($form->{l_linetotal}) { |
|
582 |
$form->{l_onhand} = "Y"; |
|
583 |
$form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice}; |
|
584 |
if ($form->{l_lastcost}) { |
|
585 |
$form->{l_linetotallastcost} = "Y"; |
|
586 |
if (($form->{searchitems} eq 'assembly') && !$form->{bom}) { |
|
587 |
$form->{l_linetotallastcost} = ""; |
|
588 |
} |
|
589 |
} |
|
590 |
$form->{l_linetotallistprice} = "Y" if $form->{l_listprice}; |
|
591 |
} |
|
592 |
|
|
593 |
if ($form->{searchitems} eq 'service') { |
|
594 |
|
|
595 |
# remove bin, weight and rop from list |
|
596 |
map { $form->{"l_$_"} = "" } qw(bin weight rop); |
|
597 |
|
|
598 |
$form->{l_onhand} = ""; |
|
201 |
$::lxdebug->enter_sub(); |
|
599 | 202 |
|
600 |
# qty is irrelevant unless bought or sold |
|
601 |
if ( $form->{bought} |
|
602 |
|| $form->{sold} |
|
603 |
|| $form->{onorder} |
|
604 |
|| $form->{ordered} |
|
605 |
|| $form->{rfq} |
|
606 |
|| $form->{quoted}) { |
|
607 |
$form->{l_onhand} = "Y"; |
|
608 |
} else { |
|
609 |
$form->{l_linetotalsellprice} = ""; |
|
610 |
$form->{l_linetotallastcost} = ""; |
|
611 |
} |
|
612 |
} |
|
203 |
$::auth->assert('part_service_assembly_edit'); |
|
613 | 204 |
|
614 |
foreach my $item (@columns) {
|
|
615 |
if ($form->{"l_$item"} eq "Y") {
|
|
616 |
push @column_index, $item;
|
|
205 |
$::form->{l_soldtotal} = "Y";
|
|
206 |
$::form->{sort} = "soldtotal";
|
|
207 |
$::form->{lastsort} = "soldtotal";
|
|
617 | 208 |
|
618 |
# add column to callback
|
|
619 |
$callback .= "&l_$item=Y";
|
|
620 |
}
|
|
621 |
}
|
|
209 |
$::form->{l_qty} = undef;
|
|
210 |
$::form->{l_linetotal} = undef;
|
|
211 |
$::form->{l_number} = "Y";
|
|
212 |
$::form->{number} = "position";
|
|
622 | 213 |
|
623 |
if ($form->{l_subtotal} eq 'Y') { |
|
624 |
$callback .= "&l_subtotal=Y"; |
|
214 |
unless ( $::form->{bought} |
|
215 |
|| $::form->{sold} |
|
216 |
|| $::form->{rfq} |
|
217 |
|| $::form->{quoted}) { |
|
218 |
$::form->{bought} = $::form->{sold} = 1; |
|
625 | 219 |
} |
626 | 220 |
|
627 |
$column_header{number} = |
|
628 |
qq|<th class=listheading nowrap>| . $locale->text('number') . qq|</th>|; |
|
629 |
$column_header{partnumber} = |
|
630 |
qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>| |
|
631 |
. $locale->text('Part Number') |
|
632 |
. qq|</a></th>|; |
|
633 |
$column_header{description} = |
|
634 |
qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>| |
|
635 |
. $locale->text('Part Description') |
|
636 |
. qq|</a></th>|; |
|
637 |
$column_header{partsgroup} = |
|
638 |
qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>| |
|
639 |
. $locale->text('Group') |
|
640 |
. qq|</a></th>|; |
|
641 |
$column_header{bin} = |
|
642 |
qq|<th><a class=listheading href=$callback&sort=bin>| |
|
643 |
. $locale->text('Bin') |
|
644 |
. qq|</a></th>|; |
|
645 |
$column_header{priceupdate} = |
|
646 |
qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>| |
|
647 |
. $locale->text('Updated') |
|
648 |
. qq|</a></th>|; |
|
649 |
$column_header{onhand} = |
|
650 |
qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>| |
|
651 |
. $locale->text('Qty') |
|
652 |
. qq|</th>|; |
|
653 |
$column_header{unit} = |
|
654 |
qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|; |
|
655 |
$column_header{listprice} = |
|
656 |
qq|<th class=listheading nowrap>| |
|
657 |
. $locale->text('List Price') |
|
658 |
. qq|</th>|; |
|
659 |
$column_header{lastcost} = |
|
660 |
qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|; |
|
661 |
$column_header{rop} = |
|
662 |
qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|; |
|
663 |
$column_header{weight} = |
|
664 |
qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|; |
|
665 |
|
|
666 |
$column_header{invnumber} = |
|
667 |
qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>| |
|
668 |
. $locale->text('Invoice Number') |
|
669 |
. qq|</a></th>|; |
|
670 |
$column_header{ordnumber} = |
|
671 |
qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>| |
|
672 |
. $locale->text('Order Number') |
|
673 |
. qq|</a></th>|; |
|
674 |
$column_header{quonumber} = |
|
675 |
qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>| |
|
676 |
. $locale->text('Quotation') |
|
677 |
. qq|</a></th>|; |
|
678 |
|
|
679 |
$column_header{name} = |
|
680 |
qq|<th nowrap><a class=listheading href=$callback&sort=name>| |
|
681 |
. $locale->text('Name') |
|
682 |
. qq|</a></th>|; |
|
683 |
|
|
684 |
$column_header{sellprice} = |
|
685 |
qq|<th class=listheading nowrap>| |
|
686 |
. $locale->text('Sell Price') |
|
687 |
. qq|</th>|; |
|
688 |
$column_header{linetotalsellprice} = |
|
689 |
qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|; |
|
690 |
$column_header{linetotallastcost} = |
|
691 |
qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|; |
|
692 |
$column_header{linetotallistprice} = |
|
693 |
qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|; |
|
694 |
|
|
695 |
$column_header{image} = |
|
696 |
qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|; |
|
697 |
$column_header{drawing} = |
|
698 |
qq|<th nowrap><a class=listheading href=$callback&sort=drawing>| |
|
699 |
. $locale->text('Drawing') |
|
700 |
. qq|</a></th>|; |
|
701 |
$column_header{microfiche} = |
|
702 |
qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>| |
|
703 |
. $locale->text('Microfiche') |
|
704 |
. qq|</a></th>|; |
|
705 |
|
|
706 |
$column_header{serialnumber} = |
|
707 |
qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>| |
|
708 |
. $locale->text('Serial Number') |
|
709 |
. qq|</a></th>|; |
|
710 |
$column_header{soldtotal} = |
|
711 |
qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>| |
|
712 |
. $locale->text('soldtotal') |
|
713 |
. qq|</a></th>|; |
|
714 |
|
|
715 |
$form->header; |
|
716 |
my $colspan = $#column_index + 1; |
|
717 |
|
|
718 |
print qq| |
|
719 |
<h1>$form->{title}</h1> |
|
720 |
|
|
721 |
<table width=100%> |
|
722 |
|
|
723 |
<tr><td colspan=$colspan>$option</td></tr> |
|
724 |
|
|
725 |
<tr class=listheading> |
|
726 |
|; |
|
727 |
|
|
728 |
map { print "\n$column_header{$_}" } @column_index; |
|
729 |
|
|
730 |
print qq| |
|
731 |
</tr> |
|
732 |
|; |
|
733 |
|
|
734 |
# add order to callback |
|
735 |
$form->{callback} = $callback .= "&sort=$form->{sort}"; |
|
736 |
|
|
737 |
# escape callback for href |
|
738 |
$callback = $form->escape($callback); |
|
739 |
|
|
740 |
if (@{ $form->{parts} }) { |
|
741 |
$sameitem = $form->{parts}->[0]->{ $form->{sort} }; |
|
742 |
} |
|
743 |
|
|
744 |
# insert numbers for top100 |
|
745 |
my $j = 0; |
|
746 |
foreach my $ref (@{ $form->{parts} }) { |
|
747 |
$j++; |
|
748 |
$ref->{number} = $j; |
|
749 |
} |
|
750 |
|
|
751 |
# if avaible -> insert choice here |
|
752 |
if (($form->{ndxs_counter}) > 0) { |
|
753 |
for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) { |
|
754 |
$partnumber = $form->{"totop100_partnumber_$i"}; |
|
755 |
$description = $form->{"totop100_description_$i"}; |
|
756 |
$unit = $form->{"totop100_unit_$i"}; |
|
757 |
$sellprice = $form->{"totop100_sellprice_$i"}; |
|
758 |
$soldtotal = $form->{"totop100_soldtotal_$i"}; |
|
759 |
|
|
760 |
$totop100 .= qq| |
|
761 |
<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}> |
|
762 |
<input type=hidden name=totop100_description_$i value=$form->{"totop100_description_$i"}> |
|
763 |
<input type=hidden name=totop100_unit_$i value=$form->{"totop100_unit_$i"}> |
|
764 |
<input type=hidden name=totop100_sellprice_$i value=$form->{"totop100_sellprice_$i"}> |
|
765 |
<input type=hidden name=totop100_soldtotal_$i value=$form->{"totop100_soldtotal_$i"}> |
|
766 |
|; |
|
767 |
|
|
768 |
# insert into list |
|
769 |
push @{ $form->{parts} }, |
|
770 |
{ number => "", |
|
771 |
partnumber => "$partnumber", |
|
772 |
description => "$description", |
|
773 |
unit => "$unit", |
|
774 |
sellprice => "$sellprice", |
|
775 |
soldtotal => "$soldtotal" }; |
|
776 |
} #rof |
|
777 |
} #fi |
|
778 |
# build data for columns |
|
779 |
my $i = 0; |
|
780 |
foreach my $ref (@{ $form->{parts} }) { |
|
781 |
|
|
782 |
if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) { |
|
783 |
if ($sameitem ne $ref->{ $form->{sort} }) { |
|
784 |
parts_subtotal(\@column_index, \$subtotalonhand, \$subtotalsellprice, \$subtotallastcost, \$subtotallistprice); |
|
785 |
$sameitem = $ref->{ $form->{sort} }; |
|
786 |
} |
|
787 |
} |
|
788 |
|
|
789 |
$ref->{exchangerate} = 1 unless $ref->{exchangerate}; |
|
790 |
$ref->{sellprice} *= $ref->{exchangerate}; |
|
791 |
$ref->{listprice} *= $ref->{exchangerate}; |
|
792 |
$ref->{lastcost} *= $ref->{exchangerate}; |
|
793 |
|
|
794 |
# use this for assemblies |
|
795 |
$onhand = $ref->{onhand}; |
|
796 |
|
|
797 |
$align = "left"; |
|
798 |
if ($ref->{assemblyitem}) { |
|
799 |
$align = "right"; |
|
800 |
$onhand = 0 if ($form->{sold}); |
|
801 |
} |
|
802 |
|
|
803 |
$ref->{description} =~ s/\n/<br>/g; |
|
804 |
|
|
805 |
$column_data{number} = |
|
806 |
"<td align=right>" |
|
807 |
. $form->format_amount(\%myconfig, $ref->{number}) |
|
808 |
. "</td>"; |
|
809 |
$column_data{partnumber} = |
|
810 |
"<td align=$align>$ref->{partnumber} </a></td>"; |
|
811 |
$column_data{description} = "<td>$ref->{description} </td>"; |
|
812 |
$column_data{partsgroup} = "<td>$ref->{partsgroup} </td>"; |
|
813 |
|
|
814 |
$column_data{onhand} = |
|
815 |
"<td align=right>" |
|
816 |
. $form->format_amount(\%myconfig, $ref->{onhand}) |
|
817 |
. "</td>"; |
|
818 |
$column_data{sellprice} = |
|
819 |
"<td align=right>" |
|
820 |
. $form->format_amount(\%myconfig, $ref->{sellprice}) |
|
821 |
. "</td>"; |
|
822 |
$column_data{listprice} = |
|
823 |
"<td align=right>" |
|
824 |
. $form->format_amount(\%myconfig, $ref->{listprice}) |
|
825 |
. "</td>"; |
|
826 |
$column_data{lastcost} = |
|
827 |
"<td align=right>" |
|
828 |
. $form->format_amount(\%myconfig, $ref->{lastcost}) |
|
829 |
. "</td>"; |
|
830 |
|
|
831 |
$column_data{linetotalsellprice} = "<td align=right>" |
|
832 |
. $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2) |
|
833 |
. "</td>"; |
|
834 |
$column_data{linetotallastcost} = "<td align=right>" |
|
835 |
. $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2) |
|
836 |
. "</td>"; |
|
837 |
$column_data{linetotallistprice} = "<td align=right>" |
|
838 |
. $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2) |
|
839 |
. "</td>"; |
|
840 |
|
|
841 |
if (!$ref->{assemblyitem}) { |
|
842 |
$totalsellprice += $onhand * $ref->{sellprice}; |
|
843 |
$totallastcost += $onhand * $ref->{lastcost}; |
|
844 |
$totallistprice += $onhand * $ref->{listprice}; |
|
845 |
|
|
846 |
$subtotalonhand += $onhand; |
|
847 |
$subtotalsellprice += $onhand * $ref->{sellprice}; |
|
848 |
$subtotallastcost += $onhand * $ref->{lastcost}; |
|
849 |
$subtotallistprice += $onhand * $ref->{listprice}; |
|
850 |
} |
|
851 |
|
|
852 |
$column_data{rop} = |
|
853 |
"<td align=right>" |
|
854 |
. $form->format_amount(\%myconfig, $ref->{rop}) . "</td>"; |
|
855 |
$column_data{weight} = |
|
856 |
"<td align=right>" |
|
857 |
. $form->format_amount(\%myconfig, $ref->{weight}) |
|
858 |
. "</td>"; |
|
859 |
$column_data{unit} = "<td>$ref->{unit} </td>"; |
|
860 |
$column_data{bin} = "<td>$ref->{bin} </td>"; |
|
861 |
$column_data{priceupdate} = "<td>$ref->{priceupdate} </td>"; |
|
862 |
|
|
863 |
$column_data{invnumber} = |
|
864 |
($ref->{module} ne 'oe') |
|
865 |
? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&callback=$callback>$ref->{invnumber}</a></td>" |
|
866 |
: "<td>$ref->{invnumber}</td>"; |
|
867 |
$column_data{ordnumber} = |
|
868 |
($ref->{module} eq 'oe') |
|
869 |
? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&callback=$callback>$ref->{ordnumber}</a></td>" |
|
870 |
: "<td>$ref->{ordnumber}</td>"; |
|
871 |
$column_data{quonumber} = |
|
872 |
($ref->{module} eq 'oe' && !$ref->{ordnumber}) |
|
873 |
? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&callback=$callback>$ref->{quonumber}</a></td>" |
|
874 |
: "<td>$ref->{quonumber}</td>"; |
|
875 |
|
|
876 |
$column_data{name} = "<td>$ref->{name}</td>"; |
|
877 |
|
|
878 |
$column_data{image} = |
|
879 |
($ref->{image}) |
|
880 |
? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>" |
|
881 |
: "<td> </td>"; |
|
882 |
$column_data{drawing} = |
|
883 |
($ref->{drawing}) |
|
884 |
? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>" |
|
885 |
: "<td> </td>"; |
|
886 |
$column_data{microfiche} = |
|
887 |
($ref->{microfiche}) |
|
888 |
? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>" |
|
889 |
: "<td> </td>"; |
|
890 |
|
|
891 |
$column_data{serialnumber} = "<td>$ref->{serialnumber}</td>"; |
|
892 |
|
|
893 |
$column_data{soldtotal} = "<td align=right>$ref->{soldtotal}</td>"; |
|
894 |
|
|
895 |
$i++; |
|
896 |
$i %= 2; |
|
897 |
print "<tr class=listrow$i>"; |
|
898 |
|
|
899 |
map { print "\n$column_data{$_}" } @column_index; |
|
900 |
|
|
901 |
print qq| |
|
902 |
</tr> |
|
903 |
|; |
|
904 |
} |
|
905 |
|
|
906 |
if ($form->{l_subtotal} eq 'Y') { |
|
907 |
parts_subtotal(\@column_index, \$subtotalonhand, \$subtotalsellprice, \$subtotallastcost, \$subtotallistprice); |
|
908 |
} #fi |
|
909 |
|
|
910 |
if ($form->{"l_linetotal"}) { |
|
911 |
map { $column_data{$_} = "<td> </td>" } @column_index; |
|
912 |
$column_data{linetotalsellprice} = |
|
913 |
"<th class=listtotal align=right>" |
|
914 |
. $form->format_amount(\%myconfig, $totalsellprice, 2) |
|
915 |
. "</th>"; |
|
916 |
$column_data{linetotallastcost} = |
|
917 |
"<th class=listtotal align=right>" |
|
918 |
. $form->format_amount(\%myconfig, $totallastcost, 2) |
|
919 |
. "</th>"; |
|
920 |
$column_data{linetotallistprice} = |
|
921 |
"<th class=listtotal align=right>" |
|
922 |
. $form->format_amount(\%myconfig, $totallistprice, 2) |
|
923 |
. "</th>"; |
|
924 |
|
|
925 |
print "<tr class=listtotal>"; |
|
926 |
|
|
927 |
map { print "\n$column_data{$_}" } @column_index; |
|
928 |
|
|
929 |
print qq|</tr> |
|
930 |
|; |
|
931 |
} |
|
932 |
|
|
933 |
print qq| |
|
934 |
<tr><td colspan=$colspan><hr size=3 noshade></td></tr> |
|
935 |
</table> |
|
936 |
|
|
937 |
|; |
|
938 |
|
|
939 |
print qq| |
|
940 |
|
|
941 |
<br> |
|
942 |
|
|
943 |
<form method=post action=$form->{script}> |
|
944 |
|
|
945 |
<input type=hidden name=itemstatus value="$form->{itemstatus}"> |
|
946 |
<input type=hidden name=l_linetotal value="$form->{l_linetotal}"> |
|
947 |
<input type=hidden name=l_partnumber value="$form->{l_partnumber}"> |
|
948 |
<input type=hidden name=l_description value="$form->{l_description}"> |
|
949 |
<input type=hidden name=l_onhand value="$form->{l_onhand}"> |
|
950 |
<input type=hidden name=l_unit value="$form->{l_unit}"> |
|
951 |
<input type=hidden name=l_sellprice value="$form->{l_sellprice}"> |
|
952 |
<input type=hidden name=l_linetotalsellprice value="$form->{l_linetotalsellprice}"> |
|
953 |
<input type=hidden name=sort value="$form->{sort}"> |
|
954 |
<input type=hidden name=revers value="$form->{revers}"> |
|
955 |
<input type=hidden name=lastsort value="$form->{lastsort}"> |
|
956 |
<input type=hidden name=parts value="$form->{parts}"> |
|
957 |
|
|
958 |
<input type=hidden name=bom value="$form->{bom}"> |
|
959 |
<input type=hidden name=titel value="$form->{titel}"> |
|
960 |
<input type=hidden name=searchitems value="$form->{searchitems}">|; |
|
961 |
|
|
962 |
print $totop100; |
|
963 |
|
|
964 |
print qq| |
|
965 |
<!-- <input type=hidden name=ndxs_counter value="$form->{ndxs_counter}">--> |
|
966 |
|
|
967 |
<!-- <input class=submit type=submit name=action value="| |
|
968 |
. $locale->text('choice') . qq|"> --> |
|
969 |
|
|
970 |
</form> |
|
971 |
|; |
|
221 |
generate_report(); |
|
972 | 222 |
|
973 | 223 |
$lxdebug->leave_sub(); |
974 |
} # end addtop100
|
|
224 |
} |
|
975 | 225 |
|
976 | 226 |
# |
977 | 227 |
# Report for Wares. |
Auch abrufbar als: Unified diff
is: top100 gegrillt. standardfunktion kann das genauso.
Ich hatte das beim Umstellen auf TT damals dringelassen, weil es noch
die addtop100 Funktionalität gab, mit der man sich Favoritenlisten bauen
konnte. Das ist jetzt fast 9 Jahre her, und die Funktion ist seit dem
kaputt.
Weg damit. Wenn gewünscht kann das beim merge von OD wieder
berücksichtigt werden.