<!DOCTYPE openRPTDef>
<report>
 <title>P/O History</title>
 <name>POHistory</name>
 <description></description>
 <parameter default="529" active="true" listtype="dynamic" type="string" name="pohead_id" >
  <description></description>
  <query>select pohead_id, pohead_number from pohead order by pohead_number desc;</query>
 </parameter>
 <size>Letter</size>
 <landscape/>
 <topmargin>50</topmargin>
 <bottommargin>50</bottommargin>
 <rightmargin>50</rightmargin>
 <leftmargin>50</leftmargin>
 <querysource>
  <name>head</name>
  <sql>SELECT pohead_number,&#xd;
       vend_name&#xd;
  FROM pohead, vendinfo&#xd;
 WHERE ((pohead_id=&lt;? value("pohead_id") ?>)&#xd;
  AND  (pohead_vend_id=vend_id));</sql>
 </querysource>
 <querysource>
  <name>detail</name>
  <sql>SELECT &#xd;
poitem_linenumber as f_number, &#xd;
item_number as f_item, &#xd;
uom_name as f_uom1,&#xd;
formatDate(poitem_duedate) as f_duedate,&#xd;
poitem_vend_item_number as f_vend_item,&#xd;
poitem_vend_uom as f_uom2,&#xd;
formatQty(poitem_qty_ordered) as f_ordered,&#xd;
formatqty(poitem_qty_received) as f_received&#xd;
FROM poitem, itemsite, item, uom&#xd;
WHERE ((poitem_itemsite_id=itemsite_id)&#xd;
AND (itemsite_item_id=item_id)&#xd;
AND (item_inv_uom_id=uom_id)&#xd;
AND (poitem_pohead_id=&lt;? value("pohead_id") ?>)) &#xd;
&#xd;
UNION&#xd;
&#xd;
SELECT &#xd;
poitem_linenumber as f_number, &#xd;
poitem_vend_item_number as f_item, &#xd;
expcat_code as f_uom1,&#xd;
formatDate(poitem_duedate) as f_duedate,&#xd;
poitem_vend_item_descrip as f_vend_item,&#xd;
expcat_descrip as f_uom2,&#xd;
formatQty(poitem_qty_ordered) as f_ordered,&#xd;
formatqty(poitem_qty_received) as f_received&#xd;
FROM poitem, expcat&#xd;
WHERE ((poitem_expcat_id = expcat_id)&#xd;
AND (poitem_pohead_id=&lt;? value("pohead_id") ?>)) &#xd;
&#xd;
ORDER BY f_number;</sql>
 </querysource>
 <rpthead>
  <height>205</height>
  <line>
   <xstart>5</xstart>
   <ystart>200</ystart>
   <xend>990</xend>
   <yend>200</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>940</x>
    <y>185</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Received</string>
  </label>
  <label>
   <rect>
    <x>455</x>
    <y>5</y>
    <width>530</width>
    <height>38</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>18</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>P/O History</string>
  </label>
  <label>
   <rect>
    <x>730</x>
    <y>185</y>
    <width>50</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>525</x>
    <y>185</y>
    <width>106</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Vend. Item #</string>
  </label>
  <label>
   <rect>
    <x>5</x>
    <y>185</y>
    <width>35</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>#</string>
  </label>
  <field>
   <rect>
    <x>105</x>
    <y>120</y>
    <width>385</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>vend_name</column>
   </data>
  </field>
  <label>
   <rect>
    <x>30</x>
    <y>120</y>
    <width>105</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Vendor:</string>
  </label>
  <label>
   <rect>
    <x>325</x>
    <y>175</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Vendor UOM or</string>
  </label>
  <label>
   <rect>
    <x>180</x>
    <y>175</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>UOM or</string>
  </label>
  <label>
   <rect>
    <x>45</x>
    <y>185</y>
    <width>106</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Item</string>
  </label>
  <field>
   <rect>
    <x>105</x>
    <y>100</y>
    <width>385</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>pohead_number</column>
   </data>
  </field>
  <label>
   <rect>
    <x>840</x>
    <y>185</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Ordered</string>
  </label>
  <label>
   <rect>
    <x>30</x>
    <y>100</y>
    <width>105</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>P/O #:</string>
  </label>
  <label>
   <rect>
    <x>180</x>
    <y>185</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Exp. Cat. Code</string>
  </label>
  <label>
   <rect>
    <x>325</x>
    <y>185</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Exp. Cat. Descrip.</string>
  </label>
 </rpthead>
 <pghead>
  <firstpage/>
  <height>8</height>
 </pghead>
 <pghead>
  <height>42</height>
  <label>
   <rect>
    <x>40</x>
    <y>22</y>
    <width>106</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Item</string>
  </label>
  <label>
   <rect>
    <x>0</x>
    <y>22</y>
    <width>35</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>#</string>
  </label>
  <label>
   <rect>
    <x>175</x>
    <y>22</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Exp. Cat. Code</string>
  </label>
  <label>
   <rect>
    <x>320</x>
    <y>22</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Exp. Cat. Descrip.</string>
  </label>
  <label>
   <rect>
    <x>525</x>
    <y>22</y>
    <width>106</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Vend. Item #</string>
  </label>
  <label>
   <rect>
    <x>725</x>
    <y>22</y>
    <width>50</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>835</x>
    <y>22</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Ordered</string>
  </label>
  <label>
   <rect>
    <x>935</x>
    <y>22</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Received</string>
  </label>
  <line>
   <xstart>5</xstart>
   <ystart>37</ystart>
   <xend>990</xend>
   <yend>37</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>175</x>
    <y>12</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>UOM or</string>
  </label>
  <label>
   <rect>
    <x>320</x>
    <y>12</y>
    <width>85</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Vendor UOM or</string>
  </label>
 </pghead>
 <section>
  <name>detail</name>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>18</height>
   <field>
    <rect>
     <x>45</x>
     <y>0</y>
     <width>150</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_item</column>
    </data>
   </field>
   <field>
    <rect>
     <x>805</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_ordered</column>
    </data>
   </field>
   <field>
    <rect>
     <x>900</x>
     <y>0</y>
     <width>90</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <right/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_received</column>
    </data>
   </field>
   <field>
    <rect>
     <x>180</x>
     <y>0</y>
     <width>145</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_uom1</column>
    </data>
   </field>
   <field>
    <rect>
     <x>5</x>
     <y>0</y>
     <width>35</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>f_number</column>
    </data>
   </field>
   <field>
    <rect>
     <x>730</x>
     <y>0</y>
     <width>55</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>
   <text>
    <rect>
     <x>525</x>
     <y>0</y>
     <width>195</width>
     <height>15</height>
    </rect>
    <bottompad>1</bottompad>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <top/>
    <data>
     <query>detail</query>
     <column>f_vend_item</column>
    </data>
   </text>
   <text>
    <rect>
     <x>325</x>
     <y>0</y>
     <width>190</width>
     <height>15</height>
    </rect>
    <bottompad>1</bottompad>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <top/>
    <data>
     <query>detail</query>
     <column>f_uom2</column>
    </data>
   </text>
  </detail>
 </section>
 <pgfoot>
  <height>32</height>
  <label>
   <rect>
    <x>860</x>
    <y>17</y>
    <width>75</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>945</x>
    <y>17</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>85</x>
    <y>17</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>10</x>
    <y>17</y>
    <width>75</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Report Date:</string>
  </label>
 </pgfoot>
</report>
