條件max date取值於當天審核後的日期,這樣週六的上收也可以取到
更新:fts_voucher_b.pk_account != '1162n51000000000032b'
(selectfts_voucher_b.interestdate,
bd_accid.accidcode,
bd_accid.accidname,
fts_voucher_b.creditamount
as上收金額,
(case
when (round(0.35
* fts_voucher_b.localcreditamount /
10000, 0) *
10000) <
100000
then'0
'else
to_char(
round(0.35
* fts_voucher_b.localcreditamount /
10000, 0)) ||'萬
'end) as
下撥金額,
to_number(substr(bd_custbank.account,
-4, 4)) as
下撥賬號,
bd_accbank.remcode
as助記碼,
(case
when (round(0.35
* fts_voucher_b.localcreditamount /
10000, 0) *
10000) <
100000
then
fts_voucher_b.creditamount
else
fts_voucher_b.creditamount
-round(0.35
* fts_voucher_b.localcreditamount /
10000, 0) *
10000
end) as
餘額
from
fts_voucher_b, bd_accid, bd_cubasdoc, bd_custbank, bd_accbank,fts_voucher
where bd_custbank.pk_cubasdoc =
bd_cubasdoc.pk_cubasdoc
and bd_cubasdoc.custcode =
bd_accid.accidcode
and fts_voucher_b.pk_account =
bd_accid.pk_accid
and bd_custbank.pk_accbank =
bd_accbank.pk_accbank
and fts_voucher.pk_voucher=
fts_voucher_b.pk_voucher
and bd_custbank.defflag ='y
'and fts_voucher_b.summary =
'每日收入戶自動歸集
'and fts_voucher.auditdate in
(select
max(auditdate)
from
fts_voucher
where fts_voucher.summary =
'每日收入戶自動歸集
')
and fts_voucher_b.pk_account != '1162n51000000000032b'
and bd_accid.accidcode<>
'080101')
union
(select
fts_voucher_b.interestdate,
bd_accid.accidcode,
bd_accid.accidname,
fts_voucher_b.creditamount
as上收金額,
to_char(
0.85
* fts_voucher_b.localcreditamount /
10000) ||'萬
'as下撥金額,
to_number(substr(bd_custbank.account,
-4, 4)) as
下撥賬號,
bd_accbank.remcode
as助記碼,
fts_voucher_b.creditamount
*0.15
as餘額
from
fts_voucher_b, bd_accid, bd_cubasdoc, bd_custbank, bd_accbank,fts_voucher
where bd_custbank.pk_cubasdoc =
bd_cubasdoc.pk_cubasdoc
and bd_cubasdoc.custcode =
bd_accid.accidcode
and fts_voucher_b.pk_account =
bd_accid.pk_accid
and bd_custbank.pk_accbank =
bd_accbank.pk_accbank
and fts_voucher.pk_voucher=
fts_voucher_b.pk_voucher
and bd_custbank.defflag ='y
'and fts_voucher_b.summary =
'每日收入戶自動歸集
'and fts_voucher.auditdate in
(select
max(auditdate)
from
fts_voucher
where fts_voucher.summary =
'每日收入戶自動歸集
Linux下mysql 每日定時備份
1 建立shell檔案dbbak.sh執行任務 bin bash 刪除3天前資料 find ifeodata bakdata mtime 3 name exec rm rf 備份當前資料庫 並以gzip壓縮 mysqldump h ip uusername ppassword single tran...
ios7,下拉重新整理,上拉重新整理,完善的方法
os7,下拉重新整理,上拉重新整理,完美的方法。nsinteger currentpageno uirefreshcontrol refreshcontrol bool ispullrefresh 判斷是否是下拉 bool scrolling 是否正在上拉重新整理 refreshcontrol ui...
Win下Mysql資料每日查詢匯出傳送方案
1 資料處理的儲存過程 create definer datahs procedure p kingr sum daily in p statistics date int begin insert into datatest.kingr1 insert into datatest.kingr2 i...