title: Adding Payments to Printed Invoice in Acumatica Report Designer
body: <h2>The Problem</h2>
  <p>Accounts Receivable has asked me to add (pre)payments to the invoices they send out because customers are paying twice (when they pre-pay and then when they get the invoice). They have tried sending receipts of payments with the invoice, but the double payments are still happening. Plus, as the head of Accounting said, &quot;If doctor bills can show payments, why can't we? The pre-payments are applied in the system to an invoice but why is there no way to include that on the invoice?&quot;</p>
  <h2>My Investigation</h2>
  <p>The Invoice report form has ARTran entity as the detail lines on any given invoice. However, ARTran only includes the itemized lines created for an invoice (usually from a link Sales Order) and not the applied payments. Applied payments are in the table ARAdjst which has no correlation to ARTran. So, my immediate thought is that a subreport is needed. Acumatica's help files say in order to add subreport, the report definition file needs to be in the same file on the server as the main report definition and that the subreport needs to have the same report parameters as the main report.</p>
  <h2>Proposed Solution</h2>
  <p>Create a subreport for ARAdjst for an invoice and total the payments in the subreport at the bottom of the main report. Let the subreport be visible only if there are payments. Subtract the payment total from the invoicing total, which is what Accounting really wants.</p>
  <h2>How It's Going</h2>
  <p>I have created a simple report called Adjustments that has the same parameters as the invoice and shows the ARAdjst for the invoice and sums the total for payments. I added the subreport to the Invoice report and linked them via parameters. I haven't even tried to get the sum of Adjustments to a field on the Invoice. I also added the Adjustments report to the server via the Report Designer (which puts the definition in the database) and by copying the file to reports folder on the server because that's what the help says to do. It crashes every time I try to run invoices in Acumatica. I also had to remove the group footer on invoice that I added for the Adjustments subreport, because I was getting an error even if I rolled back to a different version. I've considered the fact that since it's not a system report, that might be why it won't let me add it as a subreport. There are no system reports that show (pre)payments beyond AR Detail or AR Register, both of which are not what I'm looking for.</p>
  <h2>My Plea</h2>
  <p>Has anyone added a non-system report as an Acumatica subreport before and had the addition work? If yes, how?</p>
  <p>I'm feeling like this solution is dead in the water, right now. And I never thought I would see the day when I miss Crystal Reports, ha. I was going to take screenshots of the report layouts, but obviously, there is more to it than that or it would be working.</p>