# Need help in custom report

**URL:** <https://forum.sambapos.com/t/need-help-in-custom-report/7366>\
**Category:** V5 Question\
**Created:** [September 29, 2015, 6:44pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366 "2015-09-29T18:44:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 29, 2015, 6:44pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/1 "2015-09-29T18:44:04Z")

</div>

sorry for making this topic again but i need help to create 2 custom report (i can’t understand tags report 😓 ) :  
1- to show food , beverage and dessert separate totals in 1 report  
2- item sales report for food only and another for beverage and another for dessert

how i can create report for account or entity to show all orders that ordered on this entity or this account ??

other thing i have something here called officer that mean store manger and ass. store manger can get food and beverage but don’t count as sales, it’s more like a gift but we call it here officer and we settle table to officer at end of it .  
is there is anyway to do that ???

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 29, 2015, 10:45pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/2 "2015-09-29T22:45:34Z")

</div>

[http://www.sambapos.com/wiki/doku.php?id=custom\_reporting\_tags](http://www.sambapos.com/wiki/doku.php?id=custom_reporting_tags)

That is a very good resource it explains tags in detail and has samples. You can also look at built in default reports to get good idea of how most tags work.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 12:43am UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/3 "2015-09-30T00:43:58Z")

</div>

Try to explain your need in more detail and try to visualize it as much as you can. Trying to explain reports with plain text might be confusing as some terms might have different meanings depending on how you use them. For example by saying food, beverage, dessert do you mean to group sales by product group or do you mean courses?

See this post as an example of how descriptions can be confusing and how samples solves it.

> [@Sales Report monthly](http://forum.sambapos.com/t/sales-report-monthly/7344):
>
> Continuing the discussion from [Day by Day Sales Report](http://forum.sambapos.com/t/day-by-day-sales-report/2603): How to make detail sales day by day report with contain payment: [Sales 1,1,1,1,1,1,1] Day|Netto|Tax|Discount|PaymentCash|PaymentCC|Total

---

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 30, 2015, 5:25pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/4 "2015-09-30T17:25:38Z")

</div>

let me explain officer thing 1st :  
i created entity type called officer and ticket type called officer cause only tables that take 12% service

 ![](https://forum.sambapos.com/uploads/default/original/2X/5/559bd858de68f34aef929d1a43b41640e323e41c.png)  
and as you see in pic i created entity called mohamed with store manger name .  
i also created payment type officer to close all officer tables to account called officer ![](https://forum.sambapos.com/uploads/default/original/2X/1/1dd75bd76b898f87883245516f5bc7dafa59dc45.png)

i want to show all orders that ordered on this entity in report to show like

 ![](https://forum.sambapos.com/uploads/default/original/2X/a/a6e2ca0123c0cf6f7493b488d5c4464adaa8caa4.jpg)

i also want to all tickets paid as c/l and complimentary to show in report

for complimentary i wanted to look like

 ![](https://forum.sambapos.com/uploads/default/original/2X/a/a038dfc9dd99d8aa58fe885e92450f57dedeabe3.jpg)

and c/l like

 ![](https://forum.sambapos.com/uploads/default/original/2X/2/2bc8fc2f9ed1fbbc95f500663dc9a5bd3e9e5b9a.jpg)

---

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 30, 2015, 5:37pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/5 "2015-09-30T17:37:55Z")

</div>

as for food , beverage and dessert i want to show sales report like work period but only show food , beverage , dessert

 ![](https://forum.sambapos.com/uploads/default/original/2X/e/e1f4c59b8fc2d23d1ca13c551e28f8d1f118fd39.jpg)

and separete item sales for food products only and one for beverage products only and one for dessert only

 ![](https://forum.sambapos.com/uploads/default/original/2X/4/49c5f53affb06053ae6610af37b84ab7233a9df9.jpg)

---

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 30, 2015, 5:40pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/6 "2015-09-30T17:40:18Z")

</div>

sorry for long reply and requests but i realy need help with this to do on live version that working right now

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 30, 2015, 5:41pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/7 "2015-09-30T17:41:28Z")

</div>

So how are you defining whats food, drinks, desert etc? Are you using Courses, Product Tags, Group Tags?

What is c/l?

What is Complimentary?

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 6:17pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/8 "2015-09-30T18:17:56Z")

</div>

> [@Jesse](#):
>
> So how are you defining whats food, drinks, desert etc? Are you using Courses, Product Tags, Group Tags?

@a.samy Thank you very much for your detailed explanation. This comment is important because there is more than one way to implement things in SambaPOS. Are you using product groups to define if a product is food or beverage?

---

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 30, 2015, 6:24pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/9 "2015-09-30T18:24:37Z")

</div>

i define it with product tag

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 6:28pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/10 "2015-09-30T18:28:43Z")

</div>

> [@a.samy](#):
>
> i define it with product tag

 ![](https://forum.sambapos.com/uploads/default/original/2X/1/1741bb143f9a362b4a5ffa409c8841213202efb0.jpg)

---

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 30, 2015, 6:31pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/11 "2015-09-30T18:31:10Z")

</div>

comp is more like gift but go under sales total and gift don’t  
C/L is pay way but for stuff member not customer and it cut from his salary at end of the month

they both are payment method

---

<div class="post-metadata">

**Author:** ![a.samy](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@a.samy](https://forum.sambapos.com/u/a.samy)\
**Post date:** [September 30, 2015, 6:33pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/12 "2015-09-30T18:33:03Z")

</div>

not custom tag . the other one

i don’t have custom tag at my screen

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 6:40pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/13 "2015-09-30T18:40:19Z")

</div>

OK. Don’t do that. I’ll keep it simple and prepare a sample that Product Tag. After that you can use custom tags if you want.

~~First of all define it by using Custom Product Tags. Tag is used for printing purposes. Custom Tags better used for reporting. You can use Product Tag Editor to update tags.~~

~~ 

> [@\[New 4.1.14\] Custom Product Tags](http://forum.sambapos.com/t/new-4-1-14-custom-product-tags/504):
>
> As of 4.1.14 Custom Product Tags are supported. Edit Program Settings for configuration. Enter Custom Product Tags as Comma Separated values. After this modification Product Cards appears like this. I’ve created three tags for Tax type, Turkish Name and and Promotion type of the product. I can access tags with {ITEM TAG:X} tag on printer templates or order rules. This is useful for printing additional info about product or building conditional rule logic for specific pro…

 ~~

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 6:57pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/14 "2015-09-30T18:57:40Z")

</div>

###This report works by 5.1.51 version.

I’ve added tag support to order details report so it will work fine with 5.1.51 release. It will be released soon.

####Sales grouped by product tags.

```auto
[Sales by Product Tags:1, 1]
{REPORT ORDER DETAILS:M.Tag,O.ExactTotal.Sum}
>Total|{REPORT ORDER DETAILS:O.ExactTotal.Sum}

```

 ![](https://forum.sambapos.com/uploads/default/original/2X/a/af0c3fdda61f97ffab77f3347ea970dd19761d98.jpg)

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 7:06pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/15 "2015-09-30T19:06:32Z")

</div>

###Orders by Officer

```auto
[Orders by Officer:2, 1, 1]
>Item|Quantity|Total
@Mohammed,Ali,Other Officer
>>Orders by $1
{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum,O.ExactTotal.Sum:(TEN.Officer=$1)}
>$1 Total|{REPORT ORDER DETAILS:O.ExactTotal.Sum:(TEN.Officer=$1)}

```

Type names of officers you want to include in report on the line that starts with @ character.

###Sales by Payment Type

```auto
[Tickets by Payment Type:1, 1,2]
>Ticket#|Total|Customer
{REPORT TICKET DETAILS:T.TicketNumber,T.TotalAmount,EN.Customer:(PA=Cash)}
>Total|{REPORT TICKET TOTAL:(PA=Cash)}| 

```

That report lists tickets paid by Cash. Change `PA=Cash` parts to make it work for your custom payment type.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 7:16pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/16 "2015-09-30T19:16:04Z")

</div>

@a.samy I hope these samples will help you a bit to understand how custom reports work. I strongly suggest you to study these, review documents and prepare your reports. Feel free to ask anything you don’t understand. Once you get it you can prepare any report you want and update them as your business needs changes.

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 30, 2015, 7:17pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/17 "2015-09-30T19:17:18Z")

</div>

I would like to share a modified **Orders by Officer** report its optional but improves it. This report will work even for new Officer entities added without the need to edit report.

Report:

```auto
[Orders by Officer:2, 1, 1]
>Item|Quantity|Total
@{CALL:officers.getofficers()}
>>Orders by $1
{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum,O.ExactTotal.Sum:(TEN.Officer=$1)}
>$1 Total|{REPORT ORDER DETAILS:O.ExactTotal.Sum:(TEN.Officer=$1)}

```

Script:

```auto
function getofficers(){
var qry = "SELECT e.[Name] FROM [Entities] e JOIN [EntityTypes] et on et.[Id]=e.[EntityTypeId] WHERE et.[Name] = 'Officer' ORDER BY e.[Name]";
var r = sql.Query(qry).Join(',');
return r;
}

```

 ![](https://forum.sambapos.com/uploads/default/original/2X/a/a23bd1859f9cb388ff633ba99fad91583991d9c9.png)

PS. @emre I see what you did with \>\> is that new? If not I must have missed that.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 7:27pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/18 "2015-09-30T19:27:35Z")

</div>

@Jesse that hack also can be used instead of SQL. We’re benefiting from grouping and formatting features here.

```
@{REPORT ORDER DETAILS:EN.Officer,O.Quantity.Sum::{0}:,}
```

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [September 30, 2015, 7:29pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/19 "2015-09-30T19:29:03Z")

</div>

Wow good to know. I am trying to figure out what its doing. But thats a different conversation.

So a simpler version of what I just showed would be ignore the script completely and use this report.

```auto
[Orders by Officer:2, 1, 1]
>Item|Quantity|Total
@{REPORT ORDER DETAILS:EN.Officer,O.Quantity.Sum::{0}:,}
>>Orders by $1
{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum,O.ExactTotal.Sum:(TEN.Officer=$1)}
>$1 Total|{REPORT ORDER DETAILS:O.ExactTotal.Sum:(TEN.Officer=$1)}

```

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [September 30, 2015, 7:29pm UTC](https://forum.sambapos.com/t/need-help-in-custom-report/7366/20 "2015-09-30T19:29:08Z")

</div>

> [@Jesse](#):
>
> PS. @emre I see what you did with \>\> is that new? If not I must have missed that.

Yes `>` is bold `>>` is bolder. 🙂

[Next page](https://forum.sambapos.com/t/need-help-in-custom-report/7366.md?page=2)
