Added the ability to select a device for printing the "Bill" receipt
Starting from version Syrve 6.4, the ability to explicitly specify where the “Bill” receipt will be printed has been added to the API V6.
The “Bill” receipt is used in some countries, for example in the UK and Latvia.
Not all models of fiscal registrars support printing “Bill” receipts. For devices written on Hardware API, support for printing “Bill” receipts is enabled by setting IsBillTaskSupported = true in CashRegisterDriverParameters.
The “Bill” receipt is a command of ICashRegister.DoBillCheque().
The configuration IsBillTaskSupported = true implies that the bill number is mandatory in the payment receipt command.
Therefore, in the results of the DoBillCheque command, the field CashRegisterResult.BillNumber must be filled.
At the moment of printing the pre-check, the SyrveFront core polls subscribers “At which point of sale should the Bill be printed for this order?”.
The registration of the “Bill” receipt printing router is done using the method IOperationService.RegisterBillChequeTaskResolver():
- The method takes a function with arguments
IOrder“order” andbool“is this a pre-check return”. - The function must return
IPointOfSale: the point of sale to which the command for the “Bill” receipt will be sent. - If the function returns
nullor throws an exception, the command for the “Bill” receipt will not be sent anywhere.
Example code for a primitive case where the bill should be printed on the fiscal registrar of the current machine:
PluginContext.Operations.RegisterBillChequeTaskResolver(
(order, isSrorno) =>
{
var pos = PluginContext.Operations.GetHostTerminalPointsOfSale().FirstOrDefault();
PluginContext.Log.Info($"Bill for {order.Number}: {pos?.Name} - {pos?.Id}");
return pos;
});