Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 90daea72

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID 90daea72226506cd9f797ba2bfd7d3c39e19fe3e
  • Vorgänger 32394d82
  • Nachfolger 451843cf

strict Sanity

Conflicts:

SL/AM.pm
SL/OE.pm

Unterschiede anzeigen:

SL/AM.pm
1515 1515

  
1516 1516
  $form->{businessnumber} =  $businessnumber;
1517 1517

  
1518
  my $myconfig = new User($form->{login});
1518
  $myconfig = new User($form->{login});
1519 1519

  
1520 1520
  foreach my $item (keys %$form) {
1521 1521
    $myconfig->{$item} = $form->{$item};
......
1935 1935
  $main::lxdebug->enter_sub(2);
1936 1936
  ($this, $a, $b, $all_units) = @_;
1937 1937

  
1938
  $main::lxdebug->leave_sub(2) and return 0 unless $a && $b;
1938 1939
  $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a} && $all_units->{$b};
1939 1940
  $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a}{base_unit} eq $all_units->{$b}{base_unit};
1940
  $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor}; 
1941
  $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor};
1941 1942
}
1942 1943

  
1943 1944
sub unit_select_data {
SL/OE.pm
186 186

  
187 187
  my %id = ();
188 188
  $form->{OE} = [];
189
  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
189
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
190 190
    $ref->{exchangerate} = 1 unless $ref->{exchangerate};
191 191
    push @{ $form->{OE} }, $ref if $ref->{id} != $id{ $ref->{id} };
192 192
    $id{ $ref->{id} } = $ref->{id};
......
289 289
  my $project_id;
290 290
  my $reqdate;
291 291
  my $taxrate;
292
  my $taxbase;
293
  my $taxdiff;
292 294
  my $taxamount = 0;
293 295
  my $fxsellprice;
294 296
  my %taxbase;
......
360 362

  
361 363
      if ($form->round_amount($taxrate, 7) == 0) {
362 364
        if ($form->{taxincluded}) {
363
          foreach $item (@taxaccounts) {
365
          foreach my $item (@taxaccounts) {
364 366
            $taxamount = $form->round_amount($linetotal * $form->{"${item}_rate"} / (1 + abs($form->{"${item}_rate"})), 2);
365 367
            $taxaccounts{$item} += $taxamount;
366 368
            $taxdiff            += $taxamount;
......
368 370
          }
369 371
          $taxaccounts{ $taxaccounts[0] } += $taxdiff;
370 372
        } else {
371
          foreach $item (@taxaccounts) {
373
          foreach my $item (@taxaccounts) {
372 374
            $taxaccounts{$item} += $linetotal * $form->{"${item}_rate"};
373 375
            $taxbase{$item}     += $taxbase;
374 376
          }
375 377
        }
376 378
      } else {
377
        foreach $item (@taxaccounts) {
379
        foreach my $item (@taxaccounts) {
378 380
          $taxaccounts{$item} += $taxamount * $form->{"${item}_rate"} / $taxrate;
379 381
          $taxbase{$item} += $taxbase;
380 382
        }
......
594 596
  my $query = qq|SELECT s.spoolfile FROM status s | .
595 597
              qq|WHERE s.trans_id = ?|;
596 598
  my @values = (conv_i($form->{id}));
597
  $sth = $dbh->prepare($query);
599
  my $sth = $dbh->prepare($query);
598 600
  $sth->execute(@values) || $self->dberror($query);
599 601

  
600 602
  my $spoolfile;
......
670 672
    undef @ids;
671 673
  }
672 674

  
673
  my $query_add = '';
675
  # and remember for the rest of the function
676
  my $is_collective_order = scalar @ids;
677

  
674 678
  if (!$form->{id}) {
675 679
    my $wday         = (localtime(time))[6];
676 680
    my $next_workday = $wday == 5 ? 3 : $wday == 6 ? 2 : 1;
......
725 729
    @values = $form->{id} ? ($form->{id}) : @ids;
726 730
    $sth = prepare_execute_query($form, $dbh, $query, @values);
727 731

  
728
    $ref = $sth->fetchrow_hashref(NAME_lc);
732
    $ref = $sth->fetchrow_hashref("NAME_lc");
729 733
    map { $form->{$_} = $ref->{$_} } keys %$ref;
730 734

  
731 735
    $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ?
......
757 761
      $query = qq|SELECT s.* FROM shipto s WHERE s.trans_id = ? AND s.module = 'OE'|;
758 762
      $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
759 763

  
760
      $ref = $sth->fetchrow_hashref(NAME_lc);
764
      $ref = $sth->fetchrow_hashref("NAME_lc");
761 765
      delete($ref->{id});
762 766
      map { $form->{$_} = $ref->{$_} } keys %$ref;
763 767
      $sth->finish;
......
766 770
      $query = qq|SELECT s.printed, s.emailed, s.spoolfile, s.formname FROM status s WHERE s.trans_id = ?|;
767 771
      $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
768 772

  
769
      while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
773
      while ($ref = $sth->fetchrow_hashref("NAME_lc")) {
770 774
        $form->{printed} .= "$ref->{formname} " if $ref->{printed};
771 775
        $form->{emailed} .= "$ref->{formname} " if $ref->{emailed};
772 776
        $form->{queued}  .= "$ref->{formname} $ref->{spoolfile} " if $ref->{spoolfile};
......
814 818
    @ids = $form->{id} ? ($form->{id}) : @ids;
815 819
    $sth = prepare_execute_query($form, $dbh, $query, @values);
816 820

  
817
    while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
821
    while ($ref = $sth->fetchrow_hashref("NAME_lc")) {
818 822
      # Retrieve custom variables.
819 823
      my $cvars = CVar->get_custom_variables(dbh        => $dbh,
820 824
                                             module     => 'IC',
......
873 877
      delete $ref->{orderitems_id} if (@ids);
874 878

  
875 879
      # get tax rates and description
876
      $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
880
      my $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
877 881
      $query =
878 882
        qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber | .
879 883
        qq|FROM tax t LEFT JOIN chart c on (c.id = t.chart_id) | .
......
881 885
        qq|               WHERE tk.chart_id = (SELECT id FROM chart WHERE accno = ?) | .
882 886
        qq|                 AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1) | .
883 887
        qq|ORDER BY c.accno|;
884
      $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
888
      my $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
885 889
      $ref->{taxaccounts} = "";
886 890
      my $i = 0;
887
      while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
891
      while (my $ptr = $stw->fetchrow_hashref("NAME_lc")) {
888 892
        if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) {
889 893
          $i++;
890 894
          $ptr->{accno} = $i;
......
947 951
  my $position = 0;
948 952
  my $subtotal_header = 0;
949 953
  my $subposition = 0;
954
  my %taxaccounts;
955
  my %taxbase;
956
  my $tax_rate;
957
  my $taxamount;
958

  
950 959

  
951 960
  my %oid = ('Pg'     => 'oid',
952 961
             'Oracle' => 'rowid');
......
1161 1170
        $sth = $dbh->prepare($query);
1162 1171
        $sth->execute(@values) || $form->dberror($query);
1163 1172

  
1164
        while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
1173
        while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
1165 1174
          if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
1166 1175
            map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
1167 1176
            $sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
......
1224 1233
  my ($self, $dbh, $id) = @_;
1225 1234

  
1226 1235
  my $query = qq|SELECT description FROM project WHERE id = ?|;
1227
  my ($value) = selectrow_query($form, $dbh, $query, $id);
1236
  my ($value) = selectrow_query($main::form, $dbh, $query, $id);
1228 1237

  
1229 1238
  $main::lxdebug->leave_sub();
1230 1239

  

Auch abrufbar als: Unified diff