×

Payables

This section contains code samples related to payables.
 
Example Code
  • Load open invoices
  • Load all invoices
 
Load open invoices
Example Code in this section
payables_invoices_open()

    
    class Load
    {
        public static List<Invoice> payables_invoices_open(Manager manager)
        {
            var currentClient = manager.getCurrentClient();
            var currentFiscalYear = manager.getCurrentFiscalYear();
            List<Invoice> invoices = null;

            string request = "clients/{0}/fiscalYears/{1}/payables/invoices/open";
            var response = manager.httpClient.GetAsync(string.Format(request, currentClient.id, currentFiscalYear.id)).Result;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                invoices = JsonConvert.DeserializeObject<List<Invoice>>(response.Content.ReadAsStringAsync().Result);
            }
 
            return invoices;
        }
    }
    
  
Load Invoices
    
class Load:
  
    @staticmethod
    def payablesInvoices(manager):
        
        _currentClient = manager.getCurrentClient()
        _currentFiscalyear = manager.getCurrentFiscalyear()
        
        url = '{0}clients/{1}/fiscalYears/{2}/payables/Invoices'.format(manager.baseURL(), 
                                                                        _currentClient['id'], 
                                                                        _currentFiscalyear['id'])

        url = url + '?onlyOpen=true'                                                                
        response = requests.get(url, headers = manager.headers())

        if response.status_code == 200:
            return response.json()
        else:
            print(response.content())
            return None

    
  
Load Invoices
    
  UNDER CONSTRUCTION
    
  
JSON representation of an invoice
    
{
	"id": "32e93480-5575-40c4-8093-54110312c082",
	"authorizerFID": 21,
	"partyFID": 1,
	"payMethodFID": 373,
	"payTermFID": 9,
	"vatFID": -1,
	"personRoleFID": 2,
	"invoiceDate": "2019-06-12T00:00:00",
	"dueDate": "2019-07-12T00:00:00",
	"modifyDate": "2019-06-12T09:02:07.31",
	"invoiceNum": 1109,
	"reminderLevel": 0,
	"freeInvoiceNum": "RI_3810",
	"text": "Recivables Invoice",
	"PayslipCode": "",
	"totalAmount": 4000.0,
	"totalAmountFC": 4000.0,
	"exchangeRate": 1.0,
	"IsAuthorized": true,
	"noReminders": false,
	"Remarks": "",
	"partyNum": 1019,
	"partyName": "Bucherer AG",
	"partyShortName": "BucLuz",
	"payTermCode": "30T",
	"accountCode": "1100",
	"currencyCode": "CHF",
	"balance": 4000.0,
	"balanceFC": 4000.0,
	"barCode": "",
	"currentReminderLevel": 0,
	"hasDocument": 0,
	"currentReminderDate": "1753-01-01T00:00:00",
	"paymentPostings": [],
	"transaction": {
		"id": "32e93480-5575-40c4-8093-54110312c082",
		"fiscalYearFID": 55,
		"userFID": 21,
		"transactionTypeFID": 3,
		"docType": "",
		"docNum": 582,
		"docDate": "2019-06-12T00:00:00",
		"modifyDate": "2019-06-12T09:02:06.903",
		"isConfirmed": true,
		"numRangeFID": 265,
		"postings": [
			{
				"id": "a351a126-f6e9-45ba-b981-d85e003d54be",
				"transactionFID": "32e93480-5575-40c4-8093-54110312c082",
				"invoiceFID": "32e93480-5575-40c4-8093-54110312c082",
				"accountFID": 20,
				"contraAccountFID": 71,
				"vatFID": -1,
				"vatAccountFID": -1,
				"costCenterFID": -1,
				"postingTypeFID": 2,
				"amount": 4000.0,
				"fcAmount": 4000.0,
				"exchangeRate": 1.0,
				"vatAmount": 0.0,
				"vatFcAmount": 0.0,
				"vatPercent": 0.0,
				"vatQuote": 0.0,
				"text": "Recivables Invoice Posting #1",
				"freeCode": "Posting Free",
				"isDebit": true,
				"isInclusive": false,
				"isInvisible": false,
				"postingIndex": 1,
				"partyNum": 0,
				"freepartyNum": null,
				"partyName": null,
				"invoiceNum": 0,
				"freeInvoiceNum": null,
				"invoiceDate": "0001-01-01T00:00:00"
			},
			{
				"id": "a3c9ad2a-c7df-4a50-98b5-5edb7d375031",
				"transactionFID": "32e93480-5575-40c4-8093-54110312c082",
				"invoiceFID": "32e93480-5575-40c4-8093-54110312c082",
				"accountFID": 71,
				"contraAccountFID": 20,
				"vatFID": 9,
				"vatAccountFID": 51,
				"costCenterFID": -1,
				"postingTypeFID": 2,
				"amount": 3714.02,
				"fcAmount": 3714.02,
				"exchangeRate": 1.0,
				"vatAmount": 285.98,
				"vatFcAmount": 285.98,
				"vatPercent": 7.7,
				"vatQuote": 100.0,
				"text": "Recivables Invoice Posting #2 (VAT posting)",
				"freeCode": "",
				"isDebit": false,
				"isInclusive": true,
				"isInvisible": false,
				"postingIndex": 2,
				"partyNum": 0,
				"freepartyNum": null,
				"partyName": null,
				"invoiceNum": 0,
				"freeInvoiceNum": null,
				"invoiceDate": "0001-01-01T00:00:00"
			}
		]
	}
}
    
  
 
Load all invoices
Example Code in this section
payables_invoices_open()

    
    class Load
    {
        public static List<Invoice> payables_invoices(Manager manager)
        {
            var currentClient = manager.getCurrentClient();
            var currentFiscalYear = manager.getCurrentFiscalYear();
            List<Invoice> invoices = null;

            string request = "clients/{0}/fiscalYears/{1}/payables/invoices/all";
            var response = manager.httpClient.GetAsync(string.Format(request, currentClient.id, currentFiscalYear.id)).Result;
            
            if (response.StatusCode == HttpStatusCode.OK)
            {
                invoices = JsonConvert.DeserializeObject<List<Invoice>>(response.Content.ReadAsStringAsync().Result);
            }
            return invoices;
        }
    }
    
  
Load Invoices
    
class Load:
  
    @staticmethod
    def payablesInvoices(manager):
        
        _currentClient = manager.getCurrentClient()
        _currentFiscalyear = manager.getCurrentFiscalyear()
        
        url = '{0}clients/{1}/fiscalYears/{2}/payables/Invoices'.format(manager.baseURL(), 
                                                                        _currentClient['id'], 
                                                                        _currentFiscalyear['id'])

        url = url + '?onlyOpen=true'                                                                
        response = requests.get(url, headers = manager.headers())

        if response.status_code == 200:
            return response.json()
        else:
            print(response.content())
            return None

    
  
Load Invoices
    
  UNDER CONSTRUCTION
    
  
JSON representation of an invoice
    
{
	"id": "32e93480-5575-40c4-8093-54110312c082",
	"authorizerFID": 21,
	"partyFID": 1,
	"payMethodFID": 373,
	"payTermFID": 9,
	"vatFID": -1,
	"personRoleFID": 2,
	"invoiceDate": "2019-06-12T00:00:00",
	"dueDate": "2019-07-12T00:00:00",
	"modifyDate": "2019-06-12T09:02:07.31",
	"invoiceNum": 1109,
	"reminderLevel": 0,
	"freeInvoiceNum": "RI_3810",
	"text": "Recivables Invoice",
	"PayslipCode": "",
	"totalAmount": 4000.0,
	"totalAmountFC": 4000.0,
	"exchangeRate": 1.0,
	"IsAuthorized": true,
	"noReminders": false,
	"Remarks": "",
	"partyNum": 1019,
	"partyName": "Bucherer AG",
	"partyShortName": "BucLuz",
	"payTermCode": "30T",
	"accountCode": "1100",
	"currencyCode": "CHF",
	"balance": 4000.0,
	"balanceFC": 4000.0,
	"barCode": "",
	"currentReminderLevel": 0,
	"hasDocument": 0,
	"currentReminderDate": "1753-01-01T00:00:00",
	"paymentPostings": [],
	"transaction": {
		"id": "32e93480-5575-40c4-8093-54110312c082",
		"fiscalYearFID": 55,
		"userFID": 21,
		"transactionTypeFID": 3,
		"docType": "",
		"docNum": 582,
		"docDate": "2019-06-12T00:00:00",
		"modifyDate": "2019-06-12T09:02:06.903",
		"isConfirmed": true,
		"numRangeFID": 265,
		"postings": [
			{
				"id": "a351a126-f6e9-45ba-b981-d85e003d54be",
				"transactionFID": "32e93480-5575-40c4-8093-54110312c082",
				"invoiceFID": "32e93480-5575-40c4-8093-54110312c082",
				"accountFID": 20,
				"contraAccountFID": 71,
				"vatFID": -1,
				"vatAccountFID": -1,
				"costCenterFID": -1,
				"postingTypeFID": 2,
				"amount": 4000.0,
				"fcAmount": 4000.0,
				"exchangeRate": 1.0,
				"vatAmount": 0.0,
				"vatFcAmount": 0.0,
				"vatPercent": 0.0,
				"vatQuote": 0.0,
				"text": "Recivables Invoice Posting #1",
				"freeCode": "Posting Free",
				"isDebit": true,
				"isInclusive": false,
				"isInvisible": false,
				"postingIndex": 1,
				"partyNum": 0,
				"freepartyNum": null,
				"partyName": null,
				"invoiceNum": 0,
				"freeInvoiceNum": null,
				"invoiceDate": "0001-01-01T00:00:00"
			},
			{
				"id": "a3c9ad2a-c7df-4a50-98b5-5edb7d375031",
				"transactionFID": "32e93480-5575-40c4-8093-54110312c082",
				"invoiceFID": "32e93480-5575-40c4-8093-54110312c082",
				"accountFID": 71,
				"contraAccountFID": 20,
				"vatFID": 9,
				"vatAccountFID": 51,
				"costCenterFID": -1,
				"postingTypeFID": 2,
				"amount": 3714.02,
				"fcAmount": 3714.02,
				"exchangeRate": 1.0,
				"vatAmount": 285.98,
				"vatFcAmount": 285.98,
				"vatPercent": 7.7,
				"vatQuote": 100.0,
				"text": "Recivables Invoice Posting #2 (VAT posting)",
				"freeCode": "",
				"isDebit": false,
				"isInclusive": true,
				"isInvisible": false,
				"postingIndex": 2,
				"partyNum": 0,
				"freepartyNum": null,
				"partyName": null,
				"invoiceNum": 0,
				"freeInvoiceNum": null,
				"invoiceDate": "0001-01-01T00:00:00"
			}
		]
	}
}