<bottommargin>50</bottommargin>
<rightmargin>50</rightmargin>
<leftmargin>50</leftmargin>
- <querysource>
+ <querysource loadFromDb="true">
<name>detail</name>
- <sql>SELECT cohist_ordernumber AS sonumber,
- cohist_invcnumber AS invnumber,
- formatDate(cohist_orderdate) AS orddate,
- formatDate(cohist_invcdate, 'Return') AS invcdate,
- item_number, item_descrip1, item_descrip2,
- formatQty(cohist_qtyshipped) AS shipped,
- <? if exists("showPrices") ?>
- formatPrice(currtobase(cohist_curr_id,cohist_unitprice,cohist_invcdate)) AS unitprice,
- formatMoney(round(cohist_qtyshipped * currtobase(cohist_curr_id,cohist_unitprice,cohist_invcdate),2)) AS f_total,
- <? else ?>
- '' AS unitprice,
- '' AS f_total,
- <? endif ?>
- round(cohist_qtyshipped * currtobase(cohist_curr_id,cohist_unitprice,cohist_invcdate),2) AS total
- FROM cohist JOIN custinfo ON (cust_id=cohist_cust_id)
- JOIN salesrep ON (salesrep_id=cohist_salesrep_id)
-<? if exists("includeMisc") ?>
- LEFT OUTER JOIN itemsite ON (itemsite_id=cohist_itemsite_id)
- LEFT OUTER JOIN site() ON (warehous_id=itemsite_warehous_id)
- LEFT OUTER JOIN item ON (item_id=itemsite_item_id)
-<? else ?>
- JOIN itemsite ON (itemsite_id=cohist_itemsite_id)
- JOIN site() ON (warehous_id=itemsite_warehous_id)
- JOIN item ON (item_id=itemsite_item_id)
-<? endif ?>
-<? if exists("cohead_id") ?>
- JOIN cohead ON (cohead_number=cohist_ordernumber)
-<? endif ?>
-WHERE ( (true)
-<? if exists("includeMisc") ?>
- AND (COALESCE(cohist_misc_type, '') <> 'F')
- AND (COALESCE(cohist_misc_type, '') <> 'T')
-<? endif ?>
-<? if exists("startDate") ?>
- AND (cohist_invcdate >= <? value("startDate") ?>)
-<? endif ?>
-<? if exists("endDate") ?>
- AND (cohist_invcdate <= <? value("endDate") ?>)
-<? endif ?>
-<? if exists("shipStartDate") ?>
- AND (cohist_shipdate >= <? value("shipStartDate") ?>)
-<? endif ?>
-<? if exists("shipEndDate") ?>
- AND (cohist_shipdate <= <? value("shipEndDate") ?>)
-<? endif ?>
-<? if exists("salesrep_id") ?>
- AND (cohist_salesrep_id=<? value("salesrep_id") ?>)
-<? endif ?>
-<? if exists("shipto_id") ?>
- AND (cohist_shipto_id=<? value("shipto_id") ?>)
-<? endif ?>
-<? if exists("billToName") ?>
- AND (UPPER(cohist_billtoname) ~ UPPER(<? value("billToName") ?>))
-<? endif ?>
-<? if exists("cust_id") ?>
- AND (cohist_cust_id=<? value("cust_id") ?>)
-<? endif ?>
-<? if exists("custtype_id") ?>
- AND (cust_custtype_id=<? value("custtype_id") ?>)
-<? elseif exists("custtype_pattern") ?>
- AND (cust_custtype_id IN (SELECT DISTINCT custtype_id
- FROM custtype
- WHERE (custtype_code ~ <? value("custtype_pattern") ?>)))
-<? endif ?>
-<? if exists("by_custgrp" ?>
- AND (cust_id IN (SELECT DISTINCT custgrpitem_cust_id
- FROM custgrpitem))
-<? endif ?>
-<? if exists("custgrp_id") ?>
- AND (cust_id IN (SELECT DISTINCT custgrpitem_cust_id
- FROM custgrpitem
- WHERE (custgrpitem_custgrp_id=<? value("custgrp_id") ?>)))
-<? endif ?>
-<? if exists("custgrp_pattern") ?>
- AND (cust_id IN (SELECT DISTINCT custgrpitem_cust_id
- FROM custgrp, custgrpitem
- WHERE ( (custgrpitem_custgrp_id=custgrp_id)
- AND (custgrp_name ~ <? value("custgrp_pattern") ?>) )) )
-<? endif ?>
-
-<? if exists("item_id") ?>
- AND (itemsite_item_id=<? value("item_id") ?>)
-<? endif ?>
-<? if exists("prodcat_id") ?>
- AND (item_prodcat_id=<? value("prodcat_id") ?>)
-<? endif ?>
-<? if exists("prodcat_pattern") ?>
- AND (item_prodcat_id IN (SELECT DISTINCT prodcat_id
- FROM prodcat
- WHERE (prodcat_code ~ <? value("prodcat_pattern") ?>)))
-<? endif ?>
-
-<? if exists("warehous_id") ?>
- AND (itemsite_warehous_id=<? value("warehous_id") ?>)
-<? endif ?>
-<? if exists("shipzone_id") ?>
- AND (cohist_shipzone_id=<? value("shipzone_id") ?>)
-<? endif ?>
-<? if exists("saletype_id") ?>
- AND (cohist_saletype_id=<? value("saletype_id") ?>)
-<? endif ?>
-<? if exists("cohead_id") ?>
- AND (cohead_id=<? value("cohead_id") ?>)
-<? endif ?>
- )
-ORDER BY cohist_invcdate, item_number</sql>
+ <mqlgroup>salesHistory</mqlgroup>
+ <mqlname>detail</mqlname>
</querysource>
<querysource>
<name>head</name>
</pghead>
<section>
<name>detail</name>
+ <group>
+ <name>total</name>
+ <column></column>
+ <foot>
+ <height>39</height>
+ <field>
+ <rect>
+ <x>660</x>
+ <y>9</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>
+ <label>
+ <rect>
+ <x>570</x>
+ <y>9</y>
+ <width>80</width>
+ <height>15</height>
+ </rect>
+ <font>
+ <face>Arial</face>
+ <size>8</size>
+ <weight>normal</weight>
+ </font>
+ <right/>
+ <vcenter/>
+ <string>Total Sales:</string>
+ </label>
+ </foot>
+ </group>
<detail>
<key>
<query>detail</query>
<vcenter/>
<data>
<query>detail</query>
- <column>sonumber</column>
+ <column>cohist_ordernumber</column>
</data>
</field>
<field>
<vcenter/>
<data>
<query>detail</query>
- <column>unitprice</column>
+ <column>f_baseunitprice</column>
</data>
</field>
<field>
<vcenter/>
<data>
<query>detail</query>
- <column>orddate</column>
+ <column>f_orderdate</column>
</data>
</field>
<field>
<vcenter/>
<data>
<query>detail</query>
- <column>shipped</column>
+ <column>f_qtyshipped</column>
</data>
</field>
<line>
<vcenter/>
<data>
<query>detail</query>
- <column>invcdate</column>
+ <column>f_invcdate</column>
</data>
</field>
<field>
<vcenter/>
<data>
<query>detail</query>
- <column>item_number</column>
+ <column>itemnumber</column>
</data>
</field>
<field>
<vcenter/>
<data>
<query>detail</query>
- <column>f_total</column>
+ <column>f_baseextprice</column>
</data>
</field>
<field>
<vcenter/>
<data>
<query>detail</query>
- <column>invnumber</column>
+ <column>invoicenumber</column>
</data>
</field>
</detail>
</section>
- <section>
- <name>total</name>
- <detail>
- <key>
- <query>showPrices</query>
- </key>
- <height>16</height>
- <field>
- <rect>
- <x>665</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>total</column>
- </data>
- <format builtin="true">money</format>
- <tracktotal/>
- </field>
- <label>
- <rect>
- <x>575</x>
- <y>0</y>
- <width>80</width>
- <height>15</height>
- </rect>
- <font>
- <face>Arial</face>
- <size>8</size>
- <weight>normal</weight>
- </font>
- <right/>
- <vcenter/>
- <string>Total Sales:</string>
- </label>
- </detail>
- </section>
<pgfoot>
<height>16</height>
<label>