第一次機房收費系統之日周結帳單(二)

2021-09-29 06:33:21 字數 4651 閱讀 8537

前言:

重要**:

在「重新整理」按鈕裡計算充值卡餘額,充值,消費,退卡金額並跟新到結帳單的資料表裡。

dim txtsql as

string

dim msgtext as

string

dim mrc as adodb.recordset

dim mrcc as adodb.recordset

dim mrccc as adodb.recordset

dim mrcccc as adodb.recordset

dim mrccccc as adodb.recordset

dim mrcccccc as adodb.recordset

dim czk as currency

dim scz as currency

dim xf as currency

dim tk as currency

dim cz as currency

if dtpicker1.value > dtpicker2.value then

msgbox "終止時間不能小於起始時間!", vbokonly + vbexclamation, "警告"

exit

subend

if'計算本期消費金額

txtsql =

"select sum(consumecash) from checkday_info where date between'"

& format$(dtpicker1.value,

"yyyy-mm-dd")&

"'"&

"and'"

& format$(dtpicker2.value,

"yyyy-mm-dd")&

"'"set mrc = executesql(txtsql, msgtext)

debug.print txtsql

if isnull(mrc.fields(0)

)=true

then

xf =

0else

xf = trim(mrc.fields(0)

)end

if'計算本期退卡金額

txtsql =

"select sum(cancelcash) from checkday_info where date between'"

& format$(dtpicker1.value,

"yyyy-mm-dd")&

"'"&

"and'"

& format$(dtpicker2.value,

"yyyy-mm-dd")&

"'"set mrcc = executesql(txtsql, msgtext)

debug.print txtsql

if isnull(mrcc.fields(0)

)=true

then

tk =

0else

tk = trim(mrcc.fields(0)

)end

if'計算本期充值卡餘額

txtsql =

"select sum(allcash) from checkday_info where date between '"

& format(

cdate

(dtpicker1.value))&

"' and '"

& format(

cdate

(dtpicker2.value))&

"'"set mrccc = executesql(txtsql, msgtext)

debug.print txtsql

if isnull(mrccc.fields(0)

)=true

then

czk =

0else

czk = trim(mrccc.fields(0)

)end

if'計算本期充值金額

txtsql =

"select sum(rechargecash) from checkday_info where date between '"

& format(

cdate

(dtpicker1.value))&

"' and '"

& format(

cdate

(dtpicker2.value))&

"'"set mrcccc = executesql(txtsql, msgtext)

debug.print txtsql

if isnull(mrcccc.fields(0)

)=true

then

cz =

0else

cz = trim(mrcccc.fields(0)

)end

if'計算上期充值卡金額

txtsql =

"select sum(allcash) from checkday_info where date < '"

&cdate

(dtpicker1.value)

&"'"

set mrccccc = executesql(txtsql, msgtext)

debug.print txtsql

if isnull(mrccccc.fields(0)

)=true

then

scz =

0else

scz = trim(mrccccc.fields(0)

)end

if txtsql =

"select * from checkweek_info "

set mrcccccc = executesql(txtsql, msgtext)

mrcccccc.addnew

mrcccccc.fields(0)

= trim(scz)

mrcccccc.fields(1)

= trim(cz)

mrcccccc.fields(2)

= trim(xf)

mrcccccc.fields(3)

= trim(tk)

mrcccccc.fields(4)

= trim(czk)

mrcccccc.fields(5)

= trim(

date

) mrcccccc.update

report.detailgrid.recordset.querysql =

"select * from checkweek_info where date between '"

& dtpicker1.value &

"' and '"

& dtpicker2.value &

"' "

'通過select查詢建立記錄集

report.parameterbyname(

"begindate"

).value = format$(dtpicker1.value,

"yyyy-mm-dd"

) report.parameterbyname(

"enddate"

).value = format$(dtpicker2.value,

"yyyy-mm-dd"

) grdisplayviewer1.refresh '重新整理

定義報表物件

'定義報表物件

dim report as grprolibctl.gri***report

在窗體載入事件互動報表模板

set report =

new grprolibctl.gri***report '例項化模版

'載入模版

report.detailgrid.recordset.connectionstring = connectstring(

)'連線資料來源

report.detailgrid.recordset.querysql =

"select * from checkweek_info "

'通過select查詢建立記錄集

report.parameterbyname(

"begindate"

).value = format$(dtpicker1.value,

"yyyy-mm-dd"

) report.parameterbyname(

"enddate"

).value = format$(dtpicker2.value,

"yyyy-mm-dd"

) report.parameterbyname(

"xx"

).value = username

grdisplayviewer1.report = report

grdisplayviewer1.start '開始列印

第一次機房收費系統 幽夢

經過了分析需求 基本配置。終於開始敲機房了。第一步就是敲模組,我只能按照學生資訊管理系統的模組照葫蘆畫瓢。稍微改改,雖然當時整學生時把模組的 一句一句的查了一遍,但到現在還是不懂。不管怎樣,接著進行吧。於是,正式開始了!0.0 登入 在敲登入窗體時,還是要參考學生資訊管理系統。這第一句 就讓我一頭霧...

第一次機房收費系統總結

1.sub與function的區別 1 sub 過程,不需要返回值 function 函式,可以帶返回值 2 語法 sub subname 引數1,引數2,end sub function functionname 引數1,引數2,functionname 返回值 end function 2.如何...

第一次機房收費系統 總攻

前言 今天終於驗完了機房收費系統,驗完後感覺如釋重負 終於結束了。這次的驗專案相比上次的完善功能相比,更多的是對邏輯 使用者體驗的要求,所以這次的驗證相比上次來說要重要的多 因為後面我們會不斷進行機房收費系統的重構,而第一遍的邏輯若能梳理好,那麼後面不僅會輕鬆,更會少走不必要的彎路。首先我先來總結一...