Revision 5f2204ca
Von Werner Hahn vor etwa 7 Jahren hinzugefügt
SL/Controller/ShopOrder.pm | ||
---|---|---|
61 | 61 |
$self->render('shop_order/list', |
62 | 62 |
title => t8('ShopOrders'), |
63 | 63 |
SHOPORDERS => $shop_orders, |
64 |
TOOK => $transferred, # is this used?
|
|
64 |
TOOK => $transferred, |
|
65 | 65 |
); |
66 | 66 |
} |
67 | 67 |
|
... | ... | |
232 | 232 |
# TODO in shopconfig |
233 | 233 |
'taxincluded_checked' => $shop->pricetype eq "brutto" ? 1 : 0, |
234 | 234 |
'taxincluded' => $shop->pricetype eq "brutto" ? 1 : 0, |
235 |
'klass' => (split '\/',$shop->price_source)[1],
|
|
235 |
'pricegroup_id' => (split '\/',$shop->price_source)[0] eq "pricegroup" ? (split '\/',$shop->price_source)[1] : undef,
|
|
236 | 236 |
'taxzone_id' => $shop->taxzone_id, |
237 | 237 |
'currency' => 1, # TODO hardcoded |
238 |
'payment_id' => 7345,# TODO hardcoded |
|
238 |
#'payment_id' => 7345,# TODO hardcoded
|
|
239 | 239 |
); |
240 | 240 |
my $customer; |
241 | 241 |
if($::form->{cv_id}){ |
SL/DB/MetaSetup/ShopOrderItem.pm | ||
---|---|---|
9 | 9 |
__PACKAGE__->meta->table('shop_order_items'); |
10 | 10 |
|
11 | 11 |
__PACKAGE__->meta->columns( |
12 |
description => { type => 'text' }, |
|
13 |
id => { type => 'serial', not_null => 1 }, |
|
14 |
partnumber => { type => 'text' }, |
|
15 |
position => { type => 'integer' }, |
|
16 |
price => { type => 'numeric', precision => 15, scale => 5 }, |
|
17 |
quantity => { type => 'numeric', precision => 25, scale => 5 }, |
|
18 |
shop_id => { type => 'integer' }, |
|
19 |
shop_order_id => { type => 'integer' }, |
|
20 |
shop_trans_id => { type => 'integer', not_null => 1 }, |
|
21 |
tax_rate => { type => 'numeric', precision => 15, scale => 2 }, |
|
12 |
active_price_source => { type => 'text' }, |
|
13 |
description => { type => 'text' }, |
|
14 |
id => { type => 'serial', not_null => 1 }, |
|
15 |
partnumber => { type => 'text' }, |
|
16 |
position => { type => 'integer' }, |
|
17 |
price => { type => 'numeric', precision => 15, scale => 5 }, |
|
18 |
quantity => { type => 'numeric', precision => 25, scale => 5 }, |
|
19 |
shop_id => { type => 'integer' }, |
|
20 |
shop_order_id => { type => 'integer' }, |
|
21 |
shop_trans_id => { type => 'integer', not_null => 1 }, |
|
22 |
tax_rate => { type => 'numeric', precision => 15, scale => 2 }, |
|
22 | 23 |
); |
23 | 24 |
|
24 | 25 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
SL/DB/ShopOrder.pm | ||
---|---|---|
43 | 43 |
require SL::DB::Shipto; |
44 | 44 |
|
45 | 45 |
my @items = map{ |
46 |
# TODO Flash and exit if part not found |
|
46 | 47 |
my $part = SL::DB::Part->new( partnumber => $_->partnumber )->load; |
48 |
my $shop_part = SL::DB::Manager::ShopPart->get_all( where => [ shop_id => $self->shop_id, part_id => $part->id] )->[0]; |
|
49 |
|
|
47 | 50 |
my @cvars = map { ($_->config->name => { value => $_->value_as_text, is_valid => $_->is_valid }) } @{ $part->cvars_by_config } ; |
48 | 51 |
my $current_order_item = |
49 | 52 |
SL::DB::OrderItem->new(parts_id => $part->id, |
... | ... | |
52 | 55 |
sellprice => $_->price, |
53 | 56 |
unit => $part->unit, |
54 | 57 |
position => $_->position, |
55 |
active_price_source => ( $_->price == 0 ? "" : "pricegroup/908"), #TODO Hardcoded
|
|
58 |
active_price_source => $shop_part->active_price_source,
|
|
56 | 59 |
); |
57 | 60 |
}@{ $self->shop_order_items }; |
58 | 61 |
|
... | ... | |
92 | 95 |
employee_id => $employee->id, |
93 | 96 |
intnotes => ($customer->notes ne "" ? "\n[Kundestammdaten]\n" . $customer->notes : ""), |
94 | 97 |
salesman_id => $employee->id, |
95 |
taxincluded => 1, # TODO: make variable
|
|
98 |
taxincluded => $self->tax_included,
|
|
96 | 99 |
payment_id => $customer->payment_id, |
97 | 100 |
taxzone_id => $customer->taxzone_id, |
98 | 101 |
currency_id => $customer->currency_id, |
SL/ShopConnector/Shopware.pm | ||
---|---|---|
101 | 101 |
shop_id => $self->config->id, |
102 | 102 |
shop_ordernumber => $import->{data}->{number}, |
103 | 103 |
shop_trans_id => $import->{data}->{id}, |
104 |
tax_included => ($import->{data}->{net} == 0 ? 0 : 1)
|
|
104 |
tax_included => $self->config->pricetype eq "brutto" ? 1 : 0,
|
|
105 | 105 |
); |
106 | 106 |
my $shop_order = SL::DB::ShopOrder->new(%columns); |
107 | 107 |
$shop_order->save; |
... | ... | |
112 | 112 |
foreach my $pos(@positions) { |
113 | 113 |
my $price = $::form->round_amount($pos->{price},2); |
114 | 114 |
|
115 |
my %pos_columns = ( description => $pos->{articleName}, |
|
116 |
partnumber => $pos->{articleNumber}, |
|
117 |
price => $price, |
|
118 |
quantity => $pos->{quantity}, |
|
119 |
position => $position, |
|
120 |
tax_rate => $pos->{taxRate}, |
|
121 |
shop_trans_id => $pos->{articleId}, |
|
122 |
shop_order_id => $id, |
|
115 |
my %pos_columns = ( description => $pos->{articleName}, |
|
116 |
partnumber => $pos->{articleNumber}, |
|
117 |
price => $price, |
|
118 |
quantity => $pos->{quantity}, |
|
119 |
position => $position, |
|
120 |
tax_rate => $pos->{taxRate}, |
|
121 |
shop_trans_id => $pos->{articleId}, |
|
122 |
shop_order_id => $id, |
|
123 |
active_price_source => $self->config->price_source, |
|
123 | 124 |
); |
124 | 125 |
my $pos_insert = SL::DB::ShopOrderItem->new(%pos_columns); |
125 | 126 |
$pos_insert->save; |
... | ... | |
161 | 162 |
'ustid' => $shop_order->billing_vat, |
162 | 163 |
'taxincluded_checked' => $self->config->pricetype eq "brutto" ? 1 : 0, |
163 | 164 |
'taxincluded' => $self->config->pricetype eq "brutto" ? 1 : 0, |
164 |
'pricegroup_id' => (split '\/',$self->config->price_source)[1],
|
|
165 |
'pricegroup_id' => (split '\/',$self->config->price_source)[0] eq "pricegroup" ? (split '\/',$self->config->price_source)[1] : undef,
|
|
165 | 166 |
'taxzone_id' => $self->config->taxzone_id, |
166 | 167 |
'currency' => 1, # TODO hardcoded |
167 |
'payment_id' => 7345,# TODO hardcoded |
|
168 |
#'payment_id' => 7345,# TODO hardcoded
|
|
168 | 169 |
); |
169 | 170 |
my $customer = SL::DB::Customer->new(%address); |
170 | 171 |
$customer->save; |
sql/Pg-upgrade2/shop_orders_add_active_pricesource.sql | ||
---|---|---|
1 |
-- @tag: shop_orders_add_active_price_source |
|
2 |
-- @description: Erstellen der Tabellen shop_orders und shop_order_items |
|
3 |
-- @depends: release_3_4_1 shop_orders |
|
4 |
|
|
5 |
ALTER TABLE shop_order_items ADD COLUMN active_price_source TEXT; |
Auch abrufbar als: Unified diff
Shopmodul: active_price_source anhand von Shopartikelkonfiguration mit in Shoporder übernommen, Kundenpreisgruppe anhand von Shopkonfiguration beim anlegen des Kunden übernommen