2693
sub search_transfer {
2695
OE->get_warehouses(\%myconfig, \%$form);
2698
if (@{ $form->{all_warehouse} }) {
2699
$form->{selectwarehouse} = "<option>\n";
2700
$form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}| if $form->{warehouse_id};
2702
for (@{ $form->{all_warehouse} }) { $form->{selectwarehouse} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
2704
$form->error($locale->text('Nothing to transfer!'));
2707
$form->get_partsgroup(\%myconfig, { searchitems => 'part'});
2708
if (@{ $form->{all_partsgroup} }) {
2709
$form->{selectpartsgroup} = "<option>\n";
2710
for (@{ $form->{all_partsgroup} }) { $form->{selectpartsgroup} .= qq|<option value="$_->{partsgroup}--$_->{id}">$_->{partsgroup}\n| }
2713
$form->{title} = $locale->text('Transfer Inventory');
2720
<form method=post action=$form->{script}>
2724
<th class=listtop>$form->{title}</th>
2726
<tr height="5"></tr>
2731
<th align=right nowrap>|.$locale->text('Transfer from').qq|</th>
2732
<td><select name=fromwarehouse>$form->{selectwarehouse}</select></td>
2735
<th align=right nowrap>|.$locale->text('Transfer to').qq|</th>
2736
<td><select name=towarehouse>$form->{selectwarehouse}</select></td>
2739
<th align="right" nowrap="true">|.$locale->text('Part Number').qq|</th>
2740
<td><input name=partnumber size=20></td>
2743
<th align="right" nowrap="true">|.$locale->text('Description').qq|</th>
2744
<td><input name=description size=40></td>
2747
<th align=right nowrap>|.$locale->text('Group').qq|</th>
2748
<td><select name=partsgroup>$form->{selectpartsgroup}</select></td>
2754
<td><hr size=3 noshade></td>
2759
<input type=hidden name=nextsub value=list_transfer>
2761
<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">|;
2763
$form->hide_form(qw(path login sessionid));
2769
if ($form->{menubar}) {
2770
require "$form->{path}/menu.pl";
2785
$form->{sort} = "partnumber" unless $form->{sort};
2787
OE->get_inventory(\%myconfig, \%$form);
2790
$href = "$form->{script}?action=list_transfer";
2791
for (qw(direction oldsort path login sessionid)) { $href .= "&$_=$form->{$_}" }
2792
for (qw(partnumber fromwarehouse towarehouse description partsgroup)) { $href .= "&$_=".$form->escape($form->{$_}) }
2794
$form->sort_order();
2796
# construct callback
2797
$callback = "$form->{script}?action=list_transfer";
2798
for (qw(direction oldsort path login sessionid)) { $callback .= "&$_=$form->{$_}" }
2799
for (qw(partnumber fromwarehouse towarehouse description partsgroup)) { $callback .= "&$_=".$form->escape($form->{$_},1) }
2801
@column_index = $form->sort_columns(qw(partnumber description partsgroup make model fromwarehouse qty towarehouse transfer));
2803
$column_header{partnumber} = qq|<th><a class=listheading href=$href&sort=partnumber>|.$locale->text('Part Number').qq|</a></th>|;
2804
$column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
2805
$column_header{partsgroup} = qq|<th><a class=listheading href=$href&sort=partsgroup>|.$locale->text('Group').qq|</a></th>|;
2806
$column_header{fromwarehouse} = qq|<th><a class=listheading href=$href&sort=warehouse>|.$locale->text('From').qq|</a></th>|;
2807
$column_header{towarehouse} = qq|<th class=listheading>|.$locale->text('To').qq|</th>|;
2808
$column_header{qty} = qq|<th class=listheading>|.$locale->text('Qty').qq|</a></th>|;
2809
$column_header{transfer} = qq|<th class=listheading>|.$locale->text('Transfer').qq|</a></th>|;
2812
($warehouse, $warehouse_id) = split /--/, $form->{fromwarehouse};
2814
if ($form->{fromwarehouse}) {
2815
$option .= "\n<br>";
2816
$option .= $locale->text('From Warehouse')." : $warehouse";
2818
($warehouse, $warehouse_id) = split /--/, $form->{towarehouse};
2819
if ($form->{towarehouse}) {
2820
$option .= "\n<br>";
2821
$option .= $locale->text('To Warehouse')." : $warehouse";
2823
if ($form->{partnumber}) {
2824
$option .= "\n<br>" if ($option);
2825
$option .= $locale->text('Part Number')." : $form->{partnumber}";
2827
if ($form->{description}) {
2828
$option .= "\n<br>" if ($option);
2829
$option .= $locale->text('Description')." : $form->{description}";
2831
if ($form->{partsgroup}) {
2832
($partsgroup) = split /--/, $form->{partsgroup};
2833
$option .= "\n<br>" if ($option);
2834
$option .= $locale->text('Group')." : $partsgroup";
2837
$form->{title} = $locale->text('Transfer Inventory');
2839
$callback .= "&sort=$form->{sort}";
2846
<form method=post action=$form->{script}>
2848
<input type=hidden name=warehouse_id value=$warehouse_id>
2852
<th class=listtop>$form->{title}</th>
2854
<tr height="5"></tr>
2861
<tr class=listheading>|;
2863
for (@column_index) { print "\n$column_header{$_}" }
2869
if (@{ $form->{all_inventory} }) {
2870
$sameitem = $form->{all_inventory}->[0]->{$form->{sort}};
2874
foreach $ref (@{ $form->{all_inventory} }) {
2878
$column_data{partnumber} = qq|<td><input type=hidden name="id_$i" value=$ref->{id}>$ref->{partnumber}</td>|;
2879
$column_data{description} = "<td>$ref->{description} </td>";
2880
$column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
2881
$column_data{fromwarehouse} = qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse} </td>|;
2882
$column_data{towarehouse} = qq|<td>$warehouse </td>|;
2883
$column_data{qty} = qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|.$form->format_amount(\%myconfig, $ref->{qty}).qq|</td>|;
2884
$column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
2888
<tr class=listrow$j>";
2890
for (@column_index) { print "\n$column_data{$_}" }
2904
<td><hr size=3 noshade></td>
2910
<input name=callback type=hidden value="$callback">
2912
<input type=hidden name=rowcount value=$i>
2915
$form->{action} = "transfer";
2916
$form->hide_form(qw(path login sessionid action));
2919
<input class=submit type=submit name=action value="|.$locale->text('Transfer').qq|">|;
2921
if ($form->{menubar}) {
2922
require "$form->{path}/menu.pl";
2939
if (OE->transfer(\%myconfig, \%$form)) {
2940
$form->redirect($locale->text('Inventory transferred!'));
2942
$form->error($locale->text('Could not transfer Inventory!'));
2693
2947
sub rfq_ { &add };
2694
2948
sub quotation_ { &add };