<!DOCTYPE openRPTDef>
<report>
 <title>Slow Moving Inventory By Class Code</title>
 <name>SlowMovingInventoryByClassCode</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 &lt;? if exists(&quot;warehous_id&quot;) ?>
         (SELECT warehous_code
            FROM whsinfo
           WHERE (warehous_id=&lt;? value(&quot;warehous_id&quot;) ?>) )
       &lt;? else ?>
         text('All Sites')
       &lt;? endif ?>
       AS warehouse,
       &lt;? if exists(&quot;classcode_id&quot;) ?>
         (SELECT (classcode_code || '-' || classcode_descrip)
            FROM classcode
           WHERE (classcode_id=&lt;? value(&quot;classcode_id&quot;) ?>) )
       &lt;? elseif exists(&quot;classcode_pattern&quot;) ?>
         text(&lt;? value(&quot;classcode_pattern&quot;) ?>)
       &lt;? else ?>
         text('All Class Codes')
       &lt;? endif ?>
       AS classcode,
       &lt;? if exists(&quot;showValue&quot;) ?>
           &lt;? if exists(&quot;useActualCosts&quot;) ?>
             text('Show Inventory Value with Actual Costs')
           &lt;? else ?>
             text('Show Inventory Value with Standard Costs')
           &lt;? endif ?>
           AS showvalues,
           text('Unit Cost') AS f_unitcost,
           text('Value') AS f_value,
       &lt;? else ?>
           text('') AS showvalues,
           text('') AS f_unitcost,
           text('') AS f_value,
       &lt;? endif ?>
       formatDate(&lt;? value(&quot;cutoffDate&quot;) ?>) AS f_cutoff;</sql>
 </querysource>
 <querysource>
  <name>detail</name>
  <sql>SELECT warehous_code,
       item_number,
       item_descrip1,
       item_descrip2,
       uom_name,
       formatQty(itemsite_qtyonhand) AS f_qoh,
       formatDate(itemsite_datelastused) AS f_datelastused,
       &lt;? if exists(&quot;showValue&quot;) ?>
         formatCost(cost)
       &lt;? else ?>
         text('')
       &lt;? endif ?>
       AS f_unitcost,
       noNeg(cost * itemsite_qtyonhand) AS value,
       &lt;? if exists(&quot;showValue&quot;) ?>
         formatExtPrice(noNeg(cost * itemsite_qtyonhand))
       &lt;? else ?>
         text('')
       &lt;? endif ?>
       AS f_value
  FROM ( SELECT itemsite_id,
                warehous_code,
                item_number,
                item_descrip1,
                item_descrip2, uom_name,
                itemsite_qtyonhand,
                itemsite_datelastused,
                &lt;? if exists(&quot;useActualCosts&quot;) ?>
                  actcost(itemsite_item_id)
                &lt;? else ?>
                  stdcost(itemsite_item_id)
                &lt;? endif ?>
                AS cost
           FROM itemsite, item, whsinfo, uom
          WHERE ((itemsite_item_id=item_id)
            AND (item_inv_uom_id=uom_id)
            AND (itemsite_warehous_id=warehous_id)
            AND (itemsite_active)
            AND (itemsite_datelastused &lt; &lt;? value(&quot;cutoffDate&quot;) ?>)
&lt;? if exists(&quot;warehous_id&quot;) ?>
            AND (itemsite_warehous_id=&lt;? value(&quot;warehous_id&quot;) ?>)
&lt;? endif ?>
&lt;? if exists(&quot;classcode_id&quot;) ?>
            AND (item_classcode_id=&lt;? value(&quot;classcode_id&quot;) ?>)
&lt;? elseif exists(&quot;classcode_pattern&quot;) ?>
            AND (item_classcode_id IN (SELECT classcode_id
                                         FROM classcode
                                        WHERE classcode_code ~ &lt;? value(&quot;classcode_pattern&quot;) ?>) )
&lt;? endif ?>
                )
       ) AS data
ORDER BY warehous_code,
&lt;? if exists(&quot;orderByInventoryValue&quot;) ?>
  value DESC
&lt;? elseif exists(&quot;orderByDateLastUsed&quot;) ?>
  itemsite_datelastused
&lt;? else ?>
  item_number
&lt;? endif ?></sql>
 </querysource>
 <rpthead>
  <height>236</height>
  <field>
   <rect>
    <x>575</x>
    <y>200</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>f_unitcost</column>
   </data>
  </field>
  <field>
   <rect>
    <x>130</x>
    <y>140</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>warehouse</column>
   </data>
  </field>
  <line>
   <xstart>5</xstart>
   <ystart>229</ystart>
   <xend>745</xend>
   <yend>229</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>490</x>
    <y>200</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>QOH</string>
  </label>
  <label>
   <rect>
    <x>229</x>
    <y>10</y>
    <width>495</width>
    <height>38</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>18</size>
    <weight>bold</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Slow Moving Inventory By Class Code</string>
  </label>
  <label>
   <rect>
    <x>375</x>
    <y>200</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Last Movement</string>
  </label>
  <label>
   <rect>
    <x>105</x>
    <y>215</y>
    <width>229</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Item Description</string>
  </label>
  <label>
   <rect>
    <x>105</x>
    <y>200</y>
    <width>150</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Item Number</string>
  </label>
  <label>
   <rect>
    <x>25</x>
    <y>200</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Site</string>
  </label>
  <field>
   <rect>
    <x>440</x>
    <y>140</y>
    <width>300</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>showvalues</column>
   </data>
  </field>
  <label>
   <rect>
    <x>265</x>
    <y>200</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>UOM</string>
  </label>
  <label>
   <rect>
    <x>45</x>
    <y>140</y>
    <width>80</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Site:</string>
  </label>
  <field>
   <rect>
    <x>660</x>
    <y>200</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>f_value</column>
   </data>
  </field>
  <label>
   <rect>
    <x>434</x>
    <y>120</y>
    <width>100</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Cutoff Date:</string>
  </label>
  <label>
   <rect>
    <x>15</x>
    <y>120</y>
    <width>110</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <string>Class Code(s):</string>
  </label>
  <field>
   <rect>
    <x>130</x>
    <y>120</y>
    <width>300</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>classcode</column>
   </data>
  </field>
  <field>
   <rect>
    <x>540</x>
    <y>120</y>
    <width>195</width>
    <height>20</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>10</size>
    <weight>bold</weight>
   </font>
   <left/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>f_cutoff</column>
   </data>
  </field>
 </rpthead>
 <pghead>
  <firstpage/>
  <height>6</height>
 </pghead>
 <pghead>
  <height>41</height>
  <label>
   <rect>
    <x>490</x>
    <y>5</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>QOH</string>
  </label>
  <line>
   <xstart>5</xstart>
   <ystart>35</ystart>
   <xend>745</xend>
   <yend>34</yend>
   <weight>2</weight>
  </line>
  <label>
   <rect>
    <x>265</x>
    <y>5</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>UOM</string>
  </label>
  <label>
   <rect>
    <x>25</x>
    <y>5</y>
    <width>50</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Site</string>
  </label>
  <label>
   <rect>
    <x>105</x>
    <y>5</y>
    <width>150</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Item Number</string>
  </label>
  <field>
   <rect>
    <x>660</x>
    <y>5</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>f_value</column>
   </data>
  </field>
  <label>
   <rect>
    <x>375</x>
    <y>5</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <hcenter/>
   <vcenter/>
   <string>Last Movement</string>
  </label>
  <field>
   <rect>
    <x>575</x>
    <y>5</y>
    <width>80</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <right/>
   <vcenter/>
   <data>
    <query>head</query>
    <column>f_unitcost</column>
   </data>
  </field>
  <label>
   <rect>
    <x>105</x>
    <y>20</y>
    <width>229</width>
    <height>15</height>
   </rect>
   <font>
    <face>Arial</face>
    <size>8</size>
    <weight>normal</weight>
   </font>
   <left/>
   <vcenter/>
   <string>Item Description</string>
  </label>
 </pghead>
 <section>
  <name>detail</name>
  <detail>
   <key>
    <query>detail</query>
   </key>
   <height>51</height>
   <field>
    <rect>
     <x>380</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_datelastused</column>
    </data>
   </field>
   <field>
    <rect>
     <x>105</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>item_number</column>
    </data>
   </field>
   <field>
    <rect>
     <x>660</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_value</column>
    </data>
   </field>
   <field>
    <rect>
     <x>105</x>
     <y>15</y>
     <width>300</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>item_descrip1</column>
    </data>
   </field>
   <field>
    <rect>
     <x>25</x>
     <y>0</y>
     <width>50</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <hcenter/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>warehous_code</column>
    </data>
   </field>
   <field>
    <rect>
     <x>490</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_qoh</column>
    </data>
   </field>
   <line>
    <xstart>5</xstart>
    <ystart>45</ystart>
    <xend>745</xend>
    <yend>45</yend>
    <weight>0</weight>
   </line>
   <field>
    <rect>
     <x>105</x>
     <y>30</y>
     <width>300</width>
     <height>15</height>
    </rect>
    <font>
     <face>Arial</face>
     <size>8</size>
     <weight>bold</weight>
    </font>
    <left/>
    <vcenter/>
    <data>
     <query>detail</query>
     <column>item_descrip2</column>
    </data>
   </field>
   <field>
    <rect>
     <x>265</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>uom_name</column>
    </data>
   </field>
   <field>
    <rect>
     <x>575</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_unitcost</column>
    </data>
   </field>
  </detail>
 </section>
 <pgfoot>
  <height>16</height>
  <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>
  <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>90</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>0</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>
 </pgfoot>
 <rptfoot>
  <height>16</height>
 </rptfoot>
</report>
