다양화 Wave2: dbio 289 + common 120 고유화 + 프로그램 206개 EXEC SQL 심화

- dbio io(289): fetch/touch/total 시그니처 유지, SQL 바디를 JOIN/집계/커서/
  upsert/DELETE 등 구조로 고유화 → 289/289 고유
- common cu(120): 유틸 시그니처 유지, Luhn/CRC/Zeller/BIN레인지/amortization/
  netting 등 실 알고리즘으로 고유화 → 120/120 고유
- 심화: 실제 EXEC SQL 없던 프로그램에 SELECT/INSERT/UPDATE/커서+tx 추가
  → online+batch 530/530 전부 실제 SQL 보유
- 전 코퍼스 프로그램 939/939 고유, 전체 docker make -j4 = EXIT 0, 958 오브젝트
- 임시 생성기 제거, inventory.json loc 실측 갱신

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
forge-bot 2026-07-19 04:54:59 +00:00
parent c3a0259e95
commit 93c3cb74af
1111 changed files with 31539 additions and 17258 deletions

View file

@ -110,7 +110,7 @@ int ac_io_0001_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0001_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt from ac_io_0001_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
@ -150,7 +150,7 @@ int ac_io_0001_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0001_t set appr_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
@ -188,7 +188,7 @@ long ac_io_0001_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0001_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( appr_amt ) , 0 ) from ac_io_0001_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
@ -202,3 +202,4 @@ long ac_io_0001_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,10 @@ int ac_io_0001_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT appr_amt
INTO :h_amount
FROM ac_io_0001_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +54,8 @@ int ac_io_0001_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0001_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET appr_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0001_touch");
@ -79,7 +79,7 @@ long ac_io_0001_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(appr_amt), 0)
INTO :h_sum
FROM ac_io_0001_t
WHERE biz_date = :h_biz_date;
@ -90,3 +90,4 @@ long ac_io_0001_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,22 @@ int ac_io_0002_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0002.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0002.pgc"
long h_amount ;
/* exec sql end declare section */
long h_appr ;
#line 19 "app/dbio/ac_io_0002.pgc"
long h_fee ;
#line 20 "app/dbio/ac_io_0002.pgc"
long h_vat ;
/* exec sql end declare section */
#line 21 "app/dbio/ac_io_0002.pgc"
if (!key || !out_amount)
@ -110,12 +118,16 @@ int ac_io_0002_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0002_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt , fee_amt , vat_amt from ac_io_0002_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_appr),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_vat),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0002.pgc"
#line 32 "app/dbio/ac_io_0002.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,7 +136,7 @@ int ac_io_0002_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0002_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -134,13 +146,13 @@ int ac_io_0002_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0002.pgc"
#line 47 "app/dbio/ac_io_0002.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0002.pgc"
#line 48 "app/dbio/ac_io_0002.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0002.pgc"
#line 49 "app/dbio/ac_io_0002.pgc"
if (!key)
@ -150,12 +162,12 @@ int ac_io_0002_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0002_t set net_amt = $1 , upd_ts = now ( ) where mcht_no = $2 and status_cd = '00' and appr_amt > 0",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0002.pgc"
#line 60 "app/dbio/ac_io_0002.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +185,13 @@ long ac_io_0002_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0002.pgc"
#line 74 "app/dbio/ac_io_0002.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0002.pgc"
long h_sum ;
#line 75 "app/dbio/ac_io_0002.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0002.pgc"
#line 76 "app/dbio/ac_io_0002.pgc"
if (!biz_date)
@ -188,17 +200,18 @@ long ac_io_0002_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0002_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from ac_io_0002_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0002.pgc"
#line 87 "app/dbio/ac_io_0002.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0002_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -15,7 +15,9 @@ int ac_io_0002_fetch(const char *key, long *out_amount)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
long h_appr;
long h_fee;
long h_vat;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +26,10 @@ int ac_io_0002_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0002_t
WHERE key = :h_key;
EXEC SQL SELECT appr_amt, fee_amt, vat_amt
INTO :h_appr, :h_fee, :h_vat
FROM ac_io_0002_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,7 +37,7 @@ int ac_io_0002_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0002_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -54,8 +56,8 @@ int ac_io_0002_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0002_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET net_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key AND status_cd = '00' AND appr_amt > 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0002_touch");
@ -70,7 +72,7 @@ long ac_io_0002_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,8 +81,8 @@ long ac_io_0002_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_cnt
FROM ac_io_0002_t
WHERE biz_date = :h_biz_date;
@ -88,5 +90,6 @@ long ac_io_0002_total(const char *biz_date)
TX_DBIO_LOG_ERR("ac_io_0002_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int ac_io_0003_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0003_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select h . net_amt from ac_io_0003_t h join ac_io_0003_map_t m on m . mcht_no = h . mcht_no where h . mcht_no = $1 and m . use_yn = 'Y'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0003.pgc"
#line 31 "app/dbio/ac_io_0003.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0003_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0003.pgc"
#line 46 "app/dbio/ac_io_0003.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0003.pgc"
#line 47 "app/dbio/ac_io_0003.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0003.pgc"
#line 48 "app/dbio/ac_io_0003.pgc"
if (!key)
@ -150,10 +150,10 @@ int ac_io_0003_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0003_log_t ( mcht_no , appr_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0003.pgc"
@ -162,8 +162,6 @@ int ac_io_0003_touch(const char *key, long amount)
TX_DBIO_LOG_ERR("ac_io_0003_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -172,14 +170,18 @@ long ac_io_0003_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0003.pgc"
#line 70 "app/dbio/ac_io_0003.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0003.pgc"
long h_sum ;
#line 71 "app/dbio/ac_io_0003.pgc"
long h_avg ;
#line 72 "app/dbio/ac_io_0003.pgc"
short h_ind ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0003.pgc"
#line 73 "app/dbio/ac_io_0003.pgc"
if (!biz_date)
@ -188,17 +190,20 @@ long ac_io_0003_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0003_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select avg ( appr_amt ) from ac_io_0003_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0003.pgc"
ECPGt_long,&(h_avg),(long)1,(long)1,sizeof(long),
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 84 "app/dbio/ac_io_0003.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0003_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -24,10 +24,11 @@ int ac_io_0003_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT h.net_amt
INTO :h_amount
FROM ac_io_0003_t
WHERE key = :h_key;
FROM ac_io_0003_t h
JOIN ac_io_0003_map_t m ON m.mcht_no = h.mcht_no
WHERE h.mcht_no = :h_key AND m.use_yn = 'Y';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,16 +54,13 @@ int ac_io_0003_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0003_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL INSERT INTO ac_io_0003_log_t (mcht_no, appr_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0003_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -70,7 +68,8 @@ long ac_io_0003_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_avg;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +78,17 @@ long ac_io_0003_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0003_t
EXEC SQL SELECT avg(appr_amt)
INTO :h_avg :h_ind
FROM ac_io_0003_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0003_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -94,14 +94,18 @@ int ac_io_0004_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0004.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0004.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/ac_io_0004.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/ac_io_0004.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int ac_io_0004_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0004_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select bal_amt from ac_io_0004_bal_t where acct_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0004.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/ac_io_0004.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int ac_io_0004_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0004_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int ac_io_0004_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0004.pgc"
#line 48 "app/dbio/ac_io_0004.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0004.pgc"
#line 49 "app/dbio/ac_io_0004.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0004.pgc"
#line 50 "app/dbio/ac_io_0004.pgc"
if (!key)
@ -150,20 +156,31 @@ int ac_io_0004_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0004_bal_t set bal_amt = $1 , upd_ts = now ( ) where acct_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0004.pgc"
#line 61 "app/dbio/ac_io_0004.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0004_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0004_bal_t ( acct_no , bal_amt , upd_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 69 "app/dbio/ac_io_0004.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0004_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -173,13 +190,13 @@ long ac_io_0004_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0004.pgc"
#line 81 "app/dbio/ac_io_0004.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0004.pgc"
#line 82 "app/dbio/ac_io_0004.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0004.pgc"
#line 83 "app/dbio/ac_io_0004.pgc"
if (!biz_date)
@ -188,17 +205,20 @@ long ac_io_0004_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0004_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( net_amt ) , 0 ) from ac_io_0004_t where biz_date = $1 group by biz_date having sum ( net_amt ) > 0 limit 1",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0004.pgc"
#line 97 "app/dbio/ac_io_0004.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0004_total");
return -1;
}
return h_sum;
}

View file

@ -16,6 +16,7 @@ int ac_io_0004_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int ac_io_0004_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0004_t
WHERE key = :h_key;
EXEC SQL SELECT bal_amt
INTO :h_amount :h_ind
FROM ac_io_0004_bal_t
WHERE acct_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int ac_io_0004_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0004_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -53,16 +56,22 @@ int ac_io_0004_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0004_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE ac_io_0004_bal_t
SET bal_amt = :h_amount, upd_ts = now()
WHERE acct_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0004_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
EXEC SQL INSERT INTO ac_io_0004_bal_t (acct_no, bal_amt, upd_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0004_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -79,14 +88,20 @@ long ac_io_0004_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(net_amt), 0)
INTO :h_sum
FROM ac_io_0004_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
GROUP BY biz_date
HAVING sum(net_amt) > 0
LIMIT 1;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0004_total");
return -1;
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int ac_io_0005_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0005_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select req_amt from ac_io_0005_t where mcht_no = $1 and status_cd = '00' and cancel_yn = 'N'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0005.pgc"
#line 31 "app/dbio/ac_io_0005.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0005_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0005.pgc"
#line 46 "app/dbio/ac_io_0005.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0005.pgc"
#line 47 "app/dbio/ac_io_0005.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0005.pgc"
#line 48 "app/dbio/ac_io_0005.pgc"
if (!key)
@ -150,9 +150,7 @@ int ac_io_0005_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from ac_io_0005_tmp_t where ref_key = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0005.pgc"
@ -172,14 +170,18 @@ long ac_io_0005_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0005.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0005.pgc"
long h_sum ;
/* exec sql end declare section */
long h_row ;
#line 74 "app/dbio/ac_io_0005.pgc"
long acc = 0 ;
/* exec sql end declare section */
#line 75 "app/dbio/ac_io_0005.pgc"
if (!biz_date)
@ -188,17 +190,42 @@ long ac_io_0005_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0005_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0005.pgc"
ECPGset_var( 0, ( h_biz_date ), __LINE__);\
/* declare cur_ac_io_0005_t cursor for select net_amt from ac_io_0005_sum_t where biz_date = $1 */
#line 84 "app/dbio/ac_io_0005.pgc"
#line 84 "app/dbio/ac_io_0005.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_io_0005_t cursor for select net_amt from ac_io_0005_sum_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0005.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0005_total");
return -1;
}
return h_sum;
for (;;) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_io_0005_t", ECPGt_EOIT,
ECPGt_long,&(h_row),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 91 "app/dbio/ac_io_0005.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0005_total");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0005_t", ECPGt_EOIT, ECPGt_EORT);}
#line 96 "app/dbio/ac_io_0005.pgc"
return -1;
}
acc += h_row;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0005_t", ECPGt_EOIT, ECPGt_EORT);}
#line 101 "app/dbio/ac_io_0005.pgc"
return acc;
}

View file

@ -24,10 +24,11 @@ int ac_io_0005_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT req_amt
INTO :h_amount
FROM ac_io_0005_t
WHERE key = :h_key;
WHERE mcht_no = :h_key AND status_cd = '00'
AND cancel_yn = 'N';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,8 @@ int ac_io_0005_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0005_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM ac_io_0005_tmp_t
WHERE ref_key = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0005_touch");
@ -70,7 +70,8 @@ long ac_io_0005_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_row;
long acc = 0;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +80,26 @@ long ac_io_0005_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0005_t
WHERE biz_date = :h_biz_date;
EXEC SQL DECLARE cur_ac_io_0005_t CURSOR FOR
SELECT net_amt FROM ac_io_0005_sum_t WHERE biz_date = :h_biz_date;
EXEC SQL OPEN cur_ac_io_0005_t;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0005_total");
return -1;
}
return h_sum;
for (;;) {
EXEC SQL FETCH cur_ac_io_0005_t INTO :h_row;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0005_total");
EXEC SQL CLOSE cur_ac_io_0005_t;
return -1;
}
acc += h_row;
}
EXEC SQL CLOSE cur_ac_io_0005_t;
return acc;
}

View file

@ -94,14 +94,18 @@ int ac_io_0006_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0006.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0006.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/ac_io_0006.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/ac_io_0006.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int ac_io_0006_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0006_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select max ( appr_amt ) from ac_io_0006_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0006.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/ac_io_0006.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int ac_io_0006_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0006_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int ac_io_0006_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0006.pgc"
#line 48 "app/dbio/ac_io_0006.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0006.pgc"
#line 49 "app/dbio/ac_io_0006.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0006.pgc"
#line 50 "app/dbio/ac_io_0006.pgc"
if (!key)
@ -150,12 +156,14 @@ int ac_io_0006_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0006_t set fee_amt = $1 , vat_amt = $2 / 10 , upd_ts = now ( ) where mcht_no = $3 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0006.pgc"
#line 61 "app/dbio/ac_io_0006.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +180,18 @@ long ac_io_0006_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0006.pgc"
#line 75 "app/dbio/ac_io_0006.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0006.pgc"
long h_sum ;
#line 76 "app/dbio/ac_io_0006.pgc"
long h_max ;
#line 77 "app/dbio/ac_io_0006.pgc"
long h_min ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0006.pgc"
#line 78 "app/dbio/ac_io_0006.pgc"
if (!biz_date)
@ -188,17 +200,20 @@ long ac_io_0006_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0006_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( max ( appr_amt ) , 0 ) , coalesce ( min ( appr_amt ) , 0 ) from ac_io_0006_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_max),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_min),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0006.pgc"
#line 89 "app/dbio/ac_io_0006.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0006_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -16,6 +16,7 @@ int ac_io_0006_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int ac_io_0006_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0006_t
WHERE key = :h_key;
EXEC SQL SELECT max(appr_amt)
INTO :h_amount :h_ind
FROM ac_io_0006_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int ac_io_0006_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0006_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +57,8 @@ int ac_io_0006_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0006_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET fee_amt = :h_amount, vat_amt = :h_amount / 10, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0006_touch");
@ -70,7 +73,8 @@ long ac_io_0006_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_max;
long h_min;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +83,15 @@ long ac_io_0006_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0006_t
EXEC SQL SELECT coalesce(max(appr_amt), 0), coalesce(min(appr_amt), 0)
INTO :h_max, :h_min
FROM ac_io_0006_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0006_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -110,12 +110,12 @@ int ac_io_0007_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0007_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select net_amt from ac_io_0007_t where mcht_no in ( select mcht_no from ac_io_0007_map_t where grp_key = $1 )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0007.pgc"
#line 31 "app/dbio/ac_io_0007.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0007_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0007.pgc"
#line 46 "app/dbio/ac_io_0007.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0007.pgc"
#line 47 "app/dbio/ac_io_0007.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0007.pgc"
#line 48 "app/dbio/ac_io_0007.pgc"
if (!key)
@ -150,12 +150,12 @@ int ac_io_0007_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0007_t set status_cd = case when $1 > 0 then '00' else '99' end , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0007.pgc"
#line 60 "app/dbio/ac_io_0007.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long ac_io_0007_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0007.pgc"
#line 74 "app/dbio/ac_io_0007.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0007.pgc"
#line 75 "app/dbio/ac_io_0007.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0007.pgc"
#line 76 "app/dbio/ac_io_0007.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long ac_io_0007_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0007_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( d . appr_amt ) , 0 ) from ac_io_0007_dtl_t d join ac_io_0007_t h on h . mcht_no = d . mcht_no where d . biz_date = $1 and h . status_cd = '00'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0007.pgc"
#line 88 "app/dbio/ac_io_0007.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long ac_io_0007_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int ac_io_0007_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT net_amt
INTO :h_amount
FROM ac_io_0007_t
WHERE key = :h_key;
WHERE mcht_no IN
(SELECT mcht_no FROM ac_io_0007_map_t WHERE grp_key = :h_key);
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,9 @@ int ac_io_0007_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0007_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET status_cd = CASE WHEN :h_amount > 0 THEN '00' ELSE '99' END,
upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0007_touch");
@ -79,10 +81,11 @@ long ac_io_0007_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(d.appr_amt), 0)
INTO :h_sum
FROM ac_io_0007_t
WHERE biz_date = :h_biz_date;
FROM ac_io_0007_dtl_t d
JOIN ac_io_0007_t h ON h.mcht_no = d.mcht_no
WHERE d.biz_date = :h_biz_date AND h.status_cd = '00';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0007_total");
@ -90,3 +93,4 @@ long ac_io_0007_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,20 +110,43 @@ int ac_io_0008_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0008_t where key = $1 ",
ECPGset_var( 0, ( h_key ), __LINE__);\
/* declare cur_ac_io_0008_f cursor for select appr_amt from ac_io_0008_dtl_t where mcht_no = $1 order by seq desc */
#line 29 "app/dbio/ac_io_0008.pgc"
#line 29 "app/dbio/ac_io_0008.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_io_0008_f cursor for select appr_amt from ac_io_0008_dtl_t where mcht_no = $1 order by seq desc",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0008.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_fetch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_io_0008_f", ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 35 "app/dbio/ac_io_0008.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0008_f", ECPGt_EOIT, ECPGt_EORT);}
#line 37 "app/dbio/ac_io_0008.pgc"
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0008_f", ECPGt_EOIT, ECPGt_EORT);}
#line 42 "app/dbio/ac_io_0008.pgc"
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0008_f", ECPGt_EOIT, ECPGt_EORT);}
#line 45 "app/dbio/ac_io_0008.pgc"
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +157,13 @@ int ac_io_0008_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0008.pgc"
#line 54 "app/dbio/ac_io_0008.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0008.pgc"
#line 55 "app/dbio/ac_io_0008.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0008.pgc"
#line 56 "app/dbio/ac_io_0008.pgc"
if (!key)
@ -150,12 +173,12 @@ int ac_io_0008_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0008_acc_t set accum_amt = accum_amt + $1 , cnt = cnt + 1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0008.pgc"
#line 67 "app/dbio/ac_io_0008.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +196,13 @@ long ac_io_0008_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0008.pgc"
#line 81 "app/dbio/ac_io_0008.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0008.pgc"
long h_sum ;
#line 82 "app/dbio/ac_io_0008.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0008.pgc"
#line 83 "app/dbio/ac_io_0008.pgc"
if (!biz_date)
@ -188,17 +211,18 @@ long ac_io_0008_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0008_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( distinct mcht_no ) from ac_io_0008_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0008.pgc"
#line 94 "app/dbio/ac_io_0008.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -24,17 +24,26 @@ int ac_io_0008_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0008_t
WHERE key = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
EXEC SQL DECLARE cur_ac_io_0008_f CURSOR FOR
SELECT appr_amt FROM ac_io_0008_dtl_t
WHERE mcht_no = :h_key ORDER BY seq DESC;
EXEC SQL OPEN cur_ac_io_0008_f;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_fetch");
return TX_EDB;
}
EXEC SQL FETCH cur_ac_io_0008_f INTO :h_amount;
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
EXEC SQL CLOSE cur_ac_io_0008_f;
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_fetch");
EXEC SQL CLOSE cur_ac_io_0008_f;
return TX_EDB;
}
EXEC SQL CLOSE cur_ac_io_0008_f;
*out_amount = h_amount;
return TX_OK;
}
@ -53,9 +62,9 @@ int ac_io_0008_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0008_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE ac_io_0008_acc_t
SET accum_amt = accum_amt + :h_amount, cnt = cnt + 1, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_touch");
@ -70,7 +79,7 @@ long ac_io_0008_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +88,15 @@ long ac_io_0008_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0008_t
EXEC SQL SELECT count(DISTINCT mcht_no)
INTO :h_cnt
FROM ac_io_0008_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0008_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int ac_io_0009_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0009_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select case when status_cd = '00' then appr_amt else 0 end from ac_io_0009_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0009.pgc"
#line 31 "app/dbio/ac_io_0009.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0009_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0009.pgc"
#line 46 "app/dbio/ac_io_0009.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0009.pgc"
#line 47 "app/dbio/ac_io_0009.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0009.pgc"
#line 48 "app/dbio/ac_io_0009.pgc"
if (!key)
@ -150,10 +150,10 @@ int ac_io_0009_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from ac_io_0009_bal_t where acct_no = $1 and bal_amt <= $2 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0009.pgc"
@ -188,12 +188,12 @@ long ac_io_0009_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0009_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( cancel_amt ) , 0 ) from ac_io_0009_t where biz_date = $1 and status_cd = '90' and cancel_yn = 'Y'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0009.pgc"
#line 86 "app/dbio/ac_io_0009.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long ac_io_0009_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int ac_io_0009_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT
CASE WHEN status_cd = '00' THEN appr_amt ELSE 0 END
INTO :h_amount
FROM ac_io_0009_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,8 @@ int ac_io_0009_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0009_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM ac_io_0009_bal_t
WHERE acct_no = :h_key AND bal_amt <= :h_amount;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0009_touch");
@ -79,10 +79,11 @@ long ac_io_0009_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(cancel_amt), 0)
INTO :h_sum
FROM ac_io_0009_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
AND status_cd = '90' AND cancel_yn = 'Y';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0009_total");
@ -90,3 +91,4 @@ long ac_io_0009_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,7 +110,7 @@ int ac_io_0010_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0010_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt from ac_io_0010_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
@ -150,20 +150,29 @@ int ac_io_0010_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0010_t set req_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0010_touch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0010_hist_t ( mcht_no , req_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 64 "app/dbio/ac_io_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0010_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -173,13 +182,13 @@ long ac_io_0010_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0010.pgc"
#line 76 "app/dbio/ac_io_0010.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0010.pgc"
#line 77 "app/dbio/ac_io_0010.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0010.pgc"
#line 78 "app/dbio/ac_io_0010.pgc"
if (!biz_date)
@ -188,12 +197,12 @@ long ac_io_0010_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0010_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( recon_amt ) , 0 ) from ac_io_0010_sum_t where biz_date in ( select biz_date from ac_io_0010_map_t where biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0010.pgc"
#line 90 "app/dbio/ac_io_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +211,4 @@ long ac_io_0010_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,10 @@ int ac_io_0010_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT appr_amt
INTO :h_amount
FROM ac_io_0010_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,15 +54,19 @@ int ac_io_0010_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0010_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET req_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0010_touch");
return TX_EDB;
}
EXEC SQL INSERT INTO ac_io_0010_hist_t (mcht_no, req_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0010_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -79,10 +83,11 @@ long ac_io_0010_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(recon_amt), 0)
INTO :h_sum
FROM ac_io_0010_t
WHERE biz_date = :h_biz_date;
FROM ac_io_0010_sum_t
WHERE biz_date IN
(SELECT biz_date FROM ac_io_0010_map_t WHERE biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0010_total");
@ -90,3 +95,4 @@ long ac_io_0010_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,22 @@ int ac_io_0011_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0011.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0011.pgc"
long h_amount ;
/* exec sql end declare section */
long h_appr ;
#line 19 "app/dbio/ac_io_0011.pgc"
long h_fee ;
#line 20 "app/dbio/ac_io_0011.pgc"
long h_vat ;
/* exec sql end declare section */
#line 21 "app/dbio/ac_io_0011.pgc"
if (!key || !out_amount)
@ -110,12 +118,16 @@ int ac_io_0011_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0011_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt , fee_amt , vat_amt from ac_io_0011_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_appr),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_vat),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0011.pgc"
#line 32 "app/dbio/ac_io_0011.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,7 +136,7 @@ int ac_io_0011_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0011_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -134,13 +146,13 @@ int ac_io_0011_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0011.pgc"
#line 47 "app/dbio/ac_io_0011.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0011.pgc"
#line 48 "app/dbio/ac_io_0011.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0011.pgc"
#line 49 "app/dbio/ac_io_0011.pgc"
if (!key)
@ -150,12 +162,12 @@ int ac_io_0011_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0011_t set appr_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0011.pgc"
#line 60 "app/dbio/ac_io_0011.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +185,13 @@ long ac_io_0011_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0011.pgc"
#line 74 "app/dbio/ac_io_0011.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0011.pgc"
long h_sum ;
#line 75 "app/dbio/ac_io_0011.pgc"
long h_flag ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0011.pgc"
#line 76 "app/dbio/ac_io_0011.pgc"
if (!biz_date)
@ -188,17 +200,18 @@ long ac_io_0011_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0011_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from ac_io_0011_t where exists ( select 1 from ac_io_0011_dtl_t d where d . biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_flag),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0011.pgc"
#line 89 "app/dbio/ac_io_0011.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0011_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -15,7 +15,9 @@ int ac_io_0011_fetch(const char *key, long *out_amount)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
long h_appr;
long h_fee;
long h_vat;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +26,10 @@ int ac_io_0011_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0011_t
WHERE key = :h_key;
EXEC SQL SELECT appr_amt, fee_amt, vat_amt
INTO :h_appr, :h_fee, :h_vat
FROM ac_io_0011_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,7 +37,7 @@ int ac_io_0011_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0011_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -54,8 +56,8 @@ int ac_io_0011_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0011_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET appr_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0011_touch");
@ -70,7 +72,7 @@ long ac_io_0011_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_flag;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +81,17 @@ long ac_io_0011_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_flag
FROM ac_io_0011_t
WHERE biz_date = :h_biz_date;
WHERE EXISTS
(SELECT 1 FROM ac_io_0011_dtl_t d
WHERE d.biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0011_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -110,12 +110,12 @@ int ac_io_0012_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0012_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select h . net_amt from ac_io_0012_t h join ac_io_0012_map_t m on m . mcht_no = h . mcht_no where h . mcht_no = $1 and m . use_yn = 'Y'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0012.pgc"
#line 31 "app/dbio/ac_io_0012.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0012_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0012.pgc"
#line 46 "app/dbio/ac_io_0012.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0012.pgc"
#line 47 "app/dbio/ac_io_0012.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0012.pgc"
#line 48 "app/dbio/ac_io_0012.pgc"
if (!key)
@ -150,12 +150,12 @@ int ac_io_0012_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0012_t set net_amt = $1 , upd_ts = now ( ) where mcht_no = $2 and status_cd = '00' and appr_amt > 0",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0012.pgc"
#line 59 "app/dbio/ac_io_0012.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long ac_io_0012_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0012.pgc"
#line 73 "app/dbio/ac_io_0012.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0012.pgc"
#line 74 "app/dbio/ac_io_0012.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0012.pgc"
#line 75 "app/dbio/ac_io_0012.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long ac_io_0012_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0012_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( appr_amt ) , 0 ) from ac_io_0012_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0012.pgc"
#line 86 "app/dbio/ac_io_0012.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long ac_io_0012_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int ac_io_0012_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT h.net_amt
INTO :h_amount
FROM ac_io_0012_t
WHERE key = :h_key;
FROM ac_io_0012_t h
JOIN ac_io_0012_map_t m ON m.mcht_no = h.mcht_no
WHERE h.mcht_no = :h_key AND m.use_yn = 'Y';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,8 @@ int ac_io_0012_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0012_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET net_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key AND status_cd = '00' AND appr_amt > 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0012_touch");
@ -79,7 +80,7 @@ long ac_io_0012_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(appr_amt), 0)
INTO :h_sum
FROM ac_io_0012_t
WHERE biz_date = :h_biz_date;
@ -90,3 +91,4 @@ long ac_io_0012_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,18 @@ int ac_io_0013_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0013.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0013.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/ac_io_0013.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/ac_io_0013.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int ac_io_0013_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0013_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select bal_amt from ac_io_0013_bal_t where acct_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0013.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/ac_io_0013.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int ac_io_0013_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0013_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int ac_io_0013_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0013.pgc"
#line 48 "app/dbio/ac_io_0013.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0013.pgc"
#line 49 "app/dbio/ac_io_0013.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0013.pgc"
#line 50 "app/dbio/ac_io_0013.pgc"
if (!key)
@ -150,20 +156,18 @@ int ac_io_0013_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0013_log_t ( mcht_no , appr_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0013.pgc"
#line 60 "app/dbio/ac_io_0013.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0013_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -177,7 +181,7 @@ long ac_io_0013_total(const char *biz_date)
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0013.pgc"
long h_sum ;
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0013.pgc"
@ -188,10 +192,10 @@ long ac_io_0013_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0013_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from ac_io_0013_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0013.pgc"
@ -200,5 +204,6 @@ long ac_io_0013_total(const char *biz_date)
TX_DBIO_LOG_ERR("ac_io_0013_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -16,6 +16,7 @@ int ac_io_0013_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int ac_io_0013_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0013_t
WHERE key = :h_key;
EXEC SQL SELECT bal_amt
INTO :h_amount :h_ind
FROM ac_io_0013_bal_t
WHERE acct_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int ac_io_0013_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0013_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -53,16 +56,13 @@ int ac_io_0013_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0013_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL INSERT INTO ac_io_0013_log_t (mcht_no, appr_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0013_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -70,7 +70,7 @@ long ac_io_0013_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,8 +79,8 @@ long ac_io_0013_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_cnt
FROM ac_io_0013_t
WHERE biz_date = :h_biz_date;
@ -88,5 +88,6 @@ long ac_io_0013_total(const char *biz_date)
TX_DBIO_LOG_ERR("ac_io_0013_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int ac_io_0014_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0014_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select req_amt from ac_io_0014_t where mcht_no = $1 and status_cd = '00' and cancel_yn = 'N'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0014.pgc"
#line 31 "app/dbio/ac_io_0014.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0014_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0014.pgc"
#line 46 "app/dbio/ac_io_0014.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0014.pgc"
#line 47 "app/dbio/ac_io_0014.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0014.pgc"
#line 48 "app/dbio/ac_io_0014.pgc"
if (!key)
@ -150,20 +150,31 @@ int ac_io_0014_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0014_bal_t set bal_amt = $1 , upd_ts = now ( ) where acct_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0014.pgc"
#line 59 "app/dbio/ac_io_0014.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0014_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0014_bal_t ( acct_no , bal_amt , upd_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 67 "app/dbio/ac_io_0014.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0014_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -172,14 +183,18 @@ long ac_io_0014_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0014.pgc"
#line 79 "app/dbio/ac_io_0014.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0014.pgc"
long h_sum ;
#line 80 "app/dbio/ac_io_0014.pgc"
long h_avg ;
#line 81 "app/dbio/ac_io_0014.pgc"
short h_ind ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0014.pgc"
#line 82 "app/dbio/ac_io_0014.pgc"
if (!biz_date)
@ -188,17 +203,20 @@ long ac_io_0014_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0014_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select avg ( appr_amt ) from ac_io_0014_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0014.pgc"
ECPGt_long,&(h_avg),(long)1,(long)1,sizeof(long),
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 93 "app/dbio/ac_io_0014.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0014_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -24,10 +24,11 @@ int ac_io_0014_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT req_amt
INTO :h_amount
FROM ac_io_0014_t
WHERE key = :h_key;
WHERE mcht_no = :h_key AND status_cd = '00'
AND cancel_yn = 'N';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,16 +54,22 @@ int ac_io_0014_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0014_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE ac_io_0014_bal_t
SET bal_amt = :h_amount, upd_ts = now()
WHERE acct_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0014_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
EXEC SQL INSERT INTO ac_io_0014_bal_t (acct_no, bal_amt, upd_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0014_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -70,7 +77,8 @@ long ac_io_0014_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_avg;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +87,17 @@ long ac_io_0014_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0014_t
EXEC SQL SELECT avg(appr_amt)
INTO :h_avg :h_ind
FROM ac_io_0014_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0014_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -94,14 +94,18 @@ int ac_io_0015_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0015.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0015.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/ac_io_0015.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/ac_io_0015.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int ac_io_0015_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0015_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select max ( appr_amt ) from ac_io_0015_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0015.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/ac_io_0015.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int ac_io_0015_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0015_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int ac_io_0015_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0015.pgc"
#line 48 "app/dbio/ac_io_0015.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0015.pgc"
#line 49 "app/dbio/ac_io_0015.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0015.pgc"
#line 50 "app/dbio/ac_io_0015.pgc"
if (!key)
@ -150,12 +156,10 @@ int ac_io_0015_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from ac_io_0015_tmp_t where ref_key = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0015.pgc"
#line 60 "app/dbio/ac_io_0015.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +177,13 @@ long ac_io_0015_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0015.pgc"
#line 74 "app/dbio/ac_io_0015.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0015.pgc"
#line 75 "app/dbio/ac_io_0015.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0015.pgc"
#line 76 "app/dbio/ac_io_0015.pgc"
if (!biz_date)
@ -188,17 +192,20 @@ long ac_io_0015_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0015_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( net_amt ) , 0 ) from ac_io_0015_t where biz_date = $1 group by biz_date having sum ( net_amt ) > 0 limit 1",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0015.pgc"
#line 90 "app/dbio/ac_io_0015.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0015_total");
return -1;
}
return h_sum;
}

View file

@ -16,6 +16,7 @@ int ac_io_0015_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int ac_io_0015_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0015_t
WHERE key = :h_key;
EXEC SQL SELECT max(appr_amt)
INTO :h_amount :h_ind
FROM ac_io_0015_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int ac_io_0015_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0015_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -53,9 +56,8 @@ int ac_io_0015_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0015_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM ac_io_0015_tmp_t
WHERE ref_key = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0015_touch");
@ -79,14 +81,20 @@ long ac_io_0015_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(net_amt), 0)
INTO :h_sum
FROM ac_io_0015_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
GROUP BY biz_date
HAVING sum(net_amt) > 0
LIMIT 1;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0015_total");
return -1;
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int ac_io_0016_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0016_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select net_amt from ac_io_0016_t where mcht_no in ( select mcht_no from ac_io_0016_map_t where grp_key = $1 )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0016.pgc"
#line 31 "app/dbio/ac_io_0016.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0016_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0016.pgc"
#line 46 "app/dbio/ac_io_0016.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0016.pgc"
#line 47 "app/dbio/ac_io_0016.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0016.pgc"
#line 48 "app/dbio/ac_io_0016.pgc"
if (!key)
@ -150,12 +150,14 @@ int ac_io_0016_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0016_t set fee_amt = $1 , vat_amt = $2 / 10 , upd_ts = now ( ) where mcht_no = $3 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0016.pgc"
#line 59 "app/dbio/ac_io_0016.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +174,18 @@ long ac_io_0016_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0016.pgc"
#line 73 "app/dbio/ac_io_0016.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0016.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0016.pgc"
long h_row ;
#line 75 "app/dbio/ac_io_0016.pgc"
long acc = 0 ;
/* exec sql end declare section */
#line 76 "app/dbio/ac_io_0016.pgc"
if (!biz_date)
@ -188,17 +194,42 @@ long ac_io_0016_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0016_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGset_var( 0, ( h_biz_date ), __LINE__);\
/* declare cur_ac_io_0016_t cursor for select net_amt from ac_io_0016_sum_t where biz_date = $1 */
#line 85 "app/dbio/ac_io_0016.pgc"
#line 85 "app/dbio/ac_io_0016.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_io_0016_t cursor for select net_amt from ac_io_0016_sum_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 86 "app/dbio/ac_io_0016.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0016_total");
return -1;
}
return h_sum;
for (;;) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_io_0016_t", ECPGt_EOIT,
ECPGt_long,&(h_row),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 92 "app/dbio/ac_io_0016.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0016_total");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0016_t", ECPGt_EOIT, ECPGt_EORT);}
#line 97 "app/dbio/ac_io_0016.pgc"
return -1;
}
acc += h_row;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0016_t", ECPGt_EOIT, ECPGt_EORT);}
#line 102 "app/dbio/ac_io_0016.pgc"
return acc;
}

View file

@ -24,10 +24,11 @@ int ac_io_0016_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT net_amt
INTO :h_amount
FROM ac_io_0016_t
WHERE key = :h_key;
WHERE mcht_no IN
(SELECT mcht_no FROM ac_io_0016_map_t WHERE grp_key = :h_key);
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,8 @@ int ac_io_0016_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0016_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET fee_amt = :h_amount, vat_amt = :h_amount / 10, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0016_touch");
@ -70,7 +71,8 @@ long ac_io_0016_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_row;
long acc = 0;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +81,26 @@ long ac_io_0016_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0016_t
WHERE biz_date = :h_biz_date;
EXEC SQL DECLARE cur_ac_io_0016_t CURSOR FOR
SELECT net_amt FROM ac_io_0016_sum_t WHERE biz_date = :h_biz_date;
EXEC SQL OPEN cur_ac_io_0016_t;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0016_total");
return -1;
}
return h_sum;
for (;;) {
EXEC SQL FETCH cur_ac_io_0016_t INTO :h_row;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0016_total");
EXEC SQL CLOSE cur_ac_io_0016_t;
return -1;
}
acc += h_row;
}
EXEC SQL CLOSE cur_ac_io_0016_t;
return acc;
}

View file

@ -110,20 +110,43 @@ int ac_io_0017_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0017_t where key = $1 ",
ECPGset_var( 0, ( h_key ), __LINE__);\
/* declare cur_ac_io_0017_f cursor for select appr_amt from ac_io_0017_dtl_t where mcht_no = $1 order by seq desc */
#line 29 "app/dbio/ac_io_0017.pgc"
#line 29 "app/dbio/ac_io_0017.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_io_0017_f cursor for select appr_amt from ac_io_0017_dtl_t where mcht_no = $1 order by seq desc",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0017.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_fetch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_io_0017_f", ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 35 "app/dbio/ac_io_0017.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0017_f", ECPGt_EOIT, ECPGt_EORT);}
#line 37 "app/dbio/ac_io_0017.pgc"
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0017_f", ECPGt_EOIT, ECPGt_EORT);}
#line 42 "app/dbio/ac_io_0017.pgc"
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0017_f", ECPGt_EOIT, ECPGt_EORT);}
#line 45 "app/dbio/ac_io_0017.pgc"
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +157,13 @@ int ac_io_0017_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0017.pgc"
#line 54 "app/dbio/ac_io_0017.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0017.pgc"
#line 55 "app/dbio/ac_io_0017.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0017.pgc"
#line 56 "app/dbio/ac_io_0017.pgc"
if (!key)
@ -150,12 +173,12 @@ int ac_io_0017_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0017_t set status_cd = case when $1 > 0 then '00' else '99' end , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0017.pgc"
#line 68 "app/dbio/ac_io_0017.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +195,18 @@ long ac_io_0017_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0017.pgc"
#line 82 "app/dbio/ac_io_0017.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0017.pgc"
long h_sum ;
#line 83 "app/dbio/ac_io_0017.pgc"
long h_max ;
#line 84 "app/dbio/ac_io_0017.pgc"
long h_min ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0017.pgc"
#line 85 "app/dbio/ac_io_0017.pgc"
if (!biz_date)
@ -188,17 +215,20 @@ long ac_io_0017_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0017_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( max ( appr_amt ) , 0 ) , coalesce ( min ( appr_amt ) , 0 ) from ac_io_0017_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_max),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_min),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0017.pgc"
#line 96 "app/dbio/ac_io_0017.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -24,17 +24,26 @@ int ac_io_0017_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0017_t
WHERE key = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
EXEC SQL DECLARE cur_ac_io_0017_f CURSOR FOR
SELECT appr_amt FROM ac_io_0017_dtl_t
WHERE mcht_no = :h_key ORDER BY seq DESC;
EXEC SQL OPEN cur_ac_io_0017_f;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_fetch");
return TX_EDB;
}
EXEC SQL FETCH cur_ac_io_0017_f INTO :h_amount;
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
EXEC SQL CLOSE cur_ac_io_0017_f;
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_fetch");
EXEC SQL CLOSE cur_ac_io_0017_f;
return TX_EDB;
}
EXEC SQL CLOSE cur_ac_io_0017_f;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +63,9 @@ int ac_io_0017_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0017_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET status_cd = CASE WHEN :h_amount > 0 THEN '00' ELSE '99' END,
upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_touch");
@ -70,7 +80,8 @@ long ac_io_0017_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_max;
long h_min;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +90,15 @@ long ac_io_0017_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0017_t
EXEC SQL SELECT coalesce(max(appr_amt), 0), coalesce(min(appr_amt), 0)
INTO :h_max, :h_min
FROM ac_io_0017_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0017_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -110,12 +110,12 @@ int ac_io_0018_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0018_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select case when status_cd = '00' then appr_amt else 0 end from ac_io_0018_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0018.pgc"
#line 31 "app/dbio/ac_io_0018.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0018_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0018.pgc"
#line 46 "app/dbio/ac_io_0018.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0018.pgc"
#line 47 "app/dbio/ac_io_0018.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0018.pgc"
#line 48 "app/dbio/ac_io_0018.pgc"
if (!key)
@ -150,12 +150,12 @@ int ac_io_0018_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0018_acc_t set accum_amt = accum_amt + $1 , cnt = cnt + 1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0018.pgc"
#line 59 "app/dbio/ac_io_0018.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long ac_io_0018_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0018.pgc"
#line 73 "app/dbio/ac_io_0018.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0018.pgc"
#line 74 "app/dbio/ac_io_0018.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0018.pgc"
#line 75 "app/dbio/ac_io_0018.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long ac_io_0018_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0018_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( d . appr_amt ) , 0 ) from ac_io_0018_dtl_t d join ac_io_0018_t h on h . mcht_no = d . mcht_no where d . biz_date = $1 and h . status_cd = '00'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0018.pgc"
#line 87 "app/dbio/ac_io_0018.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long ac_io_0018_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int ac_io_0018_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT
CASE WHEN status_cd = '00' THEN appr_amt ELSE 0 END
INTO :h_amount
FROM ac_io_0018_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,9 @@ int ac_io_0018_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0018_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE ac_io_0018_acc_t
SET accum_amt = accum_amt + :h_amount, cnt = cnt + 1, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0018_touch");
@ -79,10 +80,11 @@ long ac_io_0018_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(d.appr_amt), 0)
INTO :h_sum
FROM ac_io_0018_t
WHERE biz_date = :h_biz_date;
FROM ac_io_0018_dtl_t d
JOIN ac_io_0018_t h ON h.mcht_no = d.mcht_no
WHERE d.biz_date = :h_biz_date AND h.status_cd = '00';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0018_total");
@ -90,3 +92,4 @@ long ac_io_0018_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,7 +110,7 @@ int ac_io_0019_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0019_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt from ac_io_0019_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
@ -150,12 +150,12 @@ int ac_io_0019_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from ac_io_0019_bal_t where acct_no = $1 and bal_amt <= $2 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0019.pgc"
#line 57 "app/dbio/ac_io_0019.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long ac_io_0019_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0019.pgc"
#line 71 "app/dbio/ac_io_0019.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0019.pgc"
long h_sum ;
#line 72 "app/dbio/ac_io_0019.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0019.pgc"
#line 73 "app/dbio/ac_io_0019.pgc"
if (!biz_date)
@ -188,17 +188,18 @@ long ac_io_0019_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0019_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( distinct mcht_no ) from ac_io_0019_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0019.pgc"
#line 84 "app/dbio/ac_io_0019.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0019_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -24,10 +24,10 @@ int ac_io_0019_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT appr_amt
INTO :h_amount
FROM ac_io_0019_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +53,8 @@ int ac_io_0019_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0019_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM ac_io_0019_bal_t
WHERE acct_no = :h_key AND bal_amt <= :h_amount;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0019_touch");
@ -70,7 +69,7 @@ long ac_io_0019_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +78,15 @@ long ac_io_0019_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0019_t
EXEC SQL SELECT count(DISTINCT mcht_no)
INTO :h_cnt
FROM ac_io_0019_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0019_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -94,14 +94,22 @@ int ac_io_0020_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0020.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0020.pgc"
long h_amount ;
/* exec sql end declare section */
long h_appr ;
#line 19 "app/dbio/ac_io_0020.pgc"
long h_fee ;
#line 20 "app/dbio/ac_io_0020.pgc"
long h_vat ;
/* exec sql end declare section */
#line 21 "app/dbio/ac_io_0020.pgc"
if (!key || !out_amount)
@ -110,12 +118,16 @@ int ac_io_0020_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0020_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt , fee_amt , vat_amt from ac_io_0020_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_appr),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_vat),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0020.pgc"
#line 32 "app/dbio/ac_io_0020.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,7 +136,7 @@ int ac_io_0020_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0020_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -134,13 +146,13 @@ int ac_io_0020_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0020.pgc"
#line 47 "app/dbio/ac_io_0020.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0020.pgc"
#line 48 "app/dbio/ac_io_0020.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0020.pgc"
#line 49 "app/dbio/ac_io_0020.pgc"
if (!key)
@ -150,20 +162,29 @@ int ac_io_0020_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0020_t set req_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0020.pgc"
#line 60 "app/dbio/ac_io_0020.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0020_touch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0020_hist_t ( mcht_no , req_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 66 "app/dbio/ac_io_0020.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0020_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -173,13 +194,13 @@ long ac_io_0020_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0020.pgc"
#line 78 "app/dbio/ac_io_0020.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0020.pgc"
#line 79 "app/dbio/ac_io_0020.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0020.pgc"
#line 80 "app/dbio/ac_io_0020.pgc"
if (!biz_date)
@ -188,12 +209,12 @@ long ac_io_0020_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0020_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( cancel_amt ) , 0 ) from ac_io_0020_t where biz_date = $1 and status_cd = '90' and cancel_yn = 'Y'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0020.pgc"
#line 92 "app/dbio/ac_io_0020.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +223,4 @@ long ac_io_0020_total(const char *biz_date)
}
return h_sum;
}

View file

@ -15,7 +15,9 @@ int ac_io_0020_fetch(const char *key, long *out_amount)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
long h_appr;
long h_fee;
long h_vat;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +26,10 @@ int ac_io_0020_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0020_t
WHERE key = :h_key;
EXEC SQL SELECT appr_amt, fee_amt, vat_amt
INTO :h_appr, :h_fee, :h_vat
FROM ac_io_0020_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,7 +37,7 @@ int ac_io_0020_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0020_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -54,15 +56,19 @@ int ac_io_0020_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0020_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET req_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0020_touch");
return TX_EDB;
}
EXEC SQL INSERT INTO ac_io_0020_hist_t (mcht_no, req_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0020_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -79,10 +85,11 @@ long ac_io_0020_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(cancel_amt), 0)
INTO :h_sum
FROM ac_io_0020_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
AND status_cd = '90' AND cancel_yn = 'Y';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0020_total");
@ -90,3 +97,4 @@ long ac_io_0020_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int ac_io_0021_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0021_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select h . net_amt from ac_io_0021_t h join ac_io_0021_map_t m on m . mcht_no = h . mcht_no where h . mcht_no = $1 and m . use_yn = 'Y'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0021.pgc"
#line 31 "app/dbio/ac_io_0021.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0021_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0021.pgc"
#line 46 "app/dbio/ac_io_0021.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0021.pgc"
#line 47 "app/dbio/ac_io_0021.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0021.pgc"
#line 48 "app/dbio/ac_io_0021.pgc"
if (!key)
@ -150,12 +150,12 @@ int ac_io_0021_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0021_t set appr_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0021.pgc"
#line 59 "app/dbio/ac_io_0021.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long ac_io_0021_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0021.pgc"
#line 73 "app/dbio/ac_io_0021.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0021.pgc"
#line 74 "app/dbio/ac_io_0021.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0021.pgc"
#line 75 "app/dbio/ac_io_0021.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long ac_io_0021_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0021_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( recon_amt ) , 0 ) from ac_io_0021_sum_t where biz_date in ( select biz_date from ac_io_0021_map_t where biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0021.pgc"
#line 87 "app/dbio/ac_io_0021.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long ac_io_0021_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int ac_io_0021_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT h.net_amt
INTO :h_amount
FROM ac_io_0021_t
WHERE key = :h_key;
FROM ac_io_0021_t h
JOIN ac_io_0021_map_t m ON m.mcht_no = h.mcht_no
WHERE h.mcht_no = :h_key AND m.use_yn = 'Y';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,8 @@ int ac_io_0021_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0021_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET appr_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0021_touch");
@ -79,10 +80,11 @@ long ac_io_0021_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(recon_amt), 0)
INTO :h_sum
FROM ac_io_0021_t
WHERE biz_date = :h_biz_date;
FROM ac_io_0021_sum_t
WHERE biz_date IN
(SELECT biz_date FROM ac_io_0021_map_t WHERE biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0021_total");
@ -90,3 +92,4 @@ long ac_io_0021_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,18 @@ int ac_io_0022_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0022.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0022.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/ac_io_0022.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/ac_io_0022.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int ac_io_0022_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0022_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select bal_amt from ac_io_0022_bal_t where acct_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0022.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/ac_io_0022.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int ac_io_0022_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0022_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int ac_io_0022_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0022.pgc"
#line 48 "app/dbio/ac_io_0022.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0022.pgc"
#line 49 "app/dbio/ac_io_0022.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0022.pgc"
#line 50 "app/dbio/ac_io_0022.pgc"
if (!key)
@ -150,12 +156,12 @@ int ac_io_0022_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0022_t set net_amt = $1 , upd_ts = now ( ) where mcht_no = $2 and status_cd = '00' and appr_amt > 0",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0022.pgc"
#line 61 "app/dbio/ac_io_0022.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +179,13 @@ long ac_io_0022_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0022.pgc"
#line 75 "app/dbio/ac_io_0022.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0022.pgc"
long h_sum ;
#line 76 "app/dbio/ac_io_0022.pgc"
long h_flag ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0022.pgc"
#line 77 "app/dbio/ac_io_0022.pgc"
if (!biz_date)
@ -188,17 +194,18 @@ long ac_io_0022_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0022_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from ac_io_0022_t where exists ( select 1 from ac_io_0022_dtl_t d where d . biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_flag),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0022.pgc"
#line 90 "app/dbio/ac_io_0022.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0022_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -16,6 +16,7 @@ int ac_io_0022_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int ac_io_0022_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0022_t
WHERE key = :h_key;
EXEC SQL SELECT bal_amt
INTO :h_amount :h_ind
FROM ac_io_0022_bal_t
WHERE acct_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int ac_io_0022_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0022_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +57,8 @@ int ac_io_0022_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0022_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET net_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key AND status_cd = '00' AND appr_amt > 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0022_touch");
@ -70,7 +73,7 @@ long ac_io_0022_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_flag;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +82,17 @@ long ac_io_0022_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_flag
FROM ac_io_0022_t
WHERE biz_date = :h_biz_date;
WHERE EXISTS
(SELECT 1 FROM ac_io_0022_dtl_t d
WHERE d.biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0022_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -110,12 +110,12 @@ int ac_io_0023_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0023_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select req_amt from ac_io_0023_t where mcht_no = $1 and status_cd = '00' and cancel_yn = 'N'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0023.pgc"
#line 31 "app/dbio/ac_io_0023.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0023_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0023.pgc"
#line 46 "app/dbio/ac_io_0023.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0023.pgc"
#line 47 "app/dbio/ac_io_0023.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0023.pgc"
#line 48 "app/dbio/ac_io_0023.pgc"
if (!key)
@ -150,10 +150,10 @@ int ac_io_0023_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0023_log_t ( mcht_no , appr_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0023.pgc"
@ -162,8 +162,6 @@ int ac_io_0023_touch(const char *key, long amount)
TX_DBIO_LOG_ERR("ac_io_0023_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -173,13 +171,13 @@ long ac_io_0023_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0023.pgc"
#line 70 "app/dbio/ac_io_0023.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0023.pgc"
#line 71 "app/dbio/ac_io_0023.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0023.pgc"
#line 72 "app/dbio/ac_io_0023.pgc"
if (!biz_date)
@ -188,12 +186,12 @@ long ac_io_0023_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0023_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( appr_amt ) , 0 ) from ac_io_0023_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0023.pgc"
#line 83 "app/dbio/ac_io_0023.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +200,4 @@ long ac_io_0023_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int ac_io_0023_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT req_amt
INTO :h_amount
FROM ac_io_0023_t
WHERE key = :h_key;
WHERE mcht_no = :h_key AND status_cd = '00'
AND cancel_yn = 'N';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,16 +54,13 @@ int ac_io_0023_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0023_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL INSERT INTO ac_io_0023_log_t (mcht_no, appr_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0023_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -79,7 +77,7 @@ long ac_io_0023_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(appr_amt), 0)
INTO :h_sum
FROM ac_io_0023_t
WHERE biz_date = :h_biz_date;
@ -90,3 +88,4 @@ long ac_io_0023_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,18 @@ int ac_io_0024_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/ac_io_0024.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/ac_io_0024.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/ac_io_0024.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/ac_io_0024.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int ac_io_0024_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0024_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select max ( appr_amt ) from ac_io_0024_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0024.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/ac_io_0024.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int ac_io_0024_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0024_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int ac_io_0024_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0024.pgc"
#line 48 "app/dbio/ac_io_0024.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0024.pgc"
#line 49 "app/dbio/ac_io_0024.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0024.pgc"
#line 50 "app/dbio/ac_io_0024.pgc"
if (!key)
@ -150,20 +156,31 @@ int ac_io_0024_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0024_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0024_bal_t set bal_amt = $1 , upd_ts = now ( ) where acct_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0024.pgc"
#line 61 "app/dbio/ac_io_0024.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0024_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into ac_io_0024_bal_t ( acct_no , bal_amt , upd_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 69 "app/dbio/ac_io_0024.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0024_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -173,13 +190,13 @@ long ac_io_0024_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0024.pgc"
#line 81 "app/dbio/ac_io_0024.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0024.pgc"
long h_sum ;
#line 82 "app/dbio/ac_io_0024.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0024.pgc"
#line 83 "app/dbio/ac_io_0024.pgc"
if (!biz_date)
@ -188,17 +205,18 @@ long ac_io_0024_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0024_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from ac_io_0024_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0024.pgc"
#line 94 "app/dbio/ac_io_0024.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0024_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -16,6 +16,7 @@ int ac_io_0024_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int ac_io_0024_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0024_t
WHERE key = :h_key;
EXEC SQL SELECT max(appr_amt)
INTO :h_amount :h_ind
FROM ac_io_0024_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int ac_io_0024_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("ac_io_0024_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -53,16 +56,22 @@ int ac_io_0024_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0024_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE ac_io_0024_bal_t
SET bal_amt = :h_amount, upd_ts = now()
WHERE acct_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0024_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
EXEC SQL INSERT INTO ac_io_0024_bal_t (acct_no, bal_amt, upd_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0024_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -70,7 +79,7 @@ long ac_io_0024_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,8 +88,8 @@ long ac_io_0024_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_cnt
FROM ac_io_0024_t
WHERE biz_date = :h_biz_date;
@ -88,5 +97,6 @@ long ac_io_0024_total(const char *biz_date)
TX_DBIO_LOG_ERR("ac_io_0024_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int ac_io_0025_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0025_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select net_amt from ac_io_0025_t where mcht_no in ( select mcht_no from ac_io_0025_map_t where grp_key = $1 )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0025.pgc"
#line 31 "app/dbio/ac_io_0025.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0025_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0025.pgc"
#line 46 "app/dbio/ac_io_0025.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0025.pgc"
#line 47 "app/dbio/ac_io_0025.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0025.pgc"
#line 48 "app/dbio/ac_io_0025.pgc"
if (!key)
@ -150,9 +150,7 @@ int ac_io_0025_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0025_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from ac_io_0025_tmp_t where ref_key = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0025.pgc"
@ -172,14 +170,18 @@ long ac_io_0025_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0025.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0025.pgc"
long h_sum ;
/* exec sql end declare section */
long h_avg ;
#line 74 "app/dbio/ac_io_0025.pgc"
short h_ind ;
/* exec sql end declare section */
#line 75 "app/dbio/ac_io_0025.pgc"
if (!biz_date)
@ -188,17 +190,20 @@ long ac_io_0025_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0025_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select avg ( appr_amt ) from ac_io_0025_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0025.pgc"
ECPGt_long,&(h_avg),(long)1,(long)1,sizeof(long),
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 86 "app/dbio/ac_io_0025.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0025_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -24,10 +24,11 @@ int ac_io_0025_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT net_amt
INTO :h_amount
FROM ac_io_0025_t
WHERE key = :h_key;
WHERE mcht_no IN
(SELECT mcht_no FROM ac_io_0025_map_t WHERE grp_key = :h_key);
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,8 @@ int ac_io_0025_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE ac_io_0025_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM ac_io_0025_tmp_t
WHERE ref_key = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0025_touch");
@ -70,7 +70,8 @@ long ac_io_0025_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_avg;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +80,17 @@ long ac_io_0025_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0025_t
EXEC SQL SELECT avg(appr_amt)
INTO :h_avg :h_ind
FROM ac_io_0025_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0025_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -110,20 +110,43 @@ int ac_io_0026_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0026_t where key = $1 ",
ECPGset_var( 0, ( h_key ), __LINE__);\
/* declare cur_ac_io_0026_f cursor for select appr_amt from ac_io_0026_dtl_t where mcht_no = $1 order by seq desc */
#line 29 "app/dbio/ac_io_0026.pgc"
#line 29 "app/dbio/ac_io_0026.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_io_0026_f cursor for select appr_amt from ac_io_0026_dtl_t where mcht_no = $1 order by seq desc",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0026.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_fetch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_io_0026_f", ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 35 "app/dbio/ac_io_0026.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0026_f", ECPGt_EOIT, ECPGt_EORT);}
#line 37 "app/dbio/ac_io_0026.pgc"
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0026_f", ECPGt_EOIT, ECPGt_EORT);}
#line 42 "app/dbio/ac_io_0026.pgc"
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0026_f", ECPGt_EOIT, ECPGt_EORT);}
#line 45 "app/dbio/ac_io_0026.pgc"
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +157,13 @@ int ac_io_0026_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0026.pgc"
#line 54 "app/dbio/ac_io_0026.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0026.pgc"
#line 55 "app/dbio/ac_io_0026.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0026.pgc"
#line 56 "app/dbio/ac_io_0026.pgc"
if (!key)
@ -150,12 +173,14 @@ int ac_io_0026_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0026_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0026_t set fee_amt = $1 , vat_amt = $2 / 10 , upd_ts = now ( ) where mcht_no = $3 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0026.pgc"
#line 67 "app/dbio/ac_io_0026.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +198,13 @@ long ac_io_0026_total(const char *biz_date)
#line 72 "app/dbio/ac_io_0026.pgc"
#line 81 "app/dbio/ac_io_0026.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0026.pgc"
#line 82 "app/dbio/ac_io_0026.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0026.pgc"
#line 83 "app/dbio/ac_io_0026.pgc"
if (!biz_date)
@ -188,17 +213,20 @@ long ac_io_0026_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0026_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( net_amt ) , 0 ) from ac_io_0026_t where biz_date = $1 group by biz_date having sum ( net_amt ) > 0 limit 1",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0026.pgc"
#line 97 "app/dbio/ac_io_0026.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_total");
return -1;
}
return h_sum;
}

View file

@ -24,17 +24,26 @@ int ac_io_0026_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM ac_io_0026_t
WHERE key = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
EXEC SQL DECLARE cur_ac_io_0026_f CURSOR FOR
SELECT appr_amt FROM ac_io_0026_dtl_t
WHERE mcht_no = :h_key ORDER BY seq DESC;
EXEC SQL OPEN cur_ac_io_0026_f;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_fetch");
return TX_EDB;
}
EXEC SQL FETCH cur_ac_io_0026_f INTO :h_amount;
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
EXEC SQL CLOSE cur_ac_io_0026_f;
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_fetch");
EXEC SQL CLOSE cur_ac_io_0026_f;
return TX_EDB;
}
EXEC SQL CLOSE cur_ac_io_0026_f;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +63,8 @@ int ac_io_0026_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0026_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET fee_amt = :h_amount, vat_amt = :h_amount / 10, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_touch");
@ -79,14 +88,20 @@ long ac_io_0026_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(net_amt), 0)
INTO :h_sum
FROM ac_io_0026_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
GROUP BY biz_date
HAVING sum(net_amt) > 0
LIMIT 1;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0026_total");
return -1;
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int ac_io_0027_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from ac_io_0027_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select case when status_cd = '00' then appr_amt else 0 end from ac_io_0027_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/ac_io_0027.pgc"
#line 31 "app/dbio/ac_io_0027.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int ac_io_0027_touch(const char *key, long amount)
#line 45 "app/dbio/ac_io_0027.pgc"
#line 46 "app/dbio/ac_io_0027.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/ac_io_0027.pgc"
#line 47 "app/dbio/ac_io_0027.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/ac_io_0027.pgc"
#line 48 "app/dbio/ac_io_0027.pgc"
if (!key)
@ -150,12 +150,12 @@ int ac_io_0027_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0027_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update ac_io_0027_t set status_cd = case when $1 > 0 then '00' else '99' end , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/ac_io_0027.pgc"
#line 60 "app/dbio/ac_io_0027.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +172,18 @@ long ac_io_0027_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/ac_io_0027.pgc"
#line 74 "app/dbio/ac_io_0027.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/ac_io_0027.pgc"
long h_sum ;
#line 75 "app/dbio/ac_io_0027.pgc"
long h_row ;
#line 76 "app/dbio/ac_io_0027.pgc"
long acc = 0 ;
/* exec sql end declare section */
#line 74 "app/dbio/ac_io_0027.pgc"
#line 77 "app/dbio/ac_io_0027.pgc"
if (!biz_date)
@ -188,17 +192,42 @@ long ac_io_0027_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from ac_io_0027_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/ac_io_0027.pgc"
ECPGset_var( 0, ( h_biz_date ), __LINE__);\
/* declare cur_ac_io_0027_t cursor for select net_amt from ac_io_0027_sum_t where biz_date = $1 */
#line 86 "app/dbio/ac_io_0027.pgc"
#line 86 "app/dbio/ac_io_0027.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_ac_io_0027_t cursor for select net_amt from ac_io_0027_sum_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 87 "app/dbio/ac_io_0027.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0027_total");
return -1;
}
return h_sum;
for (;;) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_ac_io_0027_t", ECPGt_EOIT,
ECPGt_long,&(h_row),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 93 "app/dbio/ac_io_0027.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0027_total");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0027_t", ECPGt_EOIT, ECPGt_EORT);}
#line 98 "app/dbio/ac_io_0027.pgc"
return -1;
}
acc += h_row;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_ac_io_0027_t", ECPGt_EOIT, ECPGt_EORT);}
#line 103 "app/dbio/ac_io_0027.pgc"
return acc;
}

View file

@ -24,10 +24,11 @@ int ac_io_0027_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT
CASE WHEN status_cd = '00' THEN appr_amt ELSE 0 END
INTO :h_amount
FROM ac_io_0027_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,9 @@ int ac_io_0027_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE ac_io_0027_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET status_cd = CASE WHEN :h_amount > 0 THEN '00' ELSE '99' END,
upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0027_touch");
@ -70,7 +72,8 @@ long ac_io_0027_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_row;
long acc = 0;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +82,26 @@ long ac_io_0027_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM ac_io_0027_t
WHERE biz_date = :h_biz_date;
EXEC SQL DECLARE cur_ac_io_0027_t CURSOR FOR
SELECT net_amt FROM ac_io_0027_sum_t WHERE biz_date = :h_biz_date;
EXEC SQL OPEN cur_ac_io_0027_t;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0027_total");
return -1;
}
return h_sum;
for (;;) {
EXEC SQL FETCH cur_ac_io_0027_t INTO :h_row;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("ac_io_0027_total");
EXEC SQL CLOSE cur_ac_io_0027_t;
return -1;
}
acc += h_row;
}
EXEC SQL CLOSE cur_ac_io_0027_t;
return acc;
}

View file

@ -110,7 +110,7 @@ int au_io_0001_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0001_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt from au_io_0001_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
@ -150,7 +150,7 @@ int au_io_0001_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0001_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0001_t set appr_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
@ -188,7 +188,7 @@ long au_io_0001_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0001_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( appr_amt ) , 0 ) from au_io_0001_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
@ -202,3 +202,4 @@ long au_io_0001_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,10 @@ int au_io_0001_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT appr_amt
INTO :h_amount
FROM au_io_0001_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +54,8 @@ int au_io_0001_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0001_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET appr_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0001_touch");
@ -79,7 +79,7 @@ long au_io_0001_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(appr_amt), 0)
INTO :h_sum
FROM au_io_0001_t
WHERE biz_date = :h_biz_date;
@ -90,3 +90,4 @@ long au_io_0001_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,22 @@ int au_io_0002_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0002.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0002.pgc"
long h_amount ;
/* exec sql end declare section */
long h_appr ;
#line 19 "app/dbio/au_io_0002.pgc"
long h_fee ;
#line 20 "app/dbio/au_io_0002.pgc"
long h_vat ;
/* exec sql end declare section */
#line 21 "app/dbio/au_io_0002.pgc"
if (!key || !out_amount)
@ -110,12 +118,16 @@ int au_io_0002_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0002_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt , fee_amt , vat_amt from au_io_0002_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_appr),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_vat),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0002.pgc"
#line 32 "app/dbio/au_io_0002.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,7 +136,7 @@ int au_io_0002_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0002_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -134,13 +146,13 @@ int au_io_0002_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0002.pgc"
#line 47 "app/dbio/au_io_0002.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0002.pgc"
#line 48 "app/dbio/au_io_0002.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0002.pgc"
#line 49 "app/dbio/au_io_0002.pgc"
if (!key)
@ -150,12 +162,12 @@ int au_io_0002_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0002_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0002_t set net_amt = $1 , upd_ts = now ( ) where mcht_no = $2 and status_cd = '00' and appr_amt > 0",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0002.pgc"
#line 60 "app/dbio/au_io_0002.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +185,13 @@ long au_io_0002_total(const char *biz_date)
#line 72 "app/dbio/au_io_0002.pgc"
#line 74 "app/dbio/au_io_0002.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0002.pgc"
long h_sum ;
#line 75 "app/dbio/au_io_0002.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0002.pgc"
#line 76 "app/dbio/au_io_0002.pgc"
if (!biz_date)
@ -188,17 +200,18 @@ long au_io_0002_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0002_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from au_io_0002_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0002.pgc"
#line 87 "app/dbio/au_io_0002.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0002_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -15,7 +15,9 @@ int au_io_0002_fetch(const char *key, long *out_amount)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
long h_appr;
long h_fee;
long h_vat;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +26,10 @@ int au_io_0002_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0002_t
WHERE key = :h_key;
EXEC SQL SELECT appr_amt, fee_amt, vat_amt
INTO :h_appr, :h_fee, :h_vat
FROM au_io_0002_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,7 +37,7 @@ int au_io_0002_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0002_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -54,8 +56,8 @@ int au_io_0002_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0002_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET net_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key AND status_cd = '00' AND appr_amt > 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0002_touch");
@ -70,7 +72,7 @@ long au_io_0002_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,8 +81,8 @@ long au_io_0002_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_cnt
FROM au_io_0002_t
WHERE biz_date = :h_biz_date;
@ -88,5 +90,6 @@ long au_io_0002_total(const char *biz_date)
TX_DBIO_LOG_ERR("au_io_0002_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int au_io_0003_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0003_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select h . net_amt from au_io_0003_t h join au_io_0003_map_t m on m . mcht_no = h . mcht_no where h . mcht_no = $1 and m . use_yn = 'Y'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0003.pgc"
#line 31 "app/dbio/au_io_0003.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0003_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0003.pgc"
#line 46 "app/dbio/au_io_0003.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0003.pgc"
#line 47 "app/dbio/au_io_0003.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0003.pgc"
#line 48 "app/dbio/au_io_0003.pgc"
if (!key)
@ -150,10 +150,10 @@ int au_io_0003_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0003_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0003_log_t ( mcht_no , appr_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0003.pgc"
@ -162,8 +162,6 @@ int au_io_0003_touch(const char *key, long amount)
TX_DBIO_LOG_ERR("au_io_0003_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -172,14 +170,18 @@ long au_io_0003_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/au_io_0003.pgc"
#line 70 "app/dbio/au_io_0003.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0003.pgc"
long h_sum ;
#line 71 "app/dbio/au_io_0003.pgc"
long h_avg ;
#line 72 "app/dbio/au_io_0003.pgc"
short h_ind ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0003.pgc"
#line 73 "app/dbio/au_io_0003.pgc"
if (!biz_date)
@ -188,17 +190,20 @@ long au_io_0003_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0003_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select avg ( appr_amt ) from au_io_0003_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0003.pgc"
ECPGt_long,&(h_avg),(long)1,(long)1,sizeof(long),
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 84 "app/dbio/au_io_0003.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0003_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -24,10 +24,11 @@ int au_io_0003_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT h.net_amt
INTO :h_amount
FROM au_io_0003_t
WHERE key = :h_key;
FROM au_io_0003_t h
JOIN au_io_0003_map_t m ON m.mcht_no = h.mcht_no
WHERE h.mcht_no = :h_key AND m.use_yn = 'Y';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,16 +54,13 @@ int au_io_0003_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0003_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL INSERT INTO au_io_0003_log_t (mcht_no, appr_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0003_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -70,7 +68,8 @@ long au_io_0003_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_avg;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +78,17 @@ long au_io_0003_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0003_t
EXEC SQL SELECT avg(appr_amt)
INTO :h_avg :h_ind
FROM au_io_0003_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0003_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -94,14 +94,18 @@ int au_io_0004_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0004.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0004.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/au_io_0004.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/au_io_0004.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int au_io_0004_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0004_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select bal_amt from au_io_0004_bal_t where acct_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0004.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/au_io_0004.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int au_io_0004_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0004_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int au_io_0004_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0004.pgc"
#line 48 "app/dbio/au_io_0004.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0004.pgc"
#line 49 "app/dbio/au_io_0004.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0004.pgc"
#line 50 "app/dbio/au_io_0004.pgc"
if (!key)
@ -150,20 +156,31 @@ int au_io_0004_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0004_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0004_bal_t set bal_amt = $1 , upd_ts = now ( ) where acct_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0004.pgc"
#line 61 "app/dbio/au_io_0004.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0004_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0004_bal_t ( acct_no , bal_amt , upd_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 69 "app/dbio/au_io_0004.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0004_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -173,13 +190,13 @@ long au_io_0004_total(const char *biz_date)
#line 72 "app/dbio/au_io_0004.pgc"
#line 81 "app/dbio/au_io_0004.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0004.pgc"
#line 82 "app/dbio/au_io_0004.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0004.pgc"
#line 83 "app/dbio/au_io_0004.pgc"
if (!biz_date)
@ -188,17 +205,20 @@ long au_io_0004_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0004_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( net_amt ) , 0 ) from au_io_0004_t where biz_date = $1 group by biz_date having sum ( net_amt ) > 0 limit 1",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0004.pgc"
#line 97 "app/dbio/au_io_0004.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0004_total");
return -1;
}
return h_sum;
}

View file

@ -16,6 +16,7 @@ int au_io_0004_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int au_io_0004_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0004_t
WHERE key = :h_key;
EXEC SQL SELECT bal_amt
INTO :h_amount :h_ind
FROM au_io_0004_bal_t
WHERE acct_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int au_io_0004_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0004_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -53,16 +56,22 @@ int au_io_0004_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0004_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE au_io_0004_bal_t
SET bal_amt = :h_amount, upd_ts = now()
WHERE acct_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0004_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
EXEC SQL INSERT INTO au_io_0004_bal_t (acct_no, bal_amt, upd_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0004_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -79,14 +88,20 @@ long au_io_0004_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(net_amt), 0)
INTO :h_sum
FROM au_io_0004_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
GROUP BY biz_date
HAVING sum(net_amt) > 0
LIMIT 1;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0004_total");
return -1;
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int au_io_0005_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0005_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select req_amt from au_io_0005_t where mcht_no = $1 and status_cd = '00' and cancel_yn = 'N'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0005.pgc"
#line 31 "app/dbio/au_io_0005.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0005_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0005.pgc"
#line 46 "app/dbio/au_io_0005.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0005.pgc"
#line 47 "app/dbio/au_io_0005.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0005.pgc"
#line 48 "app/dbio/au_io_0005.pgc"
if (!key)
@ -150,9 +150,7 @@ int au_io_0005_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0005_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from au_io_0005_tmp_t where ref_key = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0005.pgc"
@ -172,14 +170,18 @@ long au_io_0005_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/au_io_0005.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0005.pgc"
long h_sum ;
/* exec sql end declare section */
long h_row ;
#line 74 "app/dbio/au_io_0005.pgc"
long acc = 0 ;
/* exec sql end declare section */
#line 75 "app/dbio/au_io_0005.pgc"
if (!biz_date)
@ -188,17 +190,42 @@ long au_io_0005_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0005_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0005.pgc"
ECPGset_var( 0, ( h_biz_date ), __LINE__);\
/* declare cur_au_io_0005_t cursor for select net_amt from au_io_0005_sum_t where biz_date = $1 */
#line 84 "app/dbio/au_io_0005.pgc"
#line 84 "app/dbio/au_io_0005.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_io_0005_t cursor for select net_amt from au_io_0005_sum_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0005.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0005_total");
return -1;
}
return h_sum;
for (;;) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_io_0005_t", ECPGt_EOIT,
ECPGt_long,&(h_row),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 91 "app/dbio/au_io_0005.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0005_total");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0005_t", ECPGt_EOIT, ECPGt_EORT);}
#line 96 "app/dbio/au_io_0005.pgc"
return -1;
}
acc += h_row;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0005_t", ECPGt_EOIT, ECPGt_EORT);}
#line 101 "app/dbio/au_io_0005.pgc"
return acc;
}

View file

@ -24,10 +24,11 @@ int au_io_0005_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT req_amt
INTO :h_amount
FROM au_io_0005_t
WHERE key = :h_key;
WHERE mcht_no = :h_key AND status_cd = '00'
AND cancel_yn = 'N';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,8 @@ int au_io_0005_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0005_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM au_io_0005_tmp_t
WHERE ref_key = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0005_touch");
@ -70,7 +70,8 @@ long au_io_0005_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_row;
long acc = 0;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +80,26 @@ long au_io_0005_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0005_t
WHERE biz_date = :h_biz_date;
EXEC SQL DECLARE cur_au_io_0005_t CURSOR FOR
SELECT net_amt FROM au_io_0005_sum_t WHERE biz_date = :h_biz_date;
EXEC SQL OPEN cur_au_io_0005_t;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0005_total");
return -1;
}
return h_sum;
for (;;) {
EXEC SQL FETCH cur_au_io_0005_t INTO :h_row;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0005_total");
EXEC SQL CLOSE cur_au_io_0005_t;
return -1;
}
acc += h_row;
}
EXEC SQL CLOSE cur_au_io_0005_t;
return acc;
}

View file

@ -94,14 +94,18 @@ int au_io_0006_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0006.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0006.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/au_io_0006.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/au_io_0006.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int au_io_0006_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0006_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select max ( appr_amt ) from au_io_0006_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0006.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/au_io_0006.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int au_io_0006_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0006_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int au_io_0006_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0006.pgc"
#line 48 "app/dbio/au_io_0006.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0006.pgc"
#line 49 "app/dbio/au_io_0006.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0006.pgc"
#line 50 "app/dbio/au_io_0006.pgc"
if (!key)
@ -150,12 +156,14 @@ int au_io_0006_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0006_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0006_t set fee_amt = $1 , vat_amt = $2 / 10 , upd_ts = now ( ) where mcht_no = $3 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0006.pgc"
#line 61 "app/dbio/au_io_0006.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +180,18 @@ long au_io_0006_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/au_io_0006.pgc"
#line 75 "app/dbio/au_io_0006.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0006.pgc"
long h_sum ;
#line 76 "app/dbio/au_io_0006.pgc"
long h_max ;
#line 77 "app/dbio/au_io_0006.pgc"
long h_min ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0006.pgc"
#line 78 "app/dbio/au_io_0006.pgc"
if (!biz_date)
@ -188,17 +200,20 @@ long au_io_0006_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0006_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( max ( appr_amt ) , 0 ) , coalesce ( min ( appr_amt ) , 0 ) from au_io_0006_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_max),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_min),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0006.pgc"
#line 89 "app/dbio/au_io_0006.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0006_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -16,6 +16,7 @@ int au_io_0006_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int au_io_0006_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0006_t
WHERE key = :h_key;
EXEC SQL SELECT max(appr_amt)
INTO :h_amount :h_ind
FROM au_io_0006_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int au_io_0006_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0006_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +57,8 @@ int au_io_0006_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0006_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET fee_amt = :h_amount, vat_amt = :h_amount / 10, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0006_touch");
@ -70,7 +73,8 @@ long au_io_0006_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_max;
long h_min;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +83,15 @@ long au_io_0006_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0006_t
EXEC SQL SELECT coalesce(max(appr_amt), 0), coalesce(min(appr_amt), 0)
INTO :h_max, :h_min
FROM au_io_0006_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0006_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -110,12 +110,12 @@ int au_io_0007_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0007_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select net_amt from au_io_0007_t where mcht_no in ( select mcht_no from au_io_0007_map_t where grp_key = $1 )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0007.pgc"
#line 31 "app/dbio/au_io_0007.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0007_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0007.pgc"
#line 46 "app/dbio/au_io_0007.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0007.pgc"
#line 47 "app/dbio/au_io_0007.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0007.pgc"
#line 48 "app/dbio/au_io_0007.pgc"
if (!key)
@ -150,12 +150,12 @@ int au_io_0007_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0007_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0007_t set status_cd = case when $1 > 0 then '00' else '99' end , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0007.pgc"
#line 60 "app/dbio/au_io_0007.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long au_io_0007_total(const char *biz_date)
#line 72 "app/dbio/au_io_0007.pgc"
#line 74 "app/dbio/au_io_0007.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0007.pgc"
#line 75 "app/dbio/au_io_0007.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0007.pgc"
#line 76 "app/dbio/au_io_0007.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long au_io_0007_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0007_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( d . appr_amt ) , 0 ) from au_io_0007_dtl_t d join au_io_0007_t h on h . mcht_no = d . mcht_no where d . biz_date = $1 and h . status_cd = '00'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0007.pgc"
#line 88 "app/dbio/au_io_0007.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long au_io_0007_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int au_io_0007_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT net_amt
INTO :h_amount
FROM au_io_0007_t
WHERE key = :h_key;
WHERE mcht_no IN
(SELECT mcht_no FROM au_io_0007_map_t WHERE grp_key = :h_key);
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,9 @@ int au_io_0007_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0007_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET status_cd = CASE WHEN :h_amount > 0 THEN '00' ELSE '99' END,
upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0007_touch");
@ -79,10 +81,11 @@ long au_io_0007_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(d.appr_amt), 0)
INTO :h_sum
FROM au_io_0007_t
WHERE biz_date = :h_biz_date;
FROM au_io_0007_dtl_t d
JOIN au_io_0007_t h ON h.mcht_no = d.mcht_no
WHERE d.biz_date = :h_biz_date AND h.status_cd = '00';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0007_total");
@ -90,3 +93,4 @@ long au_io_0007_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,20 +110,43 @@ int au_io_0008_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0008_t where key = $1 ",
ECPGset_var( 0, ( h_key ), __LINE__);\
/* declare cur_au_io_0008_f cursor for select appr_amt from au_io_0008_dtl_t where mcht_no = $1 order by seq desc */
#line 29 "app/dbio/au_io_0008.pgc"
#line 29 "app/dbio/au_io_0008.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_io_0008_f cursor for select appr_amt from au_io_0008_dtl_t where mcht_no = $1 order by seq desc",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0008.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_fetch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_io_0008_f", ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 35 "app/dbio/au_io_0008.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0008_f", ECPGt_EOIT, ECPGt_EORT);}
#line 37 "app/dbio/au_io_0008.pgc"
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0008_f", ECPGt_EOIT, ECPGt_EORT);}
#line 42 "app/dbio/au_io_0008.pgc"
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0008_f", ECPGt_EOIT, ECPGt_EORT);}
#line 45 "app/dbio/au_io_0008.pgc"
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +157,13 @@ int au_io_0008_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0008.pgc"
#line 54 "app/dbio/au_io_0008.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0008.pgc"
#line 55 "app/dbio/au_io_0008.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0008.pgc"
#line 56 "app/dbio/au_io_0008.pgc"
if (!key)
@ -150,12 +173,12 @@ int au_io_0008_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0008_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0008_acc_t set accum_amt = accum_amt + $1 , cnt = cnt + 1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0008.pgc"
#line 67 "app/dbio/au_io_0008.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +196,13 @@ long au_io_0008_total(const char *biz_date)
#line 72 "app/dbio/au_io_0008.pgc"
#line 81 "app/dbio/au_io_0008.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0008.pgc"
long h_sum ;
#line 82 "app/dbio/au_io_0008.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0008.pgc"
#line 83 "app/dbio/au_io_0008.pgc"
if (!biz_date)
@ -188,17 +211,18 @@ long au_io_0008_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0008_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( distinct mcht_no ) from au_io_0008_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0008.pgc"
#line 94 "app/dbio/au_io_0008.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -24,17 +24,26 @@ int au_io_0008_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0008_t
WHERE key = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
EXEC SQL DECLARE cur_au_io_0008_f CURSOR FOR
SELECT appr_amt FROM au_io_0008_dtl_t
WHERE mcht_no = :h_key ORDER BY seq DESC;
EXEC SQL OPEN cur_au_io_0008_f;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_fetch");
return TX_EDB;
}
EXEC SQL FETCH cur_au_io_0008_f INTO :h_amount;
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
EXEC SQL CLOSE cur_au_io_0008_f;
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_fetch");
EXEC SQL CLOSE cur_au_io_0008_f;
return TX_EDB;
}
EXEC SQL CLOSE cur_au_io_0008_f;
*out_amount = h_amount;
return TX_OK;
}
@ -53,9 +62,9 @@ int au_io_0008_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0008_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE au_io_0008_acc_t
SET accum_amt = accum_amt + :h_amount, cnt = cnt + 1, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_touch");
@ -70,7 +79,7 @@ long au_io_0008_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +88,15 @@ long au_io_0008_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0008_t
EXEC SQL SELECT count(DISTINCT mcht_no)
INTO :h_cnt
FROM au_io_0008_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0008_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int au_io_0009_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0009_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select case when status_cd = '00' then appr_amt else 0 end from au_io_0009_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0009.pgc"
#line 31 "app/dbio/au_io_0009.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0009_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0009.pgc"
#line 46 "app/dbio/au_io_0009.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0009.pgc"
#line 47 "app/dbio/au_io_0009.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0009.pgc"
#line 48 "app/dbio/au_io_0009.pgc"
if (!key)
@ -150,10 +150,10 @@ int au_io_0009_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0009_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from au_io_0009_bal_t where acct_no = $1 and bal_amt <= $2 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0009.pgc"
@ -188,12 +188,12 @@ long au_io_0009_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0009_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( cancel_amt ) , 0 ) from au_io_0009_t where biz_date = $1 and status_cd = '90' and cancel_yn = 'Y'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0009.pgc"
#line 86 "app/dbio/au_io_0009.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long au_io_0009_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int au_io_0009_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT
CASE WHEN status_cd = '00' THEN appr_amt ELSE 0 END
INTO :h_amount
FROM au_io_0009_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,8 @@ int au_io_0009_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0009_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM au_io_0009_bal_t
WHERE acct_no = :h_key AND bal_amt <= :h_amount;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0009_touch");
@ -79,10 +79,11 @@ long au_io_0009_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(cancel_amt), 0)
INTO :h_sum
FROM au_io_0009_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
AND status_cd = '90' AND cancel_yn = 'Y';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0009_total");
@ -90,3 +91,4 @@ long au_io_0009_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,7 +110,7 @@ int au_io_0010_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0010_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt from au_io_0010_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
@ -150,20 +150,29 @@ int au_io_0010_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0010_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0010_t set req_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0010_touch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0010_hist_t ( mcht_no , req_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 64 "app/dbio/au_io_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0010_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -173,13 +182,13 @@ long au_io_0010_total(const char *biz_date)
#line 72 "app/dbio/au_io_0010.pgc"
#line 76 "app/dbio/au_io_0010.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0010.pgc"
#line 77 "app/dbio/au_io_0010.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0010.pgc"
#line 78 "app/dbio/au_io_0010.pgc"
if (!biz_date)
@ -188,12 +197,12 @@ long au_io_0010_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0010_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( recon_amt ) , 0 ) from au_io_0010_sum_t where biz_date in ( select biz_date from au_io_0010_map_t where biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0010.pgc"
#line 90 "app/dbio/au_io_0010.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +211,4 @@ long au_io_0010_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,10 @@ int au_io_0010_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT appr_amt
INTO :h_amount
FROM au_io_0010_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,15 +54,19 @@ int au_io_0010_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0010_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET req_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0010_touch");
return TX_EDB;
}
EXEC SQL INSERT INTO au_io_0010_hist_t (mcht_no, req_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0010_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -79,10 +83,11 @@ long au_io_0010_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(recon_amt), 0)
INTO :h_sum
FROM au_io_0010_t
WHERE biz_date = :h_biz_date;
FROM au_io_0010_sum_t
WHERE biz_date IN
(SELECT biz_date FROM au_io_0010_map_t WHERE biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0010_total");
@ -90,3 +95,4 @@ long au_io_0010_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,22 @@ int au_io_0011_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0011.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0011.pgc"
long h_amount ;
/* exec sql end declare section */
long h_appr ;
#line 19 "app/dbio/au_io_0011.pgc"
long h_fee ;
#line 20 "app/dbio/au_io_0011.pgc"
long h_vat ;
/* exec sql end declare section */
#line 21 "app/dbio/au_io_0011.pgc"
if (!key || !out_amount)
@ -110,12 +118,16 @@ int au_io_0011_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0011_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt , fee_amt , vat_amt from au_io_0011_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_appr),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_vat),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0011.pgc"
#line 32 "app/dbio/au_io_0011.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,7 +136,7 @@ int au_io_0011_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0011_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -134,13 +146,13 @@ int au_io_0011_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0011.pgc"
#line 47 "app/dbio/au_io_0011.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0011.pgc"
#line 48 "app/dbio/au_io_0011.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0011.pgc"
#line 49 "app/dbio/au_io_0011.pgc"
if (!key)
@ -150,12 +162,12 @@ int au_io_0011_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0011_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0011_t set appr_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0011.pgc"
#line 60 "app/dbio/au_io_0011.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +185,13 @@ long au_io_0011_total(const char *biz_date)
#line 72 "app/dbio/au_io_0011.pgc"
#line 74 "app/dbio/au_io_0011.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0011.pgc"
long h_sum ;
#line 75 "app/dbio/au_io_0011.pgc"
long h_flag ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0011.pgc"
#line 76 "app/dbio/au_io_0011.pgc"
if (!biz_date)
@ -188,17 +200,18 @@ long au_io_0011_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0011_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from au_io_0011_t where exists ( select 1 from au_io_0011_dtl_t d where d . biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_flag),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0011.pgc"
#line 89 "app/dbio/au_io_0011.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0011_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -15,7 +15,9 @@ int au_io_0011_fetch(const char *key, long *out_amount)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
long h_appr;
long h_fee;
long h_vat;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +26,10 @@ int au_io_0011_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0011_t
WHERE key = :h_key;
EXEC SQL SELECT appr_amt, fee_amt, vat_amt
INTO :h_appr, :h_fee, :h_vat
FROM au_io_0011_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,7 +37,7 @@ int au_io_0011_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0011_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -54,8 +56,8 @@ int au_io_0011_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0011_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET appr_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0011_touch");
@ -70,7 +72,7 @@ long au_io_0011_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_flag;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +81,17 @@ long au_io_0011_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_flag
FROM au_io_0011_t
WHERE biz_date = :h_biz_date;
WHERE EXISTS
(SELECT 1 FROM au_io_0011_dtl_t d
WHERE d.biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0011_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -110,12 +110,12 @@ int au_io_0012_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0012_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select h . net_amt from au_io_0012_t h join au_io_0012_map_t m on m . mcht_no = h . mcht_no where h . mcht_no = $1 and m . use_yn = 'Y'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0012.pgc"
#line 31 "app/dbio/au_io_0012.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0012_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0012.pgc"
#line 46 "app/dbio/au_io_0012.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0012.pgc"
#line 47 "app/dbio/au_io_0012.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0012.pgc"
#line 48 "app/dbio/au_io_0012.pgc"
if (!key)
@ -150,12 +150,12 @@ int au_io_0012_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0012_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0012_t set net_amt = $1 , upd_ts = now ( ) where mcht_no = $2 and status_cd = '00' and appr_amt > 0",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0012.pgc"
#line 59 "app/dbio/au_io_0012.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long au_io_0012_total(const char *biz_date)
#line 72 "app/dbio/au_io_0012.pgc"
#line 73 "app/dbio/au_io_0012.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0012.pgc"
#line 74 "app/dbio/au_io_0012.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0012.pgc"
#line 75 "app/dbio/au_io_0012.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long au_io_0012_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0012_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( appr_amt ) , 0 ) from au_io_0012_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0012.pgc"
#line 86 "app/dbio/au_io_0012.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long au_io_0012_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int au_io_0012_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT h.net_amt
INTO :h_amount
FROM au_io_0012_t
WHERE key = :h_key;
FROM au_io_0012_t h
JOIN au_io_0012_map_t m ON m.mcht_no = h.mcht_no
WHERE h.mcht_no = :h_key AND m.use_yn = 'Y';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,8 @@ int au_io_0012_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0012_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET net_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key AND status_cd = '00' AND appr_amt > 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0012_touch");
@ -79,7 +80,7 @@ long au_io_0012_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(appr_amt), 0)
INTO :h_sum
FROM au_io_0012_t
WHERE biz_date = :h_biz_date;
@ -90,3 +91,4 @@ long au_io_0012_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,18 @@ int au_io_0013_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0013.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0013.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/au_io_0013.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/au_io_0013.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int au_io_0013_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0013_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select bal_amt from au_io_0013_bal_t where acct_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0013.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/au_io_0013.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int au_io_0013_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0013_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int au_io_0013_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0013.pgc"
#line 48 "app/dbio/au_io_0013.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0013.pgc"
#line 49 "app/dbio/au_io_0013.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0013.pgc"
#line 50 "app/dbio/au_io_0013.pgc"
if (!key)
@ -150,20 +156,18 @@ int au_io_0013_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0013_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0013_log_t ( mcht_no , appr_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0013.pgc"
#line 60 "app/dbio/au_io_0013.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0013_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -177,7 +181,7 @@ long au_io_0013_total(const char *biz_date)
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0013.pgc"
long h_sum ;
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0013.pgc"
@ -188,10 +192,10 @@ long au_io_0013_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0013_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from au_io_0013_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0013.pgc"
@ -200,5 +204,6 @@ long au_io_0013_total(const char *biz_date)
TX_DBIO_LOG_ERR("au_io_0013_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -16,6 +16,7 @@ int au_io_0013_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int au_io_0013_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0013_t
WHERE key = :h_key;
EXEC SQL SELECT bal_amt
INTO :h_amount :h_ind
FROM au_io_0013_bal_t
WHERE acct_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int au_io_0013_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0013_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -53,16 +56,13 @@ int au_io_0013_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0013_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL INSERT INTO au_io_0013_log_t (mcht_no, appr_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0013_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -70,7 +70,7 @@ long au_io_0013_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,8 +79,8 @@ long au_io_0013_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_cnt
FROM au_io_0013_t
WHERE biz_date = :h_biz_date;
@ -88,5 +88,6 @@ long au_io_0013_total(const char *biz_date)
TX_DBIO_LOG_ERR("au_io_0013_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -110,12 +110,12 @@ int au_io_0014_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0014_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select req_amt from au_io_0014_t where mcht_no = $1 and status_cd = '00' and cancel_yn = 'N'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0014.pgc"
#line 31 "app/dbio/au_io_0014.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0014_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0014.pgc"
#line 46 "app/dbio/au_io_0014.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0014.pgc"
#line 47 "app/dbio/au_io_0014.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0014.pgc"
#line 48 "app/dbio/au_io_0014.pgc"
if (!key)
@ -150,20 +150,31 @@ int au_io_0014_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0014_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0014_bal_t set bal_amt = $1 , upd_ts = now ( ) where acct_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0014.pgc"
#line 59 "app/dbio/au_io_0014.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0014_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0014_bal_t ( acct_no , bal_amt , upd_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 67 "app/dbio/au_io_0014.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0014_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -172,14 +183,18 @@ long au_io_0014_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/au_io_0014.pgc"
#line 79 "app/dbio/au_io_0014.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0014.pgc"
long h_sum ;
#line 80 "app/dbio/au_io_0014.pgc"
long h_avg ;
#line 81 "app/dbio/au_io_0014.pgc"
short h_ind ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0014.pgc"
#line 82 "app/dbio/au_io_0014.pgc"
if (!biz_date)
@ -188,17 +203,20 @@ long au_io_0014_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0014_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select avg ( appr_amt ) from au_io_0014_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0014.pgc"
ECPGt_long,&(h_avg),(long)1,(long)1,sizeof(long),
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 93 "app/dbio/au_io_0014.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0014_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -24,10 +24,11 @@ int au_io_0014_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT req_amt
INTO :h_amount
FROM au_io_0014_t
WHERE key = :h_key;
WHERE mcht_no = :h_key AND status_cd = '00'
AND cancel_yn = 'N';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,16 +54,22 @@ int au_io_0014_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0014_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE au_io_0014_bal_t
SET bal_amt = :h_amount, upd_ts = now()
WHERE acct_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0014_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
if (sqlca.sqlerrd[2] == 0) {
EXEC SQL INSERT INTO au_io_0014_bal_t (acct_no, bal_amt, upd_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0014_touch");
return TX_EDB;
}
}
return TX_OK;
}
@ -70,7 +77,8 @@ long au_io_0014_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_avg;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +87,17 @@ long au_io_0014_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0014_t
EXEC SQL SELECT avg(appr_amt)
INTO :h_avg :h_ind
FROM au_io_0014_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0014_total");
return -1;
}
return h_sum;
if (h_ind == -1)
return 0;
return h_avg;
}

View file

@ -94,14 +94,18 @@ int au_io_0015_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0015.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0015.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/au_io_0015.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/au_io_0015.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int au_io_0015_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0015_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select max ( appr_amt ) from au_io_0015_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0015.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/au_io_0015.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int au_io_0015_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0015_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int au_io_0015_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0015.pgc"
#line 48 "app/dbio/au_io_0015.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0015.pgc"
#line 49 "app/dbio/au_io_0015.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0015.pgc"
#line 50 "app/dbio/au_io_0015.pgc"
if (!key)
@ -150,12 +156,10 @@ int au_io_0015_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0015_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from au_io_0015_tmp_t where ref_key = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0015.pgc"
#line 60 "app/dbio/au_io_0015.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +177,13 @@ long au_io_0015_total(const char *biz_date)
#line 72 "app/dbio/au_io_0015.pgc"
#line 74 "app/dbio/au_io_0015.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0015.pgc"
#line 75 "app/dbio/au_io_0015.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0015.pgc"
#line 76 "app/dbio/au_io_0015.pgc"
if (!biz_date)
@ -188,17 +192,20 @@ long au_io_0015_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0015_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( net_amt ) , 0 ) from au_io_0015_t where biz_date = $1 group by biz_date having sum ( net_amt ) > 0 limit 1",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0015.pgc"
#line 90 "app/dbio/au_io_0015.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0015_total");
return -1;
}
return h_sum;
}

View file

@ -16,6 +16,7 @@ int au_io_0015_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int au_io_0015_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0015_t
WHERE key = :h_key;
EXEC SQL SELECT max(appr_amt)
INTO :h_amount :h_ind
FROM au_io_0015_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int au_io_0015_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0015_fetch");
return TX_EDB;
}
if (sqlca.sqlcode == TX_SQL_NOTFOUND || h_ind == -1)
return TX_ENOENT;
*out_amount = h_amount;
return TX_OK;
}
@ -53,9 +56,8 @@ int au_io_0015_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0015_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM au_io_0015_tmp_t
WHERE ref_key = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0015_touch");
@ -79,14 +81,20 @@ long au_io_0015_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(net_amt), 0)
INTO :h_sum
FROM au_io_0015_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
GROUP BY biz_date
HAVING sum(net_amt) > 0
LIMIT 1;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0015_total");
return -1;
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int au_io_0016_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0016_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select net_amt from au_io_0016_t where mcht_no in ( select mcht_no from au_io_0016_map_t where grp_key = $1 )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0016.pgc"
#line 31 "app/dbio/au_io_0016.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0016_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0016.pgc"
#line 46 "app/dbio/au_io_0016.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0016.pgc"
#line 47 "app/dbio/au_io_0016.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0016.pgc"
#line 48 "app/dbio/au_io_0016.pgc"
if (!key)
@ -150,12 +150,14 @@ int au_io_0016_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0016_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0016_t set fee_amt = $1 , vat_amt = $2 / 10 , upd_ts = now ( ) where mcht_no = $3 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0016.pgc"
#line 59 "app/dbio/au_io_0016.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +174,18 @@ long au_io_0016_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/au_io_0016.pgc"
#line 73 "app/dbio/au_io_0016.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0016.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0016.pgc"
long h_row ;
#line 75 "app/dbio/au_io_0016.pgc"
long acc = 0 ;
/* exec sql end declare section */
#line 76 "app/dbio/au_io_0016.pgc"
if (!biz_date)
@ -188,17 +194,42 @@ long au_io_0016_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0016_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGset_var( 0, ( h_biz_date ), __LINE__);\
/* declare cur_au_io_0016_t cursor for select net_amt from au_io_0016_sum_t where biz_date = $1 */
#line 85 "app/dbio/au_io_0016.pgc"
#line 85 "app/dbio/au_io_0016.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_io_0016_t cursor for select net_amt from au_io_0016_sum_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 86 "app/dbio/au_io_0016.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0016_total");
return -1;
}
return h_sum;
for (;;) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_io_0016_t", ECPGt_EOIT,
ECPGt_long,&(h_row),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 92 "app/dbio/au_io_0016.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0016_total");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0016_t", ECPGt_EOIT, ECPGt_EORT);}
#line 97 "app/dbio/au_io_0016.pgc"
return -1;
}
acc += h_row;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0016_t", ECPGt_EOIT, ECPGt_EORT);}
#line 102 "app/dbio/au_io_0016.pgc"
return acc;
}

View file

@ -24,10 +24,11 @@ int au_io_0016_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT net_amt
INTO :h_amount
FROM au_io_0016_t
WHERE key = :h_key;
WHERE mcht_no IN
(SELECT mcht_no FROM au_io_0016_map_t WHERE grp_key = :h_key);
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,8 @@ int au_io_0016_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0016_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET fee_amt = :h_amount, vat_amt = :h_amount / 10, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0016_touch");
@ -70,7 +71,8 @@ long au_io_0016_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_row;
long acc = 0;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +81,26 @@ long au_io_0016_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0016_t
WHERE biz_date = :h_biz_date;
EXEC SQL DECLARE cur_au_io_0016_t CURSOR FOR
SELECT net_amt FROM au_io_0016_sum_t WHERE biz_date = :h_biz_date;
EXEC SQL OPEN cur_au_io_0016_t;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0016_total");
return -1;
}
return h_sum;
for (;;) {
EXEC SQL FETCH cur_au_io_0016_t INTO :h_row;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
break;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0016_total");
EXEC SQL CLOSE cur_au_io_0016_t;
return -1;
}
acc += h_row;
}
EXEC SQL CLOSE cur_au_io_0016_t;
return acc;
}

View file

@ -110,20 +110,43 @@ int au_io_0017_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0017_t where key = $1 ",
ECPGset_var( 0, ( h_key ), __LINE__);\
/* declare cur_au_io_0017_f cursor for select appr_amt from au_io_0017_dtl_t where mcht_no = $1 order by seq desc */
#line 29 "app/dbio/au_io_0017.pgc"
#line 29 "app/dbio/au_io_0017.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur_au_io_0017_f cursor for select appr_amt from au_io_0017_dtl_t where mcht_no = $1 order by seq desc",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0017.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_fetch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur_au_io_0017_f", ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 35 "app/dbio/au_io_0017.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0017_f", ECPGt_EOIT, ECPGt_EORT);}
#line 37 "app/dbio/au_io_0017.pgc"
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_fetch");
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0017_f", ECPGt_EOIT, ECPGt_EORT);}
#line 42 "app/dbio/au_io_0017.pgc"
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur_au_io_0017_f", ECPGt_EOIT, ECPGt_EORT);}
#line 45 "app/dbio/au_io_0017.pgc"
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +157,13 @@ int au_io_0017_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0017.pgc"
#line 54 "app/dbio/au_io_0017.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0017.pgc"
#line 55 "app/dbio/au_io_0017.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0017.pgc"
#line 56 "app/dbio/au_io_0017.pgc"
if (!key)
@ -150,12 +173,12 @@ int au_io_0017_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0017_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0017_t set status_cd = case when $1 > 0 then '00' else '99' end , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0017.pgc"
#line 68 "app/dbio/au_io_0017.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -172,14 +195,18 @@ long au_io_0017_total(const char *biz_date)
/* exec sql begin declare section */
#line 72 "app/dbio/au_io_0017.pgc"
#line 82 "app/dbio/au_io_0017.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0017.pgc"
long h_sum ;
#line 83 "app/dbio/au_io_0017.pgc"
long h_max ;
#line 84 "app/dbio/au_io_0017.pgc"
long h_min ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0017.pgc"
#line 85 "app/dbio/au_io_0017.pgc"
if (!biz_date)
@ -188,17 +215,20 @@ long au_io_0017_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0017_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( max ( appr_amt ) , 0 ) , coalesce ( min ( appr_amt ) , 0 ) from au_io_0017_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_max),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_min),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0017.pgc"
#line 96 "app/dbio/au_io_0017.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -24,17 +24,26 @@ int au_io_0017_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0017_t
WHERE key = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
EXEC SQL DECLARE cur_au_io_0017_f CURSOR FOR
SELECT appr_amt FROM au_io_0017_dtl_t
WHERE mcht_no = :h_key ORDER BY seq DESC;
EXEC SQL OPEN cur_au_io_0017_f;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_fetch");
return TX_EDB;
}
EXEC SQL FETCH cur_au_io_0017_f INTO :h_amount;
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
EXEC SQL CLOSE cur_au_io_0017_f;
return TX_ENOENT;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_fetch");
EXEC SQL CLOSE cur_au_io_0017_f;
return TX_EDB;
}
EXEC SQL CLOSE cur_au_io_0017_f;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +63,9 @@ int au_io_0017_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0017_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET status_cd = CASE WHEN :h_amount > 0 THEN '00' ELSE '99' END,
upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_touch");
@ -70,7 +80,8 @@ long au_io_0017_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_max;
long h_min;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +90,15 @@ long au_io_0017_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0017_t
EXEC SQL SELECT coalesce(max(appr_amt), 0), coalesce(min(appr_amt), 0)
INTO :h_max, :h_min
FROM au_io_0017_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0017_total");
return -1;
}
return h_sum;
return h_max - h_min;
}

View file

@ -110,12 +110,12 @@ int au_io_0018_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0018_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select case when status_cd = '00' then appr_amt else 0 end from au_io_0018_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0018.pgc"
#line 31 "app/dbio/au_io_0018.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0018_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0018.pgc"
#line 46 "app/dbio/au_io_0018.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0018.pgc"
#line 47 "app/dbio/au_io_0018.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0018.pgc"
#line 48 "app/dbio/au_io_0018.pgc"
if (!key)
@ -150,12 +150,12 @@ int au_io_0018_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0018_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0018_acc_t set accum_amt = accum_amt + $1 , cnt = cnt + 1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0018.pgc"
#line 59 "app/dbio/au_io_0018.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long au_io_0018_total(const char *biz_date)
#line 72 "app/dbio/au_io_0018.pgc"
#line 73 "app/dbio/au_io_0018.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0018.pgc"
#line 74 "app/dbio/au_io_0018.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0018.pgc"
#line 75 "app/dbio/au_io_0018.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long au_io_0018_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0018_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( d . appr_amt ) , 0 ) from au_io_0018_dtl_t d join au_io_0018_t h on h . mcht_no = d . mcht_no where d . biz_date = $1 and h . status_cd = '00'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0018.pgc"
#line 87 "app/dbio/au_io_0018.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long au_io_0018_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int au_io_0018_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT
CASE WHEN status_cd = '00' THEN appr_amt ELSE 0 END
INTO :h_amount
FROM au_io_0018_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +54,9 @@ int au_io_0018_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0018_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL UPDATE au_io_0018_acc_t
SET accum_amt = accum_amt + :h_amount, cnt = cnt + 1, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0018_touch");
@ -79,10 +80,11 @@ long au_io_0018_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(d.appr_amt), 0)
INTO :h_sum
FROM au_io_0018_t
WHERE biz_date = :h_biz_date;
FROM au_io_0018_dtl_t d
JOIN au_io_0018_t h ON h.mcht_no = d.mcht_no
WHERE d.biz_date = :h_biz_date AND h.status_cd = '00';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0018_total");
@ -90,3 +92,4 @@ long au_io_0018_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,7 +110,7 @@ int au_io_0019_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0019_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt from au_io_0019_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
@ -150,12 +150,12 @@ int au_io_0019_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0019_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "delete from au_io_0019_bal_t where acct_no = $1 and bal_amt <= $2 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0019.pgc"
#line 57 "app/dbio/au_io_0019.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long au_io_0019_total(const char *biz_date)
#line 72 "app/dbio/au_io_0019.pgc"
#line 71 "app/dbio/au_io_0019.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0019.pgc"
long h_sum ;
#line 72 "app/dbio/au_io_0019.pgc"
long h_cnt ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0019.pgc"
#line 73 "app/dbio/au_io_0019.pgc"
if (!biz_date)
@ -188,17 +188,18 @@ long au_io_0019_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0019_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( distinct mcht_no ) from au_io_0019_dtl_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_cnt),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0019.pgc"
#line 84 "app/dbio/au_io_0019.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0019_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -24,10 +24,10 @@ int au_io_0019_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT appr_amt
INTO :h_amount
FROM au_io_0019_t
WHERE key = :h_key;
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,9 +53,8 @@ int au_io_0019_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0019_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL DELETE FROM au_io_0019_bal_t
WHERE acct_no = :h_key AND bal_amt <= :h_amount;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0019_touch");
@ -70,7 +69,7 @@ long au_io_0019_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_cnt;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +78,15 @@ long au_io_0019_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
FROM au_io_0019_t
EXEC SQL SELECT count(DISTINCT mcht_no)
INTO :h_cnt
FROM au_io_0019_dtl_t
WHERE biz_date = :h_biz_date;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0019_total");
return -1;
}
return h_sum;
return h_cnt;
}

View file

@ -94,14 +94,22 @@ int au_io_0020_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0020.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0020.pgc"
long h_amount ;
/* exec sql end declare section */
long h_appr ;
#line 19 "app/dbio/au_io_0020.pgc"
long h_fee ;
#line 20 "app/dbio/au_io_0020.pgc"
long h_vat ;
/* exec sql end declare section */
#line 21 "app/dbio/au_io_0020.pgc"
if (!key || !out_amount)
@ -110,12 +118,16 @@ int au_io_0020_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0020_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select appr_amt , fee_amt , vat_amt from au_io_0020_dtl_t where mcht_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_appr),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_fee),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_vat),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0020.pgc"
#line 32 "app/dbio/au_io_0020.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,7 +136,7 @@ int au_io_0020_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0020_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -134,13 +146,13 @@ int au_io_0020_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0020.pgc"
#line 47 "app/dbio/au_io_0020.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0020.pgc"
#line 48 "app/dbio/au_io_0020.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0020.pgc"
#line 49 "app/dbio/au_io_0020.pgc"
if (!key)
@ -150,20 +162,29 @@ int au_io_0020_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0020_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0020_t set req_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0020.pgc"
#line 60 "app/dbio/au_io_0020.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0020_touch");
return TX_EDB;
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0020_hist_t ( mcht_no , req_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 66 "app/dbio/au_io_0020.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0020_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -173,13 +194,13 @@ long au_io_0020_total(const char *biz_date)
#line 72 "app/dbio/au_io_0020.pgc"
#line 78 "app/dbio/au_io_0020.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0020.pgc"
#line 79 "app/dbio/au_io_0020.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0020.pgc"
#line 80 "app/dbio/au_io_0020.pgc"
if (!biz_date)
@ -188,12 +209,12 @@ long au_io_0020_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0020_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( cancel_amt ) , 0 ) from au_io_0020_t where biz_date = $1 and status_cd = '90' and cancel_yn = 'Y'",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0020.pgc"
#line 92 "app/dbio/au_io_0020.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +223,4 @@ long au_io_0020_total(const char *biz_date)
}
return h_sum;
}

View file

@ -15,7 +15,9 @@ int au_io_0020_fetch(const char *key, long *out_amount)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
long h_appr;
long h_fee;
long h_vat;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +26,10 @@ int au_io_0020_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0020_t
WHERE key = :h_key;
EXEC SQL SELECT appr_amt, fee_amt, vat_amt
INTO :h_appr, :h_fee, :h_vat
FROM au_io_0020_dtl_t
WHERE mcht_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,7 +37,7 @@ int au_io_0020_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0020_fetch");
return TX_EDB;
}
*out_amount = h_amount;
*out_amount = h_appr - h_fee - h_vat;
return TX_OK;
}
@ -54,15 +56,19 @@ int au_io_0020_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0020_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET req_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0020_touch");
return TX_EDB;
}
EXEC SQL INSERT INTO au_io_0020_hist_t (mcht_no, req_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0020_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -79,10 +85,11 @@ long au_io_0020_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(cancel_amt), 0)
INTO :h_sum
FROM au_io_0020_t
WHERE biz_date = :h_biz_date;
WHERE biz_date = :h_biz_date
AND status_cd = '90' AND cancel_yn = 'Y';
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0020_total");
@ -90,3 +97,4 @@ long au_io_0020_total(const char *biz_date)
}
return h_sum;
}

View file

@ -110,12 +110,12 @@ int au_io_0021_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0021_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select h . net_amt from au_io_0021_t h join au_io_0021_map_t m on m . mcht_no = h . mcht_no where h . mcht_no = $1 and m . use_yn = 'Y'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0021.pgc"
#line 31 "app/dbio/au_io_0021.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0021_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0021.pgc"
#line 46 "app/dbio/au_io_0021.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0021.pgc"
#line 47 "app/dbio/au_io_0021.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0021.pgc"
#line 48 "app/dbio/au_io_0021.pgc"
if (!key)
@ -150,12 +150,12 @@ int au_io_0021_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0021_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0021_t set appr_amt = $1 , upd_ts = now ( ) where mcht_no = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0021.pgc"
#line 59 "app/dbio/au_io_0021.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +173,13 @@ long au_io_0021_total(const char *biz_date)
#line 72 "app/dbio/au_io_0021.pgc"
#line 73 "app/dbio/au_io_0021.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0021.pgc"
#line 74 "app/dbio/au_io_0021.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0021.pgc"
#line 75 "app/dbio/au_io_0021.pgc"
if (!biz_date)
@ -188,12 +188,12 @@ long au_io_0021_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0021_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( recon_amt ) , 0 ) from au_io_0021_sum_t where biz_date in ( select biz_date from au_io_0021_map_t where biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0021.pgc"
#line 87 "app/dbio/au_io_0021.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +202,4 @@ long au_io_0021_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int au_io_0021_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT h.net_amt
INTO :h_amount
FROM au_io_0021_t
WHERE key = :h_key;
FROM au_io_0021_t h
JOIN au_io_0021_map_t m ON m.mcht_no = h.mcht_no
WHERE h.mcht_no = :h_key AND m.use_yn = 'Y';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -54,8 +55,8 @@ int au_io_0021_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0021_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET appr_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0021_touch");
@ -79,10 +80,11 @@ long au_io_0021_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(recon_amt), 0)
INTO :h_sum
FROM au_io_0021_t
WHERE biz_date = :h_biz_date;
FROM au_io_0021_sum_t
WHERE biz_date IN
(SELECT biz_date FROM au_io_0021_map_t WHERE biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0021_total");
@ -90,3 +92,4 @@ long au_io_0021_total(const char *biz_date)
}
return h_sum;
}

View file

@ -94,14 +94,18 @@ int au_io_0022_fetch(const char *key, long *out_amount)
/* exec sql begin declare section */
#line 17 "app/dbio/au_io_0022.pgc"
char h_key [ 16 ] ;
#line 18 "app/dbio/au_io_0022.pgc"
long h_amount ;
/* exec sql end declare section */
#line 19 "app/dbio/au_io_0022.pgc"
short h_ind ;
/* exec sql end declare section */
#line 20 "app/dbio/au_io_0022.pgc"
if (!key || !out_amount)
@ -110,12 +114,12 @@ int au_io_0022_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0022_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select bal_amt from au_io_0022_bal_t where acct_no = $1 ",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0022.pgc"
ECPGt_short,&(h_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT);}
#line 31 "app/dbio/au_io_0022.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -124,6 +128,8 @@ int au_io_0022_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0022_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -134,13 +140,13 @@ int au_io_0022_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0022.pgc"
#line 48 "app/dbio/au_io_0022.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0022.pgc"
#line 49 "app/dbio/au_io_0022.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0022.pgc"
#line 50 "app/dbio/au_io_0022.pgc"
if (!key)
@ -150,12 +156,12 @@ int au_io_0022_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0022_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0022_t set net_amt = $1 , upd_ts = now ( ) where mcht_no = $2 and status_cd = '00' and appr_amt > 0",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0022.pgc"
#line 61 "app/dbio/au_io_0022.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -173,13 +179,13 @@ long au_io_0022_total(const char *biz_date)
#line 72 "app/dbio/au_io_0022.pgc"
#line 75 "app/dbio/au_io_0022.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0022.pgc"
long h_sum ;
#line 76 "app/dbio/au_io_0022.pgc"
long h_flag ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0022.pgc"
#line 77 "app/dbio/au_io_0022.pgc"
if (!biz_date)
@ -188,17 +194,18 @@ long au_io_0022_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0022_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from au_io_0022_t where exists ( select 1 from au_io_0022_dtl_t d where d . biz_date = $1 )",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_long,&(h_flag),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0022.pgc"
#line 90 "app/dbio/au_io_0022.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0022_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -16,6 +16,7 @@ int au_io_0022_fetch(const char *key, long *out_amount)
EXEC SQL BEGIN DECLARE SECTION;
char h_key[16];
long h_amount;
short h_ind;
EXEC SQL END DECLARE SECTION;
if (!key || !out_amount)
@ -24,10 +25,10 @@ int au_io_0022_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
INTO :h_amount
FROM au_io_0022_t
WHERE key = :h_key;
EXEC SQL SELECT bal_amt
INTO :h_amount :h_ind
FROM au_io_0022_bal_t
WHERE acct_no = :h_key;
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -35,6 +36,8 @@ int au_io_0022_fetch(const char *key, long *out_amount)
TX_DBIO_LOG_ERR("au_io_0022_fetch");
return TX_EDB;
}
if (h_ind == -1)
h_amount = 0;
*out_amount = h_amount;
return TX_OK;
}
@ -54,8 +57,8 @@ int au_io_0022_touch(const char *key, long amount)
h_amount = amount;
EXEC SQL UPDATE au_io_0022_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
SET net_amt = :h_amount, upd_ts = now()
WHERE mcht_no = :h_key AND status_cd = '00' AND appr_amt > 0;
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0022_touch");
@ -70,7 +73,7 @@ long au_io_0022_total(const char *biz_date)
{
EXEC SQL BEGIN DECLARE SECTION;
char h_biz_date[9];
long h_sum;
long h_flag;
EXEC SQL END DECLARE SECTION;
if (!biz_date)
@ -79,14 +82,17 @@ long au_io_0022_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
INTO :h_sum
EXEC SQL SELECT count(*)
INTO :h_flag
FROM au_io_0022_t
WHERE biz_date = :h_biz_date;
WHERE EXISTS
(SELECT 1 FROM au_io_0022_dtl_t d
WHERE d.biz_date = :h_biz_date);
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0022_total");
return -1;
}
return h_sum;
return h_flag > 0 ? 1 : 0;
}

View file

@ -110,12 +110,12 @@ int au_io_0023_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select amount from au_io_0023_t where key = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select req_amt from au_io_0023_t where mcht_no = $1 and status_cd = '00' and cancel_yn = 'N'",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 30 "app/dbio/au_io_0023.pgc"
#line 31 "app/dbio/au_io_0023.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
@ -134,13 +134,13 @@ int au_io_0023_touch(const char *key, long amount)
#line 45 "app/dbio/au_io_0023.pgc"
#line 46 "app/dbio/au_io_0023.pgc"
char h_key [ 16 ] ;
#line 46 "app/dbio/au_io_0023.pgc"
#line 47 "app/dbio/au_io_0023.pgc"
long h_amount ;
/* exec sql end declare section */
#line 47 "app/dbio/au_io_0023.pgc"
#line 48 "app/dbio/au_io_0023.pgc"
if (!key)
@ -150,10 +150,10 @@ int au_io_0023_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update au_io_0023_t set amount = $1 , upd_ts = now ( ) where key = $2 ",
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into au_io_0023_log_t ( mcht_no , appr_amt , reg_ts ) values ( $1 , $2 , now ( ) )",
ECPGt_char,(h_key),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_amount),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 58 "app/dbio/au_io_0023.pgc"
@ -162,8 +162,6 @@ int au_io_0023_touch(const char *key, long amount)
TX_DBIO_LOG_ERR("au_io_0023_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -173,13 +171,13 @@ long au_io_0023_total(const char *biz_date)
#line 72 "app/dbio/au_io_0023.pgc"
#line 70 "app/dbio/au_io_0023.pgc"
char h_biz_date [ 9 ] ;
#line 73 "app/dbio/au_io_0023.pgc"
#line 71 "app/dbio/au_io_0023.pgc"
long h_sum ;
/* exec sql end declare section */
#line 74 "app/dbio/au_io_0023.pgc"
#line 72 "app/dbio/au_io_0023.pgc"
if (!biz_date)
@ -188,12 +186,12 @@ long au_io_0023_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( amount ) , 0 ) from au_io_0023_t where biz_date = $1 ",
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select coalesce ( sum ( appr_amt ) , 0 ) from au_io_0023_t where biz_date = $1 ",
ECPGt_char,(h_biz_date),(long)9,(long)1,(9)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_sum),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 85 "app/dbio/au_io_0023.pgc"
#line 83 "app/dbio/au_io_0023.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
@ -202,3 +200,4 @@ long au_io_0023_total(const char *biz_date)
}
return h_sum;
}

View file

@ -24,10 +24,11 @@ int au_io_0023_fetch(const char *key, long *out_amount)
strncpy(h_key, key, sizeof(h_key) - 1);
h_key[sizeof(h_key) - 1] = '\0';
EXEC SQL SELECT amount
EXEC SQL SELECT req_amt
INTO :h_amount
FROM au_io_0023_t
WHERE key = :h_key;
WHERE mcht_no = :h_key AND status_cd = '00'
AND cancel_yn = 'N';
if (sqlca.sqlcode == TX_SQL_NOTFOUND)
return TX_ENOENT;
@ -53,16 +54,13 @@ int au_io_0023_touch(const char *key, long amount)
h_key[sizeof(h_key) - 1] = '\0';
h_amount = amount;
EXEC SQL UPDATE au_io_0023_t
SET amount = :h_amount, upd_ts = now()
WHERE key = :h_key;
EXEC SQL INSERT INTO au_io_0023_log_t (mcht_no, appr_amt, reg_ts)
VALUES (:h_key, :h_amount, now());
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("au_io_0023_touch");
return TX_EDB;
}
if (sqlca.sqlerrd[2] == 0)
return TX_ENOENT;
return TX_OK;
}
@ -79,7 +77,7 @@ long au_io_0023_total(const char *biz_date)
strncpy(h_biz_date, biz_date, sizeof(h_biz_date) - 1);
h_biz_date[sizeof(h_biz_date) - 1] = '\0';
EXEC SQL SELECT coalesce(sum(amount), 0)
EXEC SQL SELECT coalesce(sum(appr_amt), 0)
INTO :h_sum
FROM au_io_0023_t
WHERE biz_date = :h_biz_date;
@ -90,3 +88,4 @@ long au_io_0023_total(const char *biz_date)
}
return h_sum;
}

Some files were not shown because too many files have changed in this diff Show more