<!DOCTYPE openRPTDef>
<report>
 <title>Sample Check Format - 3 Part - MC - Remit - Multi Page</title>
 <name>CheckMultiPage</name>
 <description>Sample Check Format - 3 Part - MC - Uses primary Vendor or address with names: REMIT, Remit, or remit if one exists. Multi-Page.</description>
 <size>Letter</size>
 <portrait/>
 <topmargin>50</topmargin>
 <bottommargin>0</bottommargin>
 <rightmargin>50</rightmargin>
 <leftmargin>50</leftmargin>
 <querysource>
  <name>Head</name>
  <sql>SELECT
checkhead_id, checkhead_number, checkhead_for AS memo,
formatDate(checkhead_checkdate) AS f_checkdate,
formatMoney(checkhead_amount) AS f_amount,
INITCAP(spellAmount(checkhead_amount, curr_id)) AS f_words,
CASE WHEN(checkhead_void) THEN TEXT('V O I D')
     ELSE TEXT('')
END AS f_void,
CASE WHEN checkhead_recip_type = 'C' THEN (SELECT cust_number
                                           FROM custinfo
                                           WHERE (cust_id=checkhead_recip_id))
     WHEN checkhead_recip_type = 'T' THEN (SELECT taxauth_code
                                           FROM taxauth
                                           WHERE (taxauth_id=checkhead_recip_id))
     WHEN checkhead_recip_type = 'V' THEN (SELECT vend_number
                                           FROM vendinfo
                                           WHERE (vend_id=checkhead_recip_id))
     ELSE 'Unknown Recipient Type'
END AS recip_number,
formatAddr(CASE WHEN checkhead_recip_type = 'C' THEN
                                         (SELECT cntct_addr_id
                                          FROM cntct, custinfo
                                          WHERE ((cust_cntct_id=cntct_id)
                                            AND  (cust_id=checkhead_recip_id)))
                WHEN checkhead_recip_type = 'T' THEN 
                                         (SELECT taxauth_addr_id
                                          FROM taxauth
                                          WHERE (taxauth_id=checkhead_recip_id))
                WHEN checkhead_recip_type = 'V' THEN
                        COALESCE((SELECT vendaddr_addr_id
                                  FROM vendaddrinfo
                                  WHERE ((UPPER(vendaddr_code)='REMIT')
                                    AND  (vendaddr_vend_id=checkhead_recip_id))),
                                 (SELECT vend_addr_id
                                  FROM vendinfo
                                  WHERE (vend_id=checkhead_recip_id)))
           END) AS check_address,
CASE WHEN checkhead_recip_type = 'C' THEN (SELECT cust_name
                                           FROM custinfo
                                           WHERE cust_id=checkhead_recip_id)
     WHEN checkhead_recip_type = 'T' THEN (SELECT taxauth_name
                                           FROM taxauth
                                           WHERE taxauth_id=checkhead_recip_id)
     WHEN checkhead_recip_type = 'V' THEN
                         COALESCE((SELECT vendaddr_name
                                   FROM vendaddrinfo
                                   WHERE ((UPPER(vendaddr_code)='REMIT')
                                     AND  (vendaddr_vend_id=checkhead_recip_id))),
                                  (SELECT vend_name
                                   FROM vendinfo
                                   WHERE (vend_id=checkhead_recip_id)))
END AS recip_name, 
curr_symbol, curr_abbr, curr_name
FROM checkhead, curr_symbol
WHERE ((checkhead_curr_id = curr_id)
   AND (checkhead_id=&lt;? value("checkhead_id") ?>) );
</sql>
 </querysource>
 <querysource>
  <name>CheckDetail</name>
  <sql>SELECT checkdata_page,
       checkdata_checknumber,
       checkdata_checkwords,
       checkdata_checkdate,
       checkdata_checkamount,
       checkdata_checkcurrsymbol,
       checkdata_checkcurrabbr,
       checkdata_checkcurrname,
       checkdata_checkpayto,
       checkdata_checkaddress,
       checkdata_checkmemo,
       checkdata_docnumber,
       checkdata_docreference,
       checkdata_docdate,
       checkdata_docamount,
       checkdata_docdiscount,
       checkdata_docnetamount
  FROM checkDetailFormatted(&lt;? value("checkhead_id") ?>, 12);</sql>
 </querysource>
 <section>
  <name>Check</name>
  <group>
   <name>Line Detail</name>
   <column>checkdata_page</column>
   <pagebreak when="after foot" />
   <head>
    <height>351</height>
    <field>
     <rect>
      <x>175</x>
      <y>50</y>
      <width>120</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <left/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docreference</column>
     </data>
    </field>
    <label>
     <rect>
      <x>490</x>
      <y>25</y>
      <width>55</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Amount:</string>
    </label>
    <field>
     <rect>
      <x>555</x>
      <y>50</y>
      <width>80</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <right/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docdiscount</column>
     </data>
    </field>
    <field>
     <rect>
      <x>85</x>
      <y>325</y>
      <width>660</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>memo</column>
     </data>
    </field>
    <field>
     <rect>
      <x>645</x>
      <y>50</y>
      <width>100</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <right/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docnetamount</column>
     </data>
    </field>
    <field>
     <rect>
      <x>305</x>
      <y>25</y>
      <width>147</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Context Query</query>
      <column>report_date</column>
     </data>
    </field>
    <label>
     <rect>
      <x>505</x>
      <y>305</y>
      <width>75</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Check Total:</string>
    </label>
    <label>
     <rect>
      <x>20</x>
      <y>325</y>
      <width>60</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Memo:</string>
    </label>
    <label>
     <rect>
      <x>675</x>
      <y>25</y>
      <width>70</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Net Amount:</string>
    </label>
    <field>
     <rect>
      <x>5</x>
      <y>50</y>
      <width>155</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <left/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docnumber</column>
     </data>
    </field>
    <field>
     <rect>
      <x>145</x>
      <y>0</y>
      <width>175</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>recip_name</column>
     </data>
    </field>
    <line>
     <xstart>5</xstart>
     <ystart>45</ystart>
     <xend>745</xend>
     <yend>45</yend>
     <weight>0</weight>
    </line>
    <line>
     <xstart>450</xstart>
     <ystart>305</ystart>
     <xend>745</xend>
     <yend>305</yend>
     <weight>0</weight>
    </line>
    <field>
     <rect>
      <x>650</x>
      <y>0</y>
      <width>95</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>10</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>checkhead_number</column>
     </data>
    </field>
    <field>
     <rect>
      <x>640</x>
      <y>305</y>
      <width>104</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <top/>
     <data>
      <query>Head</query>
      <column>f_amount</column>
     </data>
    </field>
    <field>
     <rect>
      <x>444</x>
      <y>50</y>
      <width>100</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <right/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docamount</column>
     </data>
    </field>
    <field>
     <rect>
      <x>10</x>
      <y>0</y>
      <width>135</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>recip_number</column>
     </data>
    </field>
    <field>
     <rect>
      <x>580</x>
      <y>305</y>
      <width>55</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <top/>
     <data>
      <query>Head</query>
      <column>curr_symbol</column>
     </data>
    </field>
    <field>
     <rect>
      <x>310</x>
      <y>50</y>
      <width>100</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <left/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docdate</column>
     </data>
    </field>
    <label>
     <rect>
      <x>550</x>
      <y>25</y>
      <width>90</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <hcenter/>
     <vcenter/>
     <string>Discount / Credit:</string>
    </label>
    <label>
     <rect>
      <x>5</x>
      <y>25</y>
      <width>111</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Invoice / Document:</string>
    </label>
    <label>
     <rect>
      <x>590</x>
      <y>0</y>
      <width>61</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>10</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Check #</string>
    </label>
    <label>
     <rect>
      <x>175</x>
      <y>25</y>
      <width>75</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Reference:</string>
    </label>
   </head>
   <foot>
    <height>351</height>
    <field>
     <rect>
      <x>645</x>
      <y>0</y>
      <width>95</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>10</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>checkhead_number</column>
     </data>
    </field>
    <field>
     <rect>
      <x>5</x>
      <y>50</y>
      <width>155</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <left/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docnumber</column>
     </data>
    </field>
    <field>
     <rect>
      <x>550</x>
      <y>50</y>
      <width>80</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <right/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docdiscount</column>
     </data>
    </field>
    <label>
     <rect>
      <x>170</x>
      <y>25</y>
      <width>75</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Reference:</string>
    </label>
    <label>
     <rect>
      <x>15</x>
      <y>325</y>
      <width>60</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Memo:</string>
    </label>
    <label>
     <rect>
      <x>585</x>
      <y>0</y>
      <width>61</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>10</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Check #</string>
    </label>
    <label>
     <rect>
      <x>670</x>
      <y>25</y>
      <width>70</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Net Amount:</string>
    </label>
    <line>
     <xstart>445</xstart>
     <ystart>305</ystart>
     <xend>740</xend>
     <yend>305</yend>
     <weight>0</weight>
    </line>
    <field>
     <rect>
      <x>170</x>
      <y>50</y>
      <width>120</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <left/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docreference</column>
     </data>
    </field>
    <field>
     <rect>
      <x>440</x>
      <y>50</y>
      <width>100</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <right/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docamount</column>
     </data>
    </field>
    <label>
     <rect>
      <x>5</x>
      <y>25</y>
      <width>111</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Invoice / Document:</string>
    </label>
    <field>
     <rect>
      <x>80</x>
      <y>325</y>
      <width>660</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>memo</column>
     </data>
    </field>
    <label>
     <rect>
      <x>545</x>
      <y>25</y>
      <width>90</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <hcenter/>
     <vcenter/>
     <string>Discount / Credit:</string>
    </label>
    <field>
     <rect>
      <x>575</x>
      <y>305</y>
      <width>55</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <top/>
     <data>
      <query>Head</query>
      <column>curr_symbol</column>
     </data>
    </field>
    <line>
     <xstart>5</xstart>
     <ystart>45</ystart>
     <xend>745</xend>
     <yend>45</yend>
     <weight>0</weight>
    </line>
    <field>
     <rect>
      <x>300</x>
      <y>25</y>
      <width>147</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Context Query</query>
      <column>report_date</column>
     </data>
    </field>
    <field>
     <rect>
      <x>140</x>
      <y>0</y>
      <width>175</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>recip_name</column>
     </data>
    </field>
    <field>
     <rect>
      <x>640</x>
      <y>50</y>
      <width>100</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <right/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docnetamount</column>
     </data>
    </field>
    <field>
     <rect>
      <x>305</x>
      <y>50</y>
      <width>100</width>
      <height>250</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <wordwrap/>
     <left/>
     <top/>
     <data>
      <query>CheckDetail</query>
      <column>checkdata_docdate</column>
     </data>
    </field>
    <label>
     <rect>
      <x>485</x>
      <y>25</y>
      <width>55</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <vcenter/>
     <string>Amount:</string>
    </label>
    <label>
     <rect>
      <x>500</x>
      <y>305</y>
      <width>75</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <string>Check Total:</string>
    </label>
    <field>
     <rect>
      <x>635</x>
      <y>305</y>
      <width>104</width>
      <height>20</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <right/>
     <top/>
     <data>
      <query>Head</query>
      <column>f_amount</column>
     </data>
    </field>
    <field>
     <rect>
      <x>5</x>
      <y>0</y>
      <width>135</width>
      <height>25</height>
     </rect>
     <font>
      <face>Arial</face>
      <size>8</size>
      <weight>normal</weight>
     </font>
     <left/>
     <vcenter/>
     <data>
      <query>Head</query>
      <column>recip_number</column>
     </data>
    </field>
   </foot>
  </group>
  <detail>
   <key>
    <query>CheckDetail</query>
   </key>
   <height>292</height>
   <field>
    <rect>
     <x>10</x>
     <y>100</y>
     <width>225</width>
     <height>25</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>10</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkpayto</column>
    </data>
   </field>
   <field>
    <rect>
     <x>15</x>
     <y>40</y>
     <width>560</width>
     <height>30</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>12</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkwords</column>
    </data>
   </field>
   <field>
    <rect>
     <x>405</x>
     <y>85</y>
     <width>121</width>
     <height>25</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>10</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>80</x>
     <y>260</y>
     <width>650</width>
     <height>20</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkmemo</column>
    </data>
   </field>
   <label>
    <rect>
     <x>5</x>
     <y>260</y>
     <width>75</width>
     <height>20</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <string>Memo:</string>
   </label>
   <text>
    <rect>
     <x>10</x>
     <y>125</y>
     <width>300</width>
     <height>20</height>
    </rect>
    <bottompad>10</bottompad>
    <font>
     <face>Arial</face>
     <size>10</size>
     <weight>normal</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkaddress</column>
    </data>
   </text>
   <field>
    <rect>
     <x>545</x>
     <y>85</y>
     <width>55</width>
     <height>25</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>10</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkcurrsymbol</column>
    </data>
   </field>
   <field>
    <rect>
     <x>600</x>
     <y>85</y>
     <width>125</width>
     <height>25</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>10</size>
     <weight>normal</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>CheckDetail</query>
     <column>checkdata_checkamount</column>
    </data>
   </field>
  </detail>
 </section>
</report>
