Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
6 | +--------------------------------------------------------------------+ | |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | {* this div is being used to apply special css *} | |
27 | {if !$section } | |
28 | <div class="crm-block crm-form-block crm-report-field-form-block"> | |
29 | {include file="CRM/Report/Form/Fields.tpl"} | |
30 | </div> | |
31 | {/if} | |
32 | ||
33 | <div class="crm-block crm-content-block crm-report-form-block"> | |
34 | {include file="CRM/Report/Form/Actions.tpl"} | |
35 | {if !$section } | |
36 | {include file="CRM/Report/Form/Statistics.tpl" top=true} | |
37 | {/if} | |
38 | {if $rows} | |
39 | <div class="report-pager"> | |
40 | {include file="CRM/common/pager.tpl" location="top" noForm=0} | |
41 | </div> | |
42 | ||
43 | {* pre-compile section header here, rather than doing it every time under foreach *} | |
44 | {capture assign=sectionHeaderTemplate} | |
45 | {assign var=columnCount value=$columnHeaders|@count} | |
46 | {assign var=l value=$smarty.ldelim} | |
47 | {assign var=r value=$smarty.rdelim} | |
48 | {foreach from=$sections item=section key=column name=sections} | |
49 | {counter assign="h"} | |
50 | {$l}isValueChange value=$row.{$column} key="{$column}" assign=isValueChanged{$r} | |
51 | {$l}if $isValueChanged{$r} | |
52 | ||
53 | {$l}if $sections.{$column}.type & 4{$r} | |
54 | {$l}assign var=printValue value=$row.{$column}|crmDate{$r} | |
55 | {$l}elseif $sections.{$column}.type eq 1024{$r} | |
56 | {$l}assign var=printValue value=$row.{$column}|crmMoney{$r} | |
57 | {$l}else{$r} | |
58 | {$l}assign var=printValue value=$row.{$column}{$r} | |
59 | {$l}/if{$r} | |
60 | ||
61 | <tr><th colspan="{$columnCount}"> | |
62 | <h{$h}>{$section.title}: {$l}$printValue|default:"<em>none</em>"{$r} | |
63 | ({$l}sectionTotal key=$row.{$column} depth={$smarty.foreach.sections.index}{$r}) | |
64 | </h{$h}> | |
65 | </th></tr> | |
66 | {if $smarty.foreach.sections.last} | |
67 | <tr>{$l}$tableHeader{$r}</tr> | |
68 | {/if} | |
69 | {$l}/if{$r} | |
70 | {/foreach} | |
71 | {/capture} | |
72 | ||
73 | {foreach from=$rows item=row} | |
74 | <table class="report-layout crm-report_contact_civireport"> | |
75 | {eval var=$sectionHeaderTemplate} | |
76 | <tr> | |
77 | {foreach from=$columnHeaders item=header key=field} | |
78 | {if !$skip} | |
79 | {if $header.colspan} | |
80 | <th colspan={$header.colspan}>{$header.title}</th> | |
81 | {assign var=skip value=true} | |
82 | {assign var=skipCount value=`$header.colspan`} | |
83 | {assign var=skipMade value=1} | |
84 | {else} | |
85 | <th>{$header.title}</th> | |
86 | {assign var=skip value=false} | |
87 | {/if} | |
88 | {else} {* for skip case *} | |
89 | {assign var=skipMade value=`$skipMade+1`} | |
90 | {if $skipMade >= $skipCount}{assign var=skip value=false}{/if} | |
91 | {/if} | |
92 | {/foreach} | |
93 | </tr> | |
94 | <tr class="group-row crm-report"> | |
95 | {foreach from=$columnHeaders item=header key=field} | |
96 | {assign var=fieldLink value=$field|cat:"_link"} | |
97 | {assign var=fieldHover value=$field|cat:"_hover"} | |
98 | <td class="report-contents crm-report_{$field}"> | |
99 | {if $row.$fieldLink}<a title="{$row.$fieldHover}" href="{$row.$fieldLink}">{/if} | |
100 | ||
101 | {if $row.$field eq 'Subtotal'} | |
102 | {$row.$field} | |
103 | {elseif $header.type eq 12} | |
104 | {if $header.group_by eq 'MONTH' or $header.group_by eq 'QUARTER'} | |
105 | {$row.$field|crmDate:$config->dateformatPartial} | |
106 | {elseif $header.group_by eq 'YEAR'} | |
107 | {$row.$field|crmDate:$config->dateformatYear} | |
108 | {else} | |
109 | {$row.$field|truncate:10:''|crmDate} | |
110 | {/if} | |
111 | {elseif $header.type eq 1024} | |
112 | {$row.$field|crmMoney} | |
113 | {else} | |
114 | {$row.$field} | |
115 | {/if} | |
116 | ||
117 | {if $row.contactID} {/if} | |
118 | ||
119 | {if $row.$fieldLink}</a>{/if} | |
120 | </td> | |
121 | {/foreach} | |
122 | </tr> | |
123 | </table> | |
124 | ||
125 | {if $columnHeadersComponent} | |
126 | {assign var=componentContactId value=$row.contactID} | |
127 | {foreach from=$columnHeadersComponent item=pheader key=component} | |
128 | {if $componentRows.$componentContactId.$component} | |
129 | <h3>{$component|replace:'_civireport':''|upper}</h3> | |
130 | <table class="report-layout crm-report_{$component}"> | |
131 | {*add space before headers*} | |
132 | <tr> | |
133 | {foreach from=$pheader item=header} | |
134 | <th>{$header.title}</th> | |
135 | {/foreach} | |
136 | </tr> | |
137 | ||
138 | {foreach from=$componentRows.$componentContactId.$component item=row key=rowid} | |
139 | <tr class="{cycle values="odd-row,even-row"} crm-report" id="crm-report_{$rowid}"> | |
140 | {foreach from=$columnHeadersComponent.$component item=header key=field} | |
141 | {assign var=fieldLink value=$field|cat:"_link"} | |
142 | {assign var=fieldHover value=$field|cat:"_hover"} | |
143 | <td class="report-contents crm-report_{$field}"> | |
144 | {if $row.$fieldLink} | |
145 | <a title="{$row.$fieldHover} "href="{$row.$fieldLink}"> | |
146 | {/if} | |
147 | ||
148 | {if $row.$field eq 'Sub Total'} | |
149 | {$row.$field} | |
150 | {elseif $header.type & 4} | |
151 | {if $header.group_by eq 'MONTH' or $header.group_by eq 'QUARTER'} | |
152 | {$row.$field|crmDate:$config->dateformatPartial} | |
153 | {elseif $header.group_by eq 'YEAR'} | |
154 | {$row.$field|crmDate:$config->dateformatYear} | |
155 | {else} | |
156 | {$row.$field|truncate:10:''|crmDate} | |
157 | {/if} | |
158 | {elseif $header.type eq 1024} | |
159 | {$row.$field|crmMoney} | |
160 | {else} | |
161 | {$row.$field} | |
162 | {/if} | |
163 | ||
164 | {if $row.$fieldLink}</a>{/if} | |
165 | </td> | |
166 | {/foreach} | |
167 | </tr> | |
168 | {/foreach} | |
169 | </table> | |
170 | {/if} | |
171 | {/foreach} | |
172 | {/if} | |
173 | {/foreach} | |
174 | ||
175 | <div class="report-pager"> | |
176 | {include file="CRM/common/pager.tpl" noForm=0} | |
177 | </div> | |
178 | <br /> | |
179 | {if $grandStat} | |
180 | <table class="report-layout"> | |
181 | <tr> | |
182 | {foreach from=$columnHeaders item=header key=field} | |
183 | <td> | |
184 | <strong> | |
185 | {if $header.type eq 1024} | |
186 | {$grandStat.$field|crmMoney} | |
187 | {else} | |
188 | {$grandStat.$field} | |
189 | {/if} | |
190 | </strong> | |
191 | </td> | |
192 | {/foreach} | |
193 | </tr> | |
194 | </table> | |
195 | {/if} | |
196 | ||
197 | {if !$section } | |
198 | {*Statistics at the bottom of the page*} | |
199 | {include file="CRM/Report/Form/Statistics.tpl" bottom=true} | |
200 | {/if} | |
201 | {/if} | |
202 | {include file="CRM/Report/Form/ErrorMessage.tpl"} | |
232624b1 | 203 | </div> |