Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 480d9a56

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 480d9a56bed666562d3c115fa2da4c09ba66ac8d
  • Vorgänger c3c267fe
  • Nachfolger 0bb98f3e

Anzeige der bereits gelieferten Menge in Aufträgen im Ein- und Verkauf.

Unterschiede anzeigen:

SL/DO.pm
161 161
    my $sth = prepare_query($form, $dbh, $query);
162 162

  
163 163
    foreach my $dord (@{ $form->{DO} }) {
164
      next unless ($dord->{ordnumber});
164 165
      do_statement($form, $sth, $query, $dord->{ordnumber});
165 166
      ($dord->{oe_id}) = $sth->fetchrow_array();
166 167
    }
......
903 904
  $main::lxdebug->leave_sub();
904 905
}
905 906

  
907
sub get_shipped_qty {
908
  $main::lxdebug->enter_sub();
909

  
910
  my $self     = shift;
911
  my %params   = @_;
912

  
913
  Common::check_params(\%params, qw(type ordnumber));
914

  
915
  my $myconfig = \%main::myconfig;
916
  my $form     = $main::form;
917

  
918
  my $dbh      = $params{dbh} || $form->get_standard_dbh($myconfig);
919

  
920
  my $notsales = $params{type} eq 'sales' ? '' : 'NOT';
921

  
922
  my $query    =
923
    qq|SELECT doi.parts_id, doi.qty, doi.unit, p.unit AS partunit
924
       FROM delivery_order_items doi
925
       LEFT JOIN delivery_orders o ON (doi.delivery_order_id = o.id)
926
       LEFT JOIN parts p ON (doi.parts_id = p.id)
927
       WHERE ($notsales o.is_sales)
928
         AND (o.ordnumber = ?)|;
929

  
930
  my %ship      = ();
931
  my $entries   = selectall_hashref_query($form, $dbh, $query, $params{ordnumber});
932
  my $all_units = AM->retrieve_all_units();
933

  
934
  foreach my $entry (@{ $entries }) {
935
    $entry->{qty} *= $all_units->{$entry->{unit}}->{factor} / $all_units->{$entry->{partunit}}->{factor};
936

  
937
    if (!$ship{$entry->{parts_id}}) {
938
      $ship{$entry->{parts_id}} = $entry;
939
    } else {
940
      $ship{$entry->{parts_id}}->{qty} += $entry->{qty};
941
    }
942
  }
943

  
944
  $main::lxdebug->leave_sub();
945

  
946
  return %ship;
947
}
948

  
906 949
1;
bin/mozilla/io.pl
35 35

  
36 36
use CGI;
37 37
use CGI::Ajax;
38
use List::Util qw(max first);
38
use List::Util qw(min max first);
39 39

  
40 40
use SL::CVar;
41 41
use SL::Common;
......
111 111
  my $is_purchase        = (first { $_ eq $form->{type} } qw(request_quotation purchase_order purchase_delivery_order)) || ($form->{script} eq 'ir.pl');
112 112
  my $show_min_order_qty =  first { $_ eq $form->{type} } qw(request_quotation purchase_order);
113 113
  my $is_delivery_order  = $form->{type} =~ /_delivery_order$/;
114
  my $is_s_p_order       = (first { $_ eq $form->{type} } qw(sales_order purchase_order));
114 115

  
115 116
  if ($is_delivery_order) {
116 117
    $readonly             = ' readonly' if ($form->{closed});
......
132 133
    {  id => 'runningnumber', width => 5,     value => $locale->text('No.'),                  display => 1, },
133 134
    {  id => 'partnumber',    width => 8,     value => $locale->text('Number'),               display => 1, },
134 135
    {  id => 'description',   width => 30,    value => $locale->text('Part Description'),     display => 1, },
135
    {  id => 'ship',          width => 5,     value => ($form->{type} eq 'purchase_order' ? $locale->text('Ship rcvd') : $locale->text('Ship')),                 
136
       display => $form->{type} =~ /sales_order/ || ($form->{type} =~ /purchase_order/ && !($lizenzen && $form->{vc} eq "customer")) , },
136
    {  id => 'ship',          width => 5,     value => $locale->text('Delivered'),            display => $is_s_p_order, },
137 137
    {  id => 'qty',           width => 5,     value => $locale->text('Qty'),                  display => 1, },
138 138
    {  id => 'price_factor',  width => 5,     value => $locale->text('Price Factor'),         display => !$is_delivery_order, },
139 139
    {  id => 'unit',          width => 5,     value => $locale->text('Unit'),                 display => 1, },
......
188 188
    $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"};
189 189
  }
190 190

  
191
  _update_part_information();
192
  _update_ship() if ($is_s_p_order);
193

  
191 194
  # rows
192 195
  for $i (1 .. $numrows) {
193 196

  
194 197
    # undo formatting
195
    map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty ship discount sellprice price_new price_old) unless ($form->{simple_save});
198
    map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty discount sellprice price_new price_old) unless ($form->{simple_save});
196 199

  
197 200
# unit begin
198 201
    $form->{"unit_old_$i"}      ||= $form->{"unit_$i"};
......
250 253
    $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)", -value => $locale->text('*/'))
251 254
                       . $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"})
252 255
      if $form->{"formel_$i"};
253
    $column_data{ship} = $cgi->textfield(-name => "ship_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"ship_$i"}));
256
    $column_data{ship} = !$form->{"id_$i"} ? '' : $form->format_amount_units('amount'     => $form->{"ship_$i"} * 1,
257
                                                                             'part_unit'  => $form->{"partunit_$i"},
258
                                                                             'max_places' => 2,);
254 259

  
255 260
    # build in drop down list for pricesgroups
256 261
    if ($form->{"prices_$i"}) {
......
1844 1849
  $lxdebug->leave_sub();
1845 1850
}
1846 1851

  
1852
sub _update_part_information {
1853
  $lxdebug->enter_sub();
1854

  
1855
  my %part_information = IC->get_basic_part_info('id'        => [ grep { $_ } map { $form->{"id_${_}"} } (1..$form->{rowcount}) ],
1856
                                                 'vendor_id' => $form->{vendor_id});
1857

  
1858
  $form->{PART_INFORMATION} = \%part_information;
1859

  
1860
  foreach my $i (1..$form->{rowcount}) {
1861
    next unless ($form->{"id_${i}"});
1862

  
1863
    my $info                 = $form->{PART_INFORMATION}->{$form->{"id_${i}"}} || { };
1864
    $form->{"partunit_${i}"} = $info->{unit};
1865
  }
1866

  
1867
  $lxdebug->leave_sub();
1868
}
1869

  
1870
sub _update_ship {
1871
  $lxdebug->enter_sub();
1872

  
1873
  if (!$form->{ordnumber}) {
1874
    map { $form->{"ship_$_"} = 0 } (1..$form->{rowcount});
1875
    $lxdebug->leave_sub();
1876
    return;
1877
  }
1878

  
1879
  AM->retrieve_all_units();
1880

  
1881
  my %ship = DO->get_shipped_qty('type'      => ($form->{type} eq 'purchase_order') ? 'purchase' : 'sales',
1882
                                 'ordnumber' => $form->{ordnumber},);
1883

  
1884
  foreach my $i (1..$form->{rowcount}) {
1885
    next unless ($form->{"id_${i}"});
1886

  
1887
    $form->{"ship_$i"} = 0;
1888

  
1889
    my $ship_entry = $ship{$form->{"id_$i"}};
1890

  
1891
    next if (!$ship_entry || ($ship_entry->{qty} <= 0));
1892

  
1893
    my $rowqty =
1894
      $form->parse_amount(\%myconfig, $form->{"qty_$i"})
1895
      * $all_units->{$form->{"unit_$i"}}->{factor}
1896
      / $all_units->{$form->{"partunit_$i"}}->{factor};
1897

  
1898
    $form->{"ship_$i"}  = min($rowqty, $ship_entry->{qty});
1899
    $ship_entry->{qty} -= $form->{"ship_$i"};
1900
  }
1901

  
1902
  foreach my $i (1..$form->{rowcount}) {
1903
    next unless ($form->{"id_${i}"});
1904

  
1905
    my $ship_entry = $ship{$form->{"id_$i"}};
1906

  
1907
    next if (!$ship_entry || ($ship_entry->{qty} <= 0.01));
1908

  
1909
    $form->{"ship_$i"} += $ship_entry->{qty};
1910
    $ship_entry->{qty}  = 0;
1911
  }
1912

  
1913
  $lxdebug->leave_sub();
1914
}
bin/mozilla/oe.pl
33 33

  
34 34
use POSIX qw(strftime);
35 35

  
36
use SL::DO;
36 37
use SL::FU;
37 38
use SL::OE;
38 39
use SL::IR;
locale/de/dn
65 65
  'Date'                        => 'Datum',
66 66
  'Dec'                         => 'Dez',
67 67
  'December'                    => 'Dezember',
68
  'Delivered'                   => 'Geliefert',
68 69
  'Delivery Date'               => 'Lieferdatum',
69 70
  'Delivery Order'              => 'Lieferschein',
70 71
  'Department'                  => 'Abteilung',
......
209 210
  'September'                   => 'September',
210 211
  'Serial No.'                  => 'Seriennummer',
211 212
  'Set eMail text'              => 'eMail Text eingeben',
212
  'Ship'                        => 'Lagerausgang',
213
  'Ship rcvd'                   => 'Lagereingang',
214 213
  'Ship to'                     => 'Lieferadresse',
215 214
  'Shipping Address'            => 'Lieferadresse',
216 215
  'Start Dunning Process'       => 'Mahnprozess starten',
......
282 281
  'NTI'                         => 'NTI',
283 282
  'Q'                           => 'Q',
284 283
  '_check_io_auth'              => '_check_io_auth',
284
  '_update_part_information'    => '_update_part_information',
285
  '_update_ship'                => '_update_ship',
285 286
  'add'                         => 'add',
286 287
  'build_std_url'               => 'build_std_url',
287 288
  'calculate_qty'               => 'calculate_qty',
locale/de/do
302 302
  'NTI'                         => 'NTI',
303 303
  'Q'                           => 'Q',
304 304
  '_check_io_auth'              => '_check_io_auth',
305
  '_update_part_information'    => '_update_part_information',
306
  '_update_ship'                => '_update_ship',
305 307
  'add'                         => 'add',
306 308
  'build_std_url'               => 'build_std_url',
307 309
  'calculate_qty'               => 'calculate_qty',
locale/de/ic
74 74
  'Dec'                         => 'Dez',
75 75
  'December'                    => 'Dezember',
76 76
  'Delete'                      => 'L?schen',
77
  'Delivered'                   => 'Geliefert',
77 78
  'Delivery Date'               => 'Lieferdatum',
78 79
  'Delivery Order'              => 'Lieferschein',
79 80
  'Department'                  => 'Abteilung',
......
333 334
  'NTI'                         => 'NTI',
334 335
  'Q'                           => 'Q',
335 336
  '_check_io_auth'              => '_check_io_auth',
337
  '_update_part_information'    => '_update_part_information',
338
  '_update_ship'                => '_update_ship',
336 339
  'acc_menu'                    => 'acc_menu',
337 340
  'add'                         => 'add',
338 341
  'addtop100'                   => 'addtop100',
locale/de/io
58 58
  'Date'                        => 'Datum',
59 59
  'Dec'                         => 'Dez',
60 60
  'December'                    => 'Dezember',
61
  'Delivered'                   => 'Geliefert',
61 62
  'Delivery Date'               => 'Lieferdatum',
62 63
  'Delivery Order'              => 'Lieferschein',
63 64
  'Department'                  => 'Abteilung',
......
246 247
  'NTI'                         => 'NTI',
247 248
  'Q'                           => 'Q',
248 249
  '_check_io_auth'              => '_check_io_auth',
250
  '_update_part_information'    => '_update_part_information',
251
  '_update_ship'                => '_update_ship',
249 252
  'build_std_url'               => 'build_std_url',
250 253
  'calculate_qty'               => 'calculate_qty',
251 254
  'call_sub'                    => 'call_sub',
locale/de/ir
76 76
  'December'                    => 'Dezember',
77 77
  'Delete'                      => 'L?schen',
78 78
  'Delete drafts'               => 'Entw?rfe l?schen',
79
  'Delivered'                   => 'Geliefert',
79 80
  'Delivery Date'               => 'Lieferdatum',
80 81
  'Delivery Order'              => 'Lieferschein',
81 82
  'Department'                  => 'Abteilung',
......
317 318
  'NTI'                         => 'NTI',
318 319
  'Q'                           => 'Q',
319 320
  '_check_io_auth'              => '_check_io_auth',
321
  '_update_part_information'    => '_update_part_information',
322
  '_update_ship'                => '_update_ship',
320 323
  'add'                         => 'add',
321 324
  'build_std_url'               => 'build_std_url',
322 325
  'calculate_qty'               => 'calculate_qty',
locale/de/is
86 86
  'December'                    => 'Dezember',
87 87
  'Delete'                      => 'L?schen',
88 88
  'Delete drafts'               => 'Entw?rfe l?schen',
89
  'Delivered'                   => 'Geliefert',
89 90
  'Delivery Date'               => 'Lieferdatum',
90 91
  'Delivery Order'              => 'Lieferschein',
91 92
  'Department'                  => 'Abteilung',
......
342 343
  'NTI'                         => 'NTI',
343 344
  'Q'                           => 'Q',
344 345
  '_check_io_auth'              => '_check_io_auth',
346
  '_update_part_information'    => '_update_part_information',
347
  '_update_ship'                => '_update_ship',
345 348
  'add'                         => 'add',
346 349
  'build_std_url'               => 'build_std_url',
347 350
  'calculate_qty'               => 'calculate_qty',
locale/de/login
388 388
  'Q'                           => 'Q',
389 389
  '_check_io_auth'              => '_check_io_auth',
390 390
  '_collect_links'              => '_collect_links',
391
  '_update_part_information'    => '_update_part_information',
392
  '_update_ship'                => '_update_ship',
391 393
  'add'                         => 'add',
392 394
  'backorder_exchangerate'      => 'backorder_exchangerate',
393 395
  'build_std_url'               => 'build_std_url',
locale/de/oe
354 354
  'NTI'                         => 'NTI',
355 355
  'Q'                           => 'Q',
356 356
  '_check_io_auth'              => '_check_io_auth',
357
  '_update_part_information'    => '_update_part_information',
358
  '_update_ship'                => '_update_ship',
357 359
  'add'                         => 'add',
358 360
  'backorder_exchangerate'      => 'backorder_exchangerate',
359 361
  'build_std_url'               => 'build_std_url',
locale/de/todo
381 381
  'Q'                           => 'Q',
382 382
  '_check_io_auth'              => '_check_io_auth',
383 383
  '_collect_links'              => '_collect_links',
384
  '_update_part_information'    => '_update_part_information',
385
  '_update_ship'                => '_update_ship',
384 386
  'add'                         => 'add',
385 387
  'backorder_exchangerate'      => 'backorder_exchangerate',
386 388
  'build_std_url'               => 'build_std_url',

Auch abrufbar als: Unified diff