Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a4b22a8f

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID a4b22a8f008d6431597fa80de26bcb0fa10e8d7b
  • Vorgänger 72eaa1a7
  • Nachfolger f01741e3

Einkaufs- und Verkaufsrechnungen: Filtermöglichkeiten nach Projektnummer sowie Anzeigeoption der Projektnummer hinzugefügt.

Unterschiede anzeigen:

SL/AP.pm
404 404
  my $query =
405 405
    qq|SELECT a.id, a.invnumber, a.transdate, a.duedate, a.amount, a.paid, | .
406 406
    qq|  a.ordnumber, v.name, a.invoice, a.netamount, a.datepaid, a.notes, | .
407
    qq|  a.globalproject_id, | .
408
    qq|  pr.projectnumber AS globalprojectnumber, | .
407 409
    qq|  e.name AS employee | .
408 410
    qq|FROM ap a | .
409 411
    qq|JOIN vendor v ON (a.vendor_id = v.id) | .
410
    qq|LEFT JOIN employee e ON (a.employee_id = e.id)|;
412
    qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
413
    qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id) |;
411 414

  
412 415
  my $where;
413 416
  my @values;
......
436 439
    $where .= " AND lower(a.notes) LIKE ?";
437 440
    push(@values, $form->like($form->{notes}));
438 441
  }
442
  if ($form->{project_id}) {
443
    $where .=
444
      qq|AND ((a.globalproject_id = ?) OR EXISTS | .
445
      qq|  (SELECT * FROM invoice i | .
446
      qq|   WHERE i.project_id = ? AND i.trans_id = a.id))|;
447
    push(@values, $form->{project_id}, $form->{project_id});
448
  }
439 449

  
440 450
  if ($form->{transdatefrom}) {
441 451
    $where .= " AND a.transdate >= ?";
SL/AR.pm
552 552
  # connect to database
553 553
  my $dbh = $form->dbconnect($myconfig);
554 554

  
555
  my @values;
556

  
555 557
  my $query = qq|SELECT a.id, a.invnumber, a.ordnumber, a.transdate,
556 558
                 a.duedate, a.netamount, a.amount, a.paid, c.name,
557 559
		 a.invoice, a.datepaid, a.terms, a.notes, a.shipvia,
558
		 a.shippingpoint, a.storno,
560
		 a.shippingpoint, a.storno, a.globalproject_id,
561
                 pr.projectnumber AS globalprojectnumber,
559 562
		 e.name AS employee
560 563
	         FROM ar a
561 564
	      JOIN customer c ON (a.customer_id = c.id)
562
	      LEFT JOIN employee e ON (a.employee_id = e.id)|;
565
	      LEFT JOIN employee e ON (a.employee_id = e.id)
566
                 LEFT JOIN project pr ON a.globalproject_id = pr.id|;
563 567

  
564 568
  my $where = "1 = 1";
565 569
  if ($form->{customer_id}) {
......
586 590
    my $notes = $form->like(lc $form->{notes});
587 591
    $where .= " AND lower(a.notes) LIKE '$notes'";
588 592
  }
593
  if ($form->{"project_id"}) {
594
    $where .=
595
      qq|AND ((a.globalproject_id = ?) OR EXISTS | .
596
      qq|  (SELECT * FROM invoice i | .
597
      qq|   WHERE i.project_id = ? AND i.trans_id = a.id))|;
598
    push(@values, $form->{"project_id"}, $form->{"project_id"});
599
  }
589 600

  
590 601
  $where .= " AND a.transdate >= '$form->{transdatefrom}'"
591 602
    if $form->{transdatefrom};
......
603 614
  my $sortorder = join ', ', $form->sort_columns(@a);
604 615
  $sortorder = $form->{sort} if $form->{sort};
605 616

  
606
  $query .= "WHERE $where
617
  $query .= " WHERE $where
607 618
             ORDER by $sortorder";
608 619

  
609 620
  my $sth = $dbh->prepare($query);
610
  $sth->execute || $form->dberror($query);
621
  $sth->execute(@values) ||
622
    $form->dberror($query . " (" . join(", ", @values) . ")");
611 623

  
612 624
  while (my $ar = $sth->fetchrow_hashref(NAME_lc)) {
613 625
    push @{ $form->{AR} }, $ar;
bin/mozilla/ap.pl
36 36
use SL::PE;
37 37

  
38 38
require "$form->{path}/arap.pl";
39
require "bin/mozilla/common.pl";
39 40

  
40 41
1;
41 42

  
......
1101 1102
                              <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1102 1103
  }
1103 1104

  
1105
  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1106
                                   "all" => 1 });
1107

  
1108
  my %labels = ();
1109
  my @values = ("");
1110
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1111
    push(@values, $item->{"id"});
1112
    $labels{$item->{"id"}} = $item->{"projectnumber"};
1113
  }
1114
  my $projectnumber =
1115
    NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1116
                         '-labels' => \%labels));
1117

  
1104 1118
  $form->header;
1105 1119

  
1106 1120
  print qq|
......
1133 1147
	  <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1134 1148
	  <td colspan=3><input name=notes size=40></td>
1135 1149
	</tr>
1150
        <tr>
1151
          <th align="right">| . $locale->text("Project Number") . qq|</th>
1152
          <td colspan="3">$projectnumber</td>
1153
        </tr>
1136 1154
	<tr>
1137 1155
	  <th align=right nowrap>| . $locale->text('From') . qq|</th>
1138 1156
	  $button1
......
1197 1215
	      <tr>
1198 1216
		<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1199 1217
		<td nowrap>| . $locale->text('Subtotal') . qq|</td>
1218
		<td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1219
		<td nowrap>| . $locale->text('Project Number') . qq|</td>
1200 1220
	      </tr>
1201 1221
	    </table>
1202 1222
	  </td>
......
1299 1319
    $option   .= "\n<br>" if ($option);
1300 1320
    $option   .= $locale->text('Closed');
1301 1321
  }
1322
  if ($form->{globalproject_id}) {
1323
    $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1324
    $href     .= "&globalproject_id=" . E($form->{globalproject_id});
1325
  }
1302 1326

  
1303
  @columns = $form->sort_columns(
1304
    qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee)
1305
  );
1327
  @columns =
1328
    qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid
1329
       due duedate notes employee globalprojectnumber);
1306 1330

  
1307 1331
  foreach $item (@columns) {
1308 1332
    if ($form->{"l_$item"} eq "Y") {
......
1362 1386
  $column_header{employee} =
1363 1387
    "<th><a class=listheading href=$href&sort=employee>"
1364 1388
    . $locale->text('Employee') . "</th>";
1389
  $column_header{globalprojectnumber} =
1390
    qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1365 1391

  
1366 1392
  $form->{title} = $locale->text('AP Transactions');
1367 1393

  
......
1452 1478
    $ap->{notes} =~ s/\r\n/<br>/g;
1453 1479
    $column_data{notes}    = "<td>$ap->{notes}&nbsp;</td>";
1454 1480
    $column_data{employee} = "<td>$ap->{employee}&nbsp;</td>";
1481
    $column_data{globalprojectnumber}  =
1482
      "<td>" . H($ap->{globalprojectnumber}) . "</td>";
1455 1483

  
1456 1484
    $i++;
1457 1485
    $i %= 2;
bin/mozilla/ar.pl
37 37
use Data::Dumper;
38 38

  
39 39
require "$form->{path}/arap.pl";
40
require "bin/mozilla/common.pl";
40 41

  
41 42
1;
42 43

  
......
1129 1130
                              <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1130 1131
  }
1131 1132

  
1133
  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1134
                                   "all" => 1 });
1135

  
1136
  my %labels = ();
1137
  my @values = ("");
1138
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1139
    push(@values, $item->{"id"});
1140
    $labels{$item->{"id"}} = $item->{"projectnumber"};
1141
  }
1142
  my $projectnumber =
1143
    NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1144
                         '-labels' => \%labels));
1145

  
1132 1146
  $form->{fokus} = "search.customer";
1133 1147
  $form->header;
1134 1148

  
......
1160 1174
	  <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1161 1175
	  <td colspan=3><input name=notes size=40></td>
1162 1176
	</tr>
1177
        <tr>
1178
          <th align="right">| . $locale->text("Project Number") . qq|</th>
1179
          <td colspan="3">$projectnumber</td>
1180
        </tr>
1163 1181
	<tr>
1164 1182
	  <th align=right nowrap>| . $locale->text('From') . qq|</th>
1165 1183
          $button1
......
1226 1244
	      <tr>
1227 1245
		<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1228 1246
		<td nowrap>| . $locale->text('Subtotal') . qq|</td>
1247
		<td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1248
		<td nowrap>| . $locale->text('Project Number') . qq|</td>
1229 1249
	      </tr>
1230 1250
	    </table>
1231 1251
	  </td>
......
1331 1351
    $option   .= "\n<br>" if ($option);
1332 1352
    $option   .= $locale->text('Closed');
1333 1353
  }
1354
  if ($form->{globalproject_id}) {
1355
    $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1356
    $href     .= "&globalproject_id=" . E($form->{globalproject_id});
1357
  }
1334 1358

  
1335
  @columns = $form->sort_columns(
1336
    qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee shippingpoint shipvia)
1337
  );
1359
  @columns =
1360
    qw(transdate id type invnumber ordnumber name netamount tax amount paid
1361
       datepaid due duedate notes employee shippingpoint shipvia
1362
       globalprojectnumber);
1338 1363

  
1339 1364
  $form->{"l_type"} = "Y";
1340 1365

  
......
1407 1432
      "<th><a class=listheading href=$href&sort=shipvia>"
1408 1433
    . $locale->text('Ship via')
1409 1434
    . "</a></th>";
1435
  $column_header{globalprojectnumber} =
1436
    qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1410 1437

  
1411 1438
  $form->{title} = $locale->text('AR Transactions');
1412 1439

  
......
1505 1532
    $column_data{shippingpoint} = "<td>$ar->{shippingpoint}&nbsp;</td>";
1506 1533
    $column_data{shipvia}       = "<td>$ar->{shipvia}&nbsp;</td>";
1507 1534
    $column_data{employee}      = "<td>$ar->{employee}&nbsp;</td>";
1535
    $column_data{globalprojectnumber}  =
1536
      "<td>" . H($ar->{globalprojectnumber}) . "</td>";
1508 1537

  
1509 1538
    $i++;
1510 1539
    $i %= 2;
locale/de/ap
75 75
  'Post'                        => 'Buchen',
76 76
  'Post Payment'                => 'Zahlung buchen',
77 77
  'Project'                     => 'Projekt',
78
  'Project Number'              => 'Projektnummer',
78 79
  'Project not on file!'        => 'Dieses Projekt ist nicht in der Datenbank!',
79 80
  'Remaining'                   => 'Rest',
80 81
  'Select from one of the names below' => 'W?hlen Sie einen der untenstehenden Namen',
locale/de/ar
78 78
  'Post'                        => 'Buchen',
79 79
  'Post Payment'                => 'Zahlung buchen',
80 80
  'Project'                     => 'Projekt',
81
  'Project Number'              => 'Projektnummer',
81 82
  'Project not on file!'        => 'Dieses Projekt ist nicht in der Datenbank!',
82 83
  'Remaining'                   => 'Rest',
83 84
  'Sales Invoice'               => 'Rechnung',

Auch abrufbar als: Unified diff