在Sbo中通过单据事务日志进行物料的期初、期末、出入库综合分析
_select @dt2=t1.docDate FROM OINM t1 WHERE t1.createDate=[%1]
_select @ItemCode=t2.ItemCode from OITM t2 where t2.ItemCode = '[%2]'
from (
_select ItemCode,sum(begqty) begqty,sum(begtotal) begtotal,sum(inqty)inqty,sum(intotal)intotal,sum(outqty) outqty,sum(outtotal) outtotal,sum(endqty) endqty,sum(endtotal) endtotal, sum(BuyQty) BuyQty, sum(BuyTotal) BuyTotal, sum(RetQty) RetQty, sum(RetTotal) RetTotal
FROM
(
_select a.ItemCode,sum(IsNull(IsNull(a.InQty,0),0)-IsNull(IsNull(a.OutQty,0),0)) begqty,sum(a.TransValue) begtotal,0 inqty,0 intotal,0 outqty,0 outtotal,0 endqty,0 endtotal, 0 BuyQty, 0 BuyTotal, 0 RetQty, 0 RetTotal
from oinm a
where (a.ItemCode=@ItemCode or IsNull(@ItemCode,'')='') and a.CreateDate < IsNull(@dt1, cast('2001-1-1' as smalldatetime))
group by a.ItemCode
union all
_select a.ItemCode,0,0,sum(IsNull(a.InQty,0)),sum(case when a.TransValue>=0 then a.TransValue else 0 end),sum(IsNull(a.OutQty,0)),sum(case when a.TransValue<0 then a.TransValue else 0 end),0,0,0,0,0,0
from oinm a
where (a.ItemCode=@ItemCode or IsNull(@ItemCode,'')='') and a.CreateDate between IsNull(@dt1, cast('2001-1-1' as smalldatetime)) and IsNull(@dt2,getdate()) And a.TransType not in ('20','21')
group by a.ItemCode
union all
_select a.ItemCode,0,0,0,0,0,0,sum(IsNull(IsNull(a.InQty,0),0)-IsNull(IsNull(a.OutQty,0),0)),sum(a.TransValue),0,0,0,0
from oinm a
where (a.ItemCode=@ItemCode or IsNull(@ItemCode,'')='') and a.CreateDate<=IsNull(@dt2,getdate())
group by a.ItemCode
union all
_select a.ItemCode,0,0,0,0,0,0,0,0,sum(IsNull(IsNull(a.InQty,0),0)-IsNull(IsNull(a.OutQty,0),0)),sum(a.TransValue),0,0
from oinm a
where (a.ItemCode=@ItemCode or IsNull(@ItemCode,'')='') and a.CreateDate between IsNull(@dt1, cast('2001-1-1' as smalldatetime)) and IsNull(@dt2,getdate()) and a.TransType='20'
group by a.ItemCode
union all
_select a.ItemCode,0,0,0,0,0,0,0,0,0,0,sum(IsNull(IsNull(a.InQty,0),0)-IsNull(IsNull(a.OutQty,0),0)),sum(a.TransValue)
from oinm a
where (a.ItemCode=@ItemCode or IsNull(@ItemCode,'')='') and a.CreateDate between IsNull(@dt1, cast('2001-1-1' as smalldatetime)) and IsNull(@dt2,getdate()) and a.TransType='21'
group by a.ItemCode
) tmp
group by ItemCode) ta
inner join oitm tb on ta.itemcode = tb.ItemCode
inner join oitb tc on tb.ItmsGrpCod = tc.ItmsGrpCod
group by tc.ItmsGrpNam, tc.ItmsGrpCod, ta.itemcode, tb.ItemName
在Sbo中通过单据事务日志进行物料的期初、期末、出入库综合分析相关推荐
- fn_dblog_如何使用fn_dblog和fn_dump_dblog直接在SQL Server数据库中连续读取事务日志文件数据
fn_dblog 大纲 (Outline) In this article, we'll discuss how to read SQL Server transaction logs. This a ...
- oracle数据库事务日志已满,SQL Server中已满事务日志原因的检测(上)
对于SQL Server数据库管理员来讲,已满事务日志是一个琐碎的,但又很常见的问题.它能引发事务的提前终止,甚至通过阻止所有事务的引入,从而引起系统的崩溃.对于数据库管理员来说,关键是理解将要发生的 ...
- SQL Server中已满事务日志原因的检测
对于SQL Server数据库管理员来讲,已满事务日志是一个琐碎的,但又很常见的问题.它能引发事务的提前终止,甚至通过阻止所有事务的引入,从而引起系统的崩溃.对于数据库管理员来说,关键是理解将要发生的 ...
- ib_logfile和mysql_bin_mysql的innodb中事务日志ib_logfile
mysql的innodb中事务日志ib_logfile 事务日志或称redo日志,在mysql中默认以ib_logfile0,ib_logfile1名称存在,可以手工修改参数,调节 开启几组日志来服务 ...
- 什么是SQL Server事务日志中的虚拟日志文件?
什么是SQL Server事务日志文件? (What is a SQL Server transaction log file?) SQL Server事务日志文件是每个SQL Server数据库的组 ...
- mysql ib_logfile 数量_Mysql 事务日志(Ib_logfile)
mysql的innodb中事务日志ib_logfile(0/1) 概念: 事务日志或称redo日志,在mysql中默认以ib_logfile0,ib_logfile1名称存在,可以手工修改参数,调节开 ...
- SQL Server移除事务日志后sys.master_files依然存在记录问题
在SQL Server中移除了事务日志文件后,使用sys.master_files检查时发现,对应的事务日志文件记录信息依然存在sys.master_files里面,只是状态state_desc为OF ...
- mysql备份时候事务日志_SQLSERVER备份事务日志的作用
SQLSERVER备份事务日志的作用 事务日志备份有以下3种类型 (1)纯日志备份:仅包含相隔一段时间的事务日志记录,而不包含任何大容量更改 (2)大容量操作日志备份.包括由大容量操作更改的日志和数据 ...
- MySQL日志:binlog、事务日志(redo、undo)
事务的隔离性是通过锁实现,而事务的原子性.一致性和持久性则是通过日志实现.Mysql的日志可以分为: binlog:server层实现 事务日志:包括redo log.undo log,引擎层(inn ...
- 有关SQL Server事务日志的十大文章
了解SQL Server中的日志记录和恢复 (Understanding Logging and Recovery in SQL Server) "Understanding Logging ...
最新文章
- 解决ngnix服务器上的Discuz!x2.5 Upload Error:413错误
- Python 中 pass的使用
- 泽西岛/贾克斯RS:流式JSON
- java lookandfeel nimbus_动态改变LookAndFeel
- c++ 确定百分比_【文献笔记】JIMF中国货币政策的不确定性
- (python)7-6 sdut-数制转换
- 微软源代码遭 SolarWinds 黑客访问
- JavaMail 发送邮件的实例
- 感谢第一个和第二个付费客户对我的信任
- 电商狂欢6月之代码也疯狂
- 并行编程--MPI开发入门
- 基于TQ2440的SPI驱动学习(OLED)
- Robot Framework Selenium UI自动化测试 --- 实战篇
- Dede文章标题及文章摘要长度修改_元曦血狼_新浪博客
- Python MySQLdb 模块使用方法
- 19-图片标签注意点
- 怎么把计算机里的文件放到桌面上,ipad怎么把文件放到桌面
- 【2022年第一期 CANN训练营学习笔记】进阶班应用开发课 大作业1-开发DVPP应用,输入,输出都是JPEG图片,且分辨率不同
- Google的招聘要求
- Mathematica和Wolfram语言面向数学的入门指南:三角函数
热门文章
- 记录一次解决后端接口设置cookie设置不上去经过,一级域名可以设置上去cookie,二级域名设置不上cookie
- 31个惊艳的数据可视化作品,感受“数据之美”!
- 如何用PPT做一张高大上的照片
- NameNode作用
- 单片机基础教程那么多,什么样才是靠谱的学习方式
- java mian是什么_java mian方法详解
- 小散量化炒股记|Python也能量化财务指标!教你用净资产收益率选股!
- Nested transactions are not supported TransactionScope 多线程事务
- 《Adobe Photoshop CS6中文版经典教程》目录—导读
- 两天两夜,1M图片优化到100kb