Send all taxable amounts and taxes to a web service to print a response code on final bill

Hi,
we need, for tax book keeping reasons, to send a total amount, all taxable amounts (we have to taxes 15 and 21%) and taxes to Czech Financial Authority to register our sales. The financial authority generates a special code that we need to print on the final bill that goes to the customer.

I prepared a C# library that is handling communication with the financial authority, but now I have to deal with the communication between my library and SambaPOS.

At first I was hoping to call a webservice, I will prepare, from a script with all data converted to JSON. But I had no idea how to go through all taxes and prepare the JSON, so I decided I will calculate all data directly from database, but yesterday I found out SambaPOS does not store discount values to order table, just a reference to discounts.

So now I’m back to the original idea to call my webservices with a JSON similar to this(numbers don’t match they):
{
“TicketId”: “14”,
“Total”: “350”,
“Tax 15% Base”: “100”,
“Tax 15%”: “15”,
“Tax 21% Base”: “200”,
“Tax 21%”: “45”
}

Could you help me with that?

I know there are registrations of data accessors in ExpressionEngine class, but I have not tried it yet. I will do it know, but it’s better to ask you guys for help.

Thanks,
Ondrej

private static JScriptEngine GetEngine()
{
WindowsScriptEngineFlags flags = WindowsScriptEngineFlags.EnableStandardsMode;
if (LocalSettings.EnableJsDebuging)
flags |= WindowsScriptEngineFlags.EnableDebugging;
JScriptEngine jscriptEngine = new JScriptEngine(flags);
jscriptEngine.AddHostType(“DateTime”, typeof (DateTime));
jscriptEngine.AddHostType(“Ticket”, typeof (TicketAccessor));
jscriptEngine.AddHostType(“Order”, typeof (OrderAccessor));
jscriptEngine.AddHostType(“Entity”, typeof (EntityAccessor));
jscriptEngine.AddHostType(“Data”, typeof (DataAccessor));
jscriptEngine.AddHostType(“Helper”, typeof (HelperAccessor));
jscriptEngine.AddHostObject(“host”, (object) new ExtendedHostFunctions());
// ISSUE: method pointer
foreach (IScriptable scriptable in ExpressionEngine._scriptables.Select<Lazy, IScriptable>(ExpressionEngine.\u003C\u003Ec.\u003C\u003E9__2_0 ?? (ExpressionEngine.\u003C\u003Ec.\u003C\u003E9__2_0 = new Func<Lazy, IScriptable>((object) ExpressionEngine.\u003C\u003Ec.\u003C\u003E9, __methodptr(\u003CGetEngine\u003Eb__2_0)))))
jscriptEngine.AddHostObject(scriptable.Key, scriptable.GetInstance());
return jscriptEngine;
}