hellow sambapos i will like to know where is the the primery key or in wich table does the samba saves the taxes
Are you looking for the tax template?
no, im looking for the value that the samba calculates for each ticket.
That would be in tickets and it would be a transaction
Explain what you want to do and we can help better
but…the tax value…not the ticket total value.
Yes I am aware of what your wanting and there is no tax table. It’s handled with transactions and transaction types
If you explain what your trying to do we can offer more accurate help.
SET t.TotalAmount = f.TotalACorregir
FROM dbo.Tickets AS t
INNER JOIN (
(q.Subtotal + q.IPOConsumo + q.ServicioFijo + q.ServicioPersonalizado + q.DescuentoFijo + q.DescuentoValor) AS TotalACorregir
SUM(o.Price * o.CalculatePrice * o.Quantity) AS Subtotal,
(SUM(o.Price * o.CalculatePrice * o.Quantity) * 0.08) AS IPOConsumo,
COALESCE(c1.CalculationAmount, 0) AS ServicioFijo,
COALESCE(c2.CalculationAmount, 0) AS DescuentoFijo,
COALESCE(c3.CalculationAmount, 0) AS DescuentoValor,
COALESCE(c4.CalculationAmount, 0) AS ServicioPersonalizado
FROM dbo.Orders AS o
LEFT JOIN dbo.Calculations AS c1 ON c1.TicketId = o.TicketId AND c1.CalculationTypeId = 3
LEFT JOIN dbo.Calculations AS c2 ON c2.TicketId = o.TicketId AND c2.CalculationTypeId = 5
LEFT JOIN dbo.Calculations AS c3 ON c3.TicketId = o.TicketId AND c1.CalculationTypeId = 2
LEFT JOIN dbo.Calculations AS c4 ON c4.TicketId = o.TicketId AND c2.CalculationTypeId = 4
–o.TicketId = 334
o.LastUpdateDateTime >= ‘12-01-2017’
GROUP BY o.TIcketId,
c4.CalculationAmount) AS q
) AS f ON f.TicketId = t.Id
but in order to accomplish the update i must find the taxes associetd with each ticket
Taxes are transactions and handled by transaction type
What values? The transaction values are in the AccountTransactions table… Next one up from transaction types.
You know there is a maintinance task to rebuild tax - im sure there is…
Make sure you backup before that script goes near your DB, your making changes to allot of stuff there, I would be very cautious… :-/
Yes, tax, tax is handled by transactions… you have been told this?
If your struggling to find it then personally Id be worried about messing with the sql in the first place… Where did that query you posted earlier come from, Im guessing you didnt write it?
Don’t be worry, I’m doing it in a backup db in other computer, the query was written by a friend.
There is no tax table. Taxes are stored as transactions. I feel like I’m repeating myself.
actually you are repeating yourself brother…you should be more i dont know…polite or patient. it is not a sin to ask twice.
He told you, and I did, and you keep asking same question, hes not being rude, you are because your not listening LOL
ok…sorry im the one being rude…sorry for not “listening”.