Créer un compte comptable

Vous pouvez ajouter des comptes comptables selon vos besoins.

Ex 1: compte comptable 6251 qui est celui attaché aux Indemnités kilométriques
var myHeaders = new Headers();

myHeaders.append("Authorization", "Bearer <token>");
myHeaders.append("Content-Type", "application/json");

let myPurchaseExpenseReport= null; // Ma note de frais kilométriques

var raw = JSON.stringify({
  accounting_number: '6251', // string
  name: 'Frais de déplacement avancés par le collaborateur', // string
  description: 'Frais de déplacement et frais kilométriques avancés par le collaborateur', // string
  technical_name: 'EmployeesPurchasing->MileageAllowance' // unique string
});

var requestOptions = {
		method: 'POST',
		headers: myHeaders,
		body: raw,
		redirect: 'follow'
};

fetch("https://api.sinao.app/v1/apps/:appId/accounts/", requestOptions)
		.then(response => response.text())
		.catch(error => console.log('error', error));
Ex 2: compte comptable 421 qui est celui attaché aux notes de frais
var myHeaders = new Headers();

myHeaders.append("Authorization", "Bearer <token>");
myHeaders.append("Content-Type", "application/json");

let myPurchaseExpenseReport= null; // Ma note de frais kilométriques

var raw = JSON.stringify({
  accounting_number: '421', // string
  name: 'Personnel - Rémunérations dues', // string
  description: 'Sommes nettes à payer aux salariés et assimilés', // string
  technical_name: 'EmployeesPurchasing->Expense_report', // unique string
  is_cashflow: 1, // bool 1 |0
});

var requestOptions = {
		method: 'POST',
		headers: myHeaders,
		body: raw,
		redirect: 'follow'
};

fetch("https://api.sinao.app/v1/apps/:appId/accounts/", requestOptions)
		.then(response => response.text())
		.catch(error => console.log('error', error));
Ex 3: créer un compte comptable Général

Optionnel : vous devez préalablement lister les catégories comptables (voir Lister les catégories) si vous souhaitez attacher le nouveau compte à une catégorie comptable.

var myHeaders = new Headers();

myHeaders.append("Authorization", "Bearer <token>");
myHeaders.append("Content-Type", "application/json");

let accountingCategories= []; // liste des catégories comptables

var raw = JSON.stringify({
  "name":"Your name", // string
  "description":"Your description", // string
  "accounting_number": "333", // string
  "is_sales":1, // If true, display the accounting account in the invoice editor account list
  "is_cashflow":0, // If true, display the accounting account in bank reconciliation account list
  "is_various":1, // If true, display the accounting account in bank reconciliation under the Miscellaneous account list
  "is_purchase":0, // If true, display the accounting account in the purchase entry account list
  "initiale_balance":13345, // int real amount (133,45) * 100, default 0
  "category_id": accountingCategories[0].id // optional int|null 
});

var requestOptions = {
		method: 'POST',
		headers: myHeaders,
		body: raw,
		redirect: 'follow'
};

fetch("https://api.sinao.app/v1/apps/:appId/accounts/", requestOptions)
		.then(response => response.text())
		.catch(error => console.log('error', error));