Revision a5ce354d
Von Werner Hahn vor mehr als 7 Jahren hinzugefügt
SL/Controller/ShopOrder.pm | ||
---|---|---|
$self->render('shop_order/list',
|
||
title => t8('ShopOrders'),
|
||
SHOPORDERS => $shop_orders,
|
||
TOOK => $transferred, # is this used?
|
||
TOOK => $transferred,
|
||
);
|
||
}
|
||
|
||
... | ... | |
# TODO in shopconfig
|
||
'taxincluded_checked' => $shop->pricetype eq "brutto" ? 1 : 0,
|
||
'taxincluded' => $shop->pricetype eq "brutto" ? 1 : 0,
|
||
'klass' => (split '\/',$shop->price_source)[1],
|
||
'pricegroup_id' => (split '\/',$shop->price_source)[0] eq "pricegroup" ? (split '\/',$shop->price_source)[1] : undef,
|
||
'taxzone_id' => $shop->taxzone_id,
|
||
'currency' => 1, # TODO hardcoded
|
||
'payment_id' => 7345,# TODO hardcoded
|
||
#'payment_id' => 7345,# TODO hardcoded
|
||
);
|
||
my $customer;
|
||
if($::form->{cv_id}){
|
SL/DB/MetaSetup/ShopOrderItem.pm | ||
---|---|---|
__PACKAGE__->meta->table('shop_order_items');
|
||
|
||
__PACKAGE__->meta->columns(
|
||
description => { type => 'text' },
|
||
id => { type => 'serial', not_null => 1 },
|
||
partnumber => { type => 'text' },
|
||
position => { type => 'integer' },
|
||
price => { type => 'numeric', precision => 15, scale => 5 },
|
||
quantity => { type => 'numeric', precision => 25, scale => 5 },
|
||
shop_id => { type => 'integer' },
|
||
shop_order_id => { type => 'integer' },
|
||
shop_trans_id => { type => 'integer', not_null => 1 },
|
||
tax_rate => { type => 'numeric', precision => 15, scale => 2 },
|
||
active_price_source => { type => 'text' },
|
||
description => { type => 'text' },
|
||
id => { type => 'serial', not_null => 1 },
|
||
partnumber => { type => 'text' },
|
||
position => { type => 'integer' },
|
||
price => { type => 'numeric', precision => 15, scale => 5 },
|
||
quantity => { type => 'numeric', precision => 25, scale => 5 },
|
||
shop_id => { type => 'integer' },
|
||
shop_order_id => { type => 'integer' },
|
||
shop_trans_id => { type => 'integer', not_null => 1 },
|
||
tax_rate => { type => 'numeric', precision => 15, scale => 2 },
|
||
);
|
||
|
||
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
|
SL/DB/ShopOrder.pm | ||
---|---|---|
require SL::DB::Shipto;
|
||
|
||
my @items = map{
|
||
# TODO Flash and exit if part not found
|
||
my $part = SL::DB::Part->new( partnumber => $_->partnumber )->load;
|
||
my $shop_part = SL::DB::Manager::ShopPart->get_all( where => [ shop_id => $self->shop_id, part_id => $part->id] )->[0];
|
||
|
||
my @cvars = map { ($_->config->name => { value => $_->value_as_text, is_valid => $_->is_valid }) } @{ $part->cvars_by_config } ;
|
||
my $current_order_item =
|
||
SL::DB::OrderItem->new(parts_id => $part->id,
|
||
... | ... | |
sellprice => $_->price,
|
||
unit => $part->unit,
|
||
position => $_->position,
|
||
active_price_source => ( $_->price == 0 ? "" : "pricegroup/908"), #TODO Hardcoded
|
||
active_price_source => $shop_part->active_price_source,
|
||
);
|
||
}@{ $self->shop_order_items };
|
||
|
||
... | ... | |
employee_id => $employee->id,
|
||
intnotes => ($customer->notes ne "" ? "\n[Kundestammdaten]\n" . $customer->notes : ""),
|
||
salesman_id => $employee->id,
|
||
taxincluded => 1, # TODO: make variable
|
||
taxincluded => $self->tax_included,
|
||
payment_id => $customer->payment_id,
|
||
taxzone_id => $customer->taxzone_id,
|
||
currency_id => $customer->currency_id,
|
SL/ShopConnector/Shopware.pm | ||
---|---|---|
shop_id => $self->config->id,
|
||
shop_ordernumber => $import->{data}->{number},
|
||
shop_trans_id => $import->{data}->{id},
|
||
tax_included => ($import->{data}->{net} == 0 ? 0 : 1)
|
||
tax_included => $self->config->pricetype eq "brutto" ? 1 : 0,
|
||
);
|
||
my $shop_order = SL::DB::ShopOrder->new(%columns);
|
||
$shop_order->save;
|
||
... | ... | |
foreach my $pos(@positions) {
|
||
my $price = $::form->round_amount($pos->{price},2);
|
||
|
||
my %pos_columns = ( description => $pos->{articleName},
|
||
partnumber => $pos->{articleNumber},
|
||
price => $price,
|
||
quantity => $pos->{quantity},
|
||
position => $position,
|
||
tax_rate => $pos->{taxRate},
|
||
shop_trans_id => $pos->{articleId},
|
||
shop_order_id => $id,
|
||
my %pos_columns = ( description => $pos->{articleName},
|
||
partnumber => $pos->{articleNumber},
|
||
price => $price,
|
||
quantity => $pos->{quantity},
|
||
position => $position,
|
||
tax_rate => $pos->{taxRate},
|
||
shop_trans_id => $pos->{articleId},
|
||
shop_order_id => $id,
|
||
active_price_source => $self->config->price_source,
|
||
);
|
||
my $pos_insert = SL::DB::ShopOrderItem->new(%pos_columns);
|
||
$pos_insert->save;
|
||
... | ... | |
'ustid' => $shop_order->billing_vat,
|
||
'taxincluded_checked' => $self->config->pricetype eq "brutto" ? 1 : 0,
|
||
'taxincluded' => $self->config->pricetype eq "brutto" ? 1 : 0,
|
||
'pricegroup_id' => (split '\/',$self->config->price_source)[1],
|
||
'pricegroup_id' => (split '\/',$self->config->price_source)[0] eq "pricegroup" ? (split '\/',$self->config->price_source)[1] : undef,
|
||
'taxzone_id' => $self->config->taxzone_id,
|
||
'currency' => 1, # TODO hardcoded
|
||
'payment_id' => 7345,# TODO hardcoded
|
||
#'payment_id' => 7345,# TODO hardcoded
|
||
);
|
||
my $customer = SL::DB::Customer->new(%address);
|
||
$customer->save;
|
sql/Pg-upgrade2/shop_orders_add_active_pricesource.sql | ||
---|---|---|
-- @tag: shop_orders_add_active_price_source
|
||
-- @description: Erstellen der Tabellen shop_orders und shop_order_items
|
||
-- @depends: release_3_4_1 shop_orders
|
||
|
||
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