Hi guys,
First of all, can we create Sales Order with zero ( 0 ) sales price ? It was mean for free of charge.
Secondly, I'm using this method from SalesLine --> Salesline.CalcLineAmount(Qty), and it turns out when sales price = 0 it will always look at the item base sales price in item master.
I'm using it like this example :
SalesLine.SalesQty = myTableLine.Qty; SalesLine.SalesUnit = myTableLine.unit; salesLine.SalesPrice = myTableLine.Price; salesLine.TaxGroup = myTableLine.taxGroup; salesLine.TaxItemGroup = myTableLine.TaxItemGroup; salesLine.LineDisc = myTableLine.discAmount; salesLine.LineAmount = salesLine.calcLineAmount();
Is there something missing or incorrect with the way I'm calling that method ? Because as mentioned, if I trace this, it will look at item master base sell price ->
Is there something I need to add with the statement or I need to do some extension to make modification ?
Thanks,
Hello,
You should not defining a value in LineAmount, the focus should be on the salesPrice, and you get lineAmount thereafter.
salesLine.LineAmount = salesLine.SalesQty * salesLine.SalesPrice;
Hi Komi,
Yes, currently I'm solving it by just assign 0 in the LineAmount when sales price is 0. It seems this is the way of handling it. Initially for the line amount I'm using that method, but based on your question "Is the LineAmount dependent of myTableLine.Price & myTableLine.Qty" I guess this is not always or doesn't have to be dependent.
Thanks
You want to create a sales line with amount 0. If so, why not put the Zero in the code? Or are there condition where you want the LimeAmount to be zero ? Is the LineAmount dependent of myTableLine.Price & myTableLine.Qty?
Hi, Komi,
No, instead I don't want this SalesLine.CalcLineAmount(qty) to pick item base sales price. But when it is zero price in my Sales Order (created using x++), it will which again I do not want it.
Thanks
Hello Lars Volt,
I tried to understand your second point.
You want the code to pick the item base base sales price?
Hi,
I did, however I cannot find a good reason (or understand) why it goes to the point where the code took the base price.
The stack I found is in this order :
1. salesline.calcLineAmount(qty)
2. salesPurchLineInterface. calcLineAmount(Qty _qty = this.parmQty())
3. salesPurchLineInterface.calcPrice2LineAmount(Qty, false)
4. salesPurchLinePriceDiscCalculation.calcPrice2LineAmount(Qty, false)
and with the last stack, it looks like it will go straight to retrieve Base Sales Price ->
public AmountCur calcPrice2LineAmount(Qty _qty, boolean _forceLineAmountCalculation) { AmountCur lineAmount; if (_qty) { if (this.hasDiscWithTaxPerUnitAndGrossAmountCombination(salesPurchLineInterface.parmTaxGroup(), salesPurchLineInterface.parmTaxItemGroup())) { lineAmount = this.calcPrice2LineAmountWithTaxPerUnitAndGross(_qty, _forceLineAmountCalculation); } else { lineAmount = PriceDisc::price2Amount(salesPurchLineInterface.pdsPrice(), salesPurchLineInterface.parmPriceUnit(), salesPurchLineInterface.parmDiscAmount(), _qty, salesPurchLineInterface.parmQty(), salesPurchLineInterface.parmMarkup(), salesPurchLineInterface.parmDiscPercent(), salesPurchLineInterface.parmCurrencyCode(), salesPurchLineInterface.parmLineAmount(), _forceLineAmountCalculation); } } return lineAmount; }
the pdsPrice() when I see, will go to item's base selling price.
Thanks
First point is possible.
For second point please put breakpoint and debug.
André Arnaud de Cal...
291,971
Super User 2025 Season 1
Martin Dráb
230,846
Most Valuable Professional
nmaenpaa
101,156