<!DOCTYPE openRPTDef>
<report>
 <title>AR 30 60 90 Aging</title>
 <name>ARAging</name>
 <description>Enhanced AR Aging - Uses 30-60-90 columns - User provides Relative Date - all amounts in base currency based on Document Date.</description>
 <grid>
  <snap/>
  <show/>
  <x>0.05</x>
  <y>0.05</y>
 </grid>
 <size>Letter</size>
 <landscape/>
 <topmargin>100</topmargin>
 <bottommargin>100</bottommargin>
 <rightmargin>50</rightmargin>
 <leftmargin>50</leftmargin>
 <querysource>
  <name>detail</name>
  <sql>SELECT 
	araging_docdate,
	araging_duedate,
	araging_ponumber,
	araging_docnumber,
	araging_doctype,
	araging_cust_id,
	araging_cust_number,
	araging_cust_name,
	araging_cust_custtype_id,
	araging_custtype_code,
	araging_terms_descrip,
	formatMoney(araging_aropen_amount) AS araging_aropen_amount,
	araging_cur_val,   formatMoney(araging_cur_val)    AS araging_cur_amt,
	araging_thirty_val,formatMoney(araging_thirty_val) AS araging_thirty_amt,
	araging_sixty_val, formatMoney(araging_sixty_val)  AS araging_sixty_amt,
	araging_ninety_val,formatMoney(araging_ninety_val) AS araging_ninety_amt,
	araging_plus_val,  formatMoney(araging_plus_val)   AS araging_plus_amt,
	araging_total_val, formatMoney(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 ?>;</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>365</width>
    <height>31</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>14</size>
    <weight>bold</weight>
   </font>
   <left/>
   <top/>
   <string>Accounts Receivable Aging Report</string>
  </label>
 </rpthead>
 <section>
  <name>detail</name>
  <group>
   <name>Customer</name>
   <column>araging_cust_number</column>
   <pagebreak when="after foot"/>
   <head>
    <height>113</height>
    <label>
     <rect>
      <x>891</x>
      <y>85</y>
      <width>75</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>90+ Days</string>
    </label>
    <line>
     <xstart>0</xstart>
     <ystart>100</ystart>
     <xend>980</xend>
     <yend>100</yend>
     <weight>0</weight>
    </line>
    <label>
     <rect>
      <x>740</x>
      <y>85</y>
      <width>75</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>31-60 Days</string>
    </label>
    <label>
     <rect>
      <x>35</x>
      <y>85</y>
      <width>85</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Invoice#</string>
    </label>
    <label>
     <rect>
      <x>5</x>
      <y>40</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>0</x>
      <y>85</y>
      <width>25</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Type</string>
    </label>
    <line>
     <xstart>0</xstart>
     <ystart>5</ystart>
     <xend>967</xend>
     <yend>5</yend>
     <weight>0</weight>
    </line>
    <field>
     <rect>
      <x>125</x>
      <y>40</y>
      <width>220</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>
    <label>
     <rect>
      <x>825</x>
      <y>85</y>
      <width>75</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>61-90 Days</string>
    </label>
    <label>
     <rect>
      <x>125</x>
      <y>85</y>
      <width>60</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Doc Date</string>
    </label>
    <label>
     <rect>
      <x>490</x>
      <y>75</y>
      <width>80</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Original</string>
    </label>
    <label>
     <rect>
      <x>650</x>
      <y>85</y>
      <width>75</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>0-30 Days</string>
    </label>
    <label>
     <rect>
      <x>490</x>
      <y>85</y>
      <width>80</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Doc Amount</string>
    </label>
    <field>
     <rect>
      <x>125</x>
      <y>25</y>
      <width>220</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>
    <label>
     <rect>
      <x>35</x>
      <y>75</y>
      <width>85</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Debit Memo/</string>
    </label>
    <label>
     <rect>
      <x>5</x>
      <y>10</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>
    <field>
     <rect>
      <x>125</x>
      <y>10</y>
      <width>220</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>
    <label>
     <rect>
      <x>570</x>
      <y>85</y>
      <width>75</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>0+Days</string>
    </label>
    <label>
     <rect>
      <x>215</x>
      <y>85</y>
      <width>60</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Due Date</string>
    </label>
    <label>
     <rect>
      <x>35</x>
      <y>65</y>
      <width>85</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Credit/</string>
    </label>
    <label>
     <rect>
      <x>340</x>
      <y>85</y>
      <width>85</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>PO Number</string>
    </label>
    <label>
     <rect>
      <x>5</x>
      <y>25</y>
      <width>102</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>bold</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Customer Number:</string>
    </label>
   </head>
   <foot>
    <height>111</height>
    <field>
     <rect>
      <x>825</x>
      <y>8</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_ninety_val</column>
     </data>
     <format builtin="true">qty</format>
     <tracktotal subtotal="true"/>
    </field>
    <field>
     <rect>
      <x>740</x>
      <y>8</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_val</column>
     </data>
     <format builtin="true">qty</format>
     <tracktotal subtotal="true"/>
    </field>
    <field>
     <rect>
      <x>250</x>
      <y>50</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_total_val</column>
     </data>
     <format builtin="true">qty</format>
     <tracktotal subtotal="true"/>
    </field>
    <field>
     <rect>
      <x>570</x>
      <y>8</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_val</column>
     </data>
     <format builtin="true">qty</format>
     <tracktotal subtotal="true"/>
    </field>
    <field>
     <rect>
      <x>650</x>
      <y>8</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_val</column>
     </data>
     <format builtin="true">qty</format>
     <tracktotal subtotal="true"/>
    </field>
    <label>
     <rect>
      <x>5</x>
      <y>35</y>
      <width>135</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>bold</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Total For Customer</string>
    </label>
    <field>
     <rect>
      <x>5</x>
      <y>50</y>
      <width>220</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>bold</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>detail</query>
      <column>araging_cust_name</column>
     </data>
    </field>
    <line>
     <xstart>0</xstart>
     <ystart>5</ystart>
     <xend>967</xend>
     <yend>5</yend>
     <weight>0</weight>
    </line>
    <field>
     <rect>
      <x>900</x>
      <y>8</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_plus_val</column>
     </data>
     <format builtin="true">qty</format>
     <tracktotal subtotal="true"/>
    </field>
    <label>
     <rect>
      <x>570</x>
      <y>75</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>60</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>
    <line>
     <xstart>237</xstart>
     <ystart>31</ystart>
     <xend>237</xend>
     <yend>31</yend>
     <weight>0</weight>
    </line>
    <label>
     <rect>
      <x>-35</x>
      <y>12</y>
      <width>41</width>
      <height>11</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>bold</weight>
     </font>
     <left/>
     <top/>
     <string></string>
    </label>
   </foot>
  </group>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>18</height>
   <field>
    <rect>
     <x>740</x>
     <y>0</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>480</x>
     <y>0</y>
     <width>80</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_aropen_amount</column>
    </data>
   </field>
   <field>
    <rect>
     <x>0</x>
     <y>0</y>
     <width>25</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_doctype</column>
    </data>
   </field>
   <field>
    <rect>
     <x>40</x>
     <y>0</y>
     <width>61</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_docnumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>215</x>
     <y>0</y>
     <width>85</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_duedate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>910</x>
     <y>0</y>
     <width>55</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>825</x>
     <y>0</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_ninety_amt</column>
    </data>
   </field>
   <field>
    <rect>
     <x>120</x>
     <y>0</y>
     <width>85</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_docdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>340</x>
     <y>0</y>
     <width>61</width>
     <height>11</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>araging_ponumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>570</x>
     <y>0</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>650</x>
     <y>0</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>
  </detail>
 </section>
 <pgfoot>
  <lastpage/>
  <height>103</height>
  <label>
   <rect>
    <x>5</x>
    <y>50</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>650</x>
    <y>5</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_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <field>
   <rect>
    <x>740</x>
    <y>5</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_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>
  <label>
   <rect>
    <x>165</x>
    <y>5</y>
    <width>170</width>
    <height>11</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Report Totals:</string>
  </label>
  <field>
   <rect>
    <x>570</x>
    <y>5</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_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <field>
   <rect>
    <x>910</x>
    <y>5</y>
    <width>55</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_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <line>
   <xstart>1</xstart>
   <ystart>1</ystart>
   <xend>967</xend>
   <yend>1</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>250</x>
    <y>50</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_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>825</x>
    <y>5</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_ninety_val</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
 </pgfoot>
 <pgfoot>
  <height>57</height>
  <field>
   <rect>
    <x>440</x>
    <y>20</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>20</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>
