Revision 0dd80ce0
Von Tamino Steinert vor 5 Tagen hinzugefügt
- ID 0dd80ce016ddfc894734cf4dbb06ad18e2a9fc64
- Vorgänger 2d3180e2
SL/Controller/Order.pm | ||
---|---|---|
1178 | 1178 |
$self->js->render(); |
1179 | 1179 |
} |
1180 | 1180 |
|
1181 |
sub action_add_discount_item { |
|
1182 |
my ($self) = @_; |
|
1183 |
$self->recalc(); |
|
1184 |
|
|
1185 |
my $discount_part_id = $::instance_conf->get_discount_part_id |
|
1186 |
or die "no discount part set in client config"; |
|
1187 |
my $discount_part = SL::DB::Part->load_cached($discount_part_id); |
|
1188 |
|
|
1189 |
my $discount_type = $::form->{discount}->{type} |
|
1190 |
or die "discount.type needed"; |
|
1191 |
my $discount_value_as_number = $::form->{discount}->{value}; |
|
1192 |
my $discount_value = $::form->parse_amount(\%::myconfig, $discount_value_as_number); |
|
1193 |
$discount_value *= -1 if $discount_value > 0; |
|
1194 |
|
|
1195 |
$::form->{add_item}->{parts_id} = $discount_part_id; |
|
1196 |
$::form->{add_item}->{qty_as_number} = 1; |
|
1197 |
$::form->{add_item}->{unit} = $discount_part->unit; |
|
1198 |
$::form->{add_item}->{discount_as_percent} = 0; |
|
1199 |
|
|
1200 |
my $sellprice_as_number; |
|
1201 |
my $texts = get_part_texts($discount_part, $self->order->language_id); |
|
1202 |
my $description = $texts->{description}; |
|
1203 |
|
|
1204 |
if ($discount_type eq 'absolute') { |
|
1205 |
$sellprice_as_number = $::form->format_amount(\%::myconfig, $discount_value, 2, 0); |
|
1206 |
my $price_as_text = $::form->format_amount(\%::myconfig, -1 * $discount_value, 2, 0); |
|
1207 |
|
|
1208 |
my $currency = $self->order->currency->name; |
|
1209 |
$description =~ s/<%discount_value%>/$price_as_text $currency/; |
|
1210 |
} elsif ($discount_type eq 'percent') { |
|
1211 |
$sellprice_as_number = $::form->format_amount( |
|
1212 |
\%::myconfig, |
|
1213 |
$self->order->amount * $::form->parse_amount(\%::myconfig, $discount_value) / 100, |
|
1214 |
2, 0 |
|
1215 |
); |
|
1216 |
my $procent_as_text = $::form->format_amount(\%::myconfig, -1 * $discount_value); |
|
1217 |
|
|
1218 |
$description =~ s/<%discount_value%>/$procent_as_text%/; |
|
1219 |
} else { |
|
1220 |
die "unkown discount.type $discount_type"; |
|
1221 |
} |
|
1222 |
|
|
1223 |
$::form->{add_item}->{sellprice_as_number} = $sellprice_as_number; |
|
1224 |
$::form->{add_item}->{description} = $description; |
|
1225 |
|
|
1226 |
$self->action_add_item(); |
|
1227 |
} |
|
1228 |
|
|
1181 | 1229 |
# recalculate all linetotals, amounts and taxes and redisplay them |
1182 | 1230 |
sub action_recalc_amounts_and_taxes { |
1183 | 1231 |
my ($self) = @_; |
SL/DB/MetaSetup/Default.pm | ||
---|---|---|
67 | 67 |
delivery_date_interval => { type => 'integer', default => '0' }, |
68 | 68 |
deliverydate_on => { type => 'boolean', default => 'true' }, |
69 | 69 |
disabled_price_sources => { type => 'array' }, |
70 |
discount_part_id => { type => 'integer' }, |
|
70 | 71 |
doc_delete_printfiles => { type => 'boolean', default => 'false' }, |
71 | 72 |
doc_files => { type => 'boolean', default => 'false' }, |
72 | 73 |
doc_files_rootpath => { type => 'text', default => './documents' }, |
... | ... | |
284 | 285 |
key_columns => { currency_id => 'id' }, |
285 | 286 |
}, |
286 | 287 |
|
288 |
discount_part => { |
|
289 |
class => 'SL::DB::Part', |
|
290 |
key_columns => { discount_part_id => 'id' }, |
|
291 |
}, |
|
292 |
|
|
287 | 293 |
loss_carried_forward_chart => { |
288 | 294 |
class => 'SL::DB::Chart', |
289 | 295 |
key_columns => { loss_carried_forward_chart_id => 'id' }, |
js/kivi.Order.js | ||
---|---|---|
537 | 537 |
$.post("controller.pl", data, kivi.eval_json_result); |
538 | 538 |
}; |
539 | 539 |
|
540 |
ns.add_discount_item = function() { |
|
541 |
if (!ns.check_cv()) return; |
|
542 |
|
|
543 |
$('#row_table_id thead a img').remove(); |
|
544 |
|
|
545 |
var data = $('#order_form').serializeArray(); |
|
546 |
data.push({ name: 'action', value: 'Order/add_discount_item' }); |
|
547 |
|
|
548 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
549 |
}; |
|
550 |
|
|
540 | 551 |
ns.delete_order_item_row = function(clicked) { |
541 | 552 |
var row = $(clicked).parents("tbody").first(); |
542 | 553 |
$(row).remove(); |
locale/de/all | ||
---|---|---|
121 | 121 |
'Abbreviation Legend' => 'Beschreibung der Typ-Abkürzungen (1 Zeichen Typ, 1-2 Zeichen Klassifizierung)', |
122 | 122 |
'Abort' => 'Abbrechen', |
123 | 123 |
'Abrechnungsnummer' => 'Abrechnungsnummer', |
124 |
'Absolute' => 'Absolute', |
|
124 | 125 |
'Absolute BB Balance' => 'Gesamtsaldo laut Bankbuchungen', |
125 | 126 |
'Absolute BT Balance' => 'Gesamtsaldo laut Kontoauszug', |
126 | 127 |
'Acc Transaction' => 'Hauptbuch', |
... | ... | |
247 | 248 |
'Add custom report query' => 'Benutzerdefinierte Berichts-Abfrage erfassen', |
248 | 249 |
'Add custom variable' => 'Benutzerdefinierte Variable erfassen', |
249 | 250 |
'Add department' => 'Abteilung hinzufügen', |
251 |
'Add discount' => 'Rabatt hinzufügen', |
|
250 | 252 |
'Add document for' => 'Dokument hinzügen für ', |
251 | 253 |
'Add document for AP transactions' => 'Dokumente für Kreditorenbuchung hinzufügen (benötigt DMS)', |
252 | 254 |
'Add document for AR transactions' => 'Dokumente für Debitorenbuchung hinzufügen (benötigt DMS)', |
... | ... | |
1156 | 1158 |
'Default client' => 'Standardmandant', |
1157 | 1159 |
'Default currency' => 'Standardwährung', |
1158 | 1160 |
'Default currency missing!' => 'Standardwährung fehlt!', |
1161 |
'Default discount part' => 'Standard-Rabattartikel', |
|
1159 | 1162 |
'Default hourly rate for new customers' => 'Standard-Stundensatz für neue Kunden', |
1160 | 1163 |
'Default means "if no language selected then..."' => 'Standard bedeutet "wenn keine Sprache ausgewählt, dann..."', |
1161 | 1164 |
'Default output medium' => 'Standardausgabekanal', |
... | ... | |
1268 | 1271 |
'Discard entries with duplicates in database or CSV file' => 'Einträge aus CSV-Datei verwerfen, die es bereits in der Datenbank oder der CSV-Datei gibt', |
1269 | 1272 |
'Discount' => 'Rabatt', |
1270 | 1273 |
'Discount #1%' => 'Rabatt #1%', |
1274 |
'Discount part' => 'Rabattartikel', |
|
1271 | 1275 |
'Discounts' => 'Rabatte', |
1272 | 1276 |
'Display' => 'Anzeigen', |
1273 | 1277 |
'Display file' => 'Datei anzeigen', |
... | ... | |
1965 | 1969 |
'III' => 'III', |
1966 | 1970 |
'IMPORT' => 'Importiert', |
1967 | 1971 |
'IV' => 'IV', |
1972 |
'If a part is set, a quick entry for this article is displayed in quotations, order intakes and order confirmations. An absolute amount or a percentage amount of the current items can be selected and this item will be added to the record. The amount or percentage can be included in the item description using the <%discount_value%> placeholder. It is recommended that the discount is added at the end as the percentage is calculated at the point of addition.' => 'Wenn ein Artikel ausgewählt ist, wird eine Schnelleingabe für diesen Artikel in Angeboten, Auftragseingängen und Auftragsbestätigungen angezeigt. Es kann ein absoluter Betrag oder ein Prozentsatz der aktuellen Positionen gewählt werden und dieser Artikel wird dem Beleg hinzugefügt. Der entsprechende Betrag oder Prozentsatz kann mit dem Platzhalter <%discount_value%> in die Artikelbeschreibung übernommen werden. Es wird empfohlen, dies am Ende zu tun, da der Prozentsatz zum Zeitpunkt des Hinzufügens berechnet wird.', |
|
1968 | 1973 |
'If all of the following match' => 'Wenn alle der folgenden Bedingungen zutreffen', |
1969 | 1974 |
'If amounts differ more than "Maximal amount difference" (see settings), this item is marked as invalid.' => 'Weichen die Beträge mehr als die "maximale Betragsabweichung" (siehe Einstellungen) ab, so wird diese Position als ungültig markiert.', |
1970 | 1975 |
'If checked the taxkey will not be exported in the DATEV Export, but only IF chart taxkeys differ from general ledger taxkeys' => 'Falls angehakt wird der DATEV-Steuerschlüssel bei Buchungen auf dieses Konto nicht beim DATEV-Export mitexportiert, allerdings nur wenn zusätzlich der Konto-Steuerschlüssel vom Buchungs (Hauptbuch) Steuerschlüssel abweicht', |
... | ... | |
2871 | 2876 |
'Payments' => 'Zahlungsausgänge', |
2872 | 2877 |
'Payments Changeable' => 'Änderbarkeit von Zahlungen', |
2873 | 2878 |
'Per. Inv.' => 'Wied. Rech.', |
2879 |
'Percent' => 'Prozent', |
|
2874 | 2880 |
'Perform check when a gl transaction is posted?' => 'Prüfung durchführen, wenn eine Dialogbuchung gebucht wird?', |
2875 | 2881 |
'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' => 'Prüfung durchführen, wenn eine Einkaufsrechnung oder ein Zahlungsausgang hierfür gebucht wird?', |
2876 | 2882 |
'Perform check when a sales invoice or a payment for a sales invoice is posted?' => 'Prüfung durchführen, wenn eine Verkaufsrechnung oder ein Zahlungseingang hierfür gebucht wird?', |
locale/en/all | ||
---|---|---|
121 | 121 |
'Abbreviation Legend' => '', |
122 | 122 |
'Abort' => '', |
123 | 123 |
'Abrechnungsnummer' => '', |
124 |
'Absolute' => '', |
|
124 | 125 |
'Absolute BB Balance' => '', |
125 | 126 |
'Absolute BT Balance' => '', |
126 | 127 |
'Acc Transaction' => '', |
... | ... | |
247 | 248 |
'Add custom report query' => '', |
248 | 249 |
'Add custom variable' => '', |
249 | 250 |
'Add department' => '', |
251 |
'Add discount' => '', |
|
250 | 252 |
'Add document for' => '', |
251 | 253 |
'Add document for AP transactions' => '', |
252 | 254 |
'Add document for AR transactions' => '', |
... | ... | |
1156 | 1158 |
'Default client' => '', |
1157 | 1159 |
'Default currency' => '', |
1158 | 1160 |
'Default currency missing!' => '', |
1161 |
'Default discount part' => '', |
|
1159 | 1162 |
'Default hourly rate for new customers' => '', |
1160 | 1163 |
'Default means "if no language selected then..."' => '', |
1161 | 1164 |
'Default output medium' => '', |
... | ... | |
1268 | 1271 |
'Discard entries with duplicates in database or CSV file' => '', |
1269 | 1272 |
'Discount' => '', |
1270 | 1273 |
'Discount #1%' => '', |
1274 |
'Discount part' => '', |
|
1271 | 1275 |
'Discounts' => '', |
1272 | 1276 |
'Display' => '', |
1273 | 1277 |
'Display file' => '', |
... | ... | |
1964 | 1968 |
'III' => '', |
1965 | 1969 |
'IMPORT' => '', |
1966 | 1970 |
'IV' => '', |
1971 |
'If a part is set, a quick entry for this article is displayed in quotations, order intakes and order confirmations. An absolute amount or a percentage amount of the current items can be selected and this item will be added to the record. The amount or percentage can be included in the item description using the <%discount_value%> placeholder. It is recommended that the discount is added at the end as the percentage is calculated at the point of addition.' => '', |
|
1967 | 1972 |
'If all of the following match' => '', |
1968 | 1973 |
'If amounts differ more than "Maximal amount difference" (see settings), this item is marked as invalid.' => '', |
1969 | 1974 |
'If checked the taxkey will not be exported in the DATEV Export, but only IF chart taxkeys differ from general ledger taxkeys' => '', |
... | ... | |
2870 | 2875 |
'Payments' => '', |
2871 | 2876 |
'Payments Changeable' => '', |
2872 | 2877 |
'Per. Inv.' => '', |
2878 |
'Percent' => '', |
|
2873 | 2879 |
'Perform check when a gl transaction is posted?' => '', |
2874 | 2880 |
'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' => '', |
2875 | 2881 |
'Perform check when a sales invoice or a payment for a sales invoice is posted?' => '', |
sql/Pg-upgrade2/defaults_add_discount_part.sql | ||
---|---|---|
1 |
-- @tag: defaults_add_discount_part |
|
2 |
-- @description: Mandantenkonfiguration für Rabattartikel |
|
3 |
-- @depends: release_3_9_0 |
|
4 |
|
|
5 |
ALTER TABLE defaults ADD COLUMN discount_part_id INTEGER references parts(id); |
templates/design40_webpages/client_config/_features.html | ||
---|---|---|
141 | 141 |
<tr> |
142 | 142 |
<th class="caption" colspan="3"> [% 'E-mail' | $T8 %] </th> |
143 | 143 |
</tr> |
144 |
<tr> |
|
145 |
<th>[% LxERP.t8('Invoice email settings') %]</th> |
|
146 |
<td> |
|
147 |
[% L.select_tag('defaults.invoice_mail_settings', [ [ 'cp', LxERP.t8('Contact Person') ],[ 'invoice_mail', LxERP.t8('Invoice email') ],[ 'invoice_mail_cc_cp', LxERP.t8('Invoice email and Contact Person') ] ], default=SELF.defaults.invoice_mail_settings) %] |
|
148 |
</td> |
|
149 |
<td class="long-desc">[% 'The invoice recipient can either be a selected contact person (default) or the email adress set in the master data of the customer. Additionally a contact persons mail and the company\'s invoicing mail can be combined.' | $T8 %]</td> |
|
150 |
</tr> |
|
144 | 151 |
<tr> |
145 | 152 |
<th>[% LxERP.t8('Global Record BCC') %]</th> |
146 | 153 |
<td colspan="2"> [% L.input_tag('defaults.global_bcc', SELF.defaults.global_bcc, class='wi-wide') %] <div class="description">[% 'Manually sent E-Mails will have their BCC field appended with this address. Will not trigger for employees without the right to send bcc, and will not apply to mails sent by automated jobs.' | $T8 %]</div></td> |
... | ... | |
481 | 488 |
<td class="long-desc">[% LxERP.t8('Before saving a sales order, this article will be checked and a warning is generated.') %]</td> |
482 | 489 |
</tr> |
483 | 490 |
<tr> |
484 |
<th>[% LxERP.t8('Invoice email settings') %]</th> |
|
485 |
<td> |
|
486 |
[% L.select_tag('defaults.invoice_mail_settings', [ [ 'cp', LxERP.t8('Contact Person') ],[ 'invoice_mail', LxERP.t8('Invoice email') ],[ 'invoice_mail_cc_cp', LxERP.t8('Invoice email and Contact Person') ] ], default=SELF.defaults.invoice_mail_settings) %] |
|
487 |
</td> |
|
488 |
<td class="long-desc">[% 'The invoice recipient can either be a selected contact person (default) or the email adress set in the master data of the customer. Additionally a contact persons mail and the company\'s invoicing mail can be combined.' | $T8 %]</td> |
|
491 |
<th class="caption" colspan="3">[% LxERP.t8('Discount part') %]</th> |
|
492 |
</tr> |
|
493 |
<tr> |
|
494 |
<th>[% LxERP.t8('Default discount part') %]</th> |
|
495 |
<td>[% P.part.picker('defaults.discount_part_id', SELF.defaults.discount_part_id, class='wi-mediumsmall') %]</td> |
|
496 |
<td class="long-desc">[% LxERP.t8('If a part is set, a quick entry for this article is displayed in quotations, order intakes and order confirmations. An absolute amount or a percentage amount of the current items can be selected and this item will be added to the record. The amount or percentage can be included in the item description using the <%discount_value%> placeholder. It is recommended that the discount is added at the end as the percentage is calculated at the point of addition.') %]</td> |
|
489 | 497 |
</tr> |
490 | 498 |
<tr> |
491 | 499 |
<th class="caption" colspan="3">[% LxERP.t8("Requirement Specs") %]</th> |
templates/design40_webpages/order/tabs/_item_input.html | ||
---|---|---|
71 | 71 |
</tr> |
72 | 72 |
</tbody> |
73 | 73 |
</table> |
74 |
</div><!-- /.entry-panel --> |
|
74 |
</div><!-- new part --> |
|
75 |
|
|
76 |
[%- IF INSTANCE_CONF.get_discount_part_id %] |
|
77 |
<div class="input-panel control-panel short"> |
|
78 |
<table id="input_row_table_id" class="tbl-plain condensed"> |
|
79 |
<caption>[% 'Add discount' | $T8 %]!</caption> |
|
80 |
<tbody> |
|
81 |
<tr> |
|
82 |
<td class="tooltipster-html" title="[%- 'Add discount' | $T8 -%]"> |
|
83 |
<span class="label above">[% 'Discount' | $T8 %] </span> |
|
84 |
[% L.input_tag('discount.value', 0, class='reformat_number numeric wi-small') %] |
|
85 |
[% L.select_tag('discount.type', [['percent', LxERP.t8('Percent')], ['absolute', LxERP.t8('Absolute')]]) %] |
|
86 |
[% L.button_tag('kivi.Order.add_discount_item()', LxERP.t8('+')) %] |
|
87 |
</tr> |
|
88 |
</tbody> |
|
89 |
</table> |
|
90 |
</div><!-- discount part --> |
|
91 |
[%- END %] |
|
92 |
|
|
75 | 93 |
</div><!-- /.wrapper --> |
Auch abrufbar als: Unified diff
S:C:Order: Standard Rabattartikel einfach hinzufügen