by ShumingWang » Thu Apr 18, 2013 5:38 am
obrow := TXBrowse():New( odlg )
obrow:SetMySQL(@odb2)
obrow:bKeyDown := {|nKey|sto0120(nkey,odlg,otabs),if(ledit,if(nKey==VK_DELETE .and. LEN(ALLTRIM(odb1:stockid))>0, (if(msgyesno("删除这行吗?","请选择"),(sto0103(odb2:qty,0),odb2:DELETE(),obrow:Refresh()),)),if(nKey==VK_INSERT .and. LEN(ALLTRIM(odb1:stockid))>0,(obrow:gobottom(),obrow:godown()),)),) }
oCol := obrow1:AddCol()
oCol:cHeader := "dblclick"
oCol:AddResource("checkoff")
oCol:bBmpData := { ||1}
ocol:nwidth:=40
oCol := obrow:AddCol()
oCol:bStrData := { ||odb2:itemid}
oCol:cHeader := "物料编码"
ocol:beditvalue:={||odb2:itemid}
oCol:nedittype:= {||if(ledit .and. LEN(ALLTRIM(odb1:stockid))>0.and.odb2:qty==0,EDIT_GET_BUTTON,0)}
oCol:bEditBlock:={||goods2brw(odb2:itemid,,,odb2)}
oCol:cEditPicture:="@!"
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:itemid,;
(if(!odb2:EOF(),;
(v:=goods2brw(v,.t.,@unitid2,odb2),odb2:unitpri:=sto0109(odb1:DATE,v,odb1:vendorid),odb2:itemid:=v,odb2:unitid:=unitid2,odb2:SAVE()),;
(v:=goods2brw(v,.t.,@unitid2,odb2),odb2:unitpri:=sto0109(odb1:DATE,v,odb1:vendorid),odb2:itemid:=v,odb2:invono:=invono1,odb2:unitid:=unitid2,odb2:APPEND());
);
), ;
) }
oCol := obrow:AddCol()
oCol:bStrData := { ||oServer:QueryData("select descrip from goods2 where itemid='"+odb2:itemid+"'")}
oCol:cHeader := "名称规格"
if llots
oCol := obrow:AddCol()
oCol:bStrData := {||odb2:lotsid}
oCol:cHeader := clots
oCol:bEditBlock:={||lotsstockqtybrw(odb2:itemid,odb1:stockid)}
oCol:nEditType := {||if(ledit.and.!odb2:EOF().and.odb2:qty==0,EDIT_GET_BUTTON,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:lotsid,(sto0510(odb2:lotsid,v),odb2:lotsid:=v,odb2:save()) , ) }
end
oCol := obrow:AddCol()
oCol:bStrData := { ||odb2:unitid}
oCol:cHeader := "单位码"
ocol:beditvalue:={||odb2:unitid}
ocol:nedittype:= {||if(ledit.and.!odb2:EOF().and.odb2:qty==0,EDIT_GET_BUTTON,0)}
oCol:bEditBlock := {||unitbrw(odb2:itemid,odb2:unitid)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:unitid,(v:=unitbrw(odb2:itemid,v,.t.),odb2:unitid:=v,odb2:SAVE()) , ) }
oCol := obrow:AddCol()
oCol:bStrData := { ||oServer:QueryData("select unit from unit where itemid='"+odb2:itemid+"' and unitid='"+odb2:unitid+"'")}
oCol:cHeader := "单位"
oCol := obrow:AddCol()
oCol:bStrData := { ||odb2:pono}
oCol:cHeader := "采购单号"
ocol:beditvalue:={||odb2:pono}
ocol:nedittype:= {||if(ledit .and. !odb2:EOF(),EDIT_GET_BUTTON,0)}
oCol:bEditBlock := {||sto0123(odb2:itemid,odb1:vendorid,odb2:mid)}
oCol:cEditPicture:="@!"
oCol:bOnPostEdit := {|o, v, n| if(n != VK_ESCAPE .and. v != odb2:pono,sto0108(v),) }
oCol := obrow:AddCol()
oCol:bStrData := { ||odb2:ordno}
oCol:cHeader := "生产单号"
ocol:beditvalue:={||odb2:ordno}
ocol:nedittype:= {||if(ledit .and. !odb2:EOF(),1,0)}
oCol:cEditPicture:="@!"
oCol:bOnPostEdit := {|o, v, n| if(n != VK_ESCAPE .and. v != odb2:ordno,(odb2:ordno:=v,odb2:save()),) }
oCol := obrow:AddCol()
oCol:bStrData := { ||odb2:qty}
oCol:cHeader := "Qty"
ocol:beditvalue:={||odb2:qty}
ocol:nedittype:={||if(ledit.and.!odb2:EOF(),1,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:qty,sto0103(odb2:qty,v),)}
oCol:nDataStrAlign := AL_RIGHT
oCol:cFooter :=" "
oCol:nFootStrAlign:= AL_RIGHT
oCol:nWidth := 65
oCol := obrow:AddCol()
oCol:bStrData := {||odb2:COLOR}
oCol:cHeader := ALLTRIM(::array1[4])
ocol:nwidth:=150
oCol := obrow:AddCol()
oCol:bStrData := { ||if(odb2:ldamage,"Y","")}
oCol:cHeader := "报废Y/N"
oCol:bEditValue := {||odb2:ldamage}
oCol:nEditType := {||if(::ledit .and. !odb2:EOF(),1,0)}
oCol:ceditpicture := "Y"
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:ldamage,(oserver:query("update subptin2 set ldamage="+if(v,"1","0")+if(v,",lback=0,unitpri=0","")+" where mid="+cvaltochar(odb2:mid)),odb2:refresh()) , ) }
ocol:setcheck()
oCol := obrow:AddCol()
oCol:bStrData := { ||odb2:lfinish}
oCol:cHeader := "结案"
oCol:nEditType := {||if(::ledit .and. !odb2:EOF().and.::aright2[6]=="Y",4,0)}
ocol:aEditListTxt:={" ","Y"}
ocol:aEditListBound:={" ","Y"}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:lfinish,(oserver:query("update subptou2 set lfinish='"+V+"' where mid="+cvaltochar(odb2:ID)),odb2:refresh()) , ) }
oCol:nWidth :=30
oCol := obrow:AddCol()
oCol:bStrData := { ||::cpath1+"\sub\"+cvaltochar(odb2:imgid)+".jpg"}
oCol:cHeader := "jpg"
ocol:cdatatype:="F"