Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f8d6fccc

Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt

  • ID f8d6fccc5f4029a805ca0a18b07210bd413efc63
  • Vorgänger 19bfd0f2
  • Nachfolger ca8c7f1b

novoclon: Selbsttests strikte Prozesse: EK-Rechnungen gegen Aufträge prüfen

Unterschiede anzeigen:

SL/BackgroundJob/SelfTest/NovoclonStrict.pm
8 8
use List::MoreUtils qw(none notall);
9 9
use SL::DB::DeliveryOrder;
10 10
use SL::DB::Order;
11
use SL::DB::PurchaseInvoice;
11 12

  
12 13
use Rose::Object::MakeMethods::Generic (
13 14
  'scalar --get_set_init' => [ qw(start_date) ],
......
21 22
sub run {
22 23
  my ($self) = @_;
23 24

  
24
  $self->tester->plan(tests => 6);
25
  $self->tester->plan(tests => 8);
25 26

  
26 27
  $self->check_no_missing_invoices;
27 28
  $self->check_no_missing_deliveries;
......
29 30
  $self->check_invoices_mailed;
30 31
  $self->check_order_confirmations_mailed;
31 32
  $self->check_quotations_mailed;
33
  $self->check_purchase_invoices_sums_against_purchase_orders;
34
  $self->check_purchase_invoices_sums_against_sales_orders;
32 35
}
33 36

  
34 37
sub check_no_missing_invoices {
......
246 249
  }
247 250
}
248 251

  
252
# Check for all purchase invoices if the sum of all related purchase
253
# orders is greater than the sum of all related purchase invoices.
254
sub check_purchase_invoices_sums_against_purchase_orders {
255
  my ($self) = @_;
256

  
257
  my $title = "Die Summe der Einkaufsrechnungen ist kleiner als die Summe der Lieferantenaufträge.";
258

  
259
  my $purchase_invoices = SL::DB::Manager::PurchaseInvoice->get_all_sorted(where => ['!storno' => 1,
260
                                                                                     invoice   => 1,
261
                                                                                     transdate => {ge => $self->start_date},]);
262

  
263
  my @purchase_invoices_with_wrong_sums;
264
  foreach my $purchase_invoice (@$purchase_invoices) {
265
    if (!$purchase_invoice->check_sums_against_purchase_orders($purchase_invoice)) {
266
      push @purchase_invoices_with_wrong_sums, $purchase_invoice;
267
    }
268
  }
269

  
270
  if (@purchase_invoices_with_wrong_sums) {
271
    $self->tester->ok(0, $title);
272
    $self->tester->diag("Folgende " . scalar @purchase_invoices_with_wrong_sums . " Einkaufsrechnungen haben eine zu hohe Summe:");
273
    $self->tester->diag("Einkaufsrechnungs-Nummer vom " . $_->transdate_as_date . ": " . $_->record_number) for @purchase_invoices_with_wrong_sums;
274

  
275
  } else {
276
    $self->tester->ok(1, $title);
277
  }
278
}
279

  
280
# Check for all purchase invoices if the sum of all related sales
281
# orders is greater than the sum of all related purchase invoices.
282
sub check_purchase_invoices_sums_against_sales_orders {
283
  my ($self) = @_;
284

  
285
  my $title = "Die Summe der Einkaufsrechnungen ist kleiner als die Summe der Auftragsbestätigungen.";
286

  
287
  my $purchase_invoices = SL::DB::Manager::PurchaseInvoice->get_all_sorted(where => ['!storno' => 1,
288
                                                                                     invoice   => 1,
289
                                                                                     transdate => {ge => $self->start_date},]);
290

  
291
  my @purchase_invoices_with_wrong_sums;
292
  foreach my $purchase_invoice (@$purchase_invoices) {
293
    if (!$purchase_invoice->check_sums_against_sales_orders($purchase_invoice)) {
294
      push @purchase_invoices_with_wrong_sums, $purchase_invoice;
295
    }
296
  }
297

  
298
  if (@purchase_invoices_with_wrong_sums) {
299
    $self->tester->ok(0, $title);
300
    $self->tester->diag("Folgende " . scalar @purchase_invoices_with_wrong_sums . " Einkaufsrechnungen haben eine zu hohe Summe:");
301
    $self->tester->diag("Einkaufsrechnungs vom " . $_->transdate_as_date . ": " . $_->record_number) for @purchase_invoices_with_wrong_sums;
302

  
303
  } else {
304
    $self->tester->ok(1, $title);
305
  }
306
}
249 307

  
250 308
1;
251 309

  

Auch abrufbar als: Unified diff