功能函数
Public Sub Do_Aver_DJ()
Dim da_Rec As ADODB.Recordset
Dim da_SQL As String
Set da_Rec = AppCN.Execute("select * from AVER_DJ")
AppCN.BeginTrans
Do While Not da_Rec.EOF
da_SQL = "update J_clcl set DJDJ =" & da_Rec.Fields("DJDJ") & " where BHBH= '" & da_Rec.Fields("CLBH") & "'"
AppCN.Execute (da_SQL)
da_SQL = "update K_LLLL_D set JEJE =" & da_Rec.Fields("DJDJ") & " * k_LLLL_D.SLSL where K_LLLL_D.CLBH='" & _
da_Rec.Fields("CLBH") & "' and K_LLLL_D.DHDH IN (SELECT DHDH FROM AVER_mth_LL2)"
AppCN.Execute (da_SQL)
da_Rec.MoveNext
Loop
AppCN.CommitTrans
End Sub
收发存明细,追踪某中材料某月的进出库情况,并显示出是那一帐单据进行操作,如果是领料则在摘要中写明成本项目。计算出每次操作之后的结存数量及金额。
Private Sub CmdMe_Click(Index As Integer)
If Index = 0 Then
Call PrintLstv(Me.LstView, LoadResString(804), "材料[" & m_CLBH & "] 收发存明细A", 1, 1)
Else
Unload Me
End If
End Sub
Private Sub DoGroupCube(SlCol As String, JeCol As String)
Dim arrSlCol() As String
Dim arrJeCol() As String
Dim k As Integer
Dim total As Double
Call ON_GetArray(SlCol, arrSlCol)
Call ON_GetArray(JeCol, arrJeCol)
LstView.ListItems.Add , , ""
LstView.ListItems(LstView.ListItems.Count).SubItems(1) = "总计"
For k = 0 To UBound(arrSlCol)
total = 0
For J = 1 To LstView.ListItems.Count
total = total + Val(LstView.ListItems(J).SubItems(Val(arrSlCol(k))))
Next
LstView.ListItems(LstView.ListItems.Count).SubItems(Val(arrSlCol(k))) = total
Next
For k = 0 To UBound(arrJeCol)
total = 0
For J = 1 To LstView.ListItems.Count
total = total + Val(LstView.ListItems(J).SubItems(Val(arrJeCol(k))))
Next
LstView.ListItems(LstView.ListItems.Count).SubItems(Val(arrJeCol(k))) = Format(total, "###0.00")
Next
End Sub
Private Sub Form_Load()
Dim fl_Num As Single
Dim fl_Cash As Double
Me.Icon = LoadResPicture(101, vbResIcon)
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 4
Me.Caption = "查看[" & m_CLBH & "] 的明细情况"
Call DoStyle
If GetInitData(fl_Num, fl_Cash) = True Then
Call DoShow(fl_Num, fl_Cash)
' Call DoRemain(fl_Num, fl_Cash)
End If
End Sub
Private Sub DoShow(m_drNum As Single, m_drCash As Double)
Dim dsRec As ADODB.Recordset
Dim dsSQL As String
Dim I As Integer
Dim itmX
Dim rd_theSL As Single
Dim rd_theJE As Double
Dim rd_RKJE As Double, rd_CKJE As Double
rd_theSL = m_drNum
rd_theJE = m_drCash
dsSQL = "select * from SFC_MXA3 where CLBH='" & m_CLBH & "'"
Set dsRec = AppCN.Execute(dsSQL & " AND Month(KDRQ)=" & m_Month & " AND Year(KDRQ)=" & m_Year)
If dsRec.EOF Then
' MsgBox "无效的材料编号!"
Exit Sub
End If
I = 1
Set itmX = LstView.ListItems.Add(, , A & I)
itmX.SubItems(1) = dsRec.Fields("KDRQ").Value
itmX.SubItems(3) = "期初数量"
itmX.SubItems(10) = rd_theSL
itmX.SubItems(11) = Format(m_drCash, "##,##0.00")
Do While Not dsRec.EOF
I = I + 1
Set itmX = LstView.ListItems.Add(, , A & I)
rd_RKJE = IIf(dsRec.Fields("RKJE").Value = "", 0, dsRec.Fields("RKJE").Value)
rd_CKJE = IIf(dsRec.Fields("CKJE").Value = "", 0, dsRec.Fields("CKJE").Value)
rd_theSL = rd_theSL + Val(dsRec.Fields("RKSL")) - Val(dsRec.Fields("CKSL"))
m_drCash = m_drCash + rd_RKJE - rd_CKJE
itmX.SubItems(1) = dsRec.Fields("KDRQ").Value
itmX.SubItems(2) = dsRec.Fields("DHDH").Value
itmX.SubItems(3) = dsRec.Fields("CBXM").Value
itmX.SubItems(4) = dsRec.Fields("RKSL").Value
itmX.SubItems(5) = IIf(dsRec.Fields("RKDJ").Value = "", "", Format(dsRec.Fields("RKDJ").Value, "##,##0.00"))
itmX.SubItems(6) = IIf(dsRec.Fields("RKJE").Value = "", "", Format(dsRec.Fields("RKJE").Value, "##,##0.00")) '
itmX.SubItems(7) = dsRec.Fields("CKSL").Value
itmX.SubItems(8) = IIf(dsRec.Fields("CKDJ").Value = "", "",
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页