} else {
$arap = "ar";
my $invoice = "a.invoice";
+ my $quonumber = "a.quonumber";
if ($form->{type} =~ /_(order|quotation)$/) {
$invnumber = "ordnumber";
$invoice = '0';
}
+ if ($form->{type} eq 'packing_list') {
+ $invnumber = "donumber";
+ $arap = "delivery_orders";
+ $invoice = '0';
+ $quonumber = '0';
+ }
+
$query =
- qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, a.quonumber, | .
+ qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, $quonumber, | .
qq| a.transdate, $invoice AS invoice, '$arap' AS module, vc.name, | .
qq| s.spoolfile | .
qq|FROM $arap a, ${vc} vc, status s | .
qq|WHERE s.trans_id = a.id | .
qq| AND s.spoolfile IS NOT NULL | .
- qq| AND s.formname = ? | .
+ ($form->{type} eq 'packing_list'
+ ? qq| AND s.formname IN (?, ?) |
+ : qq| AND s.formname = ? |) .
qq| AND a.${vc}_id = vc.id|;
@values = ($form->{type});
+
+ if ($form->{type} eq 'packing_list') {
+ @values = qw(sales_delivery_order purchase_delivery_order);
+ }
}
if ($form->{"${vc}_id"}) {
$query .= " AND vc.name ILIKE ?";
push(@values, $form->like($form->{ $vc }));
}
- foreach my $column (qw(invnumber ordnumber quonumber)) {
+ foreach my $column (qw(invnumber ordnumber quonumber donumber)) {
if ($form->{$column}) {
$query .= " AND a.$column ILIKE ?";
push(@values, $form->like($form->{$column}));
}
}
- if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation)$/) {
+ if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation|packing_list)$/) {
if ($form->{transdatefrom}) {
$query .= " AND a.transdate >= ?";
push(@values, $form->{transdatefrom});
my $sortorder = join ', ', $form->sort_columns(@a);
if (grep({ $_ eq $form->{sort} }
- qw(transdate invnumber ordnumber quonumber name))) {
+ qw(transdate invnumber ordnumber quonumber donumber name))) {
$sortorder = $form->{sort};
}
push @where, ($form->{type} eq 'sales_delivery_order' ? '' : 'NOT ') . qq|COALESCE(dord.is_sales, FALSE)|;
- my $department_id = (split /--/, $form->{department})[1];
- if ($department_id) {
+ if ($form->{department_id}) {
push @where, qq|dord.department_id = ?|;
- push @values, conv_i($department_id);
+ push @values, conv_i($form->{department_id});
}
if ($form->{project_id}) {
id, delivery_order_id, parts_id, description, longdescription, qty, base_qty,
sellprice, discount, unit, reqdate, project_id, serialnumber,
ordnumber, transdate, cusordnumber,
- lastcost, price_factor_id, price_factor, marge_price_factor)
+ lastcost, price_factor_id, price_factor, marge_price_factor, pricegroup_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
- (SELECT factor FROM price_factors WHERE id = ?), ?)|;
+ (SELECT factor FROM price_factors WHERE id = ?), ?, ?)|;
my $h_item = prepare_query($form, $dbh, $q_item);
my $q_item_stock =
$form->{"cusordnumber_$i"},
$form->{"lastcost_$i"},
conv_i($form->{"price_factor_id_$i"}), conv_i($form->{"price_factor_id_$i"}),
- conv_i($form->{"marge_price_factor_$i"}));
+ conv_i($form->{"marge_price_factor_$i"}),
+ conv_i($form->{"pricegroup_id_$i"}));
do_statement($form, $h_item, $q_item, @values);
my $stock_info = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_$i"});
$h_item->finish();
$h_item_stock->finish();
- ($null, $form->{department_id}) = split(/--/, $form->{department});
# save DO record
$query =
doi.sellprice, doi.parts_id AS id, doi.unit, doi.discount, p.bin, p.notes AS partnotes,
doi.reqdate, doi.project_id, doi.serialnumber, doi.lastcost,
doi.ordnumber, doi.transdate, doi.cusordnumber, doi.longdescription,
- doi.price_factor_id, doi.price_factor, doi.marge_price_factor,
+ doi.price_factor_id, doi.price_factor, doi.marge_price_factor, doi.pricegroup_id,
pr.projectnumber, dord.transdate AS dord_transdate,
pg.partsgroup
FROM delivery_order_items doi
return scalar(@{ $self->{name_list} });
}
-# the selection sub is used in the AR, AP, IS, IR and OE module
+# the selection sub is used in the AR, AP, IS, IR, DO and OE module
#
sub all_vc {
$main::lxdebug->enter_sub();
map { $_->{onhand} *= 1 } @{ $form->{parts} };
+ # fix qty sign in ap. those are saved negative
+ if ($bsooqr && $form->{bought}) {
+ for my $row (@{ $form->{parts} }) {
+ $row->{qty} *= -1 if $row->{module} eq 'ir';
+ }
+ }
+
# post processing for assembly parts lists (bom)
# for each part get the assembly parts and add them into the partlist.
my @assemblies;
do_query($form, $dbh, $query, ($self->{login}, $myconfig->{name}, $myconfig->{tel}, "user"));
} elsif ($update_existing) {
- my $query = qq|UPDATE employee SET name = ?, workphone = ?, role = 'user' WHERE id = ?|;
+ my $query = qq|UPDATE employee SET name = ?, workphone = ?, role = 'user', deleted = 'f' WHERE id = ?|;
do_query($form, $dbh, $query, $myconfig->{name}, $myconfig->{tel}, $id);
}
'sales_order' => 'sales_order_edit',
'sales_quotation' => 'sales_quotation_edit',
'purchase_order' => 'purchase_order_edit',
+ 'packing_list' => 'sales_delivery_order_edit|purchase_delivery_order_edit',
'request_quotation' => 'request_quotation_edit',
'check' => 'cash',
'receipt' => 'cash',
purchase_order => { title => $::locale->text('Purchase Orders'), ordnumber => 1, },
sales_quotation => { title => $::locale->text('Quotations'), quonumber => 1, },
request_quotation => { title => $::locale->text('RFQs'), quonumber => 1, },
+ packing_list => { title => $::locale->text('Delivery Orders'), donumber => 1, ordnumber => 1 },
check => { title => $::locale->text('Checks'), chknumber => 1, },
receipt => { title => $::locale->text('Receipts'), rctnumber => 1, },
);
invnumber => sub { $::locale->text('Invoice Number') . " : $::form->{invnumber}" },
ordnumber => sub { $::locale->text('Order Number') . " : $::form->{ordnumber}" },
quonumber => sub { $::locale->text('Quotation Number') . " : $::form->{quonumber}" },
+ donumber => sub { $::locale->text('Delivery Order Number') . " : $::form->{donumber}" },
transdatefrom => sub { $::locale->text('From') . " " . $::locale->date(\%::myconfig, $::form->{transdatefrom}, 1) },
transdateto => sub { $::locale->text('To') . " " . $::locale->date(\%::myconfig, $::form->{transdateto}, 1) },
);
my @options;
- for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber transdatefrom transdateto)) {
+ for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber donumber transdatefrom transdateto)) {
next unless $::form->{$key};
push @href_options, $key;
push @options, $option_texts{$key} ? $option_texts{$key}->() : '';
use SL::IS;
use SL::ReportGenerator;
use SL::WH;
-
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/invoice_io.pl";
DO->retrieve('vc' => $form->{vc},
'ids' => $form->{id});
- $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes));
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes currency));
$form->{shipto} = 1 if $form->{id};
# get customer / vendor
}
$form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id));
+ $form->restore_vars(qw(currency)) if ($form->{id} || $form->{convert_from_oe_ids});
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
$form->header();
# Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID'
- $form->{department} .= '--' . $form->{department_id};
-
+ # und Erweiterung für Bug 1760:
+ # Das war leider nur ein Teil-Fix, da das Verhalten den 'Erneuern'-Knopf
+ # nicht überlebt. Konsequent jetzt auf L umgestellt
+ # $ perldoc SL::Template::Plugin::L
+ # Daher entsprechend nur die Anpassung in form_header
+ # und in DO.pm gemacht. 4 Testfälle:
+ # department_id speichern | i.O.
+ # department_id lesen | i.O.
+ # department leer überlebt erneuern | i.O.
+ # department nicht leer überlebt erneuern | i.O.
+ # $main::lxdebug->message(0, 'ABTEILUNGS ID in form?' . $form->{department_id});
print $form->parse_html_template('do/form_header');
$main::lxdebug->leave_sub();
}
+ # show pricegroup in newly loaded invoice when creating invoice from delivery order
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"sellprice_pg_$i"} = join /--/, $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"};
+ }
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ set_pricegroup($_) for 1 .. $form->{rowcount};
+
display_form();
$main::lxdebug->leave_sub();
invoice_links();
prepare_invoice();
+
+ # show pricegroup in newly loaded invoice when creating invoice from delivery order
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"sellprice_pg_$i"} = join /--/, $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"};
+ }
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ set_pricegroup($_) for 1 .. $form->{rowcount};
+
display_form();
$main::lxdebug->leave_sub();
model => $locale->text('Model') . ": '$form->{model}'",
drawing => $locale->text('Drawing') . ": '$form->{drawing}'",
microfiche => $locale->text('Microfiche') . ": '$form->{microfiche}'",
- l_soldtotal => $locale->text('soldtotal'),
+ l_soldtotal => $locale->text('Qty in Selected Records'),
ean => $locale->text('EAN') . ": '$form->{ean}'",
);
}
if ($form->{l_linetotal}) {
- $form->{l_onhand} = "Y";
+ $form->{l_qty} = "Y";
$form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
$form->{l_linetotallastcost} = $form->{searchitems} eq 'assembly' && !$form->{bom} ? "" : 'Y' if $form->{l_lastcost};
$form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
|| $form->{ordered}
|| $form->{rfq}
|| $form->{quoted}) {
- $form->{l_onhand} = "Y";
+# $form->{l_onhand} = "Y";
} else {
$form->{l_linetotalsellprice} = "";
$form->{l_linetotallastcost} = "";
}
}
+ # soldtotal doesn't make sense with more than one bsooqr option.
+ # so reset it to sold (the most common option), and issue a warning
+ my @bsooqr = qw(sold bought onorder ordered rfq quoted);
+ if ($form->{l_subtotal} && 1 < grep { $form->{$_} } @bsooqr) {
+ my $enabled = first { $form->{$_} } @bsooqr;
+ $form->{$_} = '' for @bsooqr;
+ $form->{$enabled} = 'Y';
+
+ push @options, $::locale->text('Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1', $optiontexts{$enabled});
+ }
+
IC->all_parts(\%myconfig, \%$form);
my @columns = qw(
$ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor};
# use this for assemblies
- my $onhand = $ref->{onhand};
+ my $soldtotal = $ref->{soldtotal};
if ($ref->{assemblyitem}) {
$row->{partnumber}{align} = 'right';
- $row->{onhand}{data} = 0;
- $onhand = 0 if ($form->{sold});
+ $row->{soldtotal}{data} = 0;
+ $soldtotal = 0 if ($form->{sold});
}
my $edit_link = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback');
if (!$ref->{assemblyitem}) {
foreach my $col (@subtotal_columns) {
- $totals{$col} += $onhand * $ref->{$col};
- $subtotals{$col} += $onhand * $ref->{$col};
+ $totals{$col} += $soldtotal * $ref->{$col};
+ $subtotals{$col} += $soldtotal * $ref->{$col};
}
- $subtotals{onhand} += $onhand;
+ $subtotals{soldtotal} += $soldtotal;
}
# set module stuff
my $row = { map { $_ => { 'class' => 'listsubtotal', } } @columns };
if (($form->{searchitems} ne 'assembly') || !$form->{bom}) {
- $row->{onhand}->{data} = $form->format_amount(\%myconfig, $subtotals{onhand});
+ $row->{soldtotal}->{data} = $form->format_amount(\%myconfig, $subtotals{soldtotal});
}
map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $subtotals{$_}, 2) } @subtotal_columns;
- map { $subtotals{$_} = 0 } ('onhand', @subtotal_columns);
+ map { $subtotals{$_} = 0 } ('soldtotal', @subtotal_columns);
$report->add_data($row);
if ($is_delivery_order) {
map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost);
- push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost);
+ push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost pricegroup_id);
push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}";
}
map { $form->{$_} = $old_values{$_} if ($old_values{$_}) } keys %old_values;
+ for my $i (1 .. $form->{rowcount}) {
+ (my $dummy, $form->{"pricegroup_id_$i"}) = split /--/, $form->{"sellprice_pg_$i"};
+ }
update();
$main::lxdebug->leave_sub();
- Bugfix 1738: Entwürfe können nicht gelöscht werden
- Bugfix 1759: Währung bei Kunden / Lieferanten vorbelegen
- Bugfix 1770: Währung / currency überlebt Workflow über Lieferschein nicht
+ - Bugfix 1770: (zweiter Teil) Preisgruppen überleben Workflow nicht
- Bugfix 1773: SQL Fehler bei Anzeige von Angeboten
- Bugfix 1725: In Mahnungen steht currency nicht als Variable zur Verfügung?
- Bugfix 1771: Zahlungsausgang: Lieferant wird nicht ausgewählt, wenn Name 2 Leerzeichen hintereinander enthält
- Bugfix 1566: Variablen für Verkäufer und USTID in Mahnungsdruck hinzugefügt
- Bugfix 1588: Einzelteile eines Erzeugnisses von Verkaufsbericht ausnehmen
- Bugfix 1756: Ertrag in Bruttorechnungen korrekt berechnen
+ - Bugfix 1760 - 1760: Bei einem Lieferschein wird die Abteilung nicht mitgespeichert
+
'Cannot delete quotation!' => 'Angebot kann nicht gelöscht werden!',
'Cannot delete transaction!' => 'Buchung kann nicht gelöscht werden!',
'Cannot delete vendor!' => 'Lieferant kann nicht gelöscht werden!',
- 'Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.' => '',
+ 'Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.' => 'Konnte keine passende Vorlage für diesen Druckauftrag finden. Bitte benachrichtigen Sie Ihren Vorlagenadministrator. Die folgenden Pfade wurden durchsucht: #1 ',
'Cannot have a value in both Debit and Credit!' => 'Es kann nicht gleichzeitig Soll und Haben gebucht werden!',
'Cannot post Payment!' => 'Zahlung kann nicht gebucht werden!',
'Cannot post Receipt!' => 'Beleg kann nicht gebucht werden!',
'Delivered' => 'Geliefert',
'Delivery Date' => 'Lieferdatum',
'Delivery Order' => 'Lieferschein',
- 'Delivery Order created' => 'Lieferschein erstellt',
'Delivery Order Date' => 'Lieferscheindatum',
'Delivery Order Date missing!' => 'Lieferscheindatum fehlt!',
'Delivery Order Number' => 'Lieferscheinnummer',
+ 'Delivery Order created' => 'Lieferschein erstellt',
'Delivery Order deleted!' => 'Lieferschein gelöscht!',
'Delivery Orders' => 'Lieferscheine',
'Department' => 'Abteilung',
'Subject' => 'Betreff',
'Subject:' => 'Betreff:',
'Subtotal' => 'Zwischensumme',
+ 'Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1' => 'Zwischensummen können nicht zwischen den einzelnen Belegen unterscheiden, es wird nur "#1" angezeigt',
'Such entries cannot be exported into the DATEV format and have to be fixed as well.' => 'Solche Einträge sind aber nicht DATEV-exportiertbar und müssen ebenfalls korrigiert werden.',
'Sum Credit' => 'Summe Haben',
'Sum Debit' => 'Summe Soll',
--- /dev/null
+-- @tag: delivery_order_items_add_pricegroup_id
+-- @description: Spalten für Preisgruppen-Id für Lieferscheine
+-- @depends: release_2_6_3
+-- @charset: utf-8
+ALTER TABLE delivery_order_items ADD COLUMN pricegroup_id integer;
--- /dev/null
+-- @tag: employee_deleted
+-- @description: Benutzer löschbar machen
+-- @depends: release_2_6_3
+
+ALTER TABLE employee ADD COLUMN deleted BOOLEAN DEFAULT 'f';
-find t | grep "\.t$" | grep -v '^t/old' | HARNESS_OPTIONS=j:c xargs perl -MTest::Harness -e 'runtests(@ARGV)'
+find t | grep "\.t$" | grep -v '^t/old' | HARNESS_OPTIONS=j:c xargs perl -Imodules/fallback -MTest::Harness -e 'BEGIN { unshift @INC, "modules/override" } runtests(@ARGV)'
<td colspan=3>[% L.input_tag('quonumber', '', size=20) %]</td>
</tr>
[%- END %]
+[%- IF label.$type.donumber %]
+ <tr>
+ <th align=right nowrap>[% 'Delivery Order Number' | $T8 %]</th>
+ <td colspan=3>[% L.input_tag('donumber', '', size=20) %]</td>
+ </tr>
+[%- END %]
[%- IF label.$type.chknumber %]
<tr>
<th align=right nowrap>[% 'Reference' | $T8 %]</th>
[%- USE T8 %]
-[% USE HTML %][% USE LxERP %]<body onload="on_load()">
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+<body onload="on_load()">
<script type="text/javascript" src="js/show_form_details.js"></script>
<script type="text/javascript" src="js/show_history.js"></script>
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
<td colspan="3">
- [%- IF delivered %]
- <input type="hidden" name="department" value="[% HTML.escape(department) %]">
- [%- FOREACH row = ALL_DEPARTMENTS %]
- [% IF department == row.value %][% HTML.escape(row.description) %]--[% HTML.escape(row.id) %][% END %]
- [%- END %]
- [%- ELSE %]
- <select name="department" class="fixed_width">
- <option></option>
- [%- FOREACH row = ALL_DEPARTMENTS %]
- <option[% IF department == row.value %] selected[% END %]>[% HTML.escape(row.description) %]--[% HTML.escape(row.id) %]</option>
- [%- END %]
- </select>
- [%- END %]
- </td>
+ [% L.select_tag('department_id', L.options_for_select(ALL_DEPARTMENTS, default=department_id, title="description", with_empty=1), style='width: 250px', disabled => delivered )%]
+ </td>
</tr>
[%- END %]
</td>
</tr>
+ <tr>
+ <td>
+ <input name="l_onhand" id="l_onhand" class="checkbox" type="checkbox" value="Y">
+ <label for="l_onhand">[% 'Stocked Qty' | $T8 %]</label>
+ </td>
+ </tr>
+
[% CUSTOM_VARIABLES_INCLUSION_CODE %]
</table>
</td>