Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>However there isn't any identification what receipt was paid toward what deposit.</p> </blockquote> <p>This is the key to your problem. You have to have a way to associate the receipts with the deposits UP FRONT. Imagine if you were working with paper receipts, how would you handle this? You'd have to ask the person who gave you the receipt how much was intended for which deposit, and then once you found that out you record it on the receipt. Once you know this and reflect it in the way you represent receipts, you can build the xslt to grab those bits out. Unfortunately I can't help you with the xslt for that, but imagine that each receipt has child element for each partition. like:</p> <pre><code>&lt;RECEIPTS total=500 blah blah blah&gt; &lt;subtotal deposit=1 amount=100&gt; &lt;subtotal deposit=2 amount=300&gt; &lt;/RECEIPTS&gt; </code></pre> <p>then as you loop through, grab the children of the receipt, loop through each subtotal and add it to the appropriate counter for the deposit sum.</p> <p>Also, I noticed, from your desired output, what happens if more than one receipt is applied towards a deposit? how do you represent that? currently you have</p> <pre><code>Deposit 2 is partly paid (status=outstanding, dueAmount=50, receiptNum=3 </code></pre> <p>what if deposit 2 was partially paid with 2 receipts, is the attribute receiptNum still going to have meaning for you? you might have to extend this, maybe by adding subtotal children elements in the same manner as the receipts model I offered earlier.</p> <p>Id say if you want to get a handle on this, pretend you were doing this all with/on paper. That would shed light on how you need to do it in code.</p> <p>After looking at some of your other posts, I realize that you may not be in control of the dataset you get. At some point however, you need to be able to answer the question, "Which amounts of these receipts go to which deposits?" After that, I have to say, your attempts at using recursion to solve this problem might be serving only to confuse you. Any recursion method can be replaced with a loop instead. I look forward to seeing what your final solution looks like.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload