金蝶库存去除开票未审核

'定义插件对象接口. 必须具有的声明, 以此来获得事件
Private WithEvents m_BillTransfe   As K3BillTransfer.Bill
 
Public Sub Show(ByVal oBill As Object)
 
    '接口实现
    '注意: 此方法必须存在, 请勿修改
    Set m_BillTransfe = oBill
 
End Sub

Private Sub Class_Terminate()
 
    '释放接口对象
    '注意: 此方法必须存在, 请勿修改
    Set m_BillTransfe = Nothing

End Sub

Private Sub m_BillTransfe_BillInitialize()
    Dim rs As ADODB.Recordset
    Dim MOBJ As Object
    'Dim conn As ADODB.Connection
    Dim sql1, sql2 As String
    Dim FitemID As Integer     ''物料内码
    Dim faux As Integer '物料属性
    Dim stock As Integer '仓库
    Dim Row As Integer
    Dim FitemNumber As String
    Dim FUserPrice As Double      ''用户自定义价格(价格库中查找的价格)
    Dim ImmediateQTY, FAvailableStockQTY, QFAvailableStockQTY As Double ''定义即时库存,已分配库存
   
    ImmediateQTY = 0
    FAvailableStockQTY = 0
    QFAvailableStockQTY = 0


End Sub

Private Sub m_BillTransfe_LeveCell(ByVal col As Long, ByVal Row As Long, ByVal NewCol As Long, ByVal NewRow As Long, Cancel As Boolean)
Static Mcol, code1, code2, code3, code4, code5 As Double

If Mcol = 0 Then
Do
Mcol = Mcol + 1
If m_BillTransfe.GetGridText(0, Mcol) = "产品代码" Then
code1 = Mcol
End If
If m_BillTransfe.GetGridText(0, Mcol) = "辅助属性" Then
code2 = Mcol
End If
If m_BillTransfe.GetGridText(0, Mcol) = "可开票数量" Then
code3 = Mcol
End If
If m_BillTransfe.GetGridText(0, Mcol) = "发货仓库" Then
code4 = Mcol
End If
If m_BillTransfe.GetGridText(0, Mcol) = "未审核数量" Then
code5 = Mcol
End If
Loop While m_BillTransfe.GetGridText(0, Mcol) <> "" '判断列名

End If
If m_BillTransfe.GetGridText(Row, code1) <> "" Then

'Set conn = New ADODB.Connection
'conn.CursorLocation = adUseClient
'conn.Open m_BillTransfe.Cnnstring
'Set rs = New ADODB.Recordset

Set MOBJ = CreateObject("K3Connection.AppConnection")

sql1 = "select fitemid from t_icitemcore where fnumber='" & CStr(m_BillTransfe.GetGridText(Row, code1)) & "'"

'rs.Open sql1, conn, 0, 1
Set rs = MOBJ.Execute(sql1)

If Not rs.EOF Then

FitemID = rs.Fields(0).Value

Else

  Exit Sub

End If

rs.Close

 

'去即时库存表取即时库存

If (m_BillTransfe.GetGridText(Row, code2) = "" And m_BillTransfe.GetGridText(Row, code4) = "") Then '没有物料属性,没有仓库
sql1 = "select fitemid,sum(FQty) as fqty from ICInventory where fitemid=" & FitemID & " group by fitemid"
Else
If (m_BillTransfe.GetGridText(Row, code2) <> "" And m_BillTransfe.GetGridText(Row, code4) <> "") Then '有物料属性,有仓库
sql1 = "select fitemid from t_AuxItem where fname='" & CStr(m_BillTransfe.GetGridText(Row, code2)) & "'" '取属性内码

'rs.Open sql1, conn, 0, 1
Set rs = MOBJ.Execute(sql1)

If Not rs.EOF Then

faux = rs.Fields(0).Value

End If

rs.Close
sql1 = "select fitemid from t_stock where fname='" & CStr(m_BillTransfe.GetGridText(Row, code4)) & "'"   '取仓库内码

'rs.Open sql1, conn, 0, 1
Set rs = MOBJ.Execute(sql1)

If Not rs.EOF Then

stock = rs.Fields(0).Value

End If

rs.Close
If (faux = "" Or stock = "") Then
Exit Sub
Else
sql1 = "select fitemid,sum(FQty) as fqty from ICInventory where fitemid=" & FitemID & "and fauxpropid='" & faux & "'" & "and fstockid='" & stock & "'" & " group by fitemid"
End If
Else
If m_BillTransfe.GetGridText(Row, code4) = "" Then '没有仓库
sql1 = "select fitemid from t_AuxItem where fname='" & CStr(m_BillTransfe.GetGridText(Row, code2)) & "'" '取属性内码

'rs.Open sql1, conn, 0, 1
Set rs = MOBJ.Execute(sql1)

If Not rs.EOF Then

faux = rs.Fields(0).Value

End If

rs.Close
If faux = "" Then
Exit Sub
Else
sql1 = "select fitemid,sum(FQty) as fqty from ICInventory where fitemid=" & FitemID & "and fauxpropid='" & faux & "'" & " group by fitemid"
End If
Else '没有物料属性

sql1 = "select fitemid from t_stock where fname='" & CStr(m_BillTransfe.GetGridText(Row, code4)) & "'"   '取仓库内码

'rs.Open sql1, conn, 0, 1
Set rs = MOBJ.Execute(sql1)

If Not rs.EOF Then

stock = rs.Fields(0).Value

End If

rs.Close
If stock = "" Then
Exit Sub
Else
sql1 = "select fitemid,sum(FQty) as fqty from ICInventory where fitemid=" & FitemID & "and fstockid='" & stock & "'" & " group by fitemid"
End If
End If
End If
End If

'rs.Open sql1, conn, 0, 1
Set rs = MOBJ.Execute(sql1)

If Not rs.EOF() Then

ImmediateQTY = rs.Fields(1).Value

Else

ImmediateQTY = 0

End If


rs.Close

 

'去销售出库未审核库存
If (faux = "" And stock = "") Then
sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_8  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
Else
 If (faux <> "" And stock <> "") Then
 sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fauxpropid='" & faux & "'" & "and fdcstockid='" & stock & "'" & "and fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_8  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
 Else
  If faux = "" Then
  sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fdcstockid='" & stock & "'" & "and fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_8  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
  Else
  sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fauxpropid='" & faux & "'" & "and fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_8  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
  End If
 End If
End If

'rs.Open sql2, conn, 0, 1
Set rs = MOBJ.Execute(sql2)

If Not rs.EOF() Then

FAvailableStockQTY = rs.Fields(1).Value

Else

FAvailableStockQTY = 0

End If

rs.Close

'去其它出库未审核库存
If (faux = "" And stock = "") Then
sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_16  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
Else
 If (faux <> "" And stock <> "") Then
 sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fauxpropid='" & faux & "'" & "and fdcstockid='" & stock & "'" & "and fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_16  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
 Else
  If faux = "" Then
  sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fdcstockid='" & stock & "'" & "and fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_16  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
  Else
  sql2 = "select fitemid,sum(FQty) as fqty from icstockbillentry  where fauxpropid='" & faux & "'" & "and fitemid='" & FitemID & "'" & "and finterid in (select finterid from vwicbill_16  where fcheckflag='' and fcancellation='' and fqty>0)" & " group by fitemid"
  End If
 End If
End If

'rs.Open sql2, conn, 0, 1
Set rs = MOBJ.Execute(sql2)

If Not rs.EOF() Then

QFAvailableStockQTY = rs.Fields(1).Value

Else

QFAvailableStockQTY = 0

End If

rs.Close
 

'将可用库存显示到表体中

m_BillTransfe.SetGridText Row, code3, ImmediateQTY - FAvailableStockQTY - QFAvailableStockQTY
m_BillTransfe.SetGridText Row, code5, FAvailableStockQTY + QFAvailableStockQTY

Set rs = Nothing

'conn.Close
'Set conn = Nothing

End If
End Sub

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
金蝶BOS(Kingdee Business Operation System)是一款企业管理软件,用于帮助企业实现业务流程自动化和信息化管理。在金蝶BOS单据审核是一项重要的功能,它用于确保企业业务流程的合规性和准确性。 金蝶BOS的单据审核代码是指在进行单据审核时所编写的相关程序代码。这些代码通常涉及以下几个方面: 1. 单据类型定义:首先需要定义各类单据的业务类型,如销售订单、采购订单、入库单等。每类单据需要定义相应的审核规则和审核流程。 2. 审核规则设置:根据企业的实际需求,设置适当的审核规则。例如,可以设置某些单据只需一级审核,而另一些单据需要多级审核。 3. 审核流程设计:为每种单据类型设计相应的审核流程。审核流程包括审核人员的设定、审核顺序的确定以及审核人员权限的控制等。这些流程需要根据企业内部的工作流程进行定制化设置。 4. 审核人员权限管理:根据企业的组织结构和职务权限,设定每个审核人员的审核权限。例如,销售部门的员工只能审核与销售相关的单据,而财务部门的员工可以审核与财务相关的单据。 5. 审核结果处理:在审核过程,需要记录每个审核人员的审核结果,包括审核通过、审核未通过等。审核结果可用于后续单据操作和数据跟踪。 通过以上的步骤和相关代码的编写,金蝶BOS可以帮助企业实现单据审核的自动化和规范化。这将提高企业的运行效率和管理水平,减少出错率,确保企业的业务流程顺畅运行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值