我把日结给删掉,只剩下了周结。周结是时间段之间的查询,感觉日结有点冗余。(这是我个人的看法)
代码部分:
打印
Private Sub cmdprint_Click()
report.[Print] (True)
End Sub
打印预览
Private Sub cmdprintpreview_Click()
report.PrintPreview (True)
End Sub
终止时间不能小于开始时间
If DTPicker1.Value > DTPicker2.Value Then
MsgBox "终止时间不能小于开始时间", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
账单刷新(删去上期充值卡和本期充值卡)
Rem:计算本期消费金额
txtsql = "select sum(consume) from line_Info where ondate between'" & Format$(DTPicker1.Value, "yyyy-mm-dd") & "'" & "and'" & Format$(DTPicker2.Value, "yyyy-mm-dd") & "'"
Set mrcch1 = executeSQL(txtsql, msgtext)
Debug.Print txtsql
If IsNull(mrcch1.Fields(0)) = True Then
consumecash = 0
Else
consumecash = Trim(mrcch1.Fields(0))
End If
Rem:计算本期退卡金额
txtsql = "select sum(cancelcash) from cancelcard_Info where date between'" & Format$(DTPicker1.Value, "yyyy-mm-dd") & "'" & "and'" & Format$(DTPicker2.Value, "yyyy-mm-dd") & "'"
Set mrcch2 = executeSQL(txtsql, msgtext)
Debug.Print txtsql
If IsNull(mrcch1.Fields(0)) = True Then
cancelcash = 0
Else
cancelcash = Trim(mrcch1.Fields(0))
End If
Rem:计算本期充值金额
txtsql = "select sum(addmoney) from recharge_Info where date between'" & Format$(DTPicker1.Value, "yyyy-mm-dd") & "'" & "and'" & Format$(DTPicker2.Value, "yyyy-mm-dd") & "'"
Set mrcch3 = executeSQL(txtsql, msgtext)
Debug.Print txtsql
If IsNull(mrcch3.Fields(0)) = True Then
rechargecash = 0
Else
rechargecash = Trim(mrcch3.Fields(0))
End If
txtsql = "select * from checkweek_info "
Set mrcch4 = executeSQL(txtsql, msgtext)
mrcch4.Fields(0) = 0
mrcch4.Fields(1) = Trim(rechargecash)
mrcch4.Fields(2) = Trim(consumecash)
mrcch4.Fields(3) = Trim(cancelcash)
mrcch4.Fields(4) = 0
mrcch4.Fields(5) = Trim(Date)
mrcch4.Update
mrcch4.Close
report.DetailGrid.Recordset.QuerySQL = "select * from checkweek_info where date between'" & Format$(DTPicker1.Value, "yyyy-mm-dd") & "'" & "and'" & Format$(DTPicker2.Value, "yyyy-mm-dd") & "'"
report.ParameterByName("begindate").Value = Format$(DTPicker1.Value, "yyyy-mm-dd")
report.ParameterByName("enddate").Value = Format$(DTPicker2.Value, "yyyy-mm-dd")
GRDisplayViewer1.Refresh
End Sub