<!DOCTYPE openRPTDef>
<report>
 <title>Brief Sales History</title>
 <name>BriefSalesHistory</name>
 <description></description>
 <grid>
  <snap/>
  <show/>
  <x>0.05</x>
  <y>0.05</y>
 </grid>
 <size>Letter</size>
 <portrait/>
 <topmargin>50</topmargin>
 <bottommargin>50</bottommargin>
 <rightmargin>50</rightmargin>
 <leftmargin>50</leftmargin>
 <querysource>
  <name>head</name>
  <sql>SELECT &lt;? if exists("startDate") ?>
         formatDate(date(&lt;? value("startDate") ?>))
       &lt;? else ?>
         text('Earliest')
       &lt;? endif ?> AS startDate,
       &lt;? if exists("endDate") ?>
         formatDate(date(&lt;? value("endDate") ?>))
       &lt;? else ?>
         text('Latest')
       &lt;? endif ?> AS endDate,
       &lt;? if exists("showPrices") ?>
           text('Unit Price') AS lbl_unitprice,
           text('Total') AS lbl_total,
       &lt;? else ?>
           text('') AS lbl_unitprice,
           text('') AS lbl_total,
       &lt;? endif ?>
       &lt;? if exists("warehous_id") ?>
         (SELECT warehous_code FROM whsinfo WHERE warehous_id=&lt;? value("warehous_id") ?>)
       &lt;? else ?>
         text('All Sites')
       &lt;? endif ?>
       AS warehouse,
       &lt;? if exists("cust_id") ?>
         (SELECT cust_name FROM custinfo WHERE cust_id=&lt;? value("cust_id") ?>)
       &lt;? else ?>
         text('All Customers')
       &lt;? endif ?>
         AS cust_name,
       &lt;? if exists("custtype_id") ?>
         (SELECT custtype_code FROM custtype WHERE custtype_id=&lt;? value("custtype_id") ?>)
       &lt;? else ?>
         text('All Customer Types')
       &lt;? endif ?>
         AS custtype_code,
       &lt;? if exists("custtype_pattern") ?>
           text(&lt;? value("custtype_pattern") ?>)
       &lt;? else ?>
           text('Not Applicable')
       &lt;? endif ?>
         AS custtype_pattern,
       &lt;? if exists("custgrp_id") ?>
         (SELECT custgrp_name FROM custgrp WHERE custgrp_id=&lt;? value("custgrp_id") ?>)
       &lt;? else ?>
         text('All Customer Groups')
       &lt;? endif ?>
         AS custgrp_name,
       &lt;? if exists("custgrp_pattern") ?>
           text(&lt;? value("custgrp_pattern") ?>)
       &lt;? else ?>
           text('Not Applicable')
       &lt;? endif ?>
         AS custgrp_pattern,
      &lt;? if exists("prodcat_id") ?>
         (SELECT prodcat_code FROM prodcat WHERE prodcat_id=&lt;? value("prodcat_id") ?>)
       &lt;? else ?>
         text('All Product Categories')
       &lt;? endif ?>
         AS prodcat_code,
       &lt;? if exists("prodcat_pattern") ?>
           text(&lt;? value("prodcat_pattern") ?>)
       &lt;? else ?>
           text('Not Applicable')
       &lt;? endif ?>
         AS prodcat_pattern,
       &lt;? if exists("item_id") ?>
         (SELECT item_number FROM item WHERE item_id=&lt;? value("item_id") ?>)
       &lt;? else ?>
         text('All Item Numbers')
       &lt;? endif ?>
         AS item_number,
       &lt;? if exists("cohead_id") ?>
         (SELECT cohead_number FROM cohead WHERE cohead_id=&lt;? value("cohead_id") ?>)
       &lt;? else ?>
         text('All Orders')
       &lt;? endif ?>
         AS docnumber; </sql>
 </querysource>
 <querysource loadFromDb="true">
  <name>detail</name>
  <mqlgroup>briefSalesHistory</mqlgroup>
  <mqlname>detail</mqlname>
 </querysource>
 <rpthead>
  <height>221</height>
  <label>
   <rect>
    <x>5</x>
    <y>198</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. #</string>
  </label>
  <label>
   <rect>
    <x>305</x>
    <y>198</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Invc. Date</string>
  </label>
  <label>
   <rect>
    <x>110</x>
    <y>198</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Invoice #</string>
  </label>
  <label>
   <rect>
    <x>345</x>
    <y>5</y>
    <width>400</width>
    <height>40</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>18</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Brief Sales History</string>
  </label>
  <label>
   <rect>
    <x>385</x>
    <y>198</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Total Price</string>
  </label>
  <label>
   <rect>
    <x>220</x>
    <y>198</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Ord. Date</string>
  </label>
  <line>
   <xstart>0</xstart>
   <ystart>218</ystart>
   <xend>745</xend>
   <yend>218</yend>
   <weight>2</weight>
  </line>
  <text>
   <rect>
    <x>10</x>
    <y>38</y>
    <width>725</width>
    <height>15</height>
   </rect>
   <bottompad>12</bottompad>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <top/>
   <data>
    <query>Parameter Query</query>
    <column>filter</column>
   </data>
  </text>
  <label>
   <rect>
    <x>5</x>
    <y>183</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Cust. #</string>
  </label>
  <label>
   <rect>
    <x>110</x>
    <y>183</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Cust. Type</string>
  </label>
  <label>
   <rect>
    <x>240</x>
    <y>183</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Cust. Name</string>
  </label>
  <label>
   <rect>
    <x>475</x>
    <y>198</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Total Cost</string>
  </label>
  <label>
   <rect>
    <x>565</x>
    <y>198</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Margin</string>
  </label>
  <label>
   <rect>
    <x>655</x>
    <y>198</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Margin %</string>
  </label>
 </rpthead>
 <pghead>
  <firstpage/>
  <height>6</height>
 </pghead>
 <pghead>
  <height>21</height>
  <label>
   <rect>
    <x>665</x>
    <y>0</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Total</string>
  </label>
  <label>
   <rect>
    <x>270</x>
    <y>0</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Ord. Date</string>
  </label>
  <label>
   <rect>
    <x>110</x>
    <y>0</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Invoice #</string>
  </label>
  <line>
   <xstart>5</xstart>
   <ystart>15</ystart>
   <xend>745</xend>
   <yend>15</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>355</x>
    <y>0</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Ship Date</string>
  </label>
  <label>
   <rect>
    <x>5</x>
    <y>0</y>
    <width>100</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Doc. #</string>
  </label>
 </pghead>
 <section>
  <name>detail</name>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>37</height>
   <field>
    <rect>
     <x>5</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>detail</query>
     <column>cohist_ordernumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>110</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>detail</query>
     <column>invoicenumber</column>
    </data>
   </field>
   <field>
    <rect>
     <x>565</x>
     <y>17</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_margin</column>
    </data>
   </field>
   <field>
    <rect>
     <x>305</x>
     <y>17</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_invcdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>220</x>
     <y>17</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_orderdate</column>
    </data>
   </field>
   <field>
    <rect>
     <x>5</x>
     <y>2</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_number</column>
    </data>
   </field>
   <field>
    <rect>
     <x>110</x>
     <y>2</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>custtype_code</column>
    </data>
   </field>
   <field>
    <rect>
     <x>225</x>
     <y>2</y>
     <width>320</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>
   <field>
    <rect>
     <x>390</x>
     <y>17</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_baseextprice</column>
    </data>
   </field>
   <field>
    <rect>
     <x>475</x>
     <y>17</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_extcost</column>
    </data>
   </field>
   <field>
    <rect>
     <x>655</x>
     <y>17</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_marginpercent</column>
    </data>
   </field>
  </detail>
 </section>
 <pgfoot>
  <height>16</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>
  <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>103</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>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>
 </pgfoot>
 <rptfoot>
  <height>21</height>
  <label>
   <rect>
    <x>285</x>
    <y>5</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>
  <field>
   <rect>
    <x>390</x>
    <y>5</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>baseextprice</column>
   </data>
   <format builtin="true">money</format>
   <tracktotal/>
  </field>
  <field>
   <rect>
    <x>475</x>
    <y>5</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>extcost</column>
   </data>
   <format builtin="true">money</format>
   <tracktotal/>
  </field>
  <field>
   <rect>
    <x>565</x>
    <y>5</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>margin</column>
   </data>
   <format builtin="true">money</format>
   <tracktotal/>
  </field>
 </rptfoot>
</report>
