<!DOCTYPE openRPTDef>
<report>
 <title>AR 30 60 90 Aging Customer Summary</title>
 <name>ARAgingSummary</name>
 <description>Enhanced AR Aging - Uses 30-60-90 columns - User provides Relative Date - all amounts in base currency based on Document Date.

Customer Summarised Report</description>
 <grid>
  <snap/>
  <show/>
  <x>0.05</x>
  <y>0.05</y>
 </grid>
 <size>Letter</size>
 <landscape/>
 <topmargin>50</topmargin>
 <bottommargin>50</bottommargin>
 <rightmargin>40</rightmargin>
 <leftmargin>40</leftmargin>
 <querysource>
  <name>detail</name>
  <sql>SELECT 
	araging_cust_id,
	araging_cust_number,
	araging_cust_name,
	araging_cust_custtype_id,
	araging_custtype_code,
	araging_terms_descrip,
	formatMoney(SUM(araging_aropen_amount)) AS araging_aropen_amount,
	SUM(araging_cur_val) AS araging_cur_val, formatMoney(SUM(araging_cur_val)) AS araging_cur_amt,
	SUM(araging_thirty_val) AS araging_thirty_val, formatMoney(SUM(araging_thirty_val)) AS araging_thirty_amt,
	SUM(araging_sixty_val) AS araging_sixty_val, formatMoney(SUM(araging_sixty_val))  AS araging_sixty_amt,
	SUM(araging_ninety_val) AS araging_ninety_val, formatMoney(SUM(araging_ninety_val)) AS araging_ninety_amt,
	SUM(araging_plus_val) AS araging_plus_val,  formatMoney(SUM(araging_plus_val))   AS araging_plus_amt,
	SUM(araging_total_val) AS araging_total_val, formatMoney(SUM(araging_total_val))  AS araging_total_amt
FROM araging(&lt;? value("relDate") ?>, &lt;? value("useDocDate") ?>)
&lt;? if exists("cust_id") ?>
   WHERE (araging_cust_id=&lt;? value("cust_id") ?>)
&lt;? elseif exists("custtype_id") ?>
   WHERE (araging_cust_custtype_id=&lt;? value("custtype_id") ?>)
&lt;? elseif exists("custgrp_id") ?>
   LEFT OUTER JOIN custgrpitem ON (araging_cust_id=custgrpitem_cust_id)
   WHERE (custgrpitem_custgrp_id=&lt;? value("custgrp_id") ?>)
&lt;? elseif exists("custtype_pattern") ?>
   WHERE (araging_custtype_code ~ &lt;? value("custtype_pattern") ?>)
&lt;? endif ?>
GROUP BY 	araging_cust_id,
	araging_cust_number,
	araging_cust_name,
	araging_cust_custtype_id,
	araging_custtype_code,
	araging_terms_descrip ;</sql>
 </querysource>
 <rpthead>
  <height>81</height>
  <label>
   <rect>
    <x>5</x>
    <y>40</y>
    <width>50</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>As of:</string>
  </label>
  <field>
   <rect>
    <x>60</x>
    <y>40</y>
    <width>110</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Parameter Query</query>
    <column>relDate</column>
   </data>
  </field>
  <label>
   <rect>
    <x>5</x>
    <y>0</y>
    <width>420</width>
    <height>31</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>14</size>
    <weight>bold</weight>
   </font>
   <left/>
   <top/>
   <string>Accounts Receivable Aging Report Summary</string>
  </label>
  <label>
   <rect>
    <x>780</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>31-60 Days</string>
  </label>
  <label>
   <rect>
    <x>695</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>0-30 Days</string>
  </label>
  <label>
   <rect>
    <x>860</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>61-90 Days</string>
  </label>
  <label>
   <rect>
    <x>615</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>0+Days</string>
  </label>
  <label>
   <rect>
    <x>935</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>90+ Days</string>
  </label>
  <line>
   <xstart>6</xstart>
   <ystart>76</ystart>
   <xend>1013</xend>
   <yend>76</yend>
   <weight>0</weight>
  </line>
  <label>
   <rect>
    <x>5</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Number:</string>
  </label>
  <label>
   <rect>
    <x>90</x>
    <y>60</y>
    <width>102</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Customer Name:</string>
  </label>
  <label>
   <rect>
    <x>375</x>
    <y>60</y>
    <width>102</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Terms:</string>
  </label>
  <label>
   <rect>
    <x>535</x>
    <y>60</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Total Amt.</string>
  </label>
 </rpthead>
 <section>
  <name>detail</name>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>19</height>
   <field>
    <rect>
     <x>695</x>
     <y>4</y>
     <width>75</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_thirty_amt</column>
    </data>
   </field>
   <field>
    <rect>
     <x>935</x>
     <y>4</y>
     <width>75</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_plus_amt</column>
    </data>
   </field>
   <field>
    <rect>
     <x>860</x>
     <y>4</y>
     <width>75</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_ninety_amt</column>
    </data>
   </field>
   <field>
    <rect>
     <x>615</x>
     <y>4</y>
     <width>75</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_cur_amt</column>
    </data>
   </field>
   <field>
    <rect>
     <x>785</x>
     <y>4</y>
     <width>70</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_sixty_amt</column>
    </data>
   </field>
   <field>
    <rect>
     <x>5</x>
     <y>4</y>
     <width>80</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_cust_number</column>
    </data>
   </field>
   <field>
    <rect>
     <x>90</x>
     <y>4</y>
     <width>275</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_cust_name</column>
    </data>
   </field>
   <field>
    <rect>
     <x>375</x>
     <y>4</y>
     <width>140</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_terms_descrip</column>
    </data>
   </field>
   <field>
    <rect>
     <x>525</x>
     <y>4</y>
     <width>85</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_total_amt</column>
    </data>
   </field>
  </detail>
 </section>
 <pgfoot>
  <lastpage/>
  <height>103</height>
  <label>
   <rect>
    <x>125</x>
    <y>10</y>
    <width>170</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Total For All Customers</string>
  </label>
  <field>
   <rect>
    <x>695</x>
    <y>10</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>araging_thirty_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <field>
   <rect>
    <x>785</x>
    <y>10</y>
    <width>70</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>araging_sixty_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <label>
   <rect>
    <x>385</x>
    <y>75</y>
    <width>35</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Page: </string>
  </label>
  <field>
   <rect>
    <x>615</x>
    <y>10</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>araging_cur_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <field>
   <rect>
    <x>935</x>
    <y>10</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>araging_plus_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <line>
   <xstart>6</xstart>
   <ystart>4</ystart>
   <xend>1018</xend>
   <yend>4</yend>
   <weight>2</weight>
  </line>
  <field>
   <rect>
    <x>440</x>
    <y>75</y>
    <width>41</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>page_number</column>
   </data>
  </field>
  <field>
   <rect>
    <x>525</x>
    <y>10</y>
    <width>85</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>araging_total_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <label>
   <rect>
    <x>570</x>
    <y>65</y>
    <width>440</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>All amounts are in base currency as of the document date.</string>
  </label>
  <label>
   <rect>
    <x>570</x>
    <y>50</y>
    <width>41</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Note:</string>
  </label>
  <field>
   <rect>
    <x>860</x>
    <y>10</y>
    <width>75</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>araging_ninety_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
 </pgfoot>
 <pgfoot>
  <height>57</height>
  <field>
   <rect>
    <x>440</x>
    <y>22</y>
    <width>41</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>page_number</column>
   </data>
  </field>
  <label>
   <rect>
    <x>385</x>
    <y>22</y>
    <width>35</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Page: </string>
  </label>
 </pgfoot>
</report>
