on ‎2024 Mar 06 3:16 PM
I belive that automatic price rounding to 2 digits after decimal point happens, but somehow not for all lines.
This way is sales order draft created, without prices and discounts:
var draft = (Documents)oCompany.GetBusinessObject(BoObjectTypes.oDrafts);
draft.DocObjectCode = BoObjectTypes.oOrders;
draft.CardCode = shoporder.CustomerCode;
draft.NumAtCard = shopOrder.OrderId;
draft.DocDueDate = shopOrder.DocDueDate;
var lines = draft.Lines;
foreach (var l in shopOrder.Lines)
{
if (lines.ItemCode != "")
lines.Add();
lines.ItemCode = l.ItemCode;
lines.Quantity = l.QuantityKart;
}
if (d.Add() == 0) {
draftEntry = int.Parse(oCompany.GetNewObjectKey());
} else
throw new Exception("Could not add draft");
//...
//later - adding draft as document
var draft = (Documents)oCompany.GetBusinessObject(BoObjectTypes.oDrafts);
if (draft.GetByKey(draftEntry) && draft.SaveDraftToDocument() == 0) {
var addedDoc = int.Parse(oCompany.GetNewObjectKey());
var order = (Documents)oCompany.GetBusinessObject(BoObjectTypes.oOrders);
if (!order.GetByKey(addedDoc))
throw new Exception("Added order could not be found");In draft neither prices nor discounts are defined
SAP_ORDR_DRF.xml
Line 28: <DiscPrcnt nil="true">0.000000</DiscPrcnt>
Line 528: <Price nil="true">0.000000</Price>
Line 531: <DiscPrcnt nil="true">0.000000</DiscPrcnt>
Line 865: <Price nil="true">0.000000</Price>
Line 868: <DiscPrcnt nil="true">0.000000</DiscPrcnt>
Line 1202: <Price nil="true">0.000000</Price>
Line 1205: <DiscPrcnt nil="true">0.000000</DiscPrcnt>
Line 1539: <Price nil="true">0.000000</Price>
Line 1542: <DiscPrcnt nil="true">0.000000</DiscPrcnt>But in sales order they are already filled
SAP_ORDR.xml
Line 28: <DiscPrcnt>0.000000</DiscPrcnt>
Line 528: <Price>137.400000</Price>
Line 531: <DiscPrcnt>0.000000</DiscPrcnt>
Line 865: <Price>6.190000</Price>
Line 868: <DiscPrcnt>0.030000</DiscPrcnt>
Line 1202: <Price>17.090000</Price>
Line 1205: <DiscPrcnt>-0.010000</DiscPrcnt>
Line 1539: <Price>0.000000</Price>
Line 1542: <DiscPrcnt>0.000000</DiscPrcnt>Correct price for both materials:
| Material | NumInSale | Price | PriceKart (Price * NumInSale) | Discount |
| MAT01 | 6 | 1.032 | 6.192 | 0 |
| MAT02 | 24 | 0.712 | 17.088 | 0 |
Is there any way to correct this behavior? Am I missing any settings?
UPDATE: If I create sales order directly, ommitting the draft part, no price rounding and therefore no discounts occure. But I need to use drafts.
Request clarification before answering.
| User | Count |
|---|---|
| 36 | |
| 27 | |
| 21 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.