Home Information PDF Documents EULANDA Handbooks Training Book's corner Download Contact us Table of Contents About us

Glossary

Password needed Newsgroup

Remote Support system

cn_Preis_GetVk (SQL API)

Back | Level back

The procedure determines the selling price, related to an article and a specific customer. Here the different discount and relays systems are considered:

  • Customer groups and groups of discounts and their linkages with line discounts
  • Price list
  • Relay quantities and prices
  • Currency tables
  • Net and gross oriented prices
  • Conditions

The parameter article ID, address ID, quantity, currency and grossFlg serves the determination with as initial parameters and supplies as result the new price, a discount and the source.

Syntax

PROC cn_Preis_GetVk
  @ad_Id int,
  @ar_Id int,
  @Quantity numeric(18,4),
  @Currency char(3),
  @GrossFlg bit,
  @SellingPrice numeric(18,2),
  @Discount numeric(18,2),
  @Source varchar(20)

Argument

@ad_Id

The argument @ad_id is the ID of the type Integer of an existing customer, thus an address.

@ar_id

The argument  @ar_id is the ID of the type Integer of an existing article.

@Quantity

The argument @Quantity gives the number of the article. This number is needed if prices are deposit.

@Currency

Over the argument @Currency if necessary a conversation of the price is made into a goal currency. For the EURO zone 'EUR' is indicated here.

@GrossFlg

Over the argument @GrossFlg it is indicated whether the Selling price should be inclusive steering wheel or not. With GrossFlg=0 the result price is a net price, with GrossFlg=1 is it a price the inclusive VAT.

@SellingPrice

[OUT]
The argument @SellingPrice is the pulled price, which results due to the article and the customer and/or the quantity. Depending upon setting of the GrossFlg is it net or  contains the valid control item.

@Discount

The argument @Discount is a result, which due to the article and customer are taken out of the groups of discounts and customer group matrix.

@Source

The argument @Source indicates, from which range the conditions was determined. The following returns are possible:

  • No
  • Article
  • Price list
  • Offer
  • Order

The moreover one a return value of the form is "FEHLER: xx" possible. In this case the pricing failed. In addition for the specific of the arisen error a run time error is produced through RAISERROR.

Far return values are if necessary in newer API present.

Example

DECLARE 
  @e int,
  @SellingPrice numeric(18,2),
  @Discount numeric(18,2),
  @Source varchar(20)


EXEC @e = cn_Preis_GetSellingPrice
             @Ad_Id=50, 
             @Ar_Id=10, 
             @Quantity=1, 
             @Currency='EUR',
             @GrossFlg=0,
             @SellingPrice=@SellingPrice OUT, 
             @Discount=@Discount OUT, 
             @Source=@Source OUT

SELECT @e [Exec], @SellingPrice [SellingPrice], @Discount [Discount], @Source [Source]

In this example the SellingPrice is determined to the article with the ID "10" and an address with the ID "50". The price enquiry is based on the quantity of "1". The result is to be spent in the currency "EUR" and without tax. Additionally still the value discount is returned and contains a line discount, if to the indicated article and the address a group of discounts as well as  customer group exist, which are linked with a line discount. The value source contain the value "article", if the price were loaded from the master data, otherwise the value "price list", if this were loaded from the price list.