Page 1 of 1

Sales Order Line Price

PostPosted: Thu Mar 15, 2018 8:06 pm
by nsbandara
According to Jiwa API documentation when creating a sales order

Note(3): When sales order lines are added, omitting the price will cause Jiwa to determine the price per normal pricing scheme logic.


Code: Select all
SalesOrderPOSTRequest soPostRequest = new SalesOrderPOSTRequest();
...
...
SalesOrderLine soLine = new SalesOrderLine();
soLine.PartNo = "XXX";
soLine.QuantityOrdered = 20;
soLine.DiscountedPrice = 12.5;
soPostRequest.Lines.Add(soLine);
...
...
SalesOrder order = apiManager.ApiClient.Post(soPostRequest);


Although I assign DiscountedPrice, sales order created in Jiwa has another price. Is there any setting that prevent assigning DiscountedPrice when sales order is created through API?

Re: Sales Order Line Price

PostPosted: Thu Mar 15, 2018 10:38 pm
by Mike.Sheen
nsbandara wrote:Although I assign DiscountedPrice, sales order created in Jiwa has another price. Is there any setting that prevent assigning DiscountedPrice when sales order is created through API?


What field in Jiwa has the another price, after POSTting your sales order? Can you give the JSON of the POST and then the GET of the same sales order? It will help in working out if this is an issue with the API, or a shortcoming of the documentation.

Re: Sales Order Line Price

PostPosted: Fri Mar 16, 2018 4:36 pm
by nsbandara
Please find json request and response attached.

Thanks.

Re: Sales Order Line Price

PostPosted: Mon Mar 19, 2018 1:31 pm
by nsbandara
Additional Question: What would happen if we send multiple request to API to create sales orders for same debtor, Can API handle requests from multi threaded application?

Re: Sales Order Line Price

PostPosted: Mon Mar 19, 2018 3:55 pm
by Mike.Sheen
Ok, that's odd - your response has a zero value for the DiscountedPrice field.

When I tested in demo data just now, using the following request :

Code: Select all
{
   "DebtorID" : "00000000080000000002",
   "InitiatedDate" : "2017-09-20",
   "OrderNo" : "1234",
   "SOReference" : "Test order",
   "Lines" : [{
         "PartNo" : "1170",
         "QuantityOrdered" : 5,
         "DiscountedPrice" : 12.34
      }
}
   


The response I got back had the DiscountedPrice as being 12.34 - the value provided in the request.
Code: Select all
{
   "SystemSettings" : {
      "ForceInventorySelection" : false,
      "SuppressLineRetotalling" : false,
      "IgnoreDebtorOnHold" : false,
      "CompensateTaxRounding" : false
   },
   "LastSavedDateTime" : "\/Date(1521435055920-0000)\/",
   "InitiatedDate" : "\/Date(1505829600000-0000)\/",
   "InvoiceInitDate" : "\/Date(1505829600000-0000)\/",
   "SalesOrderType" : "e_SalesOrderNormalSalesOrder",
   "OrderType" : "e_SalesOrderOrderTypeInvoiceOrder",
   "Status" : "e_SalesOrderEntered",
   "EDIStatus" : "e_SalesOrderHistoryEDIPickStatusNone",
   "BillType" : "e_SalesOrderShipAndBill",
   "ExpectedDeliveryDate" : "\/Date(1521435055753-0000)\/",
   "DeliveredDate" : "\/Date(-62135596800000-0000)\/",
   "Delivered" : false,
   "EDIPickStatus" : "e_SalesOrderHistoryEDIPickStatusNone",
   "EDIOrderType" : "e_SalesOrderEDIOrderTypeNormal",
   "EDIDeliverNotBeforeDate" : "\/Date(-62135596800000-0000)\/",
   "EDIDeliverNotAfterDate" : "\/Date(-62135596800000-0000)\/",
   "CashSales" : {
      "Name" : "",
      "Company" : "",
      "Address1" : "",
      "Address2" : "",
      "Address3" : "",
      "Address4" : "",
      "PostCode" : "",
      "Phone" : "",
      "Fax" : "",
      "ContactName" : ""
   },
   "DropShipment" : false,
   "Cartage1ExGst" : 0.000000,
   "Cartage1GstRate" : 10.000000,
   "Cartage1Gst" : 0.000000,
   "Cartage2ExGst" : 0.000000,
   "Cartage2GstRate" : 10.000000,
   "Cartage2Gst" : 0.000000,
   "Cartage3ExGst" : 0.000000,
   "Cartage3GstRate" : 10.000000,
   "Cartage3Gst" : 0.000000,
   "JobCosting" : {
      "GSTApplicable" : false,
      "JobCostID" : "",
      "JobCostNo" : "",
      "Description" : ""
   },
   "InvoiceID" : "865f54ce44a343a7a7f7",
   "InvoiceNo" : "100509",
   "LogicalID" : "ZZZZZZZZZZ0000000000",
   "LogicalWarehouseDescription" : "Main",
   "PhysicalWarehouseDescription" : "New South Wales",
   "CreditNote" : false,
   "StaffID" : "ZZZZZZZZZZ0000000000",
   "StaffUserName" : "Admin",
   "StaffTitle" : "",
   "StaffFirstName" : "Admin",
   "StaffSurname" : "Admin",
   "BranchID" : "ZZZZZZZZZZ0000000000",
   "BranchName" : "Sydney",
   "OrderNo" : "1234",
   "SOReference" : "Test order",
   "SenderEDIAddress" : "",
   "ReceiverEDIAddress" : "",
   "EDIVendorNumber" : "",
   "EDIBuyerNumber" : "",
   "DebtorID" : "00000000080000000002",
   "DebtorAccountNo" : "1002",
   "DebtorName" : "sdfsdfsdfsdfsdfsfsd",
   "DebtorEmailAddress" : "",
   "EDIASN" : "",
   "DeliveryAddressee" : "sdfsdfsdfsdfsdfsfsd",
   "DeliveryAddress1" : "Main Warehouse",
   "DeliveryAddress2" : "20 Pine Road",
   "DeliveryAddressSuburb" : "ROSEHILL",
   "DeliveryAddressState" : "NSW",
   "DeliveryAddressContactName" : "",
   "DeliveryAddressPostcode" : "2142",
   "DeliveryAddressCountry" : "",
   "DeliveryAddressNotes" : " ",
   "DeliveryAddressCourierDetails" : " ",
   "CustomFieldValues" : [],
   "Notes" : [],
   "Documents" : [],
   "Payments" : [],
   "Lines" : [{
         "ItemNo" : 1,
         "CommentLine" : false,
         "QuantityOrdered" : 5.000000,
         "QuantityDemand" : 0.000000,
         "QuantityThisDel" : 0.000000,
         "QuantityBackOrd" : 5,
         "Picked" : false,
         "PriceExGst" : 119.600000,
         "PriceIncGst" : 13.570000,
         "DiscountedPrice" : 12.340000,
         "TaxToCharge" : 0.000000,
         "TaxRate" : {
            "RecID" : "GST02000000000000000",
            "Description" : "GST Out(1)",
            "Rate" : 10.000000,
            "BASCode" : 1,
            "LedgerAccount" : {
               "LedgerID" : "00000000O20000000001",
               "AccountNo" : "7600-100-00",
               "Description" : "GST Supplies"
            }
         },
         "UnitCost" : 105.000000,
         "FixSellPrice" : 0,
         "UserDefinedFloat1" : 0.000000,
         "UserDefinedFloat2" : 0.000000,
         "UserDefinedFloat3" : 0.000000,
         "ForwardOrderDate" : "\/Date(1521435055770-0000)\/",
         "ScheduledDate" : "\/Date(1521435055770-0000)\/",
         "LineTotal" : 0.000000,
         "Weight" : 0.000000,
         "Cubic" : 0.000000,
         "QuotedDiscountedPrice" : 0,
         "DiscountedPercentage" : 89.680000,
         "DiscountGiven" : 107.260000,
         "QuantityDecimalPlaces" : 0,
         "QuantityOriginalOrdered" : 5.000000,
         "NonInventory" : false,
         "InvoiceLineID" : "206e0f260d074378a8f8",
         "InventoryID" : "000000000K00000000BQ",
         "PartNo" : "1170",
         "Description" : "Keyboard - Wireless Illuminated Computer PC Keyboard K800",
         "CommentText" : "",
         "Aux2" : "5835294",
         "LineLinkID" : "                                    ",
         "EDIStoreLocationCode" : "",
         "EDIDCLocationCode" : "",
         "CustomFieldValues" : [],
         "LineDetails" : [],
         "ShippingLabels" : []
      }
   ],
   "Histories" : [{
         "InvoiceHistoryID" : "0d487d6d0ee648be9beb",
         "HistoryNo" : 1,
         "Status" : "e_SalesOrderHistoryStatusEntering",
         "EDIPickStatus" : "e_SalesOrderHistoryEDIPickStatusNone",
         "DBTransID" : "                    ",
         "Ref" : "D01 - Inserted By Admin 19/03/2018 03:50:55",
         "LastModifiedBy" : "Admin",
         "HistoryTotal" : 0.000000,
         "AmountPaid" : 0,
         "TotalQuantityDelivered" : 0.000000,
         "RunNo" : "                    ",
         "Delivered" : false,
         "DeliveredDate" : "\/Date(-62135596800000-0000)\/",
         "RecordDate" : "\/Date(1505829600000-0000)\/",
         "DateCreated" : "\/Date(1521435055963-0000)\/",
         "DateLastSaved" : "\/Date(1521435055963-0000)\/",
         "DatePosted" : "\/Date(1505829600000-0000)\/",
         "DateProcessed" : "\/Date(-2209028400000-0000)\/",
         "InvoicePrinted" : false,
         "DocketPrinted" : false,
         "PackSlipPrinted" : false,
         "PickSheetPrinted" : false,
         "OtherPrinted" : false,
         "InvoiceEmailed" : false,
         "DocketEmailed" : false,
         "PackSlipEmailed" : false,
         "PickSheetEmailed" : false,
         "OtherEmailed" : false,
         "DeliveryAddressContactName" : "",
         "DeliveryAddressee" : "sdfsdfsdfsdfsdfsfsd",
         "DeliveryAddress1" : "Main Warehouse",
         "DeliveryAddress2" : "20 Pine Road",
         "DeliveryAddress3" : "ROSEHILL",
         "DeliveryAddress4" : "NSW",
         "DeliveryAddressPostcode" : "2142",
         "DeliveryAddressCountry" : "",
         "Notes" : " ",
         "CourierDetails" : " ",
         "FreightForwardAddress1" : "",
         "FreightForwardAddress2" : "",
         "FreightForwardAddress3" : "",
         "FreightForwardAddress4" : "",
         "FreightForwardAddressCountry" : "",
         "FreightForwardAddressNotes" : "",
         "ConsignmentNote" : "",
         "EDIASNNumber" : "",
         "DropShipment" : false,
         "CartageCharge1" : {
            "ExTaxAmount" : 0.000000,
            "TaxAmount" : 0.000000,
            "TaxRate" : {
               "RecID" : "GST02000000000000000",
               "Description" : "GST Out(1)",
               "Rate" : 10.000000,
               "BASCode" : 1,
               "LedgerAccount" : {
                  "LedgerID" : "00000000O20000000001",
                  "AccountNo" : "7600-100-00",
                  "Description" : "GST Supplies"
               }
            }
         },
         "CartageCharge2" : {
            "ExTaxAmount" : 0.000000,
            "TaxAmount" : 0.000000,
            "TaxRate" : {
               "RecID" : "GST02000000000000000",
               "Description" : "GST Out(1)",
               "Rate" : 10.000000,
               "BASCode" : 1,
               "LedgerAccount" : {
                  "LedgerID" : "00000000O20000000001",
                  "AccountNo" : "7600-100-00",
                  "Description" : "GST Supplies"
               }
            }
         },
         "CartageCharge3" : {
            "ExTaxAmount" : 0.000000,
            "TaxAmount" : 0.000000,
            "TaxRate" : {
               "RecID" : "GST02000000000000000",
               "Description" : "GST Out(1)",
               "Rate" : 10.000000,
               "BASCode" : 1,
               "LedgerAccount" : {
                  "LedgerID" : "00000000O20000000001",
                  "AccountNo" : "7600-100-00",
                  "Description" : "GST Supplies"
               }
            }
         },
         "Carrier" : {
            "CarrierID" : "D1C8AE84-D6E0-44FE-896E-F126B8CF08EB",
            "CarrierName" : "Australian National Couriers",
            "AccountNo" : "ANC",
            "Service" : {
               "CarrierServiceID" : "717A1749-CFAD-4F6C-BFAC-F12C27A2EE79",
               "Name" : "COURIER"
            },
            "UseLeastCost" : false,
            "ChargeTo" : "FreightChargeToReceiver",
            "Status" : "FreightSystemStatusNone",
            "FreightItemCollection" : [],
            "ConsignmentNoteCollection" : []
         },
         "CustomFieldValues" : []
      }
   ],
   "ASNs" : []
}


Perhaps there is a setting somewhere altering the behaviour - such as SellPriceIsIncTax against the inventory item.

Can you try against demo data using the same request as I provided, and examine the response to see if you also get the correct value in the DiscountedPrice field? If you do, then we know it has to be a setting somewhere.

Re: Sales Order Line Price

PostPosted: Mon Mar 19, 2018 4:36 pm
by Mike.Sheen
nsbandara wrote:Additional Question: What would happen if we send multiple request to API to create sales orders for same debtor, Can API handle requests from multi threaded application?


Yes - as part of our testing before we released 7.1, I created a test client application which created dozens of asynchronous workers to perform actions such as create inventory items, delete inventory items, query customers concurrently. It did reveal some issues - which we corrected prior to release. The project was mainly to gauge how many concurrent connections could be thrown at the REST API - but it does use an asynchronous client.

So - yes we can handle an asynchronous client.

The test project we used is attached.

REST_API_Load_Test.rar
(185.62 KiB) Downloaded 1276 times


Mike

EDIT: Don't run the project and point it to a live production API - it creates and deletes data.

Re: Sales Order Line Price

PostPosted: Mon Mar 19, 2018 8:15 pm
by nsbandara
Thank you Mike.

I verified sales order create request set price correctly by posting request against demo database. We are still investigating which setting override the price.

Thanks again for posting API load test project.

Re: Sales Order Line Price

PostPosted: Tue Mar 20, 2018 2:41 pm
by nsbandara
Mike,

Updating all products default price fixed sales order pricing issue.

Code: Select all
update in_main set defaultprice = 9.99


By the way we can update price for products that has 0 price when raising a sales order in Jiwa ERP. Why its not allowed when we create a sales order through API ?

Re: Sales Order Line Price

PostPosted: Tue Mar 20, 2018 7:15 pm
by Mike.Sheen
Hi nsbandara,

That's interesting that a 0 price for the item caused your issue.

It shouldn't cause an issue - I'll look into it and work out why.

Mike

EDIT: I've removed the solved status from this topic that you applied (thanks for that!) until we work out the 0 price issue.

Re: Sales Order Line Price  Topic is solved

PostPosted: Thu Mar 22, 2018 10:41 am
by Mike.Sheen
Ok, so this is an issue - logged as DEV-6539.

The problem occurs when a POST or PATCH for a sales order line (and this includes when it's part of a POST or PATCH of a sales order) contains both a quantity and the discounted price.

We'll fix this in the next release, but the work-around for you right now is to not provide the DiscountedPrice in the DTO, but then perform a subsequent PATCH providing just the InvoiceLineID and the DiscountedPrice.

So your first POST to create the order will need to look like this:
Code: Select all
{
   "DebtorID" : "00000000080000000002",
   "InitiatedDate" : "2017-09-20",
   "OrderNo" : "1234",
   "SOReference" : "Test order",
   "Lines" : [{
         "PartNo" : "1170",
         "QuantityOrdered" : 5
      }
}


This will return a DTO containing the InvoiceID and the InvoiceLineID's you'll need to provide with the next PATCH:

Then you can PATCH all lines in the same order with this:

Code: Select all
{
   "InvoiceID" : "44b9b4b519cc4f6f8927",
   "Lines" : [{
         "InvoiceLineID" : "a43ebff96f2946e4bcc5",
         "DiscountedPrice" : 12.34
      }]
}


Mike