一个获取Sales Order中Item价格的Query
2010-12-06 11:16
288 查看
一个获取Sales Order中Item价格的Query:
DECLARE @Price Numeric(19,6)
DECLARE @Dis Numeric(19,6)
DECLARE @DisPrice Numeric(19,6)
Set @Price = 0.0
Set @Dis = 0.0
Set @DisPrice = 0.0
SELECT top 1 @Price = price from [@PRICELIST] t1
where t1.itemcode = $[rdr1.itemcode] and substring(convert(char(4),convert(tinyint,t1.tradeterm)+1000),2,3) = $[ordr.U_tradecode] and t1.cardcode = $[ordr.CardCode] and
$[ordr.doccur] = t1.currency and
((t1.type = 'CO' and
$[ORDR.TaxDate] >= t1.effectivefrom and $[ORDR.TaxDate] <= isnull(t1.effectiveto,'29991231')) or
(t1.type = 'EX-FTY' and $[RDR1.ShipDate] >= t1.effectivefrom and $[RDR1.ShipDate] <= isnull(t1.effectiveto,'29991231'))) order by t1.sn desc
SELECT @Dis = isnull(discountrate,0) from [@discount] t0
inner join oitm on t0.itemcode = oitm.itemcode
where oitm.itemcode = $[rdr1.itemcode] and t0.cardcode = $[ORDR.CardCode] and
$[rdr1.U_ITEMTQ.Number] >= t0.qtyfrom
and $[rdr1.U_ITEMTQ.Number] <= IsNull(t0.qtyto,99999999)
SELECT Cast(Cast((100 - @Dis)/100 *@Price as decimal(12,6)) as char(13))
DECLARE @Price Numeric(19,6)
DECLARE @Dis Numeric(19,6)
DECLARE @DisPrice Numeric(19,6)
Set @Price = 0.0
Set @Dis = 0.0
Set @DisPrice = 0.0
SELECT top 1 @Price = price from [@PRICELIST] t1
where t1.itemcode = $[rdr1.itemcode] and substring(convert(char(4),convert(tinyint,t1.tradeterm)+1000),2,3) = $[ordr.U_tradecode] and t1.cardcode = $[ordr.CardCode] and
$[ordr.doccur] = t1.currency and
((t1.type = 'CO' and
$[ORDR.TaxDate] >= t1.effectivefrom and $[ORDR.TaxDate] <= isnull(t1.effectiveto,'29991231')) or
(t1.type = 'EX-FTY' and $[RDR1.ShipDate] >= t1.effectivefrom and $[RDR1.ShipDate] <= isnull(t1.effectiveto,'29991231'))) order by t1.sn desc
SELECT @Dis = isnull(discountrate,0) from [@discount] t0
inner join oitm on t0.itemcode = oitm.itemcode
where oitm.itemcode = $[rdr1.itemcode] and t0.cardcode = $[ORDR.CardCode] and
$[rdr1.U_ITEMTQ.Number] >= t0.qtyfrom
and $[rdr1.U_ITEMTQ.Number] <= IsNull(t0.qtyto,99999999)
SELECT Cast(Cast((100 - @Dis)/100 *@Price as decimal(12,6)) as char(13))
相关文章推荐
- 一个 C# 获取高精度时间类(调用API QueryP*)
- Magento: Item (Mage_Sales_Model_Order) with the same id “1” already exist
- ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效ORA-06512: 在 "STG.SAP_SALES_ORDER", line 41
- javascript实现获取一个日期段内每天不同的价格(计算入住总价格)
- 在gridView中选择的item和获取焦点的item不是同一个的现象
- Magento使用phpexcel导出 商品订单 /订单条目表sales_flat_order_item
- netsuite数据类型的获取(以货品item举例)以及价格带的js获取
- 用MD_SALES_ORDER_STATUS_REPORT函数从MD04事务码获取订单报表数据
- 一个检查在同一个供货商同一个ITEM中有多个Business Partner Catalog Numbers的Query
- Internal Sales Order: serial controlled item at SO issue
- Android实现一个选择器-recycleview滚动中第一个item位置的获取
- 一个简单的时间获取客户端程序
- 有关使用 GPS Intermediate Driver 无法获取到GPS数据的一个问题
- android获取当前系统时间,同时比较当前时间是否在一个时间段范围内
- python从零写一个采集器:获取网页源码
- 《java入门第一季》之Math类一个小案例获取任意数值范围内随机数
- 获取listview的所有子目录高度(使用item较少情况)
- Android ListView的Item中含有EditText,获取EditText里面的值并且刷新ListView值不改变
- iOS下如何获取一个类的所有子类