Infor LN (BaaN ERP)论坛

 找回密码
 加入Baan会员

QQ登录

只需一步,快速开始

QQ群一:61560730(已满)QQ群二:34342363
查看: 3913|回复: 7

query+report达到user的需求

[复制链接]
发表于 2009-2-17 12:58:37 | 显示全部楼层 |阅读模式
前几天应USER需求,要查看某一物料当前库存多少,库存在哪个仓库,两周之内对此物料的需求是多少。

写了一query,然后在报表中加如下列内容,达到要求。

select
whwmd215.item          | Item
from
whwmd215               | Item Inventory by Warehouse
where
whwmd215.item >= whwmd215.item.f and
whwmd215.item <= whwmd215.item.t
group by whwmd215.item
order by whwmd215.item

报表中的descript:

declaration:

table twhwmd215
table tgdrmp001
table ttcibd001


     extern domain tcqiv1  wip_162030
     extern domain tcqiv1  wip_162035

     extern domain tcqiv1  nor_162012
     extern domain tcqiv1  nor_162013
     extern domain tcqiv1  nor_162020
     extern domain tcqiv1  nor_162025
     extern domain cpcom.quan  pdemg_1
     extern domain cpcom.quan  pdemg_2

domain cpcom.dydt  pdate.g
domain tcmcs.long  count


before.program:
pdate.g = date.num()

detail.1:
before.layout:


| message (Str$(pdate.g))

select  whwmd215.stoc, whwmd215.cwar, whwmd215.item
from  whwmd215
where  whwmd215._index2 = {:whwmd215.item}
order by  whwmd215._index2
selectdo

  if strip$(whwmd215.cwar)  = "162030" then
   wip_162030 = 0
   wip_162030 = whwmd215.stoc
  endif

  if strip$(whwmd215.cwar)  = "162035" then
   wip_162035 = 0
   wip_162035 = whwmd215.stoc
  endif

  if strip$(whwmd215.cwar)  = "162012" then
   nor_162012 = 0
   nor_162012 = whwmd215.stoc
  endif

  if strip$(whwmd215.cwar)  = "162013" then
   nor_162013 = 0
   nor_162013 = whwmd215.stoc
  endif

  if strip$(whwmd215.cwar)  = "162020" then
   nor_162020 = 0
   nor_162020 = whwmd215.stoc
  endif

  if strip$(whwmd215.cwar)  = "162025" then
   nor_162025 = 0
   nor_162025 = whwmd215.stoc
  endif
  
endselect

count =0
select gdrmp001.pdem.g, gdrmp001._index1
from gdrmp001
where gdrmp001._index3 = {"162", 1}
and (gdrmp001.plni.g = :whwmd215.item or
   gdrmp001.sitm.g = :whwmd215.item )
and (gdrmp001.pdat.g >= :pdate.g or
   gdrmp001.pdat.g <= :pdate.g)
order by gdrmp001._index1
as set with 2 rows
selectdo
  count = count + 1
  if count = 1 then
   pdemg_1 = 0
   pdemg_1 = gdrmp001.pdem.g
  endif
  if count = 2 then
   pdemg_2 = 0
   pdemg_2 = gdrmp001.pdem.g
  endif

endselect


select  tcibd001.dsca
from tcibd001
where tcibd001._index1 = {:whwmd215.item}
selectdo
selectempty
  tcibd001.dsca = ""
endselect
发表于 2009-4-23 14:20:48 | 显示全部楼层
query+report达到user的需求,全是钱
发表于 2009-5-14 10:59:59 | 显示全部楼层
怎么全是Money
发表于 2009-6-22 14:03:47 | 显示全部楼层
掉到钱眼里,呵呵
发表于 2009-7-6 13:45:16 | 显示全部楼层
哈哈, LN 的 FIELDS 名与 IV的基本不同啦
 楼主| 发表于 2009-7-6 14:44:12 | 显示全部楼层

就是钱!!!
发表于 2010-2-5 14:27:59 | 显示全部楼层
very good
tks for sharing
发表于 2010-3-13 19:24:04 | 显示全部楼层
tks for sharing
您需要登录后才可以回帖 登录 | 加入Baan会员

本版积分规则

QQ|Archiver|手机版|小黑屋|Infor LN Baan论坛 沪ICP备20006045号-3

GMT+8, 2024-5-2 14:45 , Processed in 0.143150 second(s), 17 queries .

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表