Documente de vânzare
Flux comandă → factură → chitanță
1. Adăugare comandă
Python
order_payload = {
'PartnerId': 27501,
'Date': '2026-05-13',
'Currency': 'RON',
'Lines': [
{'ArticleCode': '0000002', 'Quantity': 1, 'UnitPrice': 4500.00, 'VATRateId': 1, 'WarehouseId': 1},
{'ArticleCode': '0000003', 'Quantity': 1, 'UnitPrice': 89.00, 'VATRateId': 1, 'WarehouseId': 1}
]
}
order = nx_call(token, 'AddSaleOrder', order_payload)
print(order) # {'Id': 9101, 'Number': 'COM-000556'}
2. Generare factură din comandă
Node.js
const invoice = await client._call('AddSaleInvoice', {
PartnerId: 27501,
Date: '2026-05-13',
Currency: 'RON',
Lines: order.Lines // reutilizăm liniile comenzii
});
Validare stoc
AddSaleInvoice verifică stocul dacă linia conține WarehouseId + ArticleCode. Insufficient stock → Stoc insuficient pentru ...
3. Înregistrare chitanță
PHP
$receipt = nx_call($token, 'SaveReceiptWithoutMarking', [
'PartnerId' => 27501,
'Value' => 4589.00,
'Currency' => 'RON'
]);
// ['Id' => 3001, 'Number' => 'CHI-000413']
4. Reglare chitanță pe factură
cURL
curl -X POST http://localhost:4000/NextUpServices/Services/POST/ \
-H "Content-Type: text/plain" \
-d "{
\"AuthenticationToken\":\"$NX_TOKEN\",
\"Method\":\"PayDocumentsWithReceipt\",
\"Params\":{\"ReceiptId\": 3001, \"DocumentIds\": [7101]}
}"
Stornare factură
Node.js
const storno = await client._call('StornoSaleInvoice', { Id: 7001 });
// { Id: 7102, Number: 'FAC-S-001025' } -- factură negativă
Trimitere factură pe e-mail
Python
ok = nx_call(token, 'SendDocumentToEmail', {'Id': 7001, 'Email': 'client@example.com'})
# True