Link between Customer and Transaction/Ticket


At the end of the month, I must (it’s the law here) give to my accountant such a report:

 Date           Ticket #       Cust. Tax #      Company Name    Cash    Card
 28/02/2014	001-054528					3.5	0
 28/02/2014	001-054529					0	22.5
 28/02/2014	001-054530	20528265350	MAKITA SAC	7	0
 28/02/2014	001-054531					36	0
 28/02/2014	001-054532					11	0
 28/02/2014	001-054533					42.5	0
 28/02/2014	001-054534	20524779995	NIVIGLOBAL SAC	5	0
 28/02/2014	001-054535					31.5	0

While I can find my way for Date, Ticket #, cash, Credit card, etc … I cannot find the (SQL) link between the ticket and the Customer/company information if it exists.

Thank you for any help.


Continuing the discussion from Some more Reports:

I’ll go out on a limb here and suggest that there is no such link between a Customer (Entity) and a Ticket, because an Entity does not deal with Transactions. You cannot Pay a Ticket with an Entity, only by an Account (Payment Types).

However, you will find a link between Customer ACCOUNT and a Ticket, in one or more of the Transaction tables. That said, this would require that you Pay a Ticket using a Customer Account (then subsequently add Cash or Credit Card payment to that Account).

Then you would join the (Customer) Entity table with the (Customer) Account table.


Thanks again for your quick reply.

First let me explain why I need that. It’s a local issue, but it applies to lots of countries and surely in latin america. I am in Peru. There are 2 types of manual-paper Bill:

  • Boleta: for anyone, has to be given to customer (otherwise business
    closed+fine), used to control your own sales.
  • Factura: for companies, has to be given to customer, when presented
    to tax authority, can be used by the company as a company cost. The factura MUST contains the company legal name, address and RUC (unique company tax number). Let’s say a company organises a dinner for its employees, the company can use the bill as company cost only if the bill is a factura.

Today electronic, IT, printers, … There is a third kind of Bill:

  • Ticket: printed by a cash register machine. A normal ticket is used as it is for normal customer (boleta) and can be used as a factura (and so be used by the company as a company cost) only if company name, address, RUC # are written on the ticket.

Until there, no trouble, I can print out the tickets correctly:

  • as it is if “normal customer” (like boleta)
  • selecting a customer if it is a company (like factura).

Now at the end of each month I need to sent to my accountant the list of tickets. Just date, ticket #, total for “normal customer”, but for “company” customer, legal name and RUC # must appears in the report.
And that’s where I am stuck as the information is not present in the DB.

Now, I kind of understand your answer however i am a bit a affraid to apply it.
As the customer/company information is available at the moment of printing, is there a way to script-grab the customer information + ticket # and keep it somewhere (file, db), I would add that info in the available report.

I really have to find a work around for this matter in order to be able to use SambaPOS, and I want to use it, it’s a wonderfull software.


If it helps TicketEntities table contains information about entities selected for ticket.

1 Like

You are the man !!!

TicketID and EntityName+Custom, all I was looking for :smile:

Now ley’s go SQL, I never used Ms SQL server before but must be like mysql, posgresql I guess.

Thank you @emre and @QMcKay


That’s great news! I figured this information must be stored somewhere, since the Tickets screen and Ticket Explorer widget are able to display the correlation between a Ticket and an Entity.

Now I can print Customer Account purchases if requested!