BAQ applied cash receipt to invoice

Hi, I need to create a query that shows which cash receipt is applied to which invoice. Where can I find that information? I know where to find the cash receipts and the the invoices but I can’t find the table that has the information I need.

Thanks in advance
Maria

@Maria_E
Details are in erp.cashdtl and erp.CashHead

Thank you @prash172
I can’t find which column binds any of these tables to the invoice in erp.InvoiceHead.

Reading my post I realized that it isn’t clear at all, so I am going to detail what I need to do.
I have to create a report that needs to show
Invoice legal number
Invoice amount
Invoices that have applied a receipt paid whit a check
Invoices that have a balance

At this moment I found how to know if a receipt was paid with a check, but wasn’t able to find which receipt was applied to a particular invoice.
I looked in cashdtl, cashhead and banktran tables but I wasn’t able to find anything to link them to the invoicehead table.
Thanks for your help

@Maria_E

select *
from Erp.CashHead as CashHead
inner join Erp.CashDtl as CashDtl on
CashHead.Company = CashDtl.Company
and CashHead.GroupID = CashDtl.GroupID
and CashHead.HeadNum = CashDtl.HeadNum
inner join Erp.InvcHead as InvcHead on
CashDtl.Company = InvcHead.Company
and CashDtl.InvoiceNum = InvcHead.InvoiceNum

Thanks again @prash172 , I already know all taht, what I need is to find the column that tells me what receipt was applied to a particular invoice.
As cash receipts and invoices are all in InvcHead I can bind a receipt from CashHead with the same receipt from InvoiceHead, but what I can’t do is find what Invoce the receipt was applied to,