Author Topic: Two question about the grouping tag  (Read 13363 times)

rvandam

  • Jr. Member
  • **
  • Posts: 96
Two question about the grouping tag
« on: February 02, 2013, 02:19:16 am »
I have implemented the grouping tag, using {PRODUCT TAG}. Everything is now sorted in the right tagged groups. We have however two questions:

* is there a way to influence the appearing order of the tag groups? On our tickets we have now the groups starters, main courses and deserts in random order on the tickets. How does Sambapos do the sorting of the product tag groups? By time entered?

* the items of one order number are added, so 1 x Cola, 1x Cola becomes 2x Cola. When the table is closed and reopened again, and one Cola is added, I have on the tickets 2 x Cola and 1 x Cola, instead of 3 x Cola.

Last weekend we had a group of 20 people having a party. During the evening all the time drinks and food were added to their table. This led to a 1,5 meter long ticket :)

« Last Edit: February 02, 2013, 02:47:51 am by rvandam »

rvandam

  • Jr. Member
  • **
  • Posts: 96
Re: Two question about the grouping tag
« Reply #1 on: February 02, 2013, 02:51:22 am »
I am aware of the option "Lines grouped by tag" in print jobs. But unfortunately only the group tag description is given, and not the single products grouped, so it is hard for the customer to check the bill.

rvandam

  • Jr. Member
  • **
  • Posts: 96
Re: Two question about the grouping tag
« Reply #2 on: February 02, 2013, 01:07:17 pm »
With help here:
http://stackoverflow.com/questions/14661719/sorting-and-grouping#comment20496411_14661719

 I archieved the sorting part. In the source code I changed:

if (template.GroupTemplate.Contains("{PRODUCT TAG}"))
            {
                var groups = lines.GroupBy(GetMenuItemTag);
                var result = new List<string>();
                foreach (var grp in groups)
                {
                    var grpSep = template.GroupTemplate.Replace("{PRODUCT TAG}", grp.Key);
                    result.AddRange(grpSep.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
                    result.AddRange(grp.SelectMany(x => FormatLines(template, x).Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)));
                }
                return result;
            }

Into

if (template.GroupTemplate.Contains("{PRODUCT TAG}"))
            {
                var groups = lines.GroupBy(GetMenuItemTag).OrderBy(l => l.Key);
                var result = new List<string>();
                foreach (var grp in groups)
                {
                    var grpSep = template.GroupTemplate.Replace("{PRODUCT TAG}", grp.Key);
                    result.AddRange(grpSep.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
                    result.AddRange(grp.SelectMany(x => FormatLines(template, x).Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)));
                }
                return result;
            }

If I tag the product now like "1 Starter" "2 Main course" "3 desert" I get the items in the right order on the ticket.

Do you have any hint on grouping the articles on the tickets? I mean that 1 x coffee 2x coffee becomes 3 x coffee?

lemmings

  • Full Member
  • ***
  • Posts: 165
Re: Two question about the grouping tag
« Reply #3 on: February 04, 2013, 01:40:43 pm »
Dont know if you aware but you can use the merge lines option in the printer template, this will merge all the same products together an update the quantity accordingly.

rvandam

  • Jr. Member
  • **
  • Posts: 96
Re: Two question about the grouping tag
« Reply #4 on: February 04, 2013, 02:13:47 pm »
@lemmings what??????? Oh nooo how could I have missed that......Thank you for pointing this out, you saved me a lot of time!

Another option that is there by default. I really like Sambapos (and get tired of myself sometimes).

lemmings

  • Full Member
  • ***
  • Posts: 165
Re: Two question about the grouping tag
« Reply #5 on: February 04, 2013, 02:46:24 pm »
No problem, glad to help.

Was interested in your post as trying to get my tickets in course order, looks like have to amend the source

rvandam

  • Jr. Member
  • **
  • Posts: 96
Re: Two question about the grouping tag
« Reply #6 on: February 04, 2013, 03:04:54 pm »
You have to amend the source indeed. I found out it was not that hard to learn to use Visual studio express. If you want to go that way I can give you more details about the modifications I made. I can also send you the binaries (please send me your email address by pm). I made two small modifications on the source. One for ordering, and one for the change price button (is available to all users)

Remember that you wont be able to upgrade Sambapos anymore when using the binaries, because the modifications will be lost. However I don't think there will be a big upgrade of V2 anymore because V3 is coming soon.