<!DOCTYPE openRPTDef>
<report>
 <title>A/R Open Items</title>
 <name>AROpenItems</name>
 <description></description>
 <size>Letter</size>
 <portrait/>
 <topmargin>50</topmargin>
 <bottommargin>50</bottommargin>
 <rightmargin>50</rightmargin>
 <leftmargin>50</leftmargin>
 <querysource>
  <name>head</name>
  <sql>SELECT 
CASE WHEN (&lt;? value("asofDate") ?> = endOfTime()) THEN 'Latest'
     ELSE formatDate(&lt;? value("asofDate") ?>) END AS asOfDate,
&lt;? if exists("creditsOnly") ?>
  'Credits Only' AS type,
&lt;? elseif exists("debitsOnly") ?>
  'Debits Only' AS type,
&lt;? else ?>
  'Debits and Credits' AS type,
&lt;? endif ?>
&lt;? if exists("cust_id") ?>
  (SELECT cust_name FROM custinfo WHERE cust_id=&lt;? value("cust_id") ?>) AS selection,
&lt;? elseif exists("custtype_id") ?>
  (SELECT custtype_code FROM custtype WHERE custtype_id=&lt;? value("custtype_id") ?>) AS selection,
&lt;? elseif exists("custtype_pattern") ?>
  ('Customer Type pattern = ' || &lt;? value("custtype_pattern") ?>) AS selection,
&lt;? elseif exists("custgrp_id") ?>
  (SELECT custgrp_name FROM custgrp WHERE 
 custgrp_id=&lt;? value("custgrp_id") ?>) AS selection,
&lt;? else ?>
  'All Customers' AS selection,
&lt;? endif ?>
&lt;? if exists("startDate") ?>
      'Start Doc Date:' AS start_label,
      'End Doc Date:' AS end_label,
&lt;? else ?>
      'Start Due Date:' AS start_label,   
      'End Due Date:' AS end_label,
&lt;? endif ?>
       formatDate(&lt;? value("startDate") ?>, 'Earliest') AS startdate,
       formatDate(&lt;? value("endDate") ?>, 'Latest') AS enddate,
       currConcat(baseCurrId()) AS baseAbbr,
&lt;? if exists("incidentsOnly") ?>
  'Yes' AS incidentsOnly
&lt;? else ?>
  'No' AS incidentsOnly
&lt;? endif ?>;</sql>
 </querysource>
 <querysource loadFromDb="true">
  <name>detail</name>
  <mqlgroup>arOpenItems</mqlgroup>
  <mqlname>f_detail</mqlname>
 </querysource>
 <rpthead>
  <height>178</height>
  <label>
   <rect>
    <x>270</x>
    <y>155</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. Date</string>
  </label>
  <label>
   <rect>
    <x>345.951</x>
    <y>11.3379</y>
    <width>400</width>
    <height>40</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>18</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Open Receivables</string>
  </label>
  <label>
   <rect>
    <x>85</x>
    <y>155</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Document #</string>
  </label>
  <label>
   <rect>
    <x>350</x>
    <y>155</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Due Date</string>
  </label>
  <label>
   <rect>
    <x>160</x>
    <y>155</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Customer</string>
  </label>
  <field>
   <rect>
    <x>514</x>
    <y>69.7785</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>enddate</column>
   </data>
  </field>
  <label>
   <rect>
    <x>5</x>
    <y>155</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Doc. Type</string>
  </label>
  <label>
   <rect>
    <x>600</x>
    <y>155</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Balance</string>
  </label>
  <label>
   <rect>
    <x>520</x>
    <y>155</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Paid</string>
  </label>
  <label>
   <rect>
    <x>440</x>
    <y>155</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Amount</string>
  </label>
  <label>
   <rect>
    <x>700</x>
    <y>155</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Currency</string>
  </label>
  <field>
   <rect>
    <x>514</x>
    <y>52.6662</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>startdate</column>
   </data>
  </field>
  <line>
   <xstart>5</xstart>
   <ystart>170</ystart>
   <xend>745</xend>
   <yend>170</yend>
   <weight>2</weight>
  </line>
  <field>
   <rect>
    <x>410</x>
    <y>52.6662</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>start_label</column>
   </data>
  </field>
  <field>
   <rect>
    <x>410.317</x>
    <y>69.7785</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>end_label</column>
   </data>
  </field>
  <field>
   <rect>
    <x>141.375</x>
    <y>69.7785</y>
    <width>200</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>type</column>
   </data>
  </field>
  <field>
   <rect>
    <x>142</x>
    <y>52.6662</y>
    <width>250</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>selection</column>
   </data>
  </field>
  <field>
   <rect>
    <x>141.375</x>
    <y>88.4798</y>
    <width>200</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>incidentsOnly</column>
   </data>
  </field>
  <field>
   <rect>
    <x>514.049</x>
    <y>88.4798</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>asOfDate</column>
   </data>
  </field>
  <label>
   <rect>
    <x>34.8028</x>
    <y>52.6662</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Selection:</string>
  </label>
  <label>
   <rect>
    <x>35.1592</x>
    <y>69.7785</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Type:</string>
  </label>
  <label>
   <rect>
    <x>34.8631</x>
    <y>88.4798</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Incidents Only:</string>
  </label>
  <label>
   <rect>
    <x>410.477</x>
    <y>88.4798</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>As Of Date:</string>
  </label>
 </rpthead>
 <pghead>
  <firstpage/>
  <height>5</height>
 </pghead>
 <pghead>
  <height>52</height>
  <label>
   <rect>
    <x>700</x>
    <y>30</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Currency</string>
  </label>
  <line>
   <xstart>5</xstart>
   <ystart>45</ystart>
   <xend>745</xend>
   <yend>45</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>160</x>
    <y>30</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Customer</string>
  </label>
  <label>
   <rect>
    <x>350</x>
    <y>30</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Due Date</string>
  </label>
  <label>
   <rect>
    <x>440</x>
    <y>30</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Amount</string>
  </label>
  <label>
   <rect>
    <x>600</x>
    <y>30</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Balance</string>
  </label>
  <label>
   <rect>
    <x>5</x>
    <y>30</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Doc. Type</string>
  </label>
  <label>
   <rect>
    <x>520</x>
    <y>30</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Paid</string>
  </label>
  <label>
   <rect>
    <x>270</x>
    <y>30</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. Date</string>
  </label>
  <label>
   <rect>
    <x>85</x>
    <y>30</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Document #</string>
  </label>
 </pghead>
 <section>
  <name>detail</name>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>18</height>
   <field>
    <rect>
     <x>350</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_duedate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>600</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_balance</column>
    </data>
   </field>
   <field>
    <rect>
     <x>85</x>
     <y>0</y>
     <width>77</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>docnumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>700</x>
     <y>0</y>
     <width>50</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>currAbbr</column>
    </data>
   </field>
   <field>
    <rect>
     <x>440</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_amount</column>
    </data>
   </field>
   <field>
    <rect>
     <x>520</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_paid</column>
    </data>
   </field>
   <field>
    <rect>
     <x>5</x>
     <y>0</y>
     <width>78.9</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>doctype</column>
    </data>
   </field>
   <field>
    <rect>
     <x>270</x>
     <y>0</y>
     <width>80</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_docdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>165</x>
     <y>0</y>
     <width>100</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>cust_name</column>
    </data>
   </field>
  </detail>
 </section>
 <pgfoot>
  <height>18</height>
  <label>
   <rect>
    <x>0</x>
    <y>0</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Report Date:</string>
  </label>
  <label>
   <rect>
    <x>600</x>
    <y>0</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Page:</string>
  </label>
  <field>
   <rect>
    <x>705</x>
    <y>0</y>
    <width>40</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>page_number</column>
   </data>
  </field>
  <field>
   <rect>
    <x>104</x>
    <y>0</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>Context Query</query>
    <column>report_date</column>
   </data>
  </field>
 </pgfoot>
 <rptfoot>
  <height>18</height>
  <field>
   <rect>
    <x>700</x>
    <y>0</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>baseAbbr</column>
   </data>
  </field>
  <field>
   <rect>
    <x>600</x>
    <y>0</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>detail</query>
    <column>base_balance</column>
   </data>
   <format builtin="true">qty</format>
   <tracktotal/>
  </field>
  <label>
   <rect>
    <x>520</x>
    <y>0</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Total:</string>
  </label>
 </rptfoot>
</report>
