16.1 Purchase Orders Master

16.1 Purchase Orders Master

"Organization": "Demo SRL", // NOT UPDATABLE !!! (business logic reason)

"OrderReference": null,

"Description": null,

"DocType": "Comanda Furnizor",

"DateOrdered": "2018-08-22 00:00:00+0300",

"DatePromised": "2018-08-23 00:00:00+0300",

"BPartner": "U1", // NOT UPDATABLE !!! (business logic reason)

"BPartnerName": "Ursu Unu",

"BPartnerLocation": "Germany",

"BillBPartner": "U1",

"BillBPartnerName": "Ursu Unu",

"BillLocation": "Brasov",

"BPartnerContact": "Ursu Unu ***",

"BillContact": "Ursu Unu ***",

"Warehouse": "Standard", // NOT UPDATABLE !!! (business logic reason)

"DeliveryTerms": null,

"Currency": "RON",

"SalesRep": "Ionut Ursuleanu",

"PaymentTerm": "30 days",

"TrxOrganization": "dep2",

"Activity": null,

"PaymentMethod": "On Credit",

"PriceList": "Ursu (Achizitie)" , // NOT UPDATABLE !!! (business logic reason)

"Status_ID": 1000080,

"Status": "Creată"

}

Interface

It allows you:

  • to insert new purchase orders (master document)

  • to process existent purchase orders (Change Document Action: Prepare, Complete, Void etc)

  • to update, delete existing orders

    • for update it is necessary to provide all the updatable fields in JSON even if the value is not changed. The missing fields will get their value removed!

    • delete will remove all the related details!

  • to view purchase orders master document data - ordered descending by created date and document date

Prerequisites:

In order to use this API Method for PUT there must be accomplished the following requirements in SocrateCloud:

  • to have an Organization active

  • to have an Warehouse active

  • to have a Vendor active with all the mandatory fields

  • to have a price list active

Columns that can be used as filters:

  • Organization

  • DocumentNo

  • OrderReference

  • BPartner

  • DateOrdered

  • DocumentStatus

  • PriceList

  • CreatedBy

Actions can be done:

  • list

  • insert

  • update

  • delete

Purchase Order fields (Master Document)

A Purchase Order in SocrateCloud has the following structure:

  • Master document which contains data about header document:

    • No. document

    • Order data

    • Vendor

    • Sales Reprezentative etc.

  • Document details (see 04.1 Sales Order Details) which contains the products that are ordered with informations about:

    • Product

    • Quantity

    • Selling price

    • VAT

Note: We recommend to attend the following steps:

1. If new vendor create vendor using BPartner create method

2.Create Order with DocumentAction=null -> the result will be a Purchase Order with DocumentStatus='Draft', for e g: DocumentNo: 60300

3. Create lines order into the Purchase Order no: 60300

4. Process Purchase Order no: 60300 using process method by sending the following parameters: Document Number and Document Action.

API Methods:

List:

URL: https://api.socratecloud.com/webapi/rest/purchase_order/list/{version}?startRow={0}&endRow={100}&accessToken={access_token}

Method: GET

Return: JSON object with next format:

{

"data": [

{

"Organization": "Demo SRL",

"Created": "2018-08-23 11:18:07+0300",

"CreatedBy": "Ionut Ursuleanu",

"Updated": "2018-08-23 11:18:07+0300",

"UpdatedBy": "Ionut Ursuleanu",

"DocumentNo": "810796",

"OrderReference": null,

"Description": null,

"DocType": "Comanda Furnizor",

"DateOrdered": "2018-08-22 00:00:00+0300",

"DatePromised": "2018-08-22 00:00:00+0300",

"BPartner": "U1",

"BPartnerName": "Ursu Unu",

"BPartnerLocation": "Germany",

"BillBPartner": "U1",

"BillBPartnerName": "Ursu Unu",

"BillLocation": "Brasov",

"BPartnerContact": "Ursu Unu ***",

"BillContact": "Ursu Unu ***",

"Warehouse": "Standard",

"DeliveryTerms": null,

"Currency": "RON",

"SalesRep": "Ionut Ursuleanu",

"PaymentTerm": "30 days",

"TrxOrganization": "dep2",

"Activity": null,

"TotalLines": 700,

"GrandTotal": 833,

"DocumentStatus": "Drafted",

"DocumentAction": "Prepare",

"PaymentMethod": "On Credit",

"PriceList": "Ursu (Achizitie)",

"Status_ID": 1000080,

"Status": "Creată"

}

],

"totalRows": 1

}

Create:

URL: https://api.socratecloud.com/webapi/rest/purchase_order/create/{version}?accessToken={access_token}

Method: POST

Return: document no for success or error message (start with "ERROR: ")

Data format:

{

"Organization": "Demo SRL",

"OrderReference": null,

"Description": null,

"DocType": "Comanda Furnizor",

"DateOrdered": "2018-08-22 00:00:00+0300",

"DatePromised": "2018-08-22 00:00:00+0300",

"BPartner": "U1",

"BPartnerName": "Ursu Unu",

"BPartnerLocation": "Germany",

"BillBPartner": "U1",

"BillBPartnerName": "Ursu Unu",

"BillLocation": "Brasov",

"BPartnerContact": "Ursu Unu ***",

"BillContact": "Ursu Unu ***",

"Warehouse": "Standard",

"DeliveryTerms": null,

"Currency": "RON",

"SalesRep": "Ionut Ursuleanu",

"PaymentTerm": "30 days",

"TrxOrganization": "dep2",

"Activity": null,

"PaymentMethod": "On Credit",

"PriceList": "Ursu (Achizitie)",

"Status_ID": 1000080,

"Status": "Creată"

}

Update:

URL: https://api.socratecloud.com/webapi/rest/purchase_order/update/{version}?accessToken={access_token}&DocumentNo={document_no}

Method: POST

Return: document no for success or error message (start with "ERROR: ")

Data format:

{

Note: If you don't transmit a field, then the value of that field will be deleted!! (except of not updatable fields)

Delete:

URL: https://api.socratecloud.com/webapi/rest/purchase_order/delete/{version}?accessToken={access_token}&DocumentNo={document_no}

Method: POST

Return: 'Deleted' for success or error message (start with "ERROR: ")

Process:

URL: https://api.socratecloud.com/webapi/rest/purchase_order/process/{version}?accessToken={access_token}&DocumentNo={document_no}&DocumentAction={document_action}

Method: POST

Optional parameters:

  • VoidReason - Void reason name as defined in SocrateCloud. Applicable only for DocumentAction = 'Void' or 'Reverse - Correct'.

Return: Document status for success or error message (start with "ERROR: ")