U8呆滞库存带金额(取采购入库单中最大单价)
SELECT
'呆滞仓' AS Warehouse,
CurrentStock.cInvCode,
Inventory.cInvName,
Inventory.cInvAddCode,
Inventory.cInvStd,
ComputationUnit.cComUnitName,
Inventory.cAddress,
CurrentStock.cBatch,
CurrentStock.iQuantity,
rdrecords01.iUnitCost,
CAST(CurrentStock.iQuantity * rdrecords01.iUnitCost AS DECIMAL(18, 2)) AS iPrice
FROM
(
SELECT *
FROM [172.18.1.10].UFDATA_001_2018.dbo.CurrentStock
WHERE CurrentStock.iQuantity != 0
AND CurrentStock.cWhCode = '07'
) CurrentStock
JOIN [172.18.1.10].UFDATA_001_2018.dbo.Inventory
ON Inventory.cInvCode = CurrentStock.cInvCode
JOIN [172.18.1.10].UFDATA_001_2018.dbo.ComputationUnit
ON ComputationUnit.cComunitCode = Inventory.cComUnitCode
LEFT JOIN
(
SELECT cInvCode,
MAX(iUnitCost) AS iUnitCost
FROM [172.18.1.10].UFDATA_001_2018.dbo.RdRecord01
JOIN [172.18.1.10].UFDATA_001_2018.dbo.rdrecords01
ON rdrecords01.ID = RdRecord01.ID
GROUP BY cInvCode
) rdrecords01
ON CurrentStock.cInvCode = rdrecords01.cInvCode
UNION ALL
SELECT
'呆滞仓' AS Warehouse,
CurrentStock.cInvCode,
Inventory.cInvName,
Inventory.cInvAddCode,
Inventory.cInvStd,
ComputationUnit.cComUnitName,
Inventory.cAddress,
CurrentStock.cBatch,
CurrentStock.iQuantity,
rdrecords01.iUnitCost,
CAST(CurrentStock.iQuantity * rdrecords01.iUnitCost AS DECIMAL(18, 2)) AS iPrice
FROM
(
SELECT *
FROM UFDATA_002_2018.dbo.CurrentStock
WHERE CurrentStock.iQuantity != 0
AND CurrentStock.cWhCode = '07'
) CurrentStock
JOIN UFDATA_002_2018.dbo.Inventory
ON Inventory.cInvCode = CurrentStock.cInvCode
JOIN UFDATA_002_2018.dbo.ComputationUnit
ON ComputationUnit.cComunitCode = Inventory.cComUnitCode
LEFT JOIN
(
SELECT cInvCode,
MAX(iUnitCost) AS iUnitCost
FROM UFDATA_002_2018.dbo.RdRecord01
JOIN UFDATA_002_2018.dbo.rdrecords01
ON rdrecords01.ID = RdRecord01.ID
GROUP BY cInvCode
) rdrecords01
ON CurrentStock.cInvCode = rdrecords01.cInvCode
UNION ALL
SELECT
'呆滞仓' AS Warehouse,
CurrentStock.cInvCode,
Inventory.cInvName,
Inventory.cInvAddCode,
Inventory.cInvStd,
ComputationUnit.cComUnitName,
Inventory.cAddress,
CurrentStock.cBatch,
CurrentStock.iQuantity,
rdrecords01.iUnitCost,
CAST(CurrentStock.iQuantity * rdrecords01.iUnitCost AS DECIMAL(18, 2)) AS iPrice
FROM
(
SELECT *
FROM UFDATA_003_2018.dbo.CurrentStock
WHERE CurrentStock.iQuantity != 0
AND CurrentStock.cWhCode = '07'
) CurrentStock
JOIN UFDATA_003_2018.dbo.Inventory
ON Inventory.cInvCode = CurrentStock.cInvCode
JOIN UFDATA_003_2018.dbo.ComputationUnit
ON ComputationUnit.cComunitCode = Inventory.cComUnitCode
LEFT JOIN
(
SELECT cInvCode,
MAX(iUnitCost) AS iUnitCost
FROM UFDATA_003_2018.dbo.RdRecord01
JOIN UFDATA_003_2018.dbo.rdrecords01
ON rdrecords01.ID = RdRecord01.ID
GROUP BY cInvCode
) rdrecords01
ON CurrentStock.cInvCode = rdrecords01.cInvCode
U8呆滞库存带金额(取采购入库单中最大单价)相关推荐
- 【备品备件】入库流程--采购入库--0180363009
本地测试环境:admin admin123 备品备件的入库流程有五种流程,每种流程对应的查询条件都不一样. 类型 对应页面 查询条件 字段 采购入库 ProcurementWarehousing.vu ...
- U8采购入库单API接口示例(参照采购到货)
//第一步:构造u8login对象并登陆(引用U8API类库中的Interop.U8Login.dll) //如果当前环境中有login对象则可以省去第一步 U8Login.clsLogin u8Lo ...
- U8采购入库单的月入库量
USE [UFDATA_001_2018] GO /****** Object: StoredProcedure [dbo].[P_Quck_MonthOutRd01] Script Date: 20 ...
- 干货 | 呆滞库存(Slow moving)产生原因分析和预防措施
http://blog.itpub.net/29829936/viewspace-2643364/ 一 什么是呆滞库存? 指的是在企业生产活动过程中,周转速度较慢的库存,也被叫做Slow moving ...
- SAP呆滞库存的计算
SAP呆滞库存的计算 https://blog.csdn.net/zhongguomao/article/details/50807201 SAP呆滞库存的计算 一.什么物料是呆滞物料 呆滞就是 ...
- SAP 呆滞库存的计算
SAP 呆滞库存的计算 一.什么物料是呆滞物料 呆滞就是不流动,物料呆滞多久才是呆滞?可谓标准不同,说法各异,有的认为物料的最后异动日至盘查时,其时间间隔超过180天者,称为呆滞物料.有的说超过3个月 ...
- 金蝶云星空对接打通旺店通·企业版采购入库查询接口与创建采购入库单接口
接通系统:金蝶云星空 金蝶K/3Cloud(金蝶云星空)是移动互联网时代的新型ERP,是基于WEB2.0与云技术的新时代企业管理服务平台.金蝶K/3Cloud围绕着"生态.人人.体验&quo ...
- 利用先进先出原则统计易飞ERP呆滞库存
易飞ERP如果在没有启用批号的情况下,库龄是根据最后一次的出入库日期来计算了,这就会导致呆滞计算是不准确的.比如: 某个物料1000数量,3年没用了,为了消耗库存,突然最近某一天想领一个验证下好坏.这 ...
- 呆滞库存产生的原因是什么?该如何预防?
库存是什么?有人说,库存是危机:也有人说,库存是商机. 那么,究竟孰是孰非? 两种库存 其实,两种说法都没错,库存有两种. 一种叫安全库存,是为了缓冲需求.计划.生产和供应波动的主动式备库,目的是提 ...
最新文章
- 【jQuery】如何用jQuery实现鼠标移入后改变背景颜色
- iOS进阶之底层原理-weak实现原理
- 皮一皮:程序员为什么只能吃青春饭?
- ping无法访问目标主机 0丢失_预渗透之目标识别
- 机器学习笔记(了解)
- SDF(Signed-distance-field: 有向距离场)(12): Shadow And AO(WebGL实现)增强立体感
- cad2017怎么改变选择方式_诠网科技|企业网络推广方式要怎么选择?
- Android 多媒体开发学习之简单的音乐播放器
- c语言编程线性规划,C语言大作报告_线性规划求解_基科3字班
- Homebrew国内加速
- 浪曦 ASP.net AJAX系列 视频下载
- 用优启通制作U盘启动盘教程(UEFI版)
- mysql 日志文件_mysql日志文件在哪
- 【原创】PHP 邮件自动发送(QQ邮箱)
- eve-ng模拟器安装在部署使用
- 中国ai创业公司 排行榜_加入AI创业公司之前,您需要问6个问题
- 昆明理工大学c语言程序设计答案,昆明理工大学c语言程序设计课后习题答案
- 读 《成为技术领导者》 有感
- SQL四舍五入与截断 除余
- 软件开发中的著名定律