Difference between revisions of "Nats get payment breakdown"
From TMM Wiki
Jump to navigationJump to search(7 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
Alias: [[nats_get_payment_breakdown|get_payment_breakdown]] | Alias: [[nats_get_payment_breakdown|get_payment_breakdown]] | ||
− | + | ||
== Parameters == | == Parameters == | ||
(''Required parameters in '''bold''') | (''Required parameters in '''bold''') | ||
Line 19: | Line 19: | ||
! Example | ! Example | ||
|- | |- | ||
− | | paymentids | + | | '''paymentids''' |
| the list of payment ids to get a breakdown for | | the list of payment ids to get a breakdown for | ||
| any valid payment id values | | any valid payment id values | ||
Line 38: | Line 38: | ||
|- | |- | ||
| assign_prefix | | assign_prefix | ||
− | | the string to prefix output variables with | + | | the string to prefix output Smarty variables with |
| any string | | any string | ||
| <blank> | | <blank> | ||
| assign_prefix="output_" | | assign_prefix="output_" | ||
|} | |} | ||
+ | |||
== Output == | == Output == | ||
− | A | + | A breakdown of the provided payment ids in the <tt>{$data}</tt> Smarty variable given the requested breakdown. |
− | |||
− | == | + | == Examples == |
− | You can use | + | You can use this function to output the breakdown of affiliate payments by site in your payment dumps. |
− | |||
− | $ | + | To show the site breakdown of each individual payment, you can use code like this in the 'Entry' field. |
+ | <pre> | ||
+ | {get_payment_breakdown paymentids=$entry.paymentid} | ||
+ | {foreach from=$data key=site item=amount} | ||
+ | {$site}: {$amount/100|currency_format:2} | ||
+ | {/foreach} | ||
+ | </pre> | ||
+ | To show the program breakdown of all payments for each affiliate, you can use code like this in the 'Entry Header' or the 'Entry Footer' field. | ||
<pre> | <pre> | ||
− | + | {get_payment_breakdown paymentids=$total.payment_list breakdown="programid"} | |
− | + | {foreach from=$data key=program item=amount} | |
− | + | {$program}: {$amount/100|currency_format:2} | |
− | + | {/foreach} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
− | + | To show the site group breakdown of all payments, you can use code like this in the 'Header' or the 'Footer' field. | |
− | |||
<pre> | <pre> | ||
− | + | {get_payment_breakdown paymentids=$totals.all.payment_list breakdown="site_group_id"} | |
− | + | {foreach from=$data key=site_group item=amount} | |
− | + | {$site_group}: {$amount/100|currency_format:2} | |
+ | {/foreach} | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:NATS4 Template Functions]] | [[Category:NATS4 Template Functions]] |
Latest revision as of 22:45, 26 June 2019
nats_get_payment_breakdown
Provides a breakdown for the given list of payments {$data} Smarty variable.
Alias: get_payment_breakdown
Parameters
(Required parameters in bold)
Parameter | Description | Possible Values | Default Value | Example |
---|---|---|---|---|
paymentids | the list of payment ids to get a breakdown for | any valid payment id values | <blank> | paymentids="1,2,3" |
breakdown | the breakdown you want | siteid, programid, site_group_id | siteid | breakdown="programid" |
no_details_group_name | the name for the group of payments that are not associated with transactions | any string | *SPECIAL PAYMENTS* | no_details_group_name="Other" |
assign_prefix | the string to prefix output Smarty variables with | any string | <blank> | assign_prefix="output_" |
Output
A breakdown of the provided payment ids in the {$data} Smarty variable given the requested breakdown.
Examples
You can use this function to output the breakdown of affiliate payments by site in your payment dumps.
To show the site breakdown of each individual payment, you can use code like this in the 'Entry' field.
{get_payment_breakdown paymentids=$entry.paymentid} {foreach from=$data key=site item=amount} {$site}: {$amount/100|currency_format:2} {/foreach}
To show the program breakdown of all payments for each affiliate, you can use code like this in the 'Entry Header' or the 'Entry Footer' field.
{get_payment_breakdown paymentids=$total.payment_list breakdown="programid"} {foreach from=$data key=program item=amount} {$program}: {$amount/100|currency_format:2} {/foreach}
To show the site group breakdown of all payments, you can use code like this in the 'Header' or the 'Footer' field.
{get_payment_breakdown paymentids=$totals.all.payment_list breakdown="site_group_id"} {foreach from=$data key=site_group item=amount} {$site_group}: {$amount/100|currency_format:2} {/foreach}