EMDI issues and cancels courier vouchers by calling the script you set in the courier.ini file (EMDI main folder / courier settings).
On the document shipping method, fill in the company abbreviation (courier), user, password and sender id. Open a sales document and press the voucher button: if the voucher field is empty, EMDI creates; if it already has a number, it opens the status window (print/cancel). Right-click the button to choose the sender company name, whether to send items, and which address tab supplies the recipient (customer/shipment/consignee).
Before the call, EMDI checks address+city/area, ZIP, courier details and weight > 0 (sum of item lines; if volume/area exists, it uses the greater of weight and volumetric weight = area/5000).
Service lines also set: Saturday delivery, fixed time, special handling, packages, office pickup, recipient billing, cash on delivery.
Sample courier.ini:
|
1 2 3 4 5 6 |
[general] temp=https://www.sbzsystems.com/apps/emdi/tmp/ script=https://www.sbzsystems.com/apps/emdi/courier.php pdf_software= pdf_attributes= check_payment=1 |
script = base call URL. temp = PDF folder URL (EMDI downloads {courier}_{voucher}.pdf). Optional pdf_software / pdf_attributes for local printing. With check_payment=1, if the document is unpaid, COD equals the total; otherwise 0 (unless a COD line exists).
Label printing no longer reads a per-company [print] section: after create it always calls {script}?action=print+abbreviation+&voucher=…&cppass=…. A local exe may still use placeholders:
| Placeholder | Description |
|---|---|
#senderid |
Sender code |
#courieruser/#courierpass |
Courier login |
#cpuser/#cppass |
App user/password |
#voucherno |
Voucher number |
Endpoints
| Method | Name | Example |
|---|---|---|
| POST | print (create) |
{script}?…&action=print&… + form body |
| GET | view |
{script}?…&action=view&… |
| GET | cancel{courier} |
…&action=cancelspeedex&… |
| GET | print{courier} |
{script}?action=printspeedex&voucher=… |
Create = POST hybrid (parameters in the URL + body company_data, products, optional pdf). Open/cancel/label print = GET. For ELTA, print/cancel buttons in the voucher window are hidden.
Response: voucher_number|message. If the number is missing (or contains a line break), EMDI shows the message after | and stops.
| Query | Description |
|---|---|
courier |
Abbreviation (speedex, acs, elta, dhl, …) |
rec_date |
Ship date yyyymmdd (delivery day or document date) |
courieruser/courierpass |
Login details |
cpuser/cppass |
App user/password |
senderid |
Sender code |
rec_* |
Recipient: name, company, floor (PO box), address, area+city, ZIP, phone, mobile, country |
quantity |
Packages (default 1; from “SHIPPING PACKAGES” line) |
weight |
Calculated weight |
notes |
Document notes (# → space) |
cashondelivery |
COD (see check_payment/lines) |
relateddoc |
Document series + number |
sendername |
Sender company name (company or menu choice) |
action |
Always print |
emdiuser |
EMDI license username |
saturday |
Saturday delivery: 1/0 |
exact |
Time HH:nn if “DETERMINED TIME” line exists |
special |
Special handling (1 or text after the title) |
office |
Pickup from shop: 1/0 |
recipientbilling |
Charge recipient: 1 or empty |
POST body (form fields):
| Field | Description |
|---|---|
company_data |
EMDI company data: address|ZIP|city|country|phones|VAT |
products |
Item lines if “products on voucher” is on or courier=dhl. Per line: code|description|qty|total_incl_VAT|weight and optional |taric; line end \n. For DHL with products it starts with _. |
pdf |
Base64 invoice PDF — required for DHL outside the EU (recipient zone ≠ EU); otherwise omitted if no file exists. |
Called when a voucher number already exists. EMDI opens the link and shows the HTML in the voucher window.
From the view URL it replaces action=view with action=cancel + abbreviation (e.g. cancelspeedex). Not plain action=cancel. Then it clears the voucher field on the document.
After a successful create, EMDI calls this link, downloads the PDF to files\vouchers\{courier}_{voucher}.pdf, and if a PDF program is set it prints it.
Otherwise it opens the print URL directly.
Sample PHP (each company has its own include):
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php require_once('courier_common.php'); $couriername = $_GET['courier']; $action = $_GET['action']; // … read the other query fields the same way … // On create, also read POST: pdf, company_data, products if ($couriername == 'speedex' || $action == 'printspeedex' || $action == 'receiptspeedex' || $action == 'cancelspeedex') { require_once('courier_speedex.php'); } // Create success response (plain text): // echo $voucher_code . '|' . $message; |
The response format must be voucher|message so EMDI can store the number on the document.
