by ShumingWang » Sat Feb 18, 2006 4:06 am
FUNCTION eng0504(itemid1)
local oWnd1, oBar, oTree, oBmp1, oBmp2, odb1
private oImageList
DEFINE WINDOW oWnd1 FROM 3, 0 TO 30, 105 ;
TITLE "物料 "+ALLTRIM(itemid1) + " 树型BOM展开表"
oImageList = TImageList():New()
oBmp1 = TBitmap():Define( "folder",, oWnd )
oBmp2 = TBitmap():Define( "fldMask",, oWnd)
oImageList:Add( oBmp1, oBmp2 )
oTree = TTreeView():New( 3, 0, oWnd1)
oTree:bChanged = { || eng050401( oTree:GetSelected()) }
oTree:SetImageList( oImageList )
oItem = oTree:Add(itemid1)
odb1:=oServer:Query("select bom2.itemidc itemidc,goods2.descrip descrip,unit.unit unit,substring(bom2.mem,1,25) mem,bom2.qty/bom2.qtydevisor/(1-ifnull(bom2.scraprate,0)/100) qty,bom1.version version";
+" from bom1,bom2,goods2";
+" left outer join unit on unit.itemid=bom2.itemidc and unit.unitid=bom2.unitid";
+" where bom1.itemid='"+itemid1+"' and bom1.startdate<=curdate() and bom1.enddate>=curdate() and bom2.itemid='"+itemid1+"' and bom2.version=bom1.version and goods2.itemid=bom2.itemidc ")
while !odb1:EOF()
oItem:Add(odb1:itemidc+" "+odb1:descrip+" "+odb1:unit+" "+padl(cvaltochar(odb1:qty),nqtylen," ")+" V"+alltrim(odb1:version)+" "+odb1:mem)
odb1:SKIP()
enddo
oWnd1:oClient:=oTree
oTree:Expand()
SET MESSAGE OF oWnd1 TO "BOM树型展开表" FONT ofont14
ACTIVATE WINDOW oWnd1 VALID (oBmp1:End(),oBmp2:End(),.t.)
odb1:end()
oImageList:End()
oBmp1:End()
oBmp2:End()
return
FUNCTION eng050401(oItem)
local odb1
if LEN(oItem:aItems)=0
odb1:=oserver:Query("select bom2.itemidc itemidc,goods2.descrip descrip,unit.unit unit,substring(bom2.mem,1,25) mem,bom2.qty/bom2.qtydevisor/(1-ifnull(bom2.scraprate,0)/100) qty,bom1.version version ";
+" from bom1,bom2,goods2 ";
+" left outer join unit on unit.itemid=bom2.itemidc and unit.unitid=bom2.unitid";
+" where bom1.itemid='"+LEFT(oitem:cprompt,nitemidlen)+"' and bom1.startdate<=curdate() and bom1.enddate>=curdate() and bom2.itemid='"+LEFT(oitem:cprompt,nitemidlen)+"' and bom2.version=bom1.version and goods2.itemid=bom2.itemidc ")
while !odb1:EOF()
oItem:Add(odb1:itemidc+" "+odb1:descrip+" "+odb1:unit+" "+STR(odb1:qty*val(substr(oitem:cprompt,nitemidlen+len(odb1:descrip)+len(odb1:unit)+4,nqtylen)),nqtylen,nqtydec)+" V"+odb1:version+" "+odb1:mem)
odb1:SKIP()
enddo
oitem:expand()
odb1:end()
endif
return