~ubuntu-branches/debian/sid/sql-ledger/sid

« back to all changes in this revision

Viewing changes to bin/lynx/oe.pl

  • Committer: Bazaar Package Importer
  • Author(s): Raphaël Hertzog
  • Date: 2010-04-09 14:44:35 UTC
  • mfrom: (1.2.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100409144435-7ukjxn7532n5ereb
Tags: 2.8.30-1
* New upstream release:
  - added inventory transfer module
  - fixed broken pipe issue when printing reminders 

Show diffs side-by-side

added added

removed removed

Lines of Context:
2690
2690
}
2691
2691
 
2692
2692
 
 
2693
sub search_transfer {
 
2694
  
 
2695
  OE->get_warehouses(\%myconfig, \%$form);
 
2696
 
 
2697
  # warehouse
 
2698
  if (@{ $form->{all_warehouse} }) {
 
2699
    $form->{selectwarehouse} = "<option>\n";
 
2700
    $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}| if $form->{warehouse_id};
 
2701
 
 
2702
    for (@{ $form->{all_warehouse} }) { $form->{selectwarehouse} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
 
2703
  } else {
 
2704
    $form->error($locale->text('Nothing to transfer!'));
 
2705
  }
 
2706
  
 
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| }
 
2711
  }
 
2712
  
 
2713
  $form->{title} = $locale->text('Transfer Inventory');
 
2714
 
 
2715
  $form->header;
 
2716
 
 
2717
  print qq|
 
2718
<body>
 
2719
 
 
2720
<form method=post action=$form->{script}>
 
2721
 
 
2722
<table width=100%>
 
2723
  <tr>
 
2724
    <th class=listtop>$form->{title}</th>
 
2725
  </tr>
 
2726
  <tr height="5"></tr>
 
2727
  <tr>
 
2728
    <td>
 
2729
      <table>
 
2730
        <tr>
 
2731
          <th align=right nowrap>|.$locale->text('Transfer from').qq|</th>
 
2732
          <td><select name=fromwarehouse>$form->{selectwarehouse}</select></td>
 
2733
        </tr>
 
2734
        <tr>
 
2735
          <th align=right nowrap>|.$locale->text('Transfer to').qq|</th>
 
2736
          <td><select name=towarehouse>$form->{selectwarehouse}</select></td>
 
2737
        </tr>
 
2738
        <tr>
 
2739
          <th align="right" nowrap="true">|.$locale->text('Part Number').qq|</th>
 
2740
          <td><input name=partnumber size=20></td>
 
2741
        </tr>
 
2742
        <tr>
 
2743
          <th align="right" nowrap="true">|.$locale->text('Description').qq|</th>
 
2744
          <td><input name=description size=40></td>
 
2745
        </tr>
 
2746
        <tr>
 
2747
          <th align=right nowrap>|.$locale->text('Group').qq|</th>
 
2748
          <td><select name=partsgroup>$form->{selectpartsgroup}</select></td>
 
2749
        </tr>
 
2750
      </table>
 
2751
    </td>
 
2752
  </tr>
 
2753
  <tr>
 
2754
    <td><hr size=3 noshade></td>
 
2755
  </tr>
 
2756
</table>
 
2757
 
 
2758
<br>
 
2759
<input type=hidden name=nextsub value=list_transfer>
 
2760
 
 
2761
<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">|;
 
2762
 
 
2763
  $form->hide_form(qw(path login sessionid));
 
2764
 
 
2765
  print qq|
 
2766
</form>
 
2767
|;
 
2768
 
 
2769
  if ($form->{menubar}) {
 
2770
    require "$form->{path}/menu.pl";
 
2771
    &menubar;
 
2772
  }
 
2773
 
 
2774
  print qq|
 
2775
 
 
2776
</body>
 
2777
</html>
 
2778
|;
 
2779
 
 
2780
}
 
2781
 
 
2782
 
 
2783
sub list_transfer {
 
2784
 
 
2785
  $form->{sort} = "partnumber" unless $form->{sort};
 
2786
 
 
2787
  OE->get_inventory(\%myconfig, \%$form);
 
2788
  
 
2789
  # construct href
 
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->{$_}) }
 
2793
 
 
2794
  $form->sort_order();
 
2795
  
 
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) }
 
2800
 
 
2801
  @column_index = $form->sort_columns(qw(partnumber description partsgroup make model fromwarehouse qty towarehouse transfer));
 
2802
 
 
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>|;
 
2810
 
 
2811
  
 
2812
  ($warehouse, $warehouse_id) = split /--/, $form->{fromwarehouse};
 
2813
  
 
2814
  if ($form->{fromwarehouse}) {
 
2815
    $option .= "\n<br>";
 
2816
    $option .= $locale->text('From Warehouse')." : $warehouse";
 
2817
  }
 
2818
  ($warehouse, $warehouse_id) = split /--/, $form->{towarehouse};
 
2819
  if ($form->{towarehouse}) {
 
2820
    $option .= "\n<br>";
 
2821
    $option .= $locale->text('To Warehouse')." : $warehouse";
 
2822
  }
 
2823
  if ($form->{partnumber}) {
 
2824
    $option .= "\n<br>" if ($option);
 
2825
    $option .= $locale->text('Part Number')." : $form->{partnumber}";
 
2826
  }
 
2827
  if ($form->{description}) {
 
2828
    $option .= "\n<br>" if ($option);
 
2829
    $option .= $locale->text('Description')." : $form->{description}";
 
2830
  }
 
2831
  if ($form->{partsgroup}) {
 
2832
    ($partsgroup) = split /--/, $form->{partsgroup};
 
2833
    $option .= "\n<br>" if ($option);
 
2834
    $option .= $locale->text('Group')." : $partsgroup";
 
2835
  }
 
2836
 
 
2837
  $form->{title} = $locale->text('Transfer Inventory');
 
2838
 
 
2839
  $callback .= "&sort=$form->{sort}";
 
2840
  
 
2841
  $form->header;
 
2842
 
 
2843
  print qq|
 
2844
<body>
 
2845
 
 
2846
<form method=post action=$form->{script}>
 
2847
 
 
2848
<input type=hidden name=warehouse_id value=$warehouse_id>
 
2849
 
 
2850
<table width=100%>
 
2851
  <tr>
 
2852
    <th class=listtop>$form->{title}</th>
 
2853
  </tr>
 
2854
  <tr height="5"></tr>
 
2855
  <tr>
 
2856
    <td>$option</td>
 
2857
  </tr>
 
2858
  <tr>
 
2859
    <td>
 
2860
      <table width=100%>
 
2861
        <tr class=listheading>|;
 
2862
 
 
2863
for (@column_index) { print "\n$column_header{$_}" }
 
2864
 
 
2865
print qq|
 
2866
        </tr>
 
2867
|;
 
2868
 
 
2869
  if (@{ $form->{all_inventory} }) {
 
2870
    $sameitem = $form->{all_inventory}->[0]->{$form->{sort}};
 
2871
  }
 
2872
 
 
2873
  $i = 0;
 
2874
  foreach $ref (@{ $form->{all_inventory} }) {
 
2875
 
 
2876
    $i++;
 
2877
 
 
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}&nbsp;</td>";
 
2880
    $column_data{partsgroup} = "<td>$ref->{partsgroup}&nbsp;</td>";
 
2881
    $column_data{fromwarehouse} = qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse}&nbsp;</td>|;
 
2882
    $column_data{towarehouse} = qq|<td>$warehouse&nbsp;</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>|;
 
2885
 
 
2886
    $j++; $j %= 2;
 
2887
    print "
 
2888
        <tr class=listrow$j>";
 
2889
    
 
2890
    for (@column_index) { print "\n$column_data{$_}" }
 
2891
 
 
2892
    print qq|
 
2893
        </tr>
 
2894
|;
 
2895
 
 
2896
  }
 
2897
  
 
2898
  print qq|
 
2899
      </table>
 
2900
    </td>
 
2901
  </tr>
 
2902
  
 
2903
  <tr>
 
2904
    <td><hr size=3 noshade></td>
 
2905
  </tr>
 
2906
</table>
 
2907
 
 
2908
<br>
 
2909
 
 
2910
<input name=callback type=hidden value="$callback">
 
2911
 
 
2912
<input type=hidden name=rowcount value=$i>
 
2913
|;
 
2914
 
 
2915
  $form->{action} = "transfer";
 
2916
  $form->hide_form(qw(path login sessionid action));
 
2917
 
 
2918
  print qq|
 
2919
<input class=submit type=submit name=action value="|.$locale->text('Transfer').qq|">|;
 
2920
 
 
2921
  if ($form->{menubar}) {
 
2922
    require "$form->{path}/menu.pl";
 
2923
    &menubar;
 
2924
  }
 
2925
 
 
2926
  print qq|
 
2927
</form>
 
2928
 
 
2929
</body>
 
2930
</html>
 
2931
|;
 
2932
 
 
2933
 
 
2934
}
 
2935
 
 
2936
 
 
2937
sub transfer {
 
2938
 
 
2939
  if (OE->transfer(\%myconfig, \%$form)) {
 
2940
    $form->redirect($locale->text('Inventory transferred!'));
 
2941
  } else {
 
2942
    $form->error($locale->text('Could not transfer Inventory!'));
 
2943
  }
 
2944
 
 
2945
}
 
2946
 
2693
2947
sub rfq_ { &add };
2694
2948
sub quotation_ { &add };
2695
2949