Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 508801bb

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

Verwaltung von Kunden-/Lieferantentypen auf Controller umgestellt

Unterschiede anzeigen:

SL/AM.pm
571 571
  $main::lxdebug->leave_sub();
572 572
}
573 573

  
574
sub business {
575
  $main::lxdebug->enter_sub();
576

  
577
  my ($self, $myconfig, $form) = @_;
578

  
579
  # connect to database
580
  my $dbh = $form->dbconnect($myconfig);
581

  
582
  my $query = qq|SELECT id, description, discount, customernumberinit, salesman
583
                 FROM business
584
                 ORDER BY 2|;
585

  
586
  my $sth = $dbh->prepare($query);
587
  $sth->execute || $form->dberror($query);
588

  
589
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
590
    push @{ $form->{ALL} }, $ref;
591
  }
592

  
593
  $sth->finish;
594
  $dbh->disconnect;
595

  
596
  $main::lxdebug->leave_sub();
597
}
598

  
599
sub get_business {
600
  $main::lxdebug->enter_sub();
601

  
602
  my ($self, $myconfig, $form) = @_;
603

  
604
  # connect to database
605
  my $dbh = $form->dbconnect($myconfig);
606

  
607
  my $query =
608
    qq|SELECT b.description, b.discount, b.customernumberinit, b.salesman
609
       FROM business b
610
       WHERE b.id = ?|;
611
  my $sth = $dbh->prepare($query);
612
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
613

  
614
  my $ref = $sth->fetchrow_hashref("NAME_lc");
615

  
616
  map { $form->{$_} = $ref->{$_} } keys %$ref;
617

  
618
  $sth->finish;
619

  
620
  $dbh->disconnect;
621

  
622
  $main::lxdebug->leave_sub();
623
}
624

  
625
sub save_business {
626
  $main::lxdebug->enter_sub();
627

  
628
  my ($self, $myconfig, $form) = @_;
629
  my ($query);
630

  
631
  # connect to database
632
  my $dbh = $form->dbconnect($myconfig);
633

  
634
  my @values = ($form->{description}, $form->{discount}, $form->{customernumberinit}, $form->{salesman} ? 't' : 'f');
635
  # id is the old record
636
  if ($form->{id}) {
637
    $query = qq|UPDATE business SET
638
                description = ?,
639
                discount = ?,
640
                customernumberinit = ?,
641
                salesman = ?
642
                WHERE id = ?|;
643
    push(@values, $form->{id});
644
  } else {
645
    $query = qq|INSERT INTO business
646
                (description, discount, customernumberinit, salesman)
647
                VALUES (?, ?, ?, ?)|;
648
  }
649
  do_query($form, $dbh, $query, @values);
650

  
651
  $dbh->disconnect;
652

  
653
  $main::lxdebug->leave_sub();
654
}
655

  
656
sub delete_business {
657
  $main::lxdebug->enter_sub();
658

  
659
  my ($self, $myconfig, $form) = @_;
660

  
661
  # connect to database
662
  my $dbh = $form->dbconnect($myconfig);
663

  
664
  my $query = qq|DELETE FROM business
665
              WHERE id = ?|;
666
  do_query($form, $dbh, $query, $form->{id});
667

  
668
  $dbh->disconnect;
669

  
670
  $main::lxdebug->leave_sub();
671
}
672

  
673

  
674 574
sub language {
675 575
  $main::lxdebug->enter_sub();
676 576

  
SL/Controller/Business.pm
1
package SL::Controller::Business;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
use SL::DB::Business;
8
use SL::Helper::Flash;
9

  
10
use Rose::Object::MakeMethods::Generic
11
(
12
 scalar => [ qw(business) ],
13
);
14

  
15
__PACKAGE__->run_before('check_auth');
16
__PACKAGE__->run_before('load_business', only => [ qw(edit update destroy) ]);
17

  
18
#
19
# actions
20
#
21

  
22
sub action_list {
23
  my ($self) = @_;
24

  
25
  $self->render('business/list',
26
                title       => $::locale->text('Businesses'),
27
                BUSINESSS => SL::DB::Manager::Business->get_all_sorted);
28
}
29

  
30
sub action_new {
31
  my ($self) = @_;
32

  
33
  $self->{business} = SL::DB::Business->new;
34
  $self->render('business/form', title => $::locale->text('Create a new business'));
35
}
36

  
37
sub action_edit {
38
  my ($self) = @_;
39
  $self->render('business/form', title => $::locale->text('Edit business'));
40
}
41

  
42
sub action_create {
43
  my ($self) = @_;
44

  
45
  $self->{business} = SL::DB::Business->new;
46
  $self->create_or_update;
47
}
48

  
49
sub action_update {
50
  my ($self) = @_;
51
  $self->create_or_update;
52
}
53

  
54
sub action_destroy {
55
  my ($self) = @_;
56

  
57
  if (eval { $self->{business}->delete; 1; }) {
58
    flash_later('info',  $::locale->text('The business has been deleted.'));
59
  } else {
60
    flash_later('error', $::locale->text('The business is in use and cannot be deleted.'));
61
  }
62

  
63
  $self->redirect_to(action => 'list');
64
}
65

  
66
#
67
# filters
68
#
69

  
70
sub check_auth {
71
  $::auth->assert('config');
72
}
73

  
74
#
75
# helpers
76
#
77

  
78
sub create_or_update {
79
  my $self   = shift;
80
  my $is_new = !$self->{business}->id;
81
  my $params = delete($::form->{business}) || { };
82

  
83
  $self->{business}->assign_attributes(%{ $params });
84

  
85
  my @errors = $self->{business}->validate;
86

  
87
  if (@errors) {
88
    flash('error', @errors);
89
    $self->render('business/form', title => $is_new ? $::locale->text('Create a new business') : $::locale->text('Edit business'));
90
    return;
91
  }
92

  
93
  $self->{business}->save;
94

  
95
  flash_later('info', $is_new ? $::locale->text('The business has been created.') : $::locale->text('The business has been saved.'));
96
  $self->redirect_to(action => 'list');
97
}
98

  
99
sub load_business {
100
  my ($self) = @_;
101
  $self->{business} = SL::DB::Business->new(id => $::form->{id})->load;
102
}
103

  
104
1;
SL/DB/Business.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::Business;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::Business;
6
use SL::DB::Manager::Business;
7

  
8
sub validate {
9
  my ($self) = @_;
10

  
11
  my @errors;
12
  push @errors, $::locale->text('The description is missing.')          if !$self->description;
13
  push @errors, $::locale->text('The discount must not be negative.')   if $self->discount <  0;
14
  push @errors, $::locale->text('The discount must be less than 100%.') if $self->discount >= 1;
9 15

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11
__PACKAGE__->meta->make_manager_class;
16
  return @errors;
17
}
12 18

  
13 19
1;
SL/DB/Manager/Business.pm
1
package SL::DB::Manager::Business;
2

  
3
use strict;
4

  
5
use SL::DB::Helper::Manager;
6
use base qw(SL::DB::Helper::Manager);
7

  
8
use SL::DB::Helper::Sorted;
9

  
10
sub object_class { 'SL::DB::Business' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
sub _sort_spec {
15
  return ( default => [ 'description', 1 ],
16
           columns => { SIMPLE => 'ALL',
17
                        map { ( $_ => "lower(business.$_)" ) } qw(description)
18
                      });
19
}
20

  
21
1;
bin/mozilla/am.pl
822 822
  $main::lxdebug->leave_sub();
823 823
}
824 824

  
825
sub add_business {
826
  $main::lxdebug->enter_sub();
827

  
828
  my $form     = $main::form;
829

  
830
  $main::auth->assert('config');
831

  
832
  $form->{title} = "Add";
833

  
834
  $form->{callback} = "am.pl?action=add_business" unless $form->{callback};
835

  
836
  &business_header;
837
  &form_footer;
838

  
839
  $main::lxdebug->leave_sub();
840
}
841

  
842
sub edit_business {
843
  $main::lxdebug->enter_sub();
844

  
845
  my $form     = $main::form;
846
  my %myconfig = %main::myconfig;
847

  
848
  $form->{title} = "Edit";
849

  
850
  AM->get_business(\%myconfig, \%$form);
851

  
852
  &business_header;
853

  
854
  $form->{orphaned} = 1;
855
  &form_footer;
856

  
857
  $main::lxdebug->leave_sub();
858
}
859

  
860
sub list_business {
861
  $main::lxdebug->enter_sub();
862

  
863
  my $form     = $main::form;
864
  my %myconfig = %main::myconfig;
865
  my $locale   = $main::locale;
866

  
867
  $main::auth->assert('config');
868

  
869
  AM->business(\%myconfig, \%$form);
870

  
871
  $form->{callback} = "am.pl?action=list_business";
872

  
873
  my $callback = $form->escape($form->{callback});
874

  
875
  $form->{title} = $locale->text('Type of Business');
876

  
877
  my @column_index = qw(description discount customernumberinit);
878
  push @column_index, 'salesman' if $::lx_office_conf{features}->{vertreter};
879
  my %column_header;
880
  $column_header{description} =
881
      qq|<th class=listheading width=60%>|
882
    . $locale->text('Description')
883
    . qq|</th>|;
884
  $column_header{discount} =
885
      qq|<th class=listheading width=10%>|
886
    . $locale->text('Discount')
887
    . qq| %</th>|;
888
  $column_header{customernumberinit} =
889
      qq|<th class=listheading>|
890
    . $locale->text('Customernumberinit')
891
    . qq|</th>|;
892
  $column_header{salesman} =
893
      qq|<th class=listheading>|
894
    . $locale->text('Representative')
895
    . qq|</th>|;
896

  
897
  $form->header;
898

  
899
  print qq|
900
<body>
901

  
902
<table width=100%>
903
  <tr>
904
    <th class=listtop>$form->{title}</th>
905
  </tr>
906
  <tr height="5"></tr>
907
  <tr>
908
    <td>
909
      <table width=100%>
910
        <tr class=listheading>
911
|;
912

  
913
  map { print "$column_header{$_}\n" } @column_index;
914

  
915
  print qq|
916
        </tr>
917
|;
918

  
919
  my ($i, %column_data);
920
  foreach my $ref (@{ $form->{ALL} }) {
921

  
922
    $i++;
923
    $i %= 2;
924

  
925
    print qq|
926
        <tr valign=top class=listrow$i>
927
|;
928

  
929
    my $discount    = $form->format_amount(\%myconfig, $ref->{discount} * 100);
930
    my $description = $ref->{description};
931
    $column_data{description} = qq|<td><a href="am.pl?action=edit_business&id=$ref->{id}&callback=$callback">$description</td>|;
932
    $column_data{discount}           = qq|<td align=right>$discount</td>|;
933
    $column_data{customernumberinit} =
934
      qq|<td align=right>$ref->{customernumberinit}</td>|;
935
    $column_data{salesman} = '<td>' . ($ref->{salesman} ? $::locale->text('Yes') : $::locale->text('No')) . '</td>';
936

  
937
    map { print "$column_data{$_}\n" } @column_index;
938

  
939
    print qq|
940
        </tr>
941
|;
942
  }
943

  
944
  print qq|
945
      </table>
946
    </td>
947
  </tr>
948
  <tr>
949
  <td><hr size=3 noshade></td>
950
  </tr>
951
</table>
952

  
953
<br>
954
<form method=post action=am.pl>
955

  
956
<input name=callback type=hidden value="$form->{callback}">
957

  
958
<input type=hidden name=type value=business>
959

  
960
<input class=submit type=submit name=action value="|
961
    . $locale->text('Add') . qq|">
962

  
963
  </form>
964

  
965
  </body>
966
  </html>
967
|;
968

  
969
  $main::lxdebug->leave_sub();
970
}
971

  
972
sub business_header {
973
  $main::lxdebug->enter_sub();
974

  
975
  my $form     = $main::form;
976
  my %myconfig = %main::myconfig;
977
  my $locale   = $main::locale;
978

  
979
  $main::auth->assert('config');
980

  
981
  $form->{title}    = $locale->text("$form->{title} Business");
982

  
983
  # $locale->text('Add Business')
984
  # $locale->text('Edit Business')
985

  
986
  $form->{description} =~ s/\"/&quot;/g;
987
  $form->{discount} =
988
    $form->format_amount(\%myconfig, $form->{discount} * 100);
989

  
990
  my $salesman_code;
991
  if ($::lx_office_conf{features}->{vertreter}) {
992
    $salesman_code = qq|
993
  <tr>
994
    <th align="right">| . $locale->text('Representative') . qq|</th>
995
    <td>| . $::cgi->checkbox(-name => "salesman", -value => 1, -label => '', 'checked' => $form->{salesman} ? 1 : 0) . qq|</td>
996
  </tr>
997
|;
998
  } else {
999
    $salesman_code = $::cgi->hidden(-name => 'salesman', -value => $form->{salesman} ? 1 : 0);
1000
  }
1001

  
1002
  $form->header;
1003

  
1004
  print qq|
1005
<body>
1006

  
1007
<form method=post action=am.pl>
1008

  
1009
<input type=hidden name=id value=$form->{id}>
1010
<input type=hidden name=type value=business>
1011

  
1012
<table width=100%>
1013
  <tr>
1014
    <th class=listtop colspan=2>$form->{title}</th>
1015
  </tr>
1016
  <tr height="5"></tr>
1017
  <tr>
1018
    <th align=right>| . $locale->text('Type of Business') . qq|</th>
1019
    <td><input name=description size=30 value="$form->{description}"></td>
1020
  <tr>
1021
  <tr>
1022
    <th align=right>| . $locale->text('Discount') . qq| %</th>
1023
    <td><input name=discount size=5 value=$form->{discount}></td>
1024
  </tr>
1025
  <tr>
1026
    <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1027
    <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1028
  </tr>
1029
$salesman_code
1030
  <td colspan=2><hr size=3 noshade></td>
1031
  </tr>
1032
</table>
1033
|;
1034

  
1035
  $main::lxdebug->leave_sub();
1036
}
1037

  
1038
sub save_business {
1039
  $main::lxdebug->enter_sub();
1040

  
1041
  my $form     = $main::form;
1042
  my %myconfig = %main::myconfig;
1043
  my $locale   = $main::locale;
1044

  
1045
  $main::auth->assert('config');
1046

  
1047
  $form->isblank("description", $locale->text('Description missing!'));
1048
  $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
1049
  AM->save_business(\%myconfig, \%$form);
1050
  $form->redirect($locale->text('Business saved!'));
1051

  
1052
  $main::lxdebug->leave_sub();
1053
}
1054

  
1055
sub delete_business {
1056
  $main::lxdebug->enter_sub();
1057

  
1058
  my $form     = $main::form;
1059
  my %myconfig = %main::myconfig;
1060
  my $locale   = $main::locale;
1061

  
1062
  $main::auth->assert('config');
1063

  
1064
  AM->delete_business(\%myconfig, \%$form);
1065
  $form->redirect($locale->text('Business deleted!'));
1066

  
1067
  $main::lxdebug->leave_sub();
1068
}
1069

  
1070 825
sub add_language {
1071 826
  $main::lxdebug->enter_sub();
1072 827

  
locale/de/all
196 196
  'Are you sure you want to delete Order Number' => 'Soll der Auftrag mit folgender Nummer wirklich gelöscht werden:',
197 197
  'Are you sure you want to delete Quotation Number' => 'Sind Sie sicher, dass Angebotnummer gelöscht werden soll?',
198 198
  'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
199
  'Are you sure you want to delete this business?' => 'Sind Sie sicher, dass Sie diesen Kunden-/Lieferantentyp löschen wollen?',
199 200
  'Are you sure you want to delete this department?' => 'Sind Sie sicher, dass Sie diese Abteilung löschen wollen?',
200 201
  'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?',
201 202
  'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?',
......
302 303
  'Buchungsnummer'              => 'Buchungsnummer',
303 304
  'Business Number'             => 'Firmennummer',
304 305
  'Business Volume'             => 'Geschäftsvolumen',
305
  'Business deleted!'           => 'Firma gelöscht.',
306 306
  'Business evaluation'         => 'Betriebswirtschaftliche Auswertung',
307
  'Business saved!'             => 'Firma gespeichert.',
308 307
  'Business type (database ID)' => 'Kunden-/Lieferantentyp (Datenbank-ID)',
309 308
  'Business type (name)'        => 'Kunden-/Lieferantentyp (Name)',
309
  'Businesses'                  => 'Kunden-/Lieferantentypen',
310 310
  'CANCELED'                    => 'Storniert',
311 311
  'CB Transaction'              => 'SB-Buchung',
312 312
  'CR'                          => 'H',
......
431 431
  'Create Chart of Accounts'    => 'Zu verwendender Kontenplan',
432 432
  'Create Dataset'              => 'Neue Datenbank anlegen',
433 433
  'Create Date'                 => 'Erstelldatum',
434
  'Create a new business'       => 'Einen neuen Kunden-/Lieferantentyp erfassen',
434 435
  'Create a new department'     => 'Eine neue Abteilung erfassen',
435 436
  'Create a new payment term'   => 'Neue Zahlungsbedingungen anlegen',
436 437
  'Create a standard group'     => 'Eine Standard-Benutzergruppe anlegen',
......
452 453
  'Create bank transfer via SEPA XML' => 'Überweisung via SEPA XML erzeugen',
453 454
  'Create invoice?'             => 'Rechnung erstellen?',
454 455
  'Create new'                  => 'Neu erfassen',
456
  'Create new business'         => 'Kunden-/Lieferantentyp erfassen',
455 457
  'Create new department'       => 'Neue Abteilung erfassen',
456 458
  'Create new payment term'     => 'Neue Zahlungsbedingung anlegen',
457 459
  'Create tables'               => 'Tabellen anlegen',
......
670 672
  'Edit Assembly'               => 'Erzeugnis bearbeiten',
671 673
  'Edit Bins'                   => 'Lagerpl&auml;tze bearbeiten',
672 674
  'Edit Buchungsgruppe'         => 'Buchungsgruppe bearbeiten',
673
  'Edit Business'               => 'Kunden-/Lieferantentyp bearbeiten',
674 675
  'Edit Credit Note'            => 'Gutschrift bearbeiten',
675 676
  'Edit Customer'               => 'Kunde editieren',
676 677
  'Edit Dunning'                => 'Mahnungen konfigurieren',
......
704 705
  'Edit Warehouse'              => 'Lager bearbeiten',
705 706
  'Edit and delete a group'     => 'Gruppen bearbeiten und l&ouml;schen',
706 707
  'Edit bank account'           => 'Bankkonto bearbeiten',
708
  'Edit business'               => 'Kunden-/Lieferantentyp bearbeiten',
707 709
  'Edit custom variable'        => 'Benutzerdefinierte Variable bearbeiten',
708 710
  'Edit department'             => 'Abteilung bearbeiten',
709 711
  'Edit file'                   => 'Datei bearbeiten',
......
1158 1160
  'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' => 'Für diesen Kunden wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.',
1159 1161
  'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' => 'Für diesen Lieferanten wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.',
1160 1162
  'No bins have been added to this warehouse yet.' => 'Es wurden zu diesem Lager noch keine Lagerpl&auml;tze angelegt.',
1163
  'No business has been created yet.' => 'Es wurden noch kein Kunden-/Lieferantentyp erfasst.',
1161 1164
  'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
1162 1165
  'No data was found.'          => 'Es wurden keine Daten gefunden.',
1163 1166
  'No databases have been found on this server.' => 'Auf diesem Server wurden keine Datenbanken gefunden.',
......
1727 1730
  'The base unit does not exist or it is about to be deleted in row %d.' => 'Die Basiseinheit in Zeile %d existiert nicht oder soll gel&ouml;scht werden.',
1728 1731
  'The base unit does not exist.' => 'Die Basiseinheit existiert nicht.',
1729 1732
  'The base unit relations must not contain loops (e.g. by saying that unit A\'s base unit is B, B\'s base unit is C and C\'s base unit is A) in row %d.' => 'Die Beziehungen der Einheiten d&uuml;rfen keine Schleifen beinhalten (z.B. wenn gesagt wird, dass Einheit As Basiseinheit B, Bs Basiseinheit C und Cs Basiseinheit A ist) in Zeile %d.',
1733
  'The business has been created.' => 'Der Kunden-/Lieferantentyp wurde erfasst.',
1734
  'The business has been deleted.' => 'Der Kunden-/Lieferantentyp wurde gelöscht.',
1735
  'The business has been saved.' => 'Der Kunden-/Lieferantentyp wurde gespeichert.',
1736
  'The business is in use and cannot be deleted.' => 'Der Kunden-/Lieferantentyp wird benutzt und kann nicht gelöscht werden.',
1730 1737
  'The columns &quot;Dunning Duedate&quot;, &quot;Total Fees&quot; and &quot;Interest&quot; show data for the previous dunning created for this invoice.' => 'Die Spalten &quot;Zahlbar bis&quot;, &quot;Kumulierte Geb&uuml;hren&quot; und &quot;Zinsen&quot; zeigen Daten der letzten f&uuml;r diese Rechnung erzeugten Mahnung.',
1731 1738
  'The connection to the LDAP server cannot be encrypted (SSL/TLS startup failure). Please check config/lx_office.conf.' => 'Die Verbindung zum LDAP-Server kann nicht verschl&uuml;sselt werden (Fehler bei SSL/TLS-Initialisierung). Bitte &uuml;berpr&uuml;fen Sie die Angaben in config/lx_office.conf.',
1732 1739
  'The connection to the authentication database failed:' => 'Die Verbindung zur Authentifizierungsdatenbank schlug fehl:',
......
1757 1764
  'The directory "%s" could not be created:\n%s' => 'Das Verzeichnis "%s" konnte nicht erstellt werden:\n%s',
1758 1765
  'The directory %s does not exist.' => 'Das Verzeichnis %s existiert nicht.',
1759 1766
  'The discount in percent'     => 'Der prozentuale Rabatt',
1767
  'The discount must be less than 100%.' => 'Der Rabatt muss kleiner als 100% sein.',
1768
  'The discount must not be negative.' => 'Der Rabatt darf nicht negativ sein.',
1760 1769
  'The dunning process started' => 'Der Mahnprozess ist gestartet.',
1761 1770
  'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.',
1762 1771
  'The email address is missing.' => 'Die Emailadresse fehlt.',
menu.ini
647 647
submenu=1
648 648

  
649 649
[System--Type of Business--Add Business]
650
module=am.pl
651
action=add_business
650
module=controller.pl
651
action=Business/new
652 652

  
653 653
[System--Type of Business--List Businesses]
654
module=am.pl
655
action=list_business
654
module=controller.pl
655
action=Business/list
656 656

  
657 657
[System--Lead]
658 658
module=menu.pl
templates/webpages/business/form.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2
<body>
3

  
4
 <form method="post" action="controller.pl">
5
  <div class="listtop">[% FORM.title %]</div>
6

  
7
[%- INCLUDE 'common/flash.html' %]
8

  
9
  <table>
10
   <tr>
11
    <td>[%- LxERP.t8('Description') %]</td>
12
    <td>[% L.input_tag("business.description", SELF.business.description, "size", 30) %]</td>
13
   </tr>
14

  
15
   <tr>
16
    <td>[%- LxERP.t8('Discount') %]</td>
17
    <td>[% L.input_tag("business.discount_as_percent", SELF.business.discount_as_percent, "size", 5) %]%</td>
18
   </tr>
19

  
20
   <tr>
21
    <td>[%- LxERP.t8('Customernumberinit') %]</td>
22
    <td>[% L.input_tag("business.customernumberinit", SELF.business.customernumberinit, "size", 10) %]</td>
23
   </tr>
24

  
25
   [%- IF LXCONFIG.features.vertreter %]
26
    <tr>
27
     <td>[%- LxERP.t8('Representative') %]</td>
28
     <td>[% L.checkbox_tag("business.salesman", "value", 1, "checked", SELF.business.salesman) %]</td>
29
    </tr>
30
   [%- END %]
31
  </table>
32

  
33
  <p>
34
   [% L.hidden_tag("id", SELF.business.id) %]
35
   [% L.hidden_tag("action", "Business/dispatch") %]
36
   [% L.submit_tag("action_" _  (SELF.business.id ? "update" : "create"), LxERP.t8('Save')) %]
37
   [%- IF SELF.business.id %]
38
    [% L.submit_tag("action_destroy", LxERP.t8("Delete"), "confirm", LxERP.t8("Are you sure you want to delete this business?")) %]
39
   [%- END %]
40
   <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
41
  </p>
42
 </form>
43
</body>
44
</html>
templates/webpages/business/list.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2

  
3
<body>
4
 <div class="listtop">[% FORM.title %]</div>
5

  
6
[%- INCLUDE 'common/flash.html' %]
7

  
8
 <form method="post" action="controller.pl">
9
  [% IF !BUSINESSS.size %]
10
   <p>
11
    [%- LxERP.t8('No business has been created yet.') %]
12
   </p>
13

  
14
  [%- ELSE %]
15
   <table id="business_list" width="100%">
16
    <thead>
17
    <tr class="listheading">
18
     <th width="80%">[%- LxERP.t8('Description') %]</th>
19
     <th>[%- LxERP.t8('Discount') %]</th>
20
     <th>[%- LxERP.t8('Customernumberinit') %]</th>
21
     [%- IF LXCONFIG.features.vertreter %]
22
      <th>[%- LxERP.t8('Representative') %]</th>
23
     [%- END %]
24
    </tr>
25
    </thead>
26

  
27
    <tbody>
28
    [%- FOREACH business = BUSINESSS %]
29
    <tr class="listrow[% loop.count % 2 %]" id="business_id_[% business.id %]">
30
     <td>
31
      <a href="[% SELF.url_for(action => 'edit', id => business.id) %]">
32
       [%- HTML.escape(business.description) %]
33
      </a>
34
     </td>
35
     <td align="right">[% LxERP.format_amount(business.discount * 100) %] %</td>
36
     <td align="right">[%- HTML.escape(business.customernumberinit) %]</td>
37
     [%- IF LXCONFIG.features.vertreter %]
38
      <td>[%- IF business.salesman %][%- LxERP.t8('Yes') %][%- ELSE %][%- LxERP.t8('No') %][%- END %]</td>
39
     [%- END %]
40
    </tr>
41
    [%- END %]
42
    </tbody>
43
   </table>
44
  [%- END %]
45

  
46
  <hr size="3" noshade>
47

  
48
  <p>
49
   <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create new business') %]</a>
50
  </p>
51
 </form>
52
</body>
53
</html>

Auch abrufbar als: Unified diff