Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9d07c34f

Von Bernd Bleßmann vor etwa 9 Jahren hinzugefügt

  • ID 9d07c34f5b429bfc118629d74b376479c37a8383
  • Vorgänger 40ebe601
  • Nachfolger 6d808fff

Auslagern in VK-Rechnung: Beim Buchen einer VK-Rechnung wird ausgelagert.

Todo: Es werden noch nicht alle Einstellungen berücksichtigt, die bestimmen,
wann von welchem Lager/Lagerplatz ausgelagert wird.

Unterschiede anzeigen:

SL/IS.pm
1291 1291
  return $rc;
1292 1292
}
1293 1293

  
1294
sub transfer_out {
1295
  $::lxdebug->enter_sub;
1296

  
1297
  my ($self, $form) = @_; 
1298

  
1299
  my @transfers;
1300

  
1301
  foreach my $i (1 .. $form->{rowcount}) {
1302
    next if !$form->{"id_$i"};
1303
    my ($wh_id, $bin_id) = _determine_wh_and_bin($::instance_conf, $form->{"id_$i"});
1304

  
1305
    if ($wh_id && $bin_id) {
1306
      push @transfers, {
1307
        'parts_id'         => $form->{"id_$i"},
1308
        'qty'              => $form->{"qty_$i"},
1309
        'unit'             => $form->{"unit_$i"},
1310
        'transfer_type'    => 'shipped',
1311
        'src_warehouse_id' => $wh_id,
1312
        'src_bin_id'       => $bin_id,
1313
        'project_id'       => $form->{"project_id_$i"},
1314
        'invoice_id'       => $form->{"invoice_id_$i"},
1315
      };
1316
    }
1317
  }
1318

  
1319
  require SL::WH;
1320
  WH->transfer(@transfers);
1321

  
1322
  $::lxdebug->leave_sub;
1323
  return 1;
1324
}
1325

  
1326
sub _determine_wh_and_bin {
1327
  $::lxdebug->enter_sub(2);
1328

  
1329
  my ($conf, $part_id) = @_;
1330

  
1331
  my $part = SL::DB::Part->new(id => $part_id)->load;
1332

  
1333
  if ($part->is_service && !$conf->get_transfer_default_services) {
1334
    $::lxdebug->leave_sub(2);
1335
    return;
1336
  }
1337
    
1338

  
1339
  my $wh_id  = $part->warehouse_id;
1340
  my $bin_id = $part->bin_id;
1341

  
1342
  if (!$wh_id && !$bin_id && $conf->get_transfer_default_ignore_onhand) {
1343
    $wh_id  = $conf->get_warehouse_id_ignore_onhand;
1344
    $bin_id = $conf->get_bin_id_ignore_onhand;
1345
  }
1346

  
1347
  $::lxdebug->leave_sub(2);
1348
  return ($wh_id, $bin_id);
1349
}
1350

  
1294 1351
sub _delete_payments {
1295 1352
  $main::lxdebug->enter_sub();
1296 1353

  

Auch abrufbar als: Unified diff