Sales orders are fed into ClickHome from other systems via the API. 

To replicate or test this for certain purposes please follow the bellow steps using Fiddler to replicate the external system;

  1. Start by creating a contract
  2. Then create a PO against a contract (See below insert scripts available for internal test environments)
  3. Insert Sales Order (SO) Headers and Lines via the API using Fiddler (See below information)
  4. This will generate the required notification to the field device
  5. Once the device is logged in with the correct access to that environment, sync it to load the sales order data on the device
  6. Search for the relevant contract and task/supplier 
  7. Once in the task go to the 'Sales Order' tab
  8. The default setting will be to 'Deliver all'
  9. To do a partial delivery un-check the checkbox and modify the amounts next to each line
  10. Enter a planned date, schedule the task and sync the device
  11. This will generate the release order back via the API to the external systems which are connected
  12. All tasks with that SO linked will now have released that SO and therefore the quantities will reflect the full or partial delivery amounts
  13. The release lines will now be in ClickHome and if JobFile is connected they will be there as well


If the quantity or date of delivery needs to be changed;

  1. Enter a reason, schedule the task then sync the device
  2. When the quantity is changed it will match to a specified batch using the dcDeliveryIncrement field in tblSoLines


To order another partial or full amount off a task that has already had a release done;

  1. Split the task
  2. A partial amount can also be ordered against a different task to the one that the original release was done on
  3. Select the amount, enter a planned date, schedule the task and sync the device


There is a table called tblRemainingLines. This is information that the supplier has about the order. It is their calculation of what they believe the quantity remaining is to be released on the order. 

To replicate this;

  1. Insert remaining line via the API using Fiddler
  2. The remaining lines are a different overall calculation of the available quantity
  3. SO remaining lines always stay in their table, they don't get adjusted or move into the SOlines or release tables.
  4. Once the created date is passed in, the UI will update as per the quantity in the request

............................................................................................................................................................................................................................................................

PO Insert Scripts:

UPDATE tblContracts
SET cdSchedulingStatus = 'U'
WHERE idContract = 50597 


INSERT INTO dbo.tblInterfacePOHeaders (
cdResult
,cdJobType
,sglookupcontract
,sgPOReference
,fkidSupplier
,dtPODate
,cdStatus
,snApprovedPercent
,crTotalPrice
,crTotalTax
)
VALUES (
'LOOKUP'
,'C'
,'50597'
,'50597-0010'
,2110
,GETDATE()
,'P'
,0
,1000
,100
) 


INSERT INTO tblInterfacePOLines (
sgPOReference
,sgCostCode
,dcLineQuantity
,sgItemCode
,sgItemDescription
,tblPOLine.cdUOM
,crUnitPrice
,crExtendedPrice
,crextendedTax
,cdResult
,cdJobType
)
VALUES (
'50597-0010'
,'0010'
,10
,'item'
,'description'
,'EACH'
,100
,1000
,100
,'LOOKUP'
,'C'
) 


INSERT INTO tblBackEndJobs (
inoperationCode
,dtRunAfter
,fkidContract
,sgTextValue1
,fkidBusinessUnit
,fkiduser
,cdresult
)
VALUES (
3102
,DateAdd(mi, 0, getdate())
,50597
,''
,0
,0
,'READY'
)

........................................................................................................................................................................................................................................................

SO Fiddler post:

SO header & lines
User-Agent: Fiddler 
Accept: application/json, text/plain, */* 
Content-Type: application/json 
Host: ptapi.jobfile.com.au 
JobFileAuthenticationToken: w1jCyhZhX6vC1i4MCM8hBKZhhz1RP4po6IyUUZWA3M9DKEtmCOuSqcx9xVkn1Q5LX5zqVskHWe7PTl64DogTKeTud6pRCLFc-mzdltEMVtllk9fb_75xAw 
Content-Length: 692 
Request Body :
{    "SalesOrderReference":"C350308",    "SalesOrderDate":"2019-3-6",    "lines":[        {            "SalesOrderLineReference":"C350308L1",            "Sequence":0,            "LineQuantity":9346,            "ItemCode":"3540010560",            "ItemDescription":"Boral Bricks - Elan Range",            "UOM":"Per 500",            "deliveryIncrement":500        },{            "SalesOrderLineReference":"C350308L2",            "Sequence":0,            "LineQuantity":8459,            "ItemCode":"3540010050",            "ItemDescription":"Boral Bricks - Horizon Range",            "UOM":"Per 500",            "deliveryIncrement":500        }    ] }


Remaining lines
Host: ptapi.jobfile.com.au 
Content-Length: 193 
Accept: application/json, text/plain, */* 
Content-Type: application/json 
Authorisation: Basic Q09MTElOREVSRUxFQ1RSSUNTQGpvYmZpbGUuY29tLmF1OmpvYmZpbGU6NjM2OTQwOTcwNTY0NTAxOTY4 
Request Body:
{    "remaining": [        {            "salesOrderLineReference": "C383528L1",            "remainingDate": "2019-04-16T00:00:00",            "lineQuantity": 5001        }    ] }