cust_number, cohist_cust_id AS cust_number_xtidrole, cust_name,
<? endif ?>
<? if exists("byCustomerType") ?>
- custtype_code, cust_custtype_id AS custtype_code_xtidrole,
+ custtype_code, custtype_id AS custtype_code_xtidrole,
<? endif ?>
<? if exists("byItem") ?>
item_number, item_id AS item_number_xtidrole, itemdescription,
<? endif ?>
<? if exists("bySalesRep") ?>
- salesrep_number, cohist_salesrep_id AS salesrep_number_xtidrole, salesrep_name,
+ salesrep_number, salesrep_id AS salesrep_number_xtidrole, salesrep_name,
<? endif ?>
<? if exists("byShippingZone") ?>
shipzone_name, shipzone_id AS shipzone_name_xtidrole,
<? endif ?>
<? if exists("bySite") ?>
- warehous_code, itemsite_warehous_id AS warehous_code_xtidrole,
+ warehous_code, warehous_id AS warehous_code_xtidrole,
<? endif ?>
<? if exists("byCurrency") ?>
currAbbr,
'curr' AS totalsales_xtnumericrole,
0 AS totalunits_xttotalrole,
0 AS totalsales_xttotalrole
-FROM saleshistory
-WHERE ((COALESCE(cohist_misc_type, '') <> 'F')
- AND (COALESCE(cohist_misc_type, '') <> 'T')
+FROM saleshistorymisc
+WHERE ( (TRUE)
<? if exists("startDate") ?>
AND (cohist_invcdate >= <? value("startDate") ?>)
<? endif ?>
<? endif ?>
<? if exists("warehous_id") ?>
- AND (itemsite_warehous_id=<? value("warehous_id") ?>)
+ AND (warehous_id=<? value("warehous_id") ?>)
<? endif ?>
<? if exists("item_id") ?>
- AND (itemsite_item_id=<? value("item_id") ?>)
+ AND (item_id=<? value("item_id") ?>)
<? endif ?>
<? if exists("cust_id") ?>
<? endif ?>
<? if exists("salesrep_id") ?>
- AND (cohist_salesrep_id=<? value("salesrep_id") ?>)
+ AND (salesrep_id=<? value("salesrep_id") ?>)
<? endif ?>
<? if exists("prodcat_id") ?>
- AND (item_prodcat_id=<? value("prodcat_id") ?>)
+ AND (prodcat_id=<? value("prodcat_id") ?>)
<? endif ?>
<? if exists("prodcat_pattern") ?>
<? endif ?>
<? if exists("custtype_id") ?>
- AND (cust_custtype_id=<? value("custtype_id") ?>)
+ AND (custtype_id=<? value("custtype_id") ?>)
<? endif ?>
<? if exists("custtype_pattern") ?>
)
GROUP BY dummy
<? if exists("bySalesRep") ?>
- , cohist_salesrep_id, salesrep_number, salesrep_name
+ , salesrep_id, salesrep_number, salesrep_name
<? endif ?>
<? if exists("byShippingZone") ?>
, shipzone_id, shipzone_name, shipzone_descrip
, cohist_cust_id, cust_number, cust_name
<? endif ?>
<? if exists("byCustomerType") ?>
- , cust_custtype_id, custtype_code, custtype_descrip
+ , custtype_id, custtype_code, custtype_descrip
<? endif ?>
<? if exists("byItem") ?>
, item_id, item_number, itemdescription
<? endif ?>
<? if exists("bySite") ?>
- , itemsite_warehous_id, warehous_code, warehous_descrip
+ , warehous_id, warehous_code, warehous_descrip
<? endif ?>
<? if exists("byCurrency") ?>
, cust_curr_id, currAbbr