<!DOCTYPE openRPTDef>
<report>
 <title>Customer Information</title>
 <name>CustomerInformation</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 cust_name, cust_number,
       ba.addr_line1 AS cust_address1, ba.addr_line2 AS cust_address2, ba.addr_line3 AS cust_address3,
       ba.addr_city AS cust_city, ba.addr_state AS cust_state, ba.addr_postalcode AS cust_zipcode,
       (ba.addr_city || ', ' || ba.addr_state || ' ' || ba.addr_postalcode) AS citystatezip,
       trim(bc.cntct_first_name || ' ' || bc.cntct_last_name) AS cust_contact, bc.cntct_phone AS cust_phone, bc.cntct_fax AS cust_fax, bc.cntct_email AS cust_email,
       ca.addr_line1 AS cust_corraddress1, ca.addr_line2 AS cust_corraddress2, ca.addr_line3 AS cust_corraddress3,
       ca.addr_city AS cust_corrcity, ca.addr_state AS cust_corrstate, ca.addr_postalcode AS cust_corrzipcode,
       (ca.addr_city || ', ' || ca.addr_state || ' ' || ca.addr_postalcode) AS corrcitystatezip,
       trim(cc.cntct_first_name || ' ' || cc.cntct_last_name) AS cust_corrcontact, cc.cntct_phone AS cust_corrphone,
       cc.cntct_fax AS cust_corrfax, cc.cntct_email AS cust_corremail,
       CASE WHEN (cust_creditstatus='G') THEN 'In Good Standing'
            WHEN (cust_creditstatus='W') THEN 'On Credit Warning'
            WHEN (cust_creditstatus='H') THEN 'On Credit Hold'
            ELSE ('Unknown Status: ' || cust_creditstatus)
       END AS f_creditstatus,
       cust_comments
 FROM custinfo
 LEFT OUTER JOIN cntct cc ON (cust_corrcntct_id=cc.cntct_id)
 LEFT OUTER JOIN addr ca ON (cc.cntct_addr_id=ca.addr_id)
 LEFT OUTER JOIN cntct bc ON (cust_cntct_id=bc.cntct_id)
 LEFT OUTER JOIN addr ba ON (bc.cntct_addr_id=ba.addr_id)
 WHERE (cust_id=&lt;? value(&quot;cust_id&quot;) ?>);</sql>
 </querysource>
 <querysource>
  <name>firstlastorderdate</name>
  <sql>SELECT formatDate(MIN(cohist_invcdate)) AS firstdate,
       formatDate(MAX(cohist_invcdate)) AS lastdate
   FROM cohist
WHERE (cohist_cust_id=&lt;? value(&quot;cust_id&quot;) ?>);</sql>
 </querysource>
 <querysource>
  <name>lysales</name>
  <sql>SELECT formatMoney(COALESCE(SUM(round(cohist_qtyshipped * cohist_unitprice,2)), 0)) AS lysales FROM cohist WHERE ( (cohist_invcdate BETWEEN (DATE_TRUNC('year', CURRENT_TIMESTAMP) - INTERVAL '1 year') AND                                 (DATE_TRUNC('year', CURRENT_TIMESTAMP) - INTERVAL '1 day')) AND (cohist_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) );</sql>
 </querysource>
 <querysource>
  <name>ytdsales</name>
  <sql>SELECT formatExtPrice(SUM(round(cohist_qtyshipped * cohist_unitprice,2))) AS ytdsales
  FROM cohist
 WHERE ((cohist_invcdate>=DATE_TRUNC('year', CURRENT_TIMESTAMP))
   AND (cohist_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) );</sql>
 </querysource>
 <querysource>
  <name>backlog</name>
  <sql>SELECT formatMoney( COALESCE( SUM( (noNeg(coitem_qtyord - coitem_qtyshipped + coitem_qtyreturned) * coitem_qty_invuomratio) * (coitem_price / coitem_price_invuomratio) ), 0 ) ) AS backlog FROM cohead, coitem, itemsite, item WHERE ( (coitem_cohead_id=cohead_id) AND (coitem_itemsite_id=itemsite_id) AND (itemsite_item_id=item_id) AND (coitem_status='O') AND (cohead_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) );</sql>
 </querysource>
 <querysource>
  <name>OpenBalance</name>
  <sql>SELECT formatMoney( COALESCE( SUM( CASE WHEN (aropen_doctype IN ('I', 'D')) THEN (aropen_amount - aropen_paid)                                       ELSE ((aropen_amount - aropen_paid) * -1)                                   END ), 0 ) ) AS f_balance FROM aropen WHERE ( (aropen_open) AND (aropen_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) );</sql>
 </querysource>
 <querysource>
  <name>LateBalance</name>
  <sql>SELECT formatMoney( noNeg( COALESCE( SUM( CASE WHEN (aropen_doctype IN ('I', 'D')) THEN (aropen_amount - aropen_paid)                                      ELSE ((aropen_amount - aropen_paid) * -1)                                   END ), 0 ) ) ) AS f_balance FROM aropen WHERE ( (aropen_open) AND (aropen_duedate &lt; CURRENT_DATE) AND (aropen_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) );
</sql>
 </querysource>
 <querysource>
  <name>Comments</name>
  <sql>SELECT comment_source_id AS cust_id,
       comment_id,
       formatDate(comment_date) AS f_date,
       comment_user,
       comment_text
  FROM comment
 WHERE ( (comment_source='C')
   AND (comment_source_id=&lt;? value(&quot;cust_id&quot;) ?>) )
ORDER BY comment_date;</sql>
 </querysource>
 <querysource>
  <name>History</name>
  <sql>SELECT aropen_cust_id AS cust_id,
       aropen_id AS aropenid, -1 AS applyid,
       aropen_docnumber AS sortnumber,
       aropen_docnumber AS docnumber,
       formatBoolYN(aropen_open) AS f_open,
       CASE WHEN (aropen_doctype='I') THEN text('Invoice')
            WHEN (aropen_doctype='C') THEN text('C/M')
            WHEN (aropen_doctype='D') THEN text('D/M')
            WHEN (aropen_doctype='R') THEN text('C/D')
            ELSE text('Other')
       END AS documenttype,
       formatDate(aropen_docdate) AS f_docdate,
       formatDate(aropen_duedate) AS f_duedate,
       formatMoney(aropen_amount) AS f_amount,
       formatMoney((aropen_amount - aropen_paid)) AS f_balance
FROM aropen
WHERE (aropen_cust_id=&lt;? value(&quot;cust_id&quot;) ?>)

UNION
SELECT aropen_cust_id AS cust_id,
       -1 AS aropenid, arapply_source_aropen_id AS applyid,
       aropen_docnumber AS sortnumber,
       CASE WHEN (arapply_source_doctype='C') THEN arapply_source_docnumber
            WHEN (arapply_source_doctype='K') THEN arapply_refnumber
            ELSE :error
       END AS docnumber,
       '' AS f_open,
       CASE WHEN (arapply_source_doctype='C') THEN text('C/M')
            WHEN (arapply_fundstype='C') THEN text('Check')
            WHEN (arapply_fundstype='T') THEN text('Certified Check')
            WHEN (arapply_fundstype='M') THEN text('Master Card')
            WHEN (arapply_fundstype='V') THEN text('Visa')
            WHEN (arapply_fundstype='A') THEN text('American Express')
            WHEN (arapply_fundstype='D') THEN text('Discover Card')
            WHEN (arapply_fundstype='R') THEN text('Other Credit Card')
            WHEN (arapply_fundstype='K') THEN text('Cash')
            WHEN (arapply_fundstype='W') THEN text('Wire Transfer')
            WHEN (arapply_fundstype='O') THEN text('Other')
       END AS documenttype,
       formatDate(arapply_postdate) AS f_docdate,
       '' AS f_duedate,
       formatMoney(arapply_applied) AS f_amount,
       '' AS f_balance
FROM arapply, aropen
WHERE ( (arapply_target_doctype IN ('I', 'D'))
 AND (arapply_target_doctype=aropen_doctype)
 AND (arapply_target_docnumber=aropen_docnumber)
 AND (arapply_cust_id=&lt;? value(&quot;cust_id&quot;) ?>)
 AND (aropen_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) )

UNION
SELECT aropen_cust_id AS cust_id,
       -1 AS aropenid, arapply_target_aropen_id AS applyid,
       aropen_docnumber AS sortnumber,
       arapply_target_docnumber AS docnumber,
       '' AS f_open,
       CASE WHEN (arapply_target_doctype='I') THEN text('Invoice')
            WHEN (arapply_target_doctype='D') THEN text('D/M')
            ELSE text('Other')
       END AS documenttype,
       formatDate(arapply_postdate) AS f_docdate,
       '' AS f_duedate,
       formatMoney(arapply_applied) AS f_amount,
       '' AS f_balance
FROM arapply, aropen
WHERE ( (arapply_source_doctype IN ('K', 'C'))
 AND (arapply_source_doctype=aropen_doctype)
 AND (arapply_source_docnumber=aropen_docnumber)
 AND (arapply_cust_id=&lt;? value(&quot;cust_id&quot;) ?>)
 AND (aropen_cust_id=&lt;? value(&quot;cust_id&quot;) ?>) )

ORDER BY sortnumber, applyid;</sql>
 </querysource>
 <rpthead>
  <height>392</height>
  <label>
   <rect>
    <x>385</x>
    <y>260</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>FAX:</string>
  </label>
  <text>
   <rect>
    <x>105</x>
    <y>365</y>
    <width>575</width>
    <height>15</height>
   </rect>
   <bottompad>0</bottompad>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <top/>
   <data>
    <query>head</query>
    <column>cust_comments</column>
   </data>
  </text>
  <field>
   <rect>
    <x>105</x>
    <y>305</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>firstlastorderdate</query>
    <column>firstdate</column>
   </data>
  </field>
  <label>
   <rect>
    <x>500</x>
    <y>345</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Credit Status:</string>
  </label>
  <line>
   <xstart>370</xstart>
   <ystart>160</ystart>
   <xend>370</xend>
   <yend>295</yend>
   <weight>0</weight>
  </line>
  <line>
   <xstart>5</xstart>
   <ystart>155</ystart>
   <xend>360</xend>
   <yend>155</yend>
   <weight>0</weight>
  </line>
  <label>
   <rect>
    <x>375</x>
    <y>10</y>
    <width>350</width>
    <height>38</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>18</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Customer Information</string>
  </label>
  <field>
   <rect>
    <x>100</x>
    <y>229</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corrcontact</column>
   </data>
  </field>
  <field>
   <rect>
    <x>385</x>
    <y>160</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_address1</column>
   </data>
  </field>
  <field>
   <rect>
    <x>100</x>
    <y>260</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corrfax</column>
   </data>
  </field>
  <label>
   <rect>
    <x>240</x>
    <y>305</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Last Year Sales:</string>
  </label>
  <field>
   <rect>
    <x>385</x>
    <y>175</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <bottom/>
   <data>
    <query>head</query>
    <column>cust_address2</column>
   </data>
  </field>
  <field>
   <rect>
    <x>10</x>
    <y>204</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>corrcitystatezip</column>
   </data>
  </field>
  <field>
   <rect>
    <x>475</x>
    <y>229</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_contact</column>
   </data>
  </field>
  <label>
   <rect>
    <x>15</x>
    <y>75</y>
    <width>80</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Name:</string>
  </label>
  <field>
   <rect>
    <x>385</x>
    <y>190</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_address3</column>
   </data>
  </field>
  <label>
   <rect>
    <x>5</x>
    <y>325</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Last Sales Date:</string>
  </label>
  <field>
   <rect>
    <x>600</x>
    <y>345</y>
    <width>140</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>f_creditstatus</column>
   </data>
  </field>
  <line>
   <xstart>5</xstart>
   <ystart>295</ystart>
   <xend>740</xend>
   <yend>295</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>10</x>
    <y>260</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>FAX:</string>
  </label>
  <label>
   <rect>
    <x>385</x>
    <y>229</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Contact Name:</string>
  </label>
  <field>
   <rect>
    <x>340</x>
    <y>305</y>
    <width>145</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>lysales</query>
    <column>lysales</column>
   </data>
  </field>
  <field>
   <rect>
    <x>600</x>
    <y>325</y>
    <width>140</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>LateBalance</query>
    <column>f_balance</column>
   </data>
  </field>
  <field>
   <rect>
    <x>475</x>
    <y>275</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_email</column>
   </data>
  </field>
  <field>
   <rect>
    <x>100</x>
    <y>275</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corremail</column>
   </data>
  </field>
  <field>
   <rect>
    <x>475</x>
    <y>260</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_fax</column>
   </data>
  </field>
  <label>
   <rect>
    <x>10</x>
    <y>245</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Phone:</string>
  </label>
  <field>
   <rect>
    <x>100</x>
    <y>75</y>
    <width>295</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_name</column>
   </data>
  </field>
  <field>
   <rect>
    <x>10</x>
    <y>190</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corraddress3</column>
   </data>
  </field>
  <label>
   <rect>
    <x>240</x>
    <y>325</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>YTD Sales:</string>
  </label>
  <field>
   <rect>
    <x>340</x>
    <y>325</y>
    <width>145</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>ytdsales</query>
    <column>ytdsales</column>
   </data>
  </field>
  <label>
   <rect>
    <x>240</x>
    <y>345</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Backlog:</string>
  </label>
  <label>
   <rect>
    <x>385</x>
    <y>275</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Email:</string>
  </label>
  <field>
   <rect>
    <x>475</x>
    <y>245</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_phone</column>
   </data>
  </field>
  <label>
   <rect>
    <x>385</x>
    <y>140</y>
    <width>135</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Billing Address</string>
  </label>
  <line>
   <xstart>380</xstart>
   <ystart>155</ystart>
   <xend>735</xend>
   <yend>155</yend>
   <weight>0</weight>
  </line>
  <label>
   <rect>
    <x>10</x>
    <y>229</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Contact Name:</string>
  </label>
  <label>
   <rect>
    <x>385</x>
    <y>245</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Phone:</string>
  </label>
  <label>
   <rect>
    <x>10</x>
    <y>140</y>
    <width>170</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Correspondence Address</string>
  </label>
  <field>
   <rect>
    <x>10</x>
    <y>160</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corraddress1</column>
   </data>
  </field>
  <field>
   <rect>
    <x>340</x>
    <y>345</y>
    <width>145</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>backlog</query>
    <column>backlog</column>
   </data>
  </field>
  <label>
   <rect>
    <x>500</x>
    <y>325</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Late Balance:</string>
  </label>
  <field>
   <rect>
    <x>10</x>
    <y>175</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corraddress2</column>
   </data>
  </field>
  <field>
   <rect>
    <x>100</x>
    <y>245</y>
    <width>260</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_corrphone</column>
   </data>
  </field>
  <field>
   <rect>
    <x>105</x>
    <y>325</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>firstlastorderdate</query>
    <column>lastdate</column>
   </data>
  </field>
  <field>
   <rect>
    <x>600</x>
    <y>305</y>
    <width>140</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>OpenBalance</query>
    <column>f_balance</column>
   </data>
  </field>
  <label>
   <rect>
    <x>5</x>
    <y>365</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Notes:</string>
  </label>
  <label>
   <rect>
    <x>15</x>
    <y>95</y>
    <width>80</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Number:</string>
  </label>
  <field>
   <rect>
    <x>100</x>
    <y>95</y>
    <width>200</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>cust_number</column>
   </data>
  </field>
  <field>
   <rect>
    <x>385</x>
    <y>204</y>
    <width>350</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>citystatezip</column>
   </data>
  </field>
  <label>
   <rect>
    <x>10</x>
    <y>275</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Email:</string>
  </label>
  <label>
   <rect>
    <x>500</x>
    <y>305</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Open Balance:</string>
  </label>
  <label>
   <rect>
    <x>5</x>
    <y>305</y>
    <width>95</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>First Sales Date:</string>
  </label>
 </rpthead>
 <section>
  <name>Comments</name>
  <group>
   <name>Head</name>
   <column>cust_id</column>
   <head>
    <height>46</height>
    <line>
     <xstart>55</xstart>
     <ystart>40</ystart>
     <xend>745</xend>
     <yend>40</yend>
     <weight>0</weight>
    </line>
    <label>
     <rect>
      <x>5</x>
      <y>5</y>
      <width>95</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Comments:</string>
    </label>
    <label>
     <rect>
      <x>260</x>
      <y>25</y>
      <width>95</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Comment</string>
    </label>
    <label>
     <rect>
      <x>160</x>
      <y>25</y>
      <width>95</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>User</string>
    </label>
    <label>
     <rect>
      <x>60</x>
      <y>25</y>
      <width>95</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Date</string>
    </label>
   </head>
  </group>
  <detail>
   <key>
    <query>Comments</query>
   </key>
   <height>16</height>
   <text>
    <rect>
     <x>260</x>
     <y>0</y>
     <width>484</width>
     <height>15</height>
    </rect>
    <bottompad>5</bottompad>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <top/>
    <data>
     <query>Comments</query>
     <column>comment_text</column>
    </data>
   </text>
   <field>
    <rect>
     <x>60</x>
     <y>0</y>
     <width>95</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>Comments</query>
     <column>f_date</column>
    </data>
   </field>
   <field>
    <rect>
     <x>160</x>
     <y>0</y>
     <width>95</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>Comments</query>
     <column>comment_user</column>
    </data>
   </field>
  </detail>
 </section>
 <section>
  <name>History</name>
  <group>
   <name>Head</name>
   <column>cust_id</column>
   <head>
    <height>46</height>
    <label>
     <rect>
      <x>130</x>
      <y>25</y>
      <width>75</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>210</x>
      <y>25</y>
      <width>75</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Doc. #</string>
    </label>
    <label>
     <rect>
      <x>380</x>
      <y>25</y>
      <width>85</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <hcenter/>
     <vcenter/>
     <string>Due Date</string>
    </label>
    <label>
     <rect>
      <x>60</x>
      <y>25</y>
      <width>65</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <hcenter/>
     <vcenter/>
     <string>Open</string>
    </label>
    <label>
     <rect>
      <x>470</x>
      <y>25</y>
      <width>85</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Amount</string>
    </label>
    <label>
     <rect>
      <x>5</x>
      <y>5</y>
      <width>95</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>A/R History:</string>
    </label>
    <label>
     <rect>
      <x>290</x>
      <y>25</y>
      <width>85</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <hcenter/>
     <vcenter/>
     <string>Doc. Date</string>
    </label>
    <label>
     <rect>
      <x>560</x>
      <y>25</y>
      <width>85</width>
      <height>15</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Balance</string>
    </label>
    <line>
     <xstart>55</xstart>
     <ystart>40</ystart>
     <xend>745</xend>
     <yend>40</yend>
     <weight>0</weight>
    </line>
   </head>
  </group>
  <detail>
   <key>
    <query>History</query>
   </key>
   <height>16</height>
   <field>
    <rect>
     <x>60</x>
     <y>0</y>
     <width>65</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>f_open</column>
    </data>
   </field>
   <field>
    <rect>
     <x>290</x>
     <y>0</y>
     <width>85</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>f_docdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>210</x>
     <y>0</y>
     <width>75</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>docnumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>380</x>
     <y>0</y>
     <width>85</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>f_duedate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>470</x>
     <y>0</y>
     <width>85</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>f_amount</column>
    </data>
   </field>
   <field>
    <rect>
     <x>130</x>
     <y>0</y>
     <width>75</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>documenttype</column>
    </data>
   </field>
   <field>
    <rect>
     <x>560</x>
     <y>0</y>
     <width>85</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>History</query>
     <column>f_balance</column>
    </data>
   </field>
  </detail>
 </section>
 <pgfoot>
  <height>18</height>
  <field>
   <rect>
    <x>95</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>
  <label>
   <rect>
    <x>615</x>
    <y>0</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Page:</string>
  </label>
  <label>
   <rect>
    <x>5</x>
    <y>0</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Report Date:</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>
 </pgfoot>
</report>
