use Carp;
use Data::Dumper;
+use Encode;
use SL::DBUtils;
use strict;
close(TEMPLATE);
}
+ $content = Encode::decode('utf-8-strict', $content) if $::locale->is_utf8;
+
$main::lxdebug->leave_sub();
return ($content, $lines);
my $error = "";
if (open(TEMPLATE, ">$filename")) {
+ $content = Encode::encode('utf-8-strict', $content) if $::locale->is_utf8;
$content =~ s/\r\n/\n/g;
print(TEMPLATE $content);
close(TEMPLATE);
# get makes
if ($form->{makemodel}) {
- $query = qq|SELECT m.make, m.model FROM makemodel m | .
- qq|WHERE m.parts_id = ?|;
+ #hli
+ $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | .
+ qq|WHERE m.parts_id = ? order by m.sortorder asc|;
my @values = ($form->{id});
$sth = $dbh->prepare($query);
$sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")");
my $i = 1;
- while (($form->{"make_$i"}, $form->{"model_$i"}) = $sth->fetchrow_array)
+
+ while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"},
+ $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array)
{
$i++;
}
# insert makemodel records
unless ($form->{item} eq 'service') {
+ my $lastupdate = '';
+ my $value = 0;
for my $i (1 .. $form->{makemodel_rows}) {
if (($form->{"make_$i"}) || ($form->{"model_$i"})) {
-
- $query = qq|INSERT INTO makemodel (parts_id, make, model) | .
- qq|VALUES (?, ?, ?)|;
- @values = (conv_i($form->{id}), conv_i($form->{"make_$i"}), $form->{"model_$i"});
+ #hli
+ $value = $form->parse_amount($myconfig, $form->{"lastcost_$i"});
+ if ($value == $form->{"old_lastcost_$i"})
+ {
+ $lastupdate = $dbh->quote($form->{"lastupdate_$i"});
+ } else {
+ $lastupdate = 'now()';
+ }
+ $query = qq|INSERT INTO makemodel (parts_id, make, model, lastcost, lastupdate, sortorder) | .
+ qq|VALUES (?, ?, ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{"make_$i"}), $form->{"model_$i"}, $value, $lastupdate, conv_i($form->{"sortorder_$i"}) );
do_query($form, $dbh, $query, @values);
}
ordnumber => 'apoe.', make => 'mm.',
quonumber => 'apoe.', model => 'mm.',
invnumber => 'apoe.', partsgroup => 'pg.',
- lastcost => ' ', , soldtotal => ' ',
+ lastcost => 'p.', , soldtotal => ' ',
factor => 'pfac.',
'SUM(ioi.qty)' => ' ',
description => 'p.',
if ($form->{currency} eq $defaultcurrency) {
$form->{exchangerate} = 1;
} else {
- $exchangerate = $form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, 'buy');
+ $exchangerate = $form->check_exchangerate($myconfig, $form->{currency}, $form->{invdate}, 'buy');
}
$form->{exchangerate} =
sub makemodel_row {
$lxdebug->enter_sub();
my ($numrows) = @_;
-
- my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"} }, 1 .. $numrows;
+ #hli
+ my @mm_data = grep { any { $_ ne '' } @$_{qw(make model)} } map +{ make => $form->{"make_$_"}, model => $form->{"model_$_"}, lastcost => $form->{"lastcost_$_"}, lastupdate => $form->{"lastupdate_$_"}, sortorder => $form->{"sortorder_$_"} }, 1 .. $numrows;
delete @{$form}{grep { m/^make_\d+/ || m/^model_\d+/ } keys %{ $form }};
print $form->parse_html_template('ic/makemodel', { MM_DATA => [ @mm_data, {} ], mm_rows => scalar @mm_data + 1 });
return $content;
}
+sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ foreach my $action (qw(delete delivery_order e_mail invoice print purchase_order purchase_order quotation
+ request_for_quotation sales_order sales_order save save_and_close save_as_new ship_to update)) {
+ if ($form->{"action_${action}"}) {
+ call_sub($action);
+ return;
+ }
+ }
+
+ $form->error($locale->text('No action defined.'));
+}
'Do you really want to delete AP transaction #1?' => 'Wollen Sie wirklich die Kreditorenbuchung #1 löschen?',
'Do you really want to delete AR transaction #1?' => 'Wollen Sie wirklich die Debitorenbuchung #1 löschen?',
'Do you really want to delete GL transaction #1?' => 'Wollen Sie wirklich die Dialogbuchung #1 löschen?',
- 'Do you really want to delete this group:' => 'Wollen Sie wirklich diese Gruppe löschen:',
+ 'Do you really want to delete this group?' => 'Gruppe wirklich löschen?',
'Do you really want to delete this warehouse?' => 'Wollen Sie dieses Lager wirklich löschen?',
'Do you want Lx-Office to create a group for access to all functions?' => 'Wollen Sie, dass Lx-Office eine Gruppe mit Zugriff auf alle Funktionen anlegt?',
'Do you want to <b>limit</b> your search?' => 'Wollen Sie Ihre Suche <b>spezialisieren</b>?',
'To (email)' => 'An',
'To (time)' => 'Bis',
'To Date' => 'Bis',
- 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Benutzernamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
+ 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehenden Benutzernamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
'Top' => 'Oben',
'Top (CSS)' => 'Oben (mit CSS)',
'Top (CSS) new' => 'Oben (mit CSS, neu)',
'Do you really want to delete AP transaction #1?' => 'Wollen Sie wirklich die Kreditorenbuchung #1 löschen?',
'Do you really want to delete AR transaction #1?' => 'Wollen Sie wirklich die Debitorenbuchung #1 löschen?',
'Do you really want to delete GL transaction #1?' => 'Wollen Sie wirklich die Dialogbuchung #1 löschen?',
- 'Do you really want to delete this group:' => 'Wollen Sie wirklich diese Gruppe löschen:',
+ 'Do you really want to delete this group?' => 'Gruppe wirklich löschen?',
'Do you really want to delete this warehouse?' => 'Wollen Sie dieses Lager wirklich löschen?',
'Do you want Lx-Office to create a group for access to all functions?' => 'Wollen Sie, dass Lx-Office eine Gruppe mit Zugriff auf alle Funktionen anlegt?',
'Do you want to <b>limit</b> your search?' => 'Wollen Sie Ihre Suche <b>spezialisieren</b>?',
'Lx-Office can fix these problems automatically.' => 'Lx-Office kann solche Probleme automatisch beheben.',
'Lx-Office has been switched to group-based access restrictions.' => 'Lx-Office wurde auf eine gruppenbasierte Benutzerzugriffsverwaltung umgestellt.',
'Lx-Office has found one or more problems in the general ledger.' => 'Lx-Office hat ein oder mehrere Probleme im Hauptbuch gefunden.',
- 'Lx-Office is about to update the database [ #1 ].' => '',
+ 'Lx-Office is about to update the database [ #1 ].' => 'Lx-Office wird gleich die Datenbank [ #1 ] aktualisieren.',
'Lx-Office is now able to manage warehouses instead of just tracking the amount of goods in your system.' => 'Lx-Office enthält jetzt auch echte Lagerverwaultung anstatt reiner Mengenzählung.',
'MAILED' => 'Gesendet',
'MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES' => 'Ihr Browser kann leider keine eingebetteten Frames anzeigen. Bitte wählen Sie ein anderes Menü in der Benutzerkonfiguration im Administrationsmenü aus.',
'Quote chararacter' => 'Anführungszeichen',
'Quoted' => 'Angeboten',
'RFQ' => 'Anfrage',
+ 'RFQ Date' => 'Anfragedatum',
'RFQ Number' => 'Anfragenummer',
'RFQs' => 'Preisanfragen',
'ROP' => 'Mindestlagerbestand',
'To (email)' => 'An',
'To (time)' => 'Bis',
'To Date' => 'Bis',
- 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Benutzernamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
+ 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehenden Benutzernamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
'Top' => 'Oben',
'Top (CSS)' => 'Oben (mit CSS)',
'Top (CSS) new' => 'Oben (mit CSS, neu)',
'Do you really want to delete AP transaction #1?' => '',
'Do you really want to delete AR transaction #1?' => '',
'Do you really want to delete GL transaction #1?' => '',
- 'Do you really want to delete this group:' => '',
+ 'Do you really want to delete this group?' => '',
'Do you really want to delete this warehouse?' => '',
'Do you want Lx-Office to create a group for access to all functions?' => '',
'Do you want to <b>limit</b> your search?' => '',
'Do you really want to delete AP transaction #1?' => '',
'Do you really want to delete AR transaction #1?' => '',
'Do you really want to delete GL transaction #1?' => '',
- 'Do you really want to delete this group:' => '',
+ 'Do you really want to delete this group?' => '',
'Do you really want to delete this warehouse?' => '',
'Do you want Lx-Office to create a group for access to all functions?' => '',
'Do you want to <b>limit</b> your search?' => '',
module=dn.pl
action=search
+
[AP]
[AP--Add RFQ]
--- /dev/null
+-- @tag: add_makemodel_prices
+-- @description: EK-Preis zu jedem Lieferanten speichern und das Datum der Eingabe
+-- @depends: release_2_6_1
+ALTER TABLE makemodel ADD COLUMN lastcost numeric(15,5) ;
+ALTER TABLE makemodel ADD COLUMN lastupdate date;
+ALTER TABLE makemodel ADD COLUMN sortorder integer;
+
+UPDATE makemodel SET sortorder = 1;
+
+--# Da noch keine Daten vorhanden, den Wert "veralten"
+UPDATE makemodel SET lastupdate = '1999-01-01';
+
"<br>$msg<br>" . $DBI::errstr);
}
-sub do_query {
- my ($query, $may_fail) = @_;
+sub do_update {
+ my $dbh = $main::auth->dbconnect();
+ my $query = <<SQL;
+ SELECT id
+ FROM auth."group"
+ WHERE NOT EXISTS(
+ SELECT group_id
+ FROM auth.group_rights
+ WHERE (auth.group_rights.group_id = auth."group".id)
+ AND (auth.group_rights."right" = 'sales_all_edit')
+ )
+SQL
+
+ my @group_ids = selectall_array_query($form, $dbh, $query);
+ if (@group_ids) {
+ $query = <<SQL;
+ INSERT INTO auth.group_rights (group_id, "right", granted)
+ VALUES (?, 'sales_all_edit', TRUE)
+SQL
+ my $sth = prepare_query($form, $dbh, $query);
+
+ foreach my $id (@group_ids) {
+ do_statement($form, $sth, $query, $id);
+ }
- if (!$dbh->do($query)) {
- mydberror($query) unless ($may_fail);
- $dbh->rollback();
- $dbh->begin_work();
+ $sth->finish();
+ $dbh->commit();
}
-}
-sub do_update {
- my @queries;
-
-# do_query("ALTER TABLE project ADD PRIMARY KEY (id);", 1);
-# map({ do_query($_, 0); } @queries);
-# print "hieryy";
-# print (Dumper($main::form));
- my $dbh = $main::auth->dbconnect();
- my $query = qq|SELECT distinct group_id from auth.user_group|;
- my $sth_all_groups = prepare_execute_query($form, $dbh, $query);
- while (my $hash_ref = $sth_all_groups->fetchrow_hashref()) { # Schleife
- push @queries, "INSERT INTO auth.group_rights (group_id, \"right\", granted) VALUES (" . $hash_ref->{group_id} . ", 'sales_all_edit', 't')";
-}
-# if in doubt use brute force ;-) jb
- foreach my $query (@queries){
-# print "hier:" . $query;
- my $dbh = $main::auth->dbconnect();
- my $sth = prepare_query($form, $dbh, $query);
- do_statement($form,$sth,$query);
- $sth->finish();
- $dbh ->commit();
-}
return 1;
}
[%- USE T8 %]
[% USE HTML %]<body>
- <form name="Form" method="post" action="admin.pl">
+ <div class="listtop">[% 'Delete group' | $T8 %]: [% name %]</div>
+ <p class="message_hint">[ [% name %] ] - [% 'Do you really want to delete this group?' | $T8 %]</p>
+ <form name="Form" method="post" action="admin.pl">
+ <input type="hidden" name="back_nextsub" value="edit_groups">
+ <input type="submit" class="submit" name="action" value="[% 'Back' | $T8 %]">
- <input type="hidden" name="group_id" value="[% HTML.escape(id) %]">
- <input type="hidden" name="confirmed" value="1">
- <div class="listtop">[% 'Delete group' | $T8 %]</div>
+ <input type="hidden" name="group_id" value="[% HTML.escape(id) %]">
+ <input type="hidden" name="confirmed" value="1">
+ <input type="hidden" name="delete_nextsub" value="delete_group">
+ <input type="submit" class="submit" name="action" value="[% 'Delete' | $T8 %]">
+ </form>
- <p class="message_hint">[% 'Do you really want to delete this group:' | $T8 %] [% name %] ?</p>
-
- <input type="hidden" name="delete_nextsub" value="delete_group">
- <button type="button" onclick="history.back()">[% 'Back' | $T8 %]</button>
- <input type="submit" class="submit" name="action" value="[% 'Delete' | $T8 %]">
-
- </form>
-
-</body>
+ </body>
</html>
<hr>
<input type="hidden" name="save_nextsub" value="save_group">
- <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
-
<input type="submit" class="submit" name="action" value="[% 'Back' | $T8 %]">
+ <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
</form>
</body>
</html>
<input name="callback" type="hidden" value="admin.pl?action=list_users">
+ <input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]">
<input type="hidden" name="action" value="dispatcher">
<input type="submit" class="submit" name="action_save_user" value="[% 'Save' | $T8 %]">
<input type="hidden" name="action_save_user_as_new" id="action_save_user_as_new" value="">
<input type="button" class="submit" id="save_as_new_button" value="[% 'Save as new' | $T8 %]">
<input type="submit" class="submit" name="action_delete_user" value="[% 'Delete' | $T8 %]">
- <input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]">
<input type="hidden" name="edit" value="1">
[% END %]
<br>
<input type=hidden name=action value="printer_dispatcher">
+<input type=submit class=submit name=list_printers value="[% 'Back' | $T8 %]">
<input type=submit class=submit name=save_printer value="[% 'Save' | $T8 %]">
[%- IF id %]
<input type=submit class=submit name=delete_printer value="[% 'Delete' | $T8 %]">
[%- END %]
-<input type=submit class=submit name=list_printers value="[% 'Back' | $T8 %]">
</form>
[%- IF all_printers.size %]
[%- FOREACH row = all_printers %]
<tr valign=top class="listrow[% loop.count % 2 %]">
- <td><a href="[% edit_link %][% row.id %]">[% row.printer_description %]</a></td>
- <td align=left>[% row.printer_command | html %]</td>
- <td align=left>[% row.template_code | html %]</td>
+ <td> <a href="[% edit_link %][% row.id %]">[% row.printer_description %]</a></td>
+ <td align=left> [% row.printer_command | html %]</td>
+ <td align=left> [% row.template_code | html %]</td>
</tr>
[%- END %]
[%- ELSE %]
<br>
<input type="hidden" name="action" value="printer_dispatcher">
- <input type="submit" name="add_printer" value ="[% 'Add' | $T8 %]">
<input type="submit" name='get_login_form' value="[% 'Back' | $T8 %]">
+ <input type="submit" name="add_printer" value ="[% 'Add' | $T8 %]">
</form>
</body>
</html>
<input type='hidden' name='action' value='printer_dispatcher'>
<p>
-<input type='submit' name='list_printers' value='[% 'Continue' | $T8 %]'>
<input type='submit' name='list_users' value='[% 'Back' | $T8 %]'>
+<input type='submit' name='list_printers' value='[% 'Continue' | $T8 %]'>
</p>
</form>
[%- USE T8 %]
[% USE HTML %]<body>
- <div class="message_error">[% IF title_error %][% title_error %][% ELSE %][% 'Error!' | $T8 %][% END %]</div>
-<p><input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]"></p>
+ <div class="message_error">[% IF title_error %][% title_error %][% ELSE %][% 'Error!' | $T8 %][% END %]
<p>[% label_error %]</p>
-
+ </div>
+
+ <p style="text-align: left;"><input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]"></p>
+
[%- IF SHOW_BACK_BUTTON %]
<form>
<p>
<tr>
<th class="listheading">[% 'Make' | $T8 %]</th>
<th class="listheading">[% 'Model' | $T8 %]</th>
+ <th class="listheading">[% 'Last Cost' | $T8 %]</th>
+ <th class="listheading">[% 'Updated' | $T8 %]</th>
+ <th class="listheading">[% 'order' | $T8 %]</th>
</tr>
[%- FOREACH row = MM_DATA %]
<tr>
-%]
</td>
<td><input name="model_[% loop.count %]" size="30" value="[% HTML.escape(row.model) %]"></td>
+ <td><input type="hidden" name="old_lastcost_[% loop.count %]" value="[% LxERP.format_amount(row.lastcost, -2) %]">
+ <input name="lastcost_[% loop.count %]" size="10" value="[% LxERP.format_amount(row.lastcost, -2) %]"></td>
+ <td><input name="lastupdate_[% loop.count %]" size="10" value="[% HTML.escape(row.lastupdate) %]"></td>
+ <td><input name="sortorder_[% loop.count %]" size="3" value="[% HTML.escape(row.sortorder) %]"></td>
</tr>
[%- END %]
</table>
</table>
[% label_edit %]<br>
-<input class="submit" type="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]">
-<input class="submit" type="submit" name="action" value="[% 'Ship to' | $T8 %]">
-<input class="submit" type="submit" name="action" value="[% 'Print' | $T8 %]">
-<input class="submit" type="submit" name="action" value="[% 'E-mail' | $T8 %]">
-<input class="submit" type="submit" name="action" value="[% 'Save' | $T8 %]">
-<input class="submit" type="submit" name="action" value="[% 'Save and Close' | $T8 %]">
+<input class="submit" type="submit" name="action_update" id="update_button" value="[% 'Update' | $T8 %]">
+<input class="submit" type="submit" name="action_ship_to" value="[% 'Ship to' | $T8 %]">
+<input class="submit" type="submit" name="action_print" value="[% 'Print' | $T8 %]">
+<input class="submit" type="submit" name="action_e_mail" value="[% 'E-mail' | $T8 %]">
+<input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]">
+<input class="submit" type="submit" name="action_save_and_close" value="[% 'Save and Close' | $T8 %]">
[%- IF id %]
<input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
<input type="button" class="submit" onclick="set_history_window([% HTML.escape(id) %])" name="history" id="history" value="[% 'history' | $T8 %]">
<br>[% label_workflow %]<br>
- <input class="submit" type="submit" name="action" value="[% 'Save as new' | $T8 %]">
- <input class="submit" type="submit" name="action" value="[% 'Delete' | $T8 %]">
+ <input class="submit" type="submit" name="action_save_as_new" value="[% 'Save as new' | $T8 %]">
+ <input class="submit" type="submit" name="action_delete" value="[% 'Delete' | $T8 %]">
[%- IF is_sales_quo %]
- <input class="submit" type="submit" name="action" value="[% 'Sales Order' | $T8 %]">
+ <input class="submit" type="submit" name="action_sales_order" value="[% 'Sales Order' | $T8 %]">
[%- END %]
[%- IF is_req_quo %]
- <input class="submit" type="submit" name="action" value="[% 'Purchase Order' | $T8 %]">
+ <input class="submit" type="submit" name="action_purchase_order" value="[% 'Purchase Order' | $T8 %]">
[%- END %]
[%- IF is_sales_ord || is_pur_ord %]
- <input class="submit" type="submit" name="action" value="[% 'Delivery Order' | $T8 %]">
+ <input class="submit" type="submit" name="action_delivery_order" value="[% 'Delivery Order' | $T8 %]">
[%- END %]
- <input class="submit" type="submit" name="action" value="[% 'Invoice' | $T8 %]">
+ <input class="submit" type="submit" name="action_invoice" value="[% 'Invoice' | $T8 %]">
[%- IF is_sales_ord || is_pur_ord %]
<br>[% heading %] als neue Vorlage verwenden für<br>
[%- IF is_sales_ord %]
- <input class="submit" type="submit" name="action" value="[% 'Purchase Order' | $T8 %]">
- <input class="submit" type="submit" name="action" value="[% 'Quotation' | $T8 %]">
+ <input class="submit" type="submit" name="action_purchase_order" value="[% 'Purchase Order' | $T8 %]">
+ <input class="submit" type="submit" name="action_quotation" value="[% 'Quotation' | $T8 %]">
[%- ELSE %]
[%- IF is_pur_ord %]
- <input class="submit" type="submit" name="action" value="[% 'Sales Order' | $T8 %]">
- <input class="submit" type="submit" name="action" value="[% 'Request for Quotation' | $T8 %]">
+ <input class="submit" type="submit" name="action_sales_order" value="[% 'Sales Order' | $T8 %]">
+ <input class="submit" type="submit" name="action_request_for_quotation" value="[% 'Request for Quotation' | $T8 %]">
[%- END %]
[%- END %]
[%- END %]
[%- END %]
+<input type="hidden" name="action" value="dispatcher">
<input type="hidden" name="saved_xyznumber" value="[% HTML.escape(saved_xyznumber) %]">
<input type="hidden" name="rowcount" value="[% HTML.escape(rowcount) %]">
<input type="hidden" name="callback" value="[% callback %]">