public BeforeDoCheckActionResult BeforeDoCheckAction([NotNull] ChequeTask chequeTask, [NotNull] ICashRegisterInfo device, [NotNull] CashRegisterChequeExtensions chequeExtensions, IViewManager viewManager)
        {
            var beforeCheque   = new List <Data.Print.Document>();
            var documentBefore = new Data.Print.Document();

            documentBefore.Markup.Add(new XElement(Tags.LargeFont, "Welcome"));
            documentBefore.Markup.Add(new XElement(Tags.SmallFont, "tel. 555-123456"));
            beforeCheque.Add(documentBefore);

            var afterCheque   = new List <Data.Print.Document>();
            var documentAfter = new Data.Print.Document();

            documentBefore.Markup.Add(new XElement(Tags.SmallFont, "Thank you for shopping"));
            documentBefore.Markup.Add(new XElement(Tags.QRCode, "iiko.ru"));
            beforeCheque.Add(documentAfter);

            return(new BeforeDoCheckActionResult
            {
                BeforeCheque = beforeCheque,
                AfterCheque = afterCheque,
                CashierName = "CashierName"
            });
        }
Beispiel #2
0
        public BeforeDoCheckActionResult BeforeDoCheckAction(ChequeTask chequeTask, ICashRegisterInfo device, CashRegisterChequeExtensions chequeExtensions, IViewManager viewManager)
        {
            PluginContext.Log.InfoFormat("Before do cheque on cash register: {0} ({1})", device.FriendlyName, device.Id);
            const bool needChangeInfo = true;

            if (needChangeInfo)
            {
                var sampleBeginElement = new XElement(Tags.Left,
                                                      new XElement(Tags.Left, "Organization"),
                                                      new XElement(Tags.Left, "Address"),
                                                      new XElement(Tags.Left, $"Table number: {chequeTask.TableNumberLocalized}"));
                var textBeforeCheque   = sampleBeginElement;
                var sampleAfterElement = new XElement(Tags.Left,
                                                      new XElement(Tags.Left, "Have a nice day"));
                var textAfterCheque = sampleAfterElement;

                // This information will be passed to the front app
                return(new BeforeDoCheckActionResult
                {
                    BeforeCheque = new List <Data.Print.Document>(new[] { new Data.Print.Document {
                                                                              Markup = textBeforeCheque
                                                                          } }),                                                // markup to add to the header (at the very beginning of the cheque)
                    AfterCheque = new List <Data.Print.Document>(new[] { new Data.Print.Document {
                                                                             Markup = textAfterCheque
                                                                         } }),                                               // markup to add at the end of the cheque
                    CashierName = "CashierName"
                });
            }

            // Nothing to change
            return(null);
        }