# Kundenspezifische Preise mit 42 ERP

## Kundenspezifische Einzelpreise

Die Erweiterung kundenspezifische Einzelpreise ist ein kostenpflichtiges Modul für sync4. Für die Verwendung von kundenspezifischen Einzelpreisen wird ein Plugin im Shopware Shop benötigt.\
Shopware 5: <https://store.shopware.com/swaguserpricef/kundenspezifische-preise.html>\
Shopware 6: <https://store.shopware.com/vio8752425629335/kundenspezifische-preise.html>\
Die Reihenfolge ist definiert anhand der aufgelisteten SQL Befehle.

### getCustomersProductsgroupDiscount

```
select a.Kundennumm as customers_cid, b.Artikelnum as products_model,  round(b.preis1 * (1 - (a.Rabatt / 100)),4) as products_price  
from kgrabatt as a inner join Lager as b on 
(a.Warengrupp = b.Warengrupp and isnull(a.untergrupp,'') = isnull(b.untergrupp,'') and isnull(a.untergrupp,'') <> '') or 
(a.Warengrupp = b.Warengrupp and isnull(a.untergrupp,'') = '') 
where isnull(a.Rabatt,0) > 0 and isnull(a.Warengrupp,'') <> '' and isnull(b.preis1,0) > 0 and a.kundennumm = '{customers_cid}'
```

### getCustomersGroupDiscount

```
select b.Artikelnum as products_model, c.Kundennumm as customers_cid,b.Rabattgrup,c.Rabattgrup,
round(b.preis1 * (1 - (CAST(CAST(isnull(a.wert,'0') as VARCHAR) as DECIMAL) / 100)),4) as products_price,
CAST(CAST(isnull(a.wert,'0') as VARCHAR) as DECIMAL) as Rabatt
from inip as a
inner join Lager as b
on Substring(a.Name,9,1) = b.Rabattgrup
inner join Kunde as c
on Substring(a.Name,8,1) = c.Rabattgrup and c.kundennumm = '{customers_cid}'
where a.Name like('rabatt.%') and CAST(CAST(isnull(a.wert,'0') as VARCHAR) as decimal) <> 0.0
```

### getCustomerPrices

```
SELECT '{customers_cid}' AS customers_cid, Lager.Artikelnum AS products_model, '0' AS rabatt, Lager.Preis1  AS products_price, Lager.Preis1 AS products_original_price, '1' AS amount
FROM Lager WHERE Lager.Archiv = 0 
AND lager.Artikelnum IN (SELECT preislis.Artikelnum FROM preislis WHERE preislis.Kundennumm = '{customers_cid}') 
AND (SELECT TOP 1 preislis.Anzahl FROM preislis WHERE preislis.Kundennumm = '{customers_cid}' AND preislis.Artikelnum = lager.Artikelnum ORDER BY preislis.Anzahl ASC) != 1
UNION
SELECT Preislis.Kundennumm AS customers_cid, Preislis.Artikelnum AS products_model, IsNull(Preislis.Rabatt, '0') AS rabatt, IsNull(Preislis.Preis1, '0') AS products_price, 
IsNull(Lager.Preis1, '0') AS products_original_price, Preislis.Anzahl AS amount 
FROM Preislis JOIN Lager ON Lager.Artikelnum = Preislis.Artikelnum WHERE IsNull(Preislis.Kundennumm, '') <> '' AND Preislis.Kundennumm = '{customers_cid}' 
AND Lager.Archiv = 0
ORDER BY products_model
```

Mit folgenden SQL Befehlen werden die kundenspezifischen Einzelpreise aus 42 ERP ermittelt. Lassen Sie diese von Ihrem 42 ERP Betreuer prüfen.

{% hint style="danger" %}
Beachten Sie bitte, das die Datensatzmenge extrem groß werden kann, wenn man die Kunden mit den Artikeln multipliziert. Dadurch kann ein Abgleich viele Stunden benötigen. Auch muss das Hosting des Shops entsprechende Lasten abfangen können.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sync4.de/sync4-infos/kundenspezifische-preise-mit-42-erp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
