규모확장 Wave B: 전 11모듈 svc 75→133·batch 35→46 (BAIS 온라인 1:1)
- svc 825→1,463 (모듈당 133), batch 385→506 (모듈당 46) — 전부 새 고유 실업무 로직 + 카피북 헤더, 디스패처 133 advertise, 한글 기능설명(매니페스트 추출) - BAIS As-Is 대비: 온라인 1,463 vs 1,466(99.8%), 배치 506 vs 503(초과) - 화면 매니페스트 1,463 재생성 - 검증: build DONE modules=11 batches=506, 12서버 runok, xadmin psc 1,466 AVAIL, 매입체인 XA 커밋, 신규서비스 실데이터 스모크, 전 코퍼스 .pgc 클론 0 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ea90bef264
commit
c62d91b7a7
1526 changed files with 59213 additions and 12 deletions
35
app/src/cl/batch/cl_apprstat_batch.pgc
Normal file
35
app/src/cl/batch/cl_apprstat_batch.pgc
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* cl_apprstat_batch.pgc - cl 마감 승인현황 집계 배치 (단계별 집계 리포트, 조회 전용).
|
||||
*
|
||||
* 마감이력의 승인 단계(1차 APPR:L1 / 2차 APPR:L2 / 최종 status=A) 건수를 집계해 출력한다.
|
||||
* host 변수는 전용 카피북 cl_apprstat_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_apprstat_batch
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
|
||||
EXEC SQL INCLUDE cl_apprstat_cpy;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(30, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT
|
||||
count(*) FILTER (WHERE memo = 'APPR:L1'),
|
||||
count(*) FILTER (WHERE memo = 'APPR:L2'),
|
||||
count(*) FILTER (WHERE status = 'A')
|
||||
INTO :as_l1, :as_l2, :as_fin FROM cl_close_log WHERE status <> 'X';
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
printf(">>> cl_apprstat_batch 승인현황: 1차=%ld 2차=%ld 최종=%ld\n", as_l1, as_l2, as_fin);
|
||||
|
||||
tpcommit(0);
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
6
app/src/cl/batch/cl_apprstat_cpy.h
Normal file
6
app/src/cl/batch/cl_apprstat_cpy.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* cl_apprstat_cpy.h - cl_apprstat_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long as_l1;
|
||||
long as_l2;
|
||||
long as_fin;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
37
app/src/cl/batch/cl_cxlstat_batch.pgc
Normal file
37
app/src/cl/batch/cl_cxlstat_batch.pgc
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* cl_cxlstat_batch.pgc - cl 마감 취소현황 집계 배치 (사유별 집계 리포트, 조회 전용).
|
||||
*
|
||||
* 취소(status=X) 마감이력을 취소 사유(오류정정/지연자료/중복마감)별로 집계해 출력한다.
|
||||
* host 변수는 전용 카피북 cl_cxlstat_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_cxlstat_batch
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
|
||||
EXEC SQL INCLUDE cl_cxlstat_cpy;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(30, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT
|
||||
count(*) FILTER (WHERE memo LIKE '취소:오류%'),
|
||||
count(*) FILTER (WHERE memo LIKE '취소:지연%'),
|
||||
count(*) FILTER (WHERE memo LIKE '취소:중복%'),
|
||||
count(*)
|
||||
INTO :cs_err, :cs_late, :cs_dup, :cs_tot FROM cl_close_log WHERE status = 'X';
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
printf(">>> cl_cxlstat_batch 취소현황: 오류정정=%ld 지연자료=%ld 중복마감=%ld 총=%ld\n",
|
||||
cs_err, cs_late, cs_dup, cs_tot);
|
||||
|
||||
tpcommit(0);
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
7
app/src/cl/batch/cl_cxlstat_cpy.h
Normal file
7
app/src/cl/batch/cl_cxlstat_cpy.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* cl_cxlstat_cpy.h - cl_cxlstat_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long cs_err;
|
||||
long cs_late;
|
||||
long cs_dup;
|
||||
long cs_tot;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
54
app/src/cl/batch/cl_duelist_batch.pgc
Normal file
54
app/src/cl/batch/cl_duelist_batch.pgc
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* cl_duelist_batch.pgc - cl 마감 예정 목록 배치 (미마감 영업일 커서 출력, 조회 전용).
|
||||
*
|
||||
* 기준일 이전 14일 내 영업일(주말 제외) 중 DAILY 마감이 없는 미마감 대상일을 커서로 출력한다.
|
||||
* host 변수는 전용 카피북 cl_duelist_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_duelist_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long due = 0;
|
||||
|
||||
EXEC SQL INCLUDE cl_duelist_cpy;
|
||||
|
||||
strncpy(dl_bizdate, bizdate, sizeof(dl_bizdate)-1); dl_bizdate[sizeof(dl_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(30, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL DECLARE cdueb CURSOR FOR
|
||||
SELECT to_char(d,'YYYY-MM-DD') FROM (
|
||||
SELECT (:dl_bizdate::date - s) AS d,
|
||||
extract(dow from (:dl_bizdate::date - s)) AS dw
|
||||
FROM generate_series(0,13) s) t
|
||||
WHERE dw NOT IN (0,6)
|
||||
AND NOT EXISTS (SELECT 1 FROM cl_close_log
|
||||
WHERE close_type = 'DAILY'
|
||||
AND period_key = to_char(t.d,'YYYY-MM-DD') AND status <> 'X')
|
||||
ORDER BY d DESC;
|
||||
EXEC SQL OPEN cdueb;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
printf(">>> cl_duelist_batch %s 기준 마감 예정(미마감) 목록:\n", bizdate);
|
||||
for (;;) {
|
||||
EXEC SQL FETCH cdueb INTO :dl_day;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE cdueb; tpabort(0); return 1; }
|
||||
printf(" - %s 미마감\n", dl_day);
|
||||
due++;
|
||||
}
|
||||
EXEC SQL CLOSE cdueb;
|
||||
|
||||
tpcommit(0);
|
||||
printf(">>> cl_duelist_batch 미마감 대상일 %ld건\n", due);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
5
app/src/cl/batch/cl_duelist_cpy.h
Normal file
5
app/src/cl/batch/cl_duelist_cpy.h
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* cl_duelist_cpy.h - cl_duelist_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char dl_bizdate[16];
|
||||
char dl_day[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
55
app/src/cl/batch/cl_issclose_batch.pgc
Normal file
55
app/src/cl/batch/cl_issclose_batch.pgc
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* cl_issclose_batch.pgc - cl 발급사별 마감 배치 (발급사 커서 + ISS 마감 + XA).
|
||||
*
|
||||
* 당일 매입을 발급사(issuer)별로 커서 순회하며 발급사마다 ISS 마감이력을 1건씩 기록한다.
|
||||
* host 변수는 전용 카피북 cl_issclose_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_issclose_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long made = 0, cid, totfee = 0;
|
||||
char memo[48];
|
||||
|
||||
EXEC SQL INCLUDE cl_issclose_cpy;
|
||||
|
||||
strncpy(ic_bizdate, bizdate, sizeof(ic_bizdate)-1); ic_bizdate[sizeof(ic_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL DECLARE cissb CURSOR FOR
|
||||
SELECT issuer, count(*), coalesce(sum(amount),0), coalesce(sum(fee),0)
|
||||
FROM purchase WHERE biz_date = :ic_bizdate
|
||||
GROUP BY issuer ORDER BY 3 DESC;
|
||||
EXEC SQL OPEN cissb;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
for (;;) {
|
||||
EXEC SQL FETCH cissb INTO :ic_iss, :ic_cnt, :ic_amt, :ic_fee;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE cissb; tpabort(0); return 1; }
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) { EXEC SQL CLOSE cissb; tpabort(0); return 1; }
|
||||
snprintf(memo, sizeof(memo), "발급사마감(배치):%s", ic_iss);
|
||||
if (cldb_insert_close(cid, "ISS", ic_bizdate, ic_bizdate, "C", ic_cnt, ic_amt, memo) < 0) {
|
||||
EXEC SQL CLOSE cissb; tpabort(0); return 1;
|
||||
}
|
||||
totfee += ic_fee;
|
||||
made++;
|
||||
}
|
||||
EXEC SQL CLOSE cissb;
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_issclose_batch COMMIT: %s 발급사마감 %ld건 수수료합=%ld\n", bizdate, made, totfee);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
8
app/src/cl/batch/cl_issclose_cpy.h
Normal file
8
app/src/cl/batch/cl_issclose_cpy.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/* cl_issclose_cpy.h - cl_issclose_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char ic_bizdate[16];
|
||||
char ic_iss[24];
|
||||
long ic_cnt;
|
||||
long ic_amt;
|
||||
long ic_fee;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
42
app/src/cl/batch/cl_mainclose_batch.pgc
Normal file
42
app/src/cl/batch/cl_mainclose_batch.pgc
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* cl_mainclose_batch.pgc - cl 본마감 승격 배치 (가마감 재집계 + O->C 승격 + XA).
|
||||
*
|
||||
* 당일 가마감(TENT, status=O) 이력을 당일 전체 매입으로 재집계해 확정(status=C)으로 승격.
|
||||
* host 변수는 전용 카피북 cl_mainclose_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_mainclose_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long promoted;
|
||||
|
||||
EXEC SQL INCLUDE cl_mainclose_cpy;
|
||||
|
||||
strncpy(mc_bizdate, bizdate, sizeof(mc_bizdate)-1); mc_bizdate[sizeof(mc_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :mc_cnt, :mc_amt
|
||||
FROM purchase WHERE biz_date = :mc_bizdate;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
EXEC SQL UPDATE cl_close_log
|
||||
SET status = 'C', txn_count = :mc_cnt, total_amount = :mc_amt, memo = '본마감(배치)', updated_at = now()
|
||||
WHERE close_type = 'TENT' AND period_key = :mc_bizdate AND status = 'O';
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
promoted = (long)sqlca.sqlerrd[2];
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_mainclose_batch COMMIT: %s 본마감 승격 %ld건 확정건수=%ld\n", bizdate, promoted, mc_cnt);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
6
app/src/cl/batch/cl_mainclose_cpy.h
Normal file
6
app/src/cl/batch/cl_mainclose_cpy.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* cl_mainclose_cpy.h - cl_mainclose_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char mc_bizdate[16];
|
||||
long mc_cnt;
|
||||
long mc_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
59
app/src/cl/batch/cl_netcross_batch.pgc
Normal file
59
app/src/cl/batch/cl_netcross_batch.pgc
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* cl_netcross_batch.pgc - cl 정산액 크로스검증 배치 (마감별 스냅샷 net vs 매입 net + XA).
|
||||
*
|
||||
* 당일 확정(C) 마감이력을 커서 순회하며 각 마감의 스냅샷 net 합계와 당일 매입 net 합계를
|
||||
* 대사하고 편차가 있는 마감을 출력한다 (조회 전용 XA 브랜치).
|
||||
* host 변수는 전용 카피북 cl_netcross_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_netcross_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long checked = 0, mism = 0, delta;
|
||||
|
||||
EXEC SQL INCLUDE cl_netcross_cpy;
|
||||
|
||||
strncpy(nx_bizdate, bizdate, sizeof(nx_bizdate)-1); nx_bizdate[sizeof(nx_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT coalesce(sum(net),0) INTO :nx_real
|
||||
FROM purchase WHERE biz_date = :nx_bizdate;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
EXEC SQL DECLARE cnxb CURSOR FOR
|
||||
SELECT close_id FROM cl_close_log
|
||||
WHERE period_key = :nx_bizdate AND status = 'C' ORDER BY close_id;
|
||||
EXEC SQL OPEN cnxb;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
printf(">>> cl_netcross_batch %s 정산액 크로스검증 (매입 net=%ld)\n", bizdate, nx_real);
|
||||
for (;;) {
|
||||
EXEC SQL FETCH cnxb INTO :nx_cid;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE cnxb; tpabort(0); return 1; }
|
||||
EXEC SQL SELECT coalesce(sum(net_amount),0) INTO :nx_snap
|
||||
FROM cl_snapshot WHERE close_id = :nx_cid;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE cnxb; tpabort(0); return 1; }
|
||||
delta = nx_snap - nx_real; if (delta < 0) delta = -delta;
|
||||
if (nx_snap != 0 && delta != 0) {
|
||||
printf(" ! cid=%ld 스냅샷net=%ld 편차=%ld\n", nx_cid, nx_snap, delta);
|
||||
mism++;
|
||||
}
|
||||
checked++;
|
||||
}
|
||||
EXEC SQL CLOSE cnxb;
|
||||
|
||||
tpcommit(0);
|
||||
printf(">>> cl_netcross_batch 점검=%ld건 편차=%ld건\n", checked, mism);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
7
app/src/cl/batch/cl_netcross_cpy.h
Normal file
7
app/src/cl/batch/cl_netcross_cpy.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* cl_netcross_cpy.h - cl_netcross_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char nx_bizdate[16];
|
||||
long nx_cid;
|
||||
long nx_snap;
|
||||
long nx_real;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
54
app/src/cl/batch/cl_segclose_batch.pgc
Normal file
54
app/src/cl/batch/cl_segclose_batch.pgc
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* cl_segclose_batch.pgc - cl 부문별 마감 배치 (업종 커서 + 부문마다 SEG 마감 + XA).
|
||||
*
|
||||
* 당일 매입을 업종(category) 부문으로 커서 순회하며 부문마다 SEG 마감이력을 1건씩 기록한다.
|
||||
* host 변수는 전용 카피북 cl_segclose_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_segclose_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long made = 0, cid;
|
||||
char memo[48];
|
||||
|
||||
EXEC SQL INCLUDE cl_segclose_cpy;
|
||||
|
||||
strncpy(sc_bizdate, bizdate, sizeof(sc_bizdate)-1); sc_bizdate[sizeof(sc_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL DECLARE csegb CURSOR FOR
|
||||
SELECT category, count(*), coalesce(sum(amount),0)
|
||||
FROM purchase WHERE biz_date = :sc_bizdate
|
||||
GROUP BY category ORDER BY category;
|
||||
EXEC SQL OPEN csegb;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
for (;;) {
|
||||
EXEC SQL FETCH csegb INTO :sc_cat, :sc_cnt, :sc_amt;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE csegb; tpabort(0); return 1; }
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) { EXEC SQL CLOSE csegb; tpabort(0); return 1; }
|
||||
snprintf(memo, sizeof(memo), "부문마감(배치):%s", sc_cat);
|
||||
if (cldb_insert_close(cid, "SEG", sc_bizdate, sc_bizdate, "C", sc_cnt, sc_amt, memo) < 0) {
|
||||
EXEC SQL CLOSE csegb; tpabort(0); return 1;
|
||||
}
|
||||
made++;
|
||||
}
|
||||
EXEC SQL CLOSE csegb;
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_segclose_batch COMMIT: %s 부문마감 %ld건 생성\n", bizdate, made);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
7
app/src/cl/batch/cl_segclose_cpy.h
Normal file
7
app/src/cl/batch/cl_segclose_cpy.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* cl_segclose_cpy.h - cl_segclose_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char sc_bizdate[16];
|
||||
char sc_cat[16];
|
||||
long sc_cnt;
|
||||
long sc_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
54
app/src/cl/batch/cl_semimonth_batch.pgc
Normal file
54
app/src/cl/batch/cl_semimonth_batch.pgc
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* cl_semimonth_batch.pgc - cl 반월 마감 배치 (전반/후반 집계 + SEMIMON 마감 + XA).
|
||||
*
|
||||
* 기준일이 속한 반월(전반 1~15 / 후반 16~말) 구간 매입을 집계해 SEMIMON 마감이력을 기록.
|
||||
* host 변수는 전용 카피북 cl_semimonth_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_semimonth_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long cid, half;
|
||||
char period[24], memo[32];
|
||||
|
||||
EXEC SQL INCLUDE cl_semimonth_cpy;
|
||||
|
||||
strncpy(sm_bizdate, bizdate, sizeof(sm_bizdate)-1); sm_bizdate[sizeof(sm_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT extract(day from :sm_bizdate::date)::int,
|
||||
to_char(:sm_bizdate::date, 'YYYY-MM') INTO :sm_day, :sm_ym;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
half = (sm_day <= 15) ? 1 : 2;
|
||||
sm_lo = (half == 1) ? 1 : 16;
|
||||
sm_hi = (half == 1) ? 15 : 31;
|
||||
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :sm_cnt, :sm_amt
|
||||
FROM purchase WHERE to_char(biz_date,'YYYY-MM') = :sm_ym
|
||||
AND extract(day from biz_date) BETWEEN :sm_lo AND :sm_hi;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
snprintf(period, sizeof(period), "%s-H%ld", sm_ym, half);
|
||||
snprintf(memo, sizeof(memo), "반월마감(배치):%s", (half == 1) ? "전반" : "후반");
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) { tpabort(0); return 1; }
|
||||
if (cldb_insert_close(cid, "SEMIMON", period, bizdate, "C", sm_cnt, sm_amt, memo) < 0) {
|
||||
tpabort(0); return 1;
|
||||
}
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_semimonth_batch COMMIT: %s %s cid=%ld 건수=%ld\n",
|
||||
sm_ym, (half==1)?"전반":"후반", cid, sm_cnt);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
10
app/src/cl/batch/cl_semimonth_cpy.h
Normal file
10
app/src/cl/batch/cl_semimonth_cpy.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* cl_semimonth_cpy.h - cl_semimonth_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char sm_bizdate[16];
|
||||
char sm_ym[16];
|
||||
long sm_day;
|
||||
long sm_lo;
|
||||
long sm_hi;
|
||||
long sm_cnt;
|
||||
long sm_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
53
app/src/cl/batch/cl_tenday_batch.pgc
Normal file
53
app/src/cl/batch/cl_tenday_batch.pgc
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* cl_tenday_batch.pgc - cl 순(10일) 마감 배치 (상/중/하순 집계 + TENDAY 마감 + XA).
|
||||
*
|
||||
* 기준일이 속한 순(1~10/11~20/21~말) 구간의 매입을 집계해 TENDAY 마감이력을 기록한다.
|
||||
* host 변수는 전용 카피북 cl_tenday_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_tenday_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long cid, dec;
|
||||
char period[24], memo[32];
|
||||
|
||||
EXEC SQL INCLUDE cl_tenday_cpy;
|
||||
|
||||
strncpy(td_bizdate, bizdate, sizeof(td_bizdate)-1); td_bizdate[sizeof(td_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT extract(day from :td_bizdate::date)::int,
|
||||
to_char(:td_bizdate::date, 'YYYY-MM') INTO :td_day, :td_ym;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
dec = (td_day <= 10) ? 1 : (td_day <= 20 ? 2 : 3);
|
||||
td_lo = (dec - 1) * 10 + 1;
|
||||
td_hi = (dec == 3) ? 31 : dec * 10;
|
||||
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :td_cnt, :td_amt
|
||||
FROM purchase WHERE to_char(biz_date,'YYYY-MM') = :td_ym
|
||||
AND extract(day from biz_date) BETWEEN :td_lo AND :td_hi;
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
snprintf(period, sizeof(period), "%s-T%ld", td_ym, dec);
|
||||
snprintf(memo, sizeof(memo), "순마감(배치):%ld순", dec);
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) { tpabort(0); return 1; }
|
||||
if (cldb_insert_close(cid, "TENDAY", period, bizdate, "C", td_cnt, td_amt, memo) < 0) {
|
||||
tpabort(0); return 1;
|
||||
}
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_tenday_batch COMMIT: %s %ld순 cid=%ld 건수=%ld\n", td_ym, dec, cid, td_cnt);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
10
app/src/cl/batch/cl_tenday_cpy.h
Normal file
10
app/src/cl/batch/cl_tenday_cpy.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* cl_tenday_cpy.h - cl_tenday_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char td_bizdate[16];
|
||||
char td_ym[16];
|
||||
long td_day;
|
||||
long td_lo;
|
||||
long td_hi;
|
||||
long td_cnt;
|
||||
long td_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
42
app/src/cl/batch/cl_tentclose_batch.pgc
Normal file
42
app/src/cl/batch/cl_tentclose_batch.pgc
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* cl_tentclose_batch.pgc - cl 가마감(잠정) 배치 (접수/대사 잠정집계 + TENT(O) + XA).
|
||||
*
|
||||
* 당일 접수(A)/대사완료(M) 매입을 잠정 집계해 가마감(status=O) 이력을 1건 기록한다.
|
||||
* host 변수는 전용 카피북 cl_tentclose_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_tentclose_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long cid;
|
||||
|
||||
EXEC SQL INCLUDE cl_tentclose_cpy;
|
||||
|
||||
strncpy(tc_bizdate, bizdate, sizeof(tc_bizdate)-1); tc_bizdate[sizeof(tc_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :tc_cnt, :tc_amt
|
||||
FROM purchase WHERE biz_date = :tc_bizdate AND status IN ('A','M');
|
||||
if (sqlca.sqlcode < 0) { tpabort(0); return 1; }
|
||||
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) { tpabort(0); return 1; }
|
||||
if (cldb_insert_close(cid, "TENT", bizdate, bizdate, "O", tc_cnt, tc_amt, "가마감(배치)") < 0) {
|
||||
tpabort(0); return 1;
|
||||
}
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_tentclose_batch COMMIT: %s 가마감 cid=%ld 잠정건수=%ld\n", bizdate, cid, tc_cnt);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
6
app/src/cl/batch/cl_tentclose_cpy.h
Normal file
6
app/src/cl/batch/cl_tentclose_cpy.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* cl_tentclose_cpy.h - cl_tentclose_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char tc_bizdate[16];
|
||||
long tc_cnt;
|
||||
long tc_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
44
app/src/cl/batch/cl_weekly_batch.pgc
Normal file
44
app/src/cl/batch/cl_weekly_batch.pgc
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* cl_weekly_batch.pgc - cl 주 마감 배치 (주간 집계 + WEEKLY 마감이력 + XA).
|
||||
*
|
||||
* 기준일이 속한 주(월~일) 매입을 집계해 WEEKLY 마감이력(close_log)을 1건 기록한다.
|
||||
* host 변수는 전용 카피북 cl_weekly_cpy.h 를 EXEC SQL INCLUDE 로 가져온다.
|
||||
* Usage: cl_weekly_batch [YYYY-MM-DD]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <atmi.h>
|
||||
#include "cl_dbio.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *bizdate = (argc > 1) ? argv[1] : "2026-07-19";
|
||||
long cid;
|
||||
|
||||
EXEC SQL INCLUDE cl_weekly_cpy;
|
||||
|
||||
strncpy(wk_bizdate, bizdate, sizeof(wk_bizdate)-1); wk_bizdate[sizeof(wk_bizdate)-1] = 0;
|
||||
|
||||
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpopen() < 0) { fprintf(stderr, "tpopen FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
if (tpbegin(60, 0) < 0) { fprintf(stderr, "tpbegin FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
||||
|
||||
EXEC SQL SELECT to_char(date_trunc('week', :wk_bizdate::date), 'IYYY"W"IW'),
|
||||
count(*), coalesce(sum(amount),0)
|
||||
INTO :wk_key, :wk_cnt, :wk_amt FROM purchase
|
||||
WHERE date_trunc('week', biz_date) = date_trunc('week', :wk_bizdate::date);
|
||||
if (sqlca.sqlcode < 0) { fprintf(stderr, "AGG FAIL [%d] %s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); tpabort(0); return 1; }
|
||||
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) { tpabort(0); return 1; }
|
||||
if (cldb_insert_close(cid, "WEEKLY", wk_key, bizdate, "C", wk_cnt, wk_amt, "주마감(배치)") < 0) {
|
||||
tpabort(0); return 1;
|
||||
}
|
||||
|
||||
if (tpcommit(0) < 0) { fprintf(stderr, "tpcommit FAIL: %s\n", tpstrerror(tperrno)); tpabort(0); return 1; }
|
||||
printf(">>> cl_weekly_batch COMMIT: 주=%s cid=%ld 건수=%ld 금액=%ld\n", wk_key, cid, wk_cnt, wk_amt);
|
||||
|
||||
tpclose(); tpterm();
|
||||
return 0;
|
||||
}
|
||||
7
app/src/cl/batch/cl_weekly_cpy.h
Normal file
7
app/src/cl/batch/cl_weekly_cpy.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* cl_weekly_cpy.h - cl_weekly_batch 전용 카피북 (host 변수 선언, EXEC SQL INCLUDE 대상). */
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char wk_bizdate[16];
|
||||
char wk_key[16];
|
||||
long wk_cnt;
|
||||
long wk_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* cl_svr.pgc - cl (마감/closing) MODULE SERVER (thin dispatcher).
|
||||
*
|
||||
* The legacy "one module server, many services" pattern: this binary owns NO
|
||||
* business logic. Each of cl's 75 online services now lives in its own file
|
||||
* business logic. Each of cl's 133 online services now lives in its own file
|
||||
* (app/src/cl/svc/<SVCNAME>.pgc) with its own copybook header
|
||||
* (app/src/cl/svc/<SVCNAME>.h); those objects are archived into libclsvc.a and
|
||||
* linked into this server. Here we only:
|
||||
|
|
@ -99,6 +99,66 @@
|
|||
#include "CL_FORCECLOSE.h"
|
||||
#include "CL_SNAPDIFF.h"
|
||||
|
||||
/* --- cl 마감 확장 서비스 (svc/*.pgc, +58) --- */
|
||||
#include "CL_WEEKLY.h"
|
||||
#include "CL_TENDAY.h"
|
||||
#include "CL_SEMIMONTH.h"
|
||||
#include "CL_HYCLOSE.h"
|
||||
#include "CL_DAYVERIFY.h"
|
||||
#include "CL_WEEKVERIFY.h"
|
||||
#include "CL_MONVERIFY.h"
|
||||
#include "CL_QTRVERIFY.h"
|
||||
#include "CL_YEARVERIFY.h"
|
||||
#include "CL_HYVERIFY.h"
|
||||
#include "CL_SEGCLOSE.h"
|
||||
#include "CL_ISSCLOSE.h"
|
||||
#include "CL_POSCLOSE.h"
|
||||
#include "CL_FXCLOSE.h"
|
||||
#include "CL_SEGVERIFY.h"
|
||||
#include "CL_CORPVERIFY.h"
|
||||
#include "CL_CHKUNMATCH.h"
|
||||
#include "CL_CHKPENDING.h"
|
||||
#include "CL_CHKVOID.h"
|
||||
#include "CL_CHKLIMIT.h"
|
||||
#include "CL_CHKALL.h"
|
||||
#include "CL_TENTCLOSE.h"
|
||||
#include "CL_MAINCLOSE.h"
|
||||
#include "CL_RECLOSEREG.h"
|
||||
#include "CL_PROVCMP.h"
|
||||
#include "CL_RECLOSECHK.h"
|
||||
#include "CL_APPRL1.h"
|
||||
#include "CL_APPRL2.h"
|
||||
#include "CL_APPRFINAL.h"
|
||||
#include "CL_APPRWD.h"
|
||||
#include "CL_APPRDELEG.h"
|
||||
#include "CL_APPRSTAT.h"
|
||||
#include "CL_CXLERROR.h"
|
||||
#include "CL_CXLLATE.h"
|
||||
#include "CL_CXLDUP.h"
|
||||
#include "CL_CXLREQ.h"
|
||||
#include "CL_CXLSTAT.h"
|
||||
#include "CL_STCROSS.h"
|
||||
#include "CL_CNTVERIFY.h"
|
||||
#include "CL_FEECROSS.h"
|
||||
#include "CL_NETCROSS.h"
|
||||
#include "CL_MERXCHECK.h"
|
||||
#include "CL_RPTDIV.h"
|
||||
#include "CL_RPTPERIOD.h"
|
||||
#include "CL_RPTSTATUS.h"
|
||||
#include "CL_RPTDELAY.h"
|
||||
#include "CL_RPTAPPR.h"
|
||||
#include "CL_RPTCXL.h"
|
||||
#include "CL_SLASET.h"
|
||||
#include "CL_SLABREACH.h"
|
||||
#include "CL_SCHEDNEXT.h"
|
||||
#include "CL_DUELIST.h"
|
||||
#include "CL_HOLICHK.h"
|
||||
#include "CL_NEXTBIZ.h"
|
||||
#include "CL_TRIGSETTLE.h"
|
||||
#include "CL_TRIGRPT.h"
|
||||
#include "CL_STCHGAUDIT.h"
|
||||
#include "CL_SNAPMER.h"
|
||||
|
||||
/* ----- advertise table: {service name, function} (fn is extern from its file) */
|
||||
static struct { const char *name; void (*fn)(TPSVCINFO *); } SVCS[] = {
|
||||
{"CL_DAILY", CL_DAILY}, {"CL_MONTHLY", CL_MONTHLY},
|
||||
|
|
@ -139,6 +199,35 @@ static struct { const char *name; void (*fn)(TPSVCINFO *); } SVCS[] = {
|
|||
{"CL_ESCALATE", CL_ESCALATE}, {"CL_CALENDAR", CL_CALENDAR},
|
||||
{"CL_TRIGSTAT", CL_TRIGSTAT}, {"CL_FORCECLOSE", CL_FORCECLOSE},
|
||||
{"CL_SNAPDIFF", CL_SNAPDIFF},
|
||||
{"CL_WEEKLY", CL_WEEKLY}, {"CL_TENDAY", CL_TENDAY},
|
||||
{"CL_SEMIMONTH", CL_SEMIMONTH}, {"CL_HYCLOSE", CL_HYCLOSE},
|
||||
{"CL_DAYVERIFY", CL_DAYVERIFY}, {"CL_WEEKVERIFY", CL_WEEKVERIFY},
|
||||
{"CL_MONVERIFY", CL_MONVERIFY}, {"CL_QTRVERIFY", CL_QTRVERIFY},
|
||||
{"CL_YEARVERIFY", CL_YEARVERIFY}, {"CL_HYVERIFY", CL_HYVERIFY},
|
||||
{"CL_SEGCLOSE", CL_SEGCLOSE}, {"CL_ISSCLOSE", CL_ISSCLOSE},
|
||||
{"CL_POSCLOSE", CL_POSCLOSE}, {"CL_FXCLOSE", CL_FXCLOSE},
|
||||
{"CL_SEGVERIFY", CL_SEGVERIFY}, {"CL_CORPVERIFY", CL_CORPVERIFY},
|
||||
{"CL_CHKUNMATCH", CL_CHKUNMATCH}, {"CL_CHKPENDING", CL_CHKPENDING},
|
||||
{"CL_CHKVOID", CL_CHKVOID}, {"CL_CHKLIMIT", CL_CHKLIMIT},
|
||||
{"CL_CHKALL", CL_CHKALL}, {"CL_TENTCLOSE", CL_TENTCLOSE},
|
||||
{"CL_MAINCLOSE", CL_MAINCLOSE}, {"CL_RECLOSEREG", CL_RECLOSEREG},
|
||||
{"CL_PROVCMP", CL_PROVCMP}, {"CL_RECLOSECHK", CL_RECLOSECHK},
|
||||
{"CL_APPRL1", CL_APPRL1}, {"CL_APPRL2", CL_APPRL2},
|
||||
{"CL_APPRFINAL", CL_APPRFINAL}, {"CL_APPRWD", CL_APPRWD},
|
||||
{"CL_APPRDELEG", CL_APPRDELEG}, {"CL_APPRSTAT", CL_APPRSTAT},
|
||||
{"CL_CXLERROR", CL_CXLERROR}, {"CL_CXLLATE", CL_CXLLATE},
|
||||
{"CL_CXLDUP", CL_CXLDUP}, {"CL_CXLREQ", CL_CXLREQ},
|
||||
{"CL_CXLSTAT", CL_CXLSTAT}, {"CL_STCROSS", CL_STCROSS},
|
||||
{"CL_CNTVERIFY", CL_CNTVERIFY}, {"CL_FEECROSS", CL_FEECROSS},
|
||||
{"CL_NETCROSS", CL_NETCROSS}, {"CL_MERXCHECK", CL_MERXCHECK},
|
||||
{"CL_RPTDIV", CL_RPTDIV}, {"CL_RPTPERIOD", CL_RPTPERIOD},
|
||||
{"CL_RPTSTATUS", CL_RPTSTATUS}, {"CL_RPTDELAY", CL_RPTDELAY},
|
||||
{"CL_RPTAPPR", CL_RPTAPPR}, {"CL_RPTCXL", CL_RPTCXL},
|
||||
{"CL_SLASET", CL_SLASET}, {"CL_SLABREACH", CL_SLABREACH},
|
||||
{"CL_SCHEDNEXT", CL_SCHEDNEXT}, {"CL_DUELIST", CL_DUELIST},
|
||||
{"CL_HOLICHK", CL_HOLICHK}, {"CL_NEXTBIZ", CL_NEXTBIZ},
|
||||
{"CL_TRIGSETTLE", CL_TRIGSETTLE}, {"CL_TRIGRPT", CL_TRIGRPT},
|
||||
{"CL_STCHGAUDIT", CL_STCHGAUDIT}, {"CL_SNAPMER", CL_SNAPMER},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
22
app/src/cl/svc/CL_APPRDELEG.h
Normal file
22
app/src/cl/svc/CL_APPRDELEG.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_APPRDELEG.h - cl 서비스 CL_APPRDELEG 카피북 (copybook / record header).
|
||||
* 마감 승인 위임: 승인 위임 메모 기록 후 상태 유지.
|
||||
*/
|
||||
#ifndef CL_APPRDELEG_H
|
||||
#define CL_APPRDELEG_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_apprdeleg_rec_t;
|
||||
|
||||
void CL_APPRDELEG(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_APPRDELEG_H */
|
||||
29
app/src/cl/svc/CL_APPRDELEG.pgc
Normal file
29
app/src/cl/svc/CL_APPRDELEG.pgc
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CL_APPRDELEG.pgc - cl 모듈 서비스 CL_APPRDELEG (one service = one file).
|
||||
* 마감 승인 위임: 위임 대상자(T_STR1)를 memo(APPR:DELEG:..)에 기록하고 상태 유지.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_APPRDELEG.h"
|
||||
|
||||
void CL_APPRDELEG(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char deleg[32];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid;
|
||||
char h_memo[64];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
gets_(b, T_STR1, deleg, sizeof(deleg));
|
||||
if (deleg[0] == 0) strcpy(deleg, "DELEGATE");
|
||||
snprintf(h_memo, sizeof(h_memo), "APPR:DELEG:%s", deleg);
|
||||
EXEC SQL UPDATE cl_close_log SET memo = :h_memo, updated_at = now()
|
||||
WHERE close_id = :h_cid AND status IN ('O','C');
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_RC, (long)sqlca.sqlerrd[2]);
|
||||
Bchg(b, T_STR1, 0, deleg, 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_APPRFINAL.h
Normal file
22
app/src/cl/svc/CL_APPRFINAL.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_APPRFINAL.h - cl 서비스 CL_APPRFINAL 카피북 (copybook / record header).
|
||||
* 최종 마감 승인: 2차 승인 마감을 최종 승인(A)으로 확정.
|
||||
*/
|
||||
#ifndef CL_APPRFINAL_H
|
||||
#define CL_APPRFINAL_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_apprfinal_rec_t;
|
||||
|
||||
void CL_APPRFINAL(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_APPRFINAL_H */
|
||||
29
app/src/cl/svc/CL_APPRFINAL.pgc
Normal file
29
app/src/cl/svc/CL_APPRFINAL.pgc
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CL_APPRFINAL.pgc - cl 모듈 서비스 CL_APPRFINAL (one service = one file).
|
||||
* 최종 마감 승인: 2차 승인(APPR:L2) 마감을 최종 승인(status=A)으로 확정.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_APPRFINAL.h"
|
||||
|
||||
void CL_APPRFINAL(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid, h_ok;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT count(*) INTO :h_ok FROM cl_close_log
|
||||
WHERE close_id = :h_cid AND memo = 'APPR:L2';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
if (h_ok == 0) { Bchg(b, T_MSG, 0, "2차 승인 선행 필요", 0L); FAIL(b); }
|
||||
EXEC SQL UPDATE cl_close_log SET status = 'A', memo = 'APPR:FINAL', updated_at = now()
|
||||
WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_ARG1, 3);
|
||||
Bchg(b, T_STATUS, 0, "A", 0L);
|
||||
Bchg(b, T_MSG, 0, "최종 승인 완료", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_APPRL1.h
Normal file
22
app/src/cl/svc/CL_APPRL1.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_APPRL1.h - cl 서비스 CL_APPRL1 카피북 (copybook / record header).
|
||||
* 1차 마감 승인: 개시(O)/완료(C) 마감을 1차 승인 단계로 전이.
|
||||
*/
|
||||
#ifndef CL_APPRL1_H
|
||||
#define CL_APPRL1_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_apprl1_rec_t;
|
||||
|
||||
void CL_APPRL1(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_APPRL1_H */
|
||||
27
app/src/cl/svc/CL_APPRL1.pgc
Normal file
27
app/src/cl/svc/CL_APPRL1.pgc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* CL_APPRL1.pgc - cl 모듈 서비스 CL_APPRL1 (one service = one file).
|
||||
* 1차 마감 승인: 개시(O)/완료(C) 마감을 1차 승인(memo=APPR:L1) 단계로 전이.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_APPRL1.h"
|
||||
|
||||
void CL_APPRL1(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char st[2];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
if (cldb_get_close_status(h_cid, st) < 0) FAIL(b);
|
||||
if (st[0] != 'O' && st[0] != 'C') { Bchg(b, T_MSG, 0, "승인 대상 상태 아님", 0L); FAIL(b); }
|
||||
EXEC SQL UPDATE cl_close_log SET memo = 'APPR:L1', updated_at = now()
|
||||
WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_ARG1, 1);
|
||||
Bchg(b, T_MSG, 0, "1차 승인 완료", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_APPRL2.h
Normal file
22
app/src/cl/svc/CL_APPRL2.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_APPRL2.h - cl 서비스 CL_APPRL2 카피북 (copybook / record header).
|
||||
* 2차 마감 승인: 1차 승인 마감을 2차 승인 단계로 전이.
|
||||
*/
|
||||
#ifndef CL_APPRL2_H
|
||||
#define CL_APPRL2_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_apprl2_rec_t;
|
||||
|
||||
void CL_APPRL2(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_APPRL2_H */
|
||||
28
app/src/cl/svc/CL_APPRL2.pgc
Normal file
28
app/src/cl/svc/CL_APPRL2.pgc
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* CL_APPRL2.pgc - cl 모듈 서비스 CL_APPRL2 (one service = one file).
|
||||
* 2차 마감 승인: 1차 승인(APPR:L1) 마감을 2차 승인(APPR:L2)으로 전이.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_APPRL2.h"
|
||||
|
||||
void CL_APPRL2(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid, h_ok;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT count(*) INTO :h_ok FROM cl_close_log
|
||||
WHERE close_id = :h_cid AND memo = 'APPR:L1';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
if (h_ok == 0) { Bchg(b, T_MSG, 0, "1차 승인 선행 필요", 0L); FAIL(b); }
|
||||
EXEC SQL UPDATE cl_close_log SET memo = 'APPR:L2', updated_at = now()
|
||||
WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_ARG1, 2);
|
||||
Bchg(b, T_MSG, 0, "2차 승인 완료", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_APPRSTAT.h
Normal file
22
app/src/cl/svc/CL_APPRSTAT.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_APPRSTAT.h - cl 서비스 CL_APPRSTAT 카피북 (copybook / record header).
|
||||
* 마감 승인 현황: 승인 단계별 마감 건수 집계.
|
||||
*/
|
||||
#ifndef CL_APPRSTAT_H
|
||||
#define CL_APPRSTAT_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_apprstat_rec_t;
|
||||
|
||||
void CL_APPRSTAT(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_APPRSTAT_H */
|
||||
27
app/src/cl/svc/CL_APPRSTAT.pgc
Normal file
27
app/src/cl/svc/CL_APPRSTAT.pgc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* CL_APPRSTAT.pgc - cl 모듈 서비스 CL_APPRSTAT (one service = one file).
|
||||
* 마감 승인 현황: 승인 단계별(L1/L2/최종A) 마감 건수를 집계한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_APPRSTAT.h"
|
||||
|
||||
void CL_APPRSTAT(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_l1, h_l2, h_fin;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL SELECT
|
||||
count(*) FILTER (WHERE memo = 'APPR:L1'),
|
||||
count(*) FILTER (WHERE memo = 'APPR:L2'),
|
||||
count(*) FILTER (WHERE status = 'A')
|
||||
INTO :h_l1, :h_l2, :h_fin FROM cl_close_log WHERE status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ARG1, h_l1);
|
||||
setl(b, T_ARG2, h_l2);
|
||||
setl(b, T_ARG3, h_fin);
|
||||
setl(b, T_COUNT, h_l1 + h_l2 + h_fin);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_APPRWD.h
Normal file
22
app/src/cl/svc/CL_APPRWD.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_APPRWD.h - cl 서비스 CL_APPRWD 카피북 (copybook / record header).
|
||||
* 마감 승인 회수: 승인 마감을 완료(C) 상태로 되돌림.
|
||||
*/
|
||||
#ifndef CL_APPRWD_H
|
||||
#define CL_APPRWD_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_apprwd_rec_t;
|
||||
|
||||
void CL_APPRWD(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_APPRWD_H */
|
||||
27
app/src/cl/svc/CL_APPRWD.pgc
Normal file
27
app/src/cl/svc/CL_APPRWD.pgc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* CL_APPRWD.pgc - cl 모듈 서비스 CL_APPRWD (one service = one file).
|
||||
* 마감 승인 회수: 승인(A) 마감을 완료(C) 상태로 되돌리고 승인 이력 초기화.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_APPRWD.h"
|
||||
|
||||
void CL_APPRWD(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char st[2];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
if (cldb_get_close_status(h_cid, st) < 0) FAIL(b);
|
||||
if (st[0] != 'A') { Bchg(b, T_MSG, 0, "승인(A) 상태 아님-회수 불가", 0L); FAIL(b); }
|
||||
if (cldb_update_close_status(h_cid, "C") < 0) FAIL(b);
|
||||
EXEC SQL UPDATE cl_close_log SET memo = '', updated_at = now() WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ID1, h_cid);
|
||||
Bchg(b, T_STATUS, 0, "C", 0L);
|
||||
Bchg(b, T_MSG, 0, "승인 회수 완료", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CHKALL.h
Normal file
22
app/src/cl/svc/CL_CHKALL.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CHKALL.h - cl 서비스 CL_CHKALL 카피북 (copybook / record header).
|
||||
* 마감 전 통합 체크: 미마감/미매칭/보류/한도 합산 점수 산출.
|
||||
*/
|
||||
#ifndef CL_CHKALL_H
|
||||
#define CL_CHKALL_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_chkall_rec_t;
|
||||
|
||||
void CL_CHKALL(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CHKALL_H */
|
||||
41
app/src/cl/svc/CL_CHKALL.pgc
Normal file
41
app/src/cl/svc/CL_CHKALL.pgc
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* CL_CHKALL.pgc - cl 모듈 서비스 CL_CHKALL (one service = one file).
|
||||
* 마감 전 통합 체크: 미마감(M)/미매칭/보류(H)/void(V) 합산 점수 산출.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CHKALL.h"
|
||||
|
||||
void CL_CHKALL(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long score;
|
||||
char msg[128];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_m, h_u, h_h, h_v;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*) INTO :h_m FROM purchase
|
||||
WHERE biz_date = :h_bizdate AND status = 'M';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT count(*) INTO :h_u FROM ac_unmatch WHERE biz_date = :h_bizdate;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT count(*) INTO :h_h FROM purchase
|
||||
WHERE biz_date = :h_bizdate AND status = 'H';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT count(*) INTO :h_v FROM purchase
|
||||
WHERE biz_date = :h_bizdate AND status = 'V';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
score = h_m + h_u + h_h + h_v;
|
||||
snprintf(msg, sizeof(msg), "미마감%ld/미매칭%ld/보류%ld/void%ld", h_m, h_u, h_h, h_v);
|
||||
setl(b, T_ARG1, h_m);
|
||||
setl(b, T_ARG2, h_u);
|
||||
setl(b, T_ARG3, h_h);
|
||||
setl(b, T_ARG4, h_v);
|
||||
setl(b, T_COUNT, score);
|
||||
setl(b, T_RC, (score > 0) ? 1 : 0);
|
||||
Bchg(b, T_MSG, 0, msg, 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CHKLIMIT.h
Normal file
22
app/src/cl/svc/CL_CHKLIMIT.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CHKLIMIT.h - cl 서비스 CL_CHKLIMIT 카피북 (copybook / record header).
|
||||
* 마감 전 한도 체크: 가맹점 일한도 초과 매입 존재 여부 판정.
|
||||
*/
|
||||
#ifndef CL_CHKLIMIT_H
|
||||
#define CL_CHKLIMIT_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_chklimit_rec_t;
|
||||
|
||||
void CL_CHKLIMIT(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CHKLIMIT_H */
|
||||
29
app/src/cl/svc/CL_CHKLIMIT.pgc
Normal file
29
app/src/cl/svc/CL_CHKLIMIT.pgc
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CL_CHKLIMIT.pgc - cl 모듈 서비스 CL_CHKLIMIT (one service = one file).
|
||||
* 마감 전 한도 체크: 가맹점 일한도(daily_limit) 초과 매입 존재 여부 판정.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CHKLIMIT.h"
|
||||
|
||||
void CL_CHKLIMIT(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_over;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*) INTO :h_over FROM (
|
||||
SELECT p.merchant_id
|
||||
FROM purchase p JOIN merchant m ON m.merchant_id = p.merchant_id
|
||||
WHERE p.biz_date = :h_bizdate
|
||||
GROUP BY p.merchant_id, m.daily_limit
|
||||
HAVING coalesce(sum(p.amount),0) > m.daily_limit) x;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_COUNT, h_over);
|
||||
setl(b, T_RC, (h_over > 0) ? 1 : 0);
|
||||
Bchg(b, T_MSG, 0, (h_over > 0) ? "일한도 초과 가맹점 존재" : "한도 내 정상", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CHKPENDING.h
Normal file
22
app/src/cl/svc/CL_CHKPENDING.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CHKPENDING.h - cl 서비스 CL_CHKPENDING 카피북 (copybook / record header).
|
||||
* 마감 전 보류 체크: 당일 보류(H) 매입 존재 여부 판정.
|
||||
*/
|
||||
#ifndef CL_CHKPENDING_H
|
||||
#define CL_CHKPENDING_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_chkpending_rec_t;
|
||||
|
||||
void CL_CHKPENDING(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CHKPENDING_H */
|
||||
26
app/src/cl/svc/CL_CHKPENDING.pgc
Normal file
26
app/src/cl/svc/CL_CHKPENDING.pgc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* CL_CHKPENDING.pgc - cl 모듈 서비스 CL_CHKPENDING (one service = one file).
|
||||
* 마감 전 보류 체크: 당일 보류(H) 매입 존재 여부 판정.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CHKPENDING.h"
|
||||
|
||||
void CL_CHKPENDING(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_n, h_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_n, :h_amt
|
||||
FROM purchase WHERE biz_date = :h_bizdate AND status = 'H';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_COUNT, h_n);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
setl(b, T_RC, (h_n > 0) ? 1 : 0);
|
||||
Bchg(b, T_MSG, 0, (h_n > 0) ? "보류(H) 매입 잔존" : "보류 없음", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CHKUNMATCH.h
Normal file
22
app/src/cl/svc/CL_CHKUNMATCH.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CHKUNMATCH.h - cl 서비스 CL_CHKUNMATCH 카피북 (copybook / record header).
|
||||
* 마감 전 미매칭 체크: 당일 미매칭(ac_unmatch) 존재 여부 판정.
|
||||
*/
|
||||
#ifndef CL_CHKUNMATCH_H
|
||||
#define CL_CHKUNMATCH_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_chkunmatch_rec_t;
|
||||
|
||||
void CL_CHKUNMATCH(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CHKUNMATCH_H */
|
||||
24
app/src/cl/svc/CL_CHKUNMATCH.pgc
Normal file
24
app/src/cl/svc/CL_CHKUNMATCH.pgc
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* CL_CHKUNMATCH.pgc - cl 모듈 서비스 CL_CHKUNMATCH (one service = one file).
|
||||
* 마감 전 미매칭 체크: 당일 미매칭(ac_unmatch) 존재 여부 판정.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CHKUNMATCH.h"
|
||||
|
||||
void CL_CHKUNMATCH(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_n;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*) INTO :h_n FROM ac_unmatch WHERE biz_date = :h_bizdate;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_COUNT, h_n);
|
||||
setl(b, T_RC, (h_n > 0) ? 1 : 0);
|
||||
Bchg(b, T_MSG, 0, (h_n > 0) ? "미매칭 존재-마감 불가" : "미매칭 없음", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CHKVOID.h
Normal file
22
app/src/cl/svc/CL_CHKVOID.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CHKVOID.h - cl 서비스 CL_CHKVOID 카피북 (copybook / record header).
|
||||
* 마감 전 void 체크: 당일 void(V) 매입 잔존 여부 판정.
|
||||
*/
|
||||
#ifndef CL_CHKVOID_H
|
||||
#define CL_CHKVOID_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_chkvoid_rec_t;
|
||||
|
||||
void CL_CHKVOID(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CHKVOID_H */
|
||||
25
app/src/cl/svc/CL_CHKVOID.pgc
Normal file
25
app/src/cl/svc/CL_CHKVOID.pgc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* CL_CHKVOID.pgc - cl 모듈 서비스 CL_CHKVOID (one service = one file).
|
||||
* 마감 전 void 체크: 당일 void(V) 매입 잔존 여부 판정.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CHKVOID.h"
|
||||
|
||||
void CL_CHKVOID(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_n;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*) INTO :h_n
|
||||
FROM purchase WHERE biz_date = :h_bizdate AND status = 'V';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_COUNT, h_n);
|
||||
setl(b, T_RC, (h_n > 0) ? 1 : 0);
|
||||
Bchg(b, T_MSG, 0, (h_n > 0) ? "void(V) 매입 잔존" : "void 없음", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CNTVERIFY.h
Normal file
22
app/src/cl/svc/CL_CNTVERIFY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CNTVERIFY.h - cl 서비스 CL_CNTVERIFY 카피북 (copybook / record header).
|
||||
* 건수 정합검증: 마감이력 건수와 매입 실건수 대사.
|
||||
*/
|
||||
#ifndef CL_CNTVERIFY_H
|
||||
#define CL_CNTVERIFY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_cntverify_rec_t;
|
||||
|
||||
void CL_CNTVERIFY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CNTVERIFY_H */
|
||||
30
app/src/cl/svc/CL_CNTVERIFY.pgc
Normal file
30
app/src/cl/svc/CL_CNTVERIFY.pgc
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CL_CNTVERIFY.pgc - cl 모듈 서비스 CL_CNTVERIFY (one service = one file).
|
||||
* 건수 정합검증: 마감이력 txn_count 와 해당 영업일 매입 실건수를 대사한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CNTVERIFY.h"
|
||||
|
||||
void CL_CNTVERIFY(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long delta;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_date[16];
|
||||
long h_cid, h_lc, h_rc;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT txn_count, to_char(biz_date,'YYYY-MM-DD') INTO :h_lc, :h_date
|
||||
FROM cl_close_log WHERE close_id = :h_cid AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL SELECT count(*) INTO :h_rc FROM purchase WHERE biz_date = :h_date;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
delta = h_lc - h_rc; if (delta < 0) delta = -delta;
|
||||
setl(b, T_ARG1, h_lc);
|
||||
setl(b, T_COUNT, h_rc);
|
||||
setl(b, T_DELTA, delta);
|
||||
setl(b, T_RC, (delta == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CORPVERIFY.h
Normal file
22
app/src/cl/svc/CL_CORPVERIFY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CORPVERIFY.h - cl 서비스 CL_CORPVERIFY 카피북 (copybook / record header).
|
||||
* 법인별 마감 검증: 법인 마감이력 건수/금액 정합 점검.
|
||||
*/
|
||||
#ifndef CL_CORPVERIFY_H
|
||||
#define CL_CORPVERIFY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_corpverify_rec_t;
|
||||
|
||||
void CL_CORPVERIFY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CORPVERIFY_H */
|
||||
34
app/src/cl/svc/CL_CORPVERIFY.pgc
Normal file
34
app/src/cl/svc/CL_CORPVERIFY.pgc
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* CL_CORPVERIFY.pgc - cl 모듈 서비스 CL_CORPVERIFY (one service = one file).
|
||||
* 법인별 마감 검증: 마감이력 헤더 건수/금액과 스냅샷 집계 정합 점검.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CORPVERIFY.h"
|
||||
|
||||
void CL_CORPVERIFY(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long mask = 0, dc, da;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid, h_lc, h_la, h_sc, h_sa;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT txn_count, total_amount INTO :h_lc, :h_la
|
||||
FROM cl_close_log WHERE close_id = :h_cid AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(txn_count),0), coalesce(sum(gross_amount),0)
|
||||
INTO :h_sc, :h_sa FROM cl_snapshot WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
dc = h_lc - h_sc; if (dc < 0) dc = -dc;
|
||||
da = h_la - h_sa; if (da < 0) da = -da;
|
||||
if (dc != 0) mask |= 1;
|
||||
if (da != 0) mask |= 2;
|
||||
setl(b, T_ARG1, h_lc);
|
||||
setl(b, T_ARG2, h_sc);
|
||||
setl(b, T_AMT1, h_la);
|
||||
setl(b, T_AMT2, h_sa);
|
||||
setl(b, T_RC, mask);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CXLDUP.h
Normal file
22
app/src/cl/svc/CL_CXLDUP.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CXLDUP.h - cl 서비스 CL_CXLDUP 카피북 (copybook / record header).
|
||||
* 중복마감 취소: 중복 마감 사유로 마감 취소 처리.
|
||||
*/
|
||||
#ifndef CL_CXLDUP_H
|
||||
#define CL_CXLDUP_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_cxldup_rec_t;
|
||||
|
||||
void CL_CXLDUP(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CXLDUP_H */
|
||||
30
app/src/cl/svc/CL_CXLDUP.pgc
Normal file
30
app/src/cl/svc/CL_CXLDUP.pgc
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CL_CXLDUP.pgc - cl 모듈 서비스 CL_CXLDUP (one service = one file).
|
||||
* 중복마감 취소: 동일 기간 중복 마감이력 중 최신을 남기고 취소(status=X) 처리.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CXLDUP.h"
|
||||
|
||||
void CL_CXLDUP(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_ct[16], h_pk[24];
|
||||
long h_cid;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT close_type, period_key INTO :h_ct, :h_pk
|
||||
FROM cl_close_log WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL UPDATE cl_close_log SET status = 'X', memo = '취소:중복마감', updated_at = now()
|
||||
WHERE close_type = :h_ct AND period_key = :h_pk AND status <> 'X'
|
||||
AND close_id <> (SELECT max(close_id) FROM cl_close_log
|
||||
WHERE close_type = :h_ct AND period_key = :h_pk AND status <> 'X');
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_RC, (long)sqlca.sqlerrd[2]);
|
||||
setl(b, T_COUNT, (long)sqlca.sqlerrd[2]);
|
||||
Bchg(b, T_REASON, 0, "중복마감", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CXLERROR.h
Normal file
22
app/src/cl/svc/CL_CXLERROR.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CXLERROR.h - cl 서비스 CL_CXLERROR 카피북 (copybook / record header).
|
||||
* 오류정정 취소: 오류정정 사유로 마감 취소(X) 처리.
|
||||
*/
|
||||
#ifndef CL_CXLERROR_H
|
||||
#define CL_CXLERROR_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_cxlerror_rec_t;
|
||||
|
||||
void CL_CXLERROR(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CXLERROR_H */
|
||||
26
app/src/cl/svc/CL_CXLERROR.pgc
Normal file
26
app/src/cl/svc/CL_CXLERROR.pgc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* CL_CXLERROR.pgc - cl 모듈 서비스 CL_CXLERROR (one service = one file).
|
||||
* 오류정정 취소: 오류정정 사유로 마감을 취소(status=X)한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CXLERROR.h"
|
||||
|
||||
void CL_CXLERROR(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL UPDATE cl_close_log SET status = 'X', memo = '취소:오류정정', updated_at = now()
|
||||
WHERE close_id = :h_cid AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
if (sqlca.sqlerrd[2] == 0) { Bchg(b, T_MSG, 0, "취소 대상 없음(이미 취소)", 0L); FAIL(b); }
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_RC, (long)sqlca.sqlerrd[2]);
|
||||
Bchg(b, T_STATUS, 0, "X", 0L);
|
||||
Bchg(b, T_REASON, 0, "오류정정", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CXLLATE.h
Normal file
22
app/src/cl/svc/CL_CXLLATE.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CXLLATE.h - cl 서비스 CL_CXLLATE 카피북 (copybook / record header).
|
||||
* 지연자료 취소: 지연자료 반영 사유로 마감 취소 처리.
|
||||
*/
|
||||
#ifndef CL_CXLLATE_H
|
||||
#define CL_CXLLATE_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_cxllate_rec_t;
|
||||
|
||||
void CL_CXLLATE(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CXLLATE_H */
|
||||
26
app/src/cl/svc/CL_CXLLATE.pgc
Normal file
26
app/src/cl/svc/CL_CXLLATE.pgc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* CL_CXLLATE.pgc - cl 모듈 서비스 CL_CXLLATE (one service = one file).
|
||||
* 지연자료 취소: 지연자료 반영 사유로 마감을 취소(status=X)한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CXLLATE.h"
|
||||
|
||||
void CL_CXLLATE(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL UPDATE cl_close_log SET status = 'X', memo = '취소:지연자료', updated_at = now()
|
||||
WHERE close_id = :h_cid AND status IN ('C','A');
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
if (sqlca.sqlerrd[2] == 0) { Bchg(b, T_MSG, 0, "취소 가능 상태 아님", 0L); FAIL(b); }
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_RC, (long)sqlca.sqlerrd[2]);
|
||||
Bchg(b, T_STATUS, 0, "X", 0L);
|
||||
Bchg(b, T_REASON, 0, "지연자료", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CXLREQ.h
Normal file
22
app/src/cl/svc/CL_CXLREQ.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CXLREQ.h - cl 서비스 CL_CXLREQ 카피북 (copybook / record header).
|
||||
* 마감 취소 요청: 취소 요청 사유 기록 후 요청 표기.
|
||||
*/
|
||||
#ifndef CL_CXLREQ_H
|
||||
#define CL_CXLREQ_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_cxlreq_rec_t;
|
||||
|
||||
void CL_CXLREQ(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CXLREQ_H */
|
||||
30
app/src/cl/svc/CL_CXLREQ.pgc
Normal file
30
app/src/cl/svc/CL_CXLREQ.pgc
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CL_CXLREQ.pgc - cl 모듈 서비스 CL_CXLREQ (one service = one file).
|
||||
* 마감 취소 요청: 취소 사유(T_REASON)를 memo(CXLREQ:..)에 기록해 요청 표기(상태 유지).
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CXLREQ.h"
|
||||
|
||||
void CL_CXLREQ(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char reason[32];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_cid;
|
||||
char h_memo[64];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
gets_(b, T_REASON, reason, sizeof(reason));
|
||||
if (reason[0] == 0) strcpy(reason, "미기재");
|
||||
snprintf(h_memo, sizeof(h_memo), "CXLREQ:%s", reason);
|
||||
EXEC SQL UPDATE cl_close_log SET memo = :h_memo, updated_at = now()
|
||||
WHERE close_id = :h_cid AND status IN ('C','A');
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
if (sqlca.sqlerrd[2] == 0) { Bchg(b, T_MSG, 0, "요청 대상 아님", 0L); FAIL(b); }
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_RC, (long)sqlca.sqlerrd[2]);
|
||||
Bchg(b, T_REASON, 0, reason, 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_CXLSTAT.h
Normal file
22
app/src/cl/svc/CL_CXLSTAT.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_CXLSTAT.h - cl 서비스 CL_CXLSTAT 카피북 (copybook / record header).
|
||||
* 마감 취소 현황: 취소 사유별 마감 취소 건수 집계.
|
||||
*/
|
||||
#ifndef CL_CXLSTAT_H
|
||||
#define CL_CXLSTAT_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_cxlstat_rec_t;
|
||||
|
||||
void CL_CXLSTAT(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_CXLSTAT_H */
|
||||
28
app/src/cl/svc/CL_CXLSTAT.pgc
Normal file
28
app/src/cl/svc/CL_CXLSTAT.pgc
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* CL_CXLSTAT.pgc - cl 모듈 서비스 CL_CXLSTAT (one service = one file).
|
||||
* 마감 취소 현황: 취소 사유별(오류정정/지연자료/중복마감) 취소 건수를 집계한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_CXLSTAT.h"
|
||||
|
||||
void CL_CXLSTAT(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
long h_err, h_late, h_dup, h_tot;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL SELECT
|
||||
count(*) FILTER (WHERE memo LIKE '취소:오류%'),
|
||||
count(*) FILTER (WHERE memo LIKE '취소:지연%'),
|
||||
count(*) FILTER (WHERE memo LIKE '취소:중복%'),
|
||||
count(*)
|
||||
INTO :h_err, :h_late, :h_dup, :h_tot FROM cl_close_log WHERE status = 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
setl(b, T_ARG1, h_err);
|
||||
setl(b, T_ARG2, h_late);
|
||||
setl(b, T_ARG3, h_dup);
|
||||
setl(b, T_COUNT, h_tot);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_DAYVERIFY.h
Normal file
22
app/src/cl/svc/CL_DAYVERIFY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_DAYVERIFY.h - cl 서비스 CL_DAYVERIFY 카피북 (copybook / record header).
|
||||
* 일 마감 검증: 당일 마감이력 집계와 매입 실집계 대사.
|
||||
*/
|
||||
#ifndef CL_DAYVERIFY_H
|
||||
#define CL_DAYVERIFY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_dayverify_rec_t;
|
||||
|
||||
void CL_DAYVERIFY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_DAYVERIFY_H */
|
||||
35
app/src/cl/svc/CL_DAYVERIFY.pgc
Normal file
35
app/src/cl/svc/CL_DAYVERIFY.pgc
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* CL_DAYVERIFY.pgc - cl 모듈 서비스 CL_DAYVERIFY (one service = one file).
|
||||
* 일 마감 검증: 당일 마감이력 집계와 매입 실집계 대사.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_DAYVERIFY.h"
|
||||
|
||||
void CL_DAYVERIFY(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long dc, da;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_lc, h_la, h_rc, h_ra;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT coalesce(sum(txn_count),0), coalesce(sum(total_amount),0)
|
||||
INTO :h_lc, :h_la FROM cl_close_log
|
||||
WHERE close_type = 'DAILY' AND period_key = :h_bizdate AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_rc, :h_ra
|
||||
FROM purchase WHERE biz_date = :h_bizdate;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
dc = h_lc - h_rc; if (dc < 0) dc = -dc;
|
||||
da = h_la - h_ra; if (da < 0) da = -da;
|
||||
setl(b, T_COUNT, h_rc);
|
||||
setl(b, T_ARG1, h_lc);
|
||||
setl(b, T_AMT1, h_la);
|
||||
setl(b, T_AMT2, h_ra);
|
||||
setl(b, T_DELTA, da);
|
||||
setl(b, T_RC, (dc == 0 && da == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_DUELIST.h
Normal file
22
app/src/cl/svc/CL_DUELIST.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_DUELIST.h - cl 서비스 CL_DUELIST 카피북 (copybook / record header).
|
||||
* 마감 예정 목록: 기한 도래 마감 대상 기간 목록 산출.
|
||||
*/
|
||||
#ifndef CL_DUELIST_H
|
||||
#define CL_DUELIST_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_duelist_rec_t;
|
||||
|
||||
void CL_DUELIST(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_DUELIST_H */
|
||||
41
app/src/cl/svc/CL_DUELIST.pgc
Normal file
41
app/src/cl/svc/CL_DUELIST.pgc
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* CL_DUELIST.pgc - cl 모듈 서비스 CL_DUELIST (one service = one file).
|
||||
* 마감 예정 목록: 기준일 이전 14일 내 영업일 중 DAILY 마감이 없는 미마감 대상일을 나열.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_DUELIST.h"
|
||||
|
||||
void CL_DUELIST(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long occ = 0;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16], h_day[16];
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL DECLARE crdue CURSOR FOR
|
||||
SELECT to_char(d,'YYYY-MM-DD') FROM (
|
||||
SELECT (:h_bizdate::date - s) AS d,
|
||||
extract(dow from (:h_bizdate::date - s)) AS dw
|
||||
FROM generate_series(0,13) s) t
|
||||
WHERE dw NOT IN (0,6)
|
||||
AND NOT EXISTS (SELECT 1 FROM cl_close_log
|
||||
WHERE close_type = 'DAILY'
|
||||
AND period_key = to_char(t.d,'YYYY-MM-DD') AND status <> 'X')
|
||||
ORDER BY d DESC;
|
||||
EXEC SQL OPEN crdue;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
for (;;) {
|
||||
EXEC SQL FETCH crdue INTO :h_day;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE crdue; FAIL(b); }
|
||||
Bchg(b, T_KEY1, (BFLDOCC)occ, h_day, 0L);
|
||||
occ++;
|
||||
}
|
||||
EXEC SQL CLOSE crdue;
|
||||
setl(b, T_COUNT, occ);
|
||||
setl(b, T_RC, (occ > 0) ? 1 : 0);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_FEECROSS.h
Normal file
22
app/src/cl/svc/CL_FEECROSS.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_FEECROSS.h - cl 서비스 CL_FEECROSS 카피북 (copybook / record header).
|
||||
* 수수료 크로스검증: 마감 수수료 합계와 매입 fee 합계 대사.
|
||||
*/
|
||||
#ifndef CL_FEECROSS_H
|
||||
#define CL_FEECROSS_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_feecross_rec_t;
|
||||
|
||||
void CL_FEECROSS(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_FEECROSS_H */
|
||||
34
app/src/cl/svc/CL_FEECROSS.pgc
Normal file
34
app/src/cl/svc/CL_FEECROSS.pgc
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* CL_FEECROSS.pgc - cl 모듈 서비스 CL_FEECROSS (one service = one file).
|
||||
* 수수료 크로스검증: 마감 스냅샷 fee 합계와 해당 영업일 매입 fee 합계를 대사한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_FEECROSS.h"
|
||||
|
||||
void CL_FEECROSS(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long delta;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_date[16];
|
||||
long h_cid, h_sf, h_pf;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT to_char(biz_date,'YYYY-MM-DD') INTO :h_date
|
||||
FROM cl_close_log WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(fee_amount),0) INTO :h_sf
|
||||
FROM cl_snapshot WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(fee),0) INTO :h_pf
|
||||
FROM purchase WHERE biz_date = :h_date;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
delta = h_sf - h_pf; if (delta < 0) delta = -delta;
|
||||
setl(b, T_AMT1, h_sf);
|
||||
setl(b, T_AMT2, h_pf);
|
||||
setl(b, T_DELTA, delta);
|
||||
setl(b, T_RC, (delta == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_FXCLOSE.h
Normal file
22
app/src/cl/svc/CL_FXCLOSE.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_FXCLOSE.h - cl 서비스 CL_FXCLOSE 카피북 (copybook / record header).
|
||||
* 해외(FOREIGN) 채널 마감: 해외 매입 집계 후 FX 마감이력.
|
||||
*/
|
||||
#ifndef CL_FXCLOSE_H
|
||||
#define CL_FXCLOSE_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_fxclose_rec_t;
|
||||
|
||||
void CL_FXCLOSE(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_FXCLOSE_H */
|
||||
34
app/src/cl/svc/CL_FXCLOSE.pgc
Normal file
34
app/src/cl/svc/CL_FXCLOSE.pgc
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* CL_FXCLOSE.pgc - cl 모듈 서비스 CL_FXCLOSE (one service = one file).
|
||||
* 해외(FOREIGN) 채널 마감: 해외 매입 집계 + ac_fx 원화환산 합계 후 FX 마감.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_FXCLOSE.h"
|
||||
|
||||
void CL_FXCLOSE(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long cid;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_cnt, h_amt, h_krw;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_cnt, :h_amt
|
||||
FROM purchase WHERE biz_date = :h_bizdate AND channel = 'FOREIGN';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(krw_amount),0) INTO :h_krw
|
||||
FROM ac_fx WHERE biz_date = :h_bizdate;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) FAIL(b);
|
||||
if (cldb_insert_close(cid, "FX", h_bizdate, h_bizdate, "C", h_cnt, h_amt, "해외채널마감") < 0) FAIL(b);
|
||||
setl(b, T_ID1, cid);
|
||||
setl(b, T_COUNT, h_cnt);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
setl(b, T_AMT1, h_krw);
|
||||
setl(b, T_RC, (h_amt == h_krw) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_HOLICHK.h
Normal file
22
app/src/cl/svc/CL_HOLICHK.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_HOLICHK.h - cl 서비스 CL_HOLICHK 카피북 (copybook / record header).
|
||||
* 휴일 마감 판정: 주말/휴일 여부에 따른 마감정책 결정.
|
||||
*/
|
||||
#ifndef CL_HOLICHK_H
|
||||
#define CL_HOLICHK_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_holichk_rec_t;
|
||||
|
||||
void CL_HOLICHK(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_HOLICHK_H */
|
||||
26
app/src/cl/svc/CL_HOLICHK.pgc
Normal file
26
app/src/cl/svc/CL_HOLICHK.pgc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* CL_HOLICHK.pgc - cl 모듈 서비스 CL_HOLICHK (one service = one file).
|
||||
* 휴일 마감 판정: 기준일의 요일(dow)로 주말 여부를 보고 마감정책(정상/이월)을 결정.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_HOLICHK.h"
|
||||
|
||||
void CL_HOLICHK(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
int weekend;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_dow;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT extract(dow from :h_bizdate::date)::int INTO :h_dow;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
weekend = (h_dow == 0 || h_dow == 6) ? 1 : 0;
|
||||
setl(b, T_ARG1, h_dow);
|
||||
setl(b, T_RC, weekend);
|
||||
Bchg(b, T_MSG, 0, weekend ? "휴일-마감 이월" : "영업일-정상 마감", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_HYCLOSE.h
Normal file
22
app/src/cl/svc/CL_HYCLOSE.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_HYCLOSE.h - cl 서비스 CL_HYCLOSE 카피북 (copybook / record header).
|
||||
* 반기 마감: 상/하반기 6개월 매입 집계 후 HALFYR 마감이력 생성.
|
||||
*/
|
||||
#ifndef CL_HYCLOSE_H
|
||||
#define CL_HYCLOSE_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_hyclose_rec_t;
|
||||
|
||||
void CL_HYCLOSE(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_HYCLOSE_H */
|
||||
40
app/src/cl/svc/CL_HYCLOSE.pgc
Normal file
40
app/src/cl/svc/CL_HYCLOSE.pgc
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* CL_HYCLOSE.pgc - cl 모듈 서비스 CL_HYCLOSE (one service = one file).
|
||||
* 반기 마감: 상/하반기 6개월 매입 집계 후 HALFYR 마감이력 생성.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_HYCLOSE.h"
|
||||
|
||||
void CL_HYCLOSE(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long cid, half;
|
||||
char period[24], memo[32];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16], h_yr[8];
|
||||
long h_mon, h_lo, h_hi, h_cnt, h_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT extract(month from :h_bizdate::date)::int,
|
||||
to_char(:h_bizdate::date, 'YYYY') INTO :h_mon, :h_yr;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
half = (h_mon <= 6) ? 1 : 2;
|
||||
h_lo = (half == 1) ? 1 : 7;
|
||||
h_hi = (half == 1) ? 6 : 12;
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_cnt, :h_amt
|
||||
FROM purchase WHERE to_char(biz_date,'YYYY') = :h_yr
|
||||
AND extract(month from biz_date) BETWEEN :h_lo AND :h_hi;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
snprintf(period, sizeof(period), "%s-HY%ld", h_yr, half);
|
||||
snprintf(memo, sizeof(memo), "반기마감:%s반기", (half == 1) ? "상" : "하");
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) FAIL(b);
|
||||
if (cldb_insert_close(cid, "HALFYR", period, h_bizdate, "C", h_cnt, h_amt, memo) < 0) FAIL(b);
|
||||
setl(b, T_ID1, cid);
|
||||
setl(b, T_ARG1, half);
|
||||
setl(b, T_COUNT, h_cnt);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_HYVERIFY.h
Normal file
22
app/src/cl/svc/CL_HYVERIFY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_HYVERIFY.h - cl 서비스 CL_HYVERIFY 카피북 (copybook / record header).
|
||||
* 반기 마감 검증: 반기 마감이력과 반기 매입 실집계 대사.
|
||||
*/
|
||||
#ifndef CL_HYVERIFY_H
|
||||
#define CL_HYVERIFY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_hyverify_rec_t;
|
||||
|
||||
void CL_HYVERIFY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_HYVERIFY_H */
|
||||
42
app/src/cl/svc/CL_HYVERIFY.pgc
Normal file
42
app/src/cl/svc/CL_HYVERIFY.pgc
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* CL_HYVERIFY.pgc - cl 모듈 서비스 CL_HYVERIFY (one service = one file).
|
||||
* 반기 마감 검증: 반기 마감이력과 반기 매입 실집계 대사.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_HYVERIFY.h"
|
||||
|
||||
void CL_HYVERIFY(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long half, da;
|
||||
char pk[24];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16], h_yr[8], h_pk[24];
|
||||
long h_mon, h_lo, h_hi, h_la, h_ra;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT extract(month from :h_bizdate::date)::int,
|
||||
to_char(:h_bizdate::date, 'YYYY') INTO :h_mon, :h_yr;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
half = (h_mon <= 6) ? 1 : 2;
|
||||
h_lo = (half == 1) ? 1 : 7;
|
||||
h_hi = (half == 1) ? 6 : 12;
|
||||
snprintf(pk, sizeof(pk), "%s-HY%ld", h_yr, half);
|
||||
strncpy(h_pk, pk, sizeof(h_pk)-1); h_pk[sizeof(h_pk)-1] = 0;
|
||||
EXEC SQL SELECT coalesce(sum(total_amount),0) INTO :h_la FROM cl_close_log
|
||||
WHERE close_type = 'HALFYR' AND period_key = :h_pk AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(amount),0) INTO :h_ra FROM purchase
|
||||
WHERE to_char(biz_date,'YYYY') = :h_yr
|
||||
AND extract(month from biz_date) BETWEEN :h_lo AND :h_hi;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
da = h_la - h_ra; if (da < 0) da = -da;
|
||||
setl(b, T_ARG1, half);
|
||||
setl(b, T_AMT1, h_la);
|
||||
setl(b, T_AMT2, h_ra);
|
||||
setl(b, T_DELTA, da);
|
||||
setl(b, T_RC, (da == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_ISSCLOSE.h
Normal file
22
app/src/cl/svc/CL_ISSCLOSE.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_ISSCLOSE.h - cl 서비스 CL_ISSCLOSE 카피북 (copybook / record header).
|
||||
* 발급사별 마감: 발급사(issuer) 단위 매입 집계 후 ISS 마감.
|
||||
*/
|
||||
#ifndef CL_ISSCLOSE_H
|
||||
#define CL_ISSCLOSE_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_issclose_rec_t;
|
||||
|
||||
void CL_ISSCLOSE(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_ISSCLOSE_H */
|
||||
36
app/src/cl/svc/CL_ISSCLOSE.pgc
Normal file
36
app/src/cl/svc/CL_ISSCLOSE.pgc
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* CL_ISSCLOSE.pgc - cl 모듈 서비스 CL_ISSCLOSE (one service = one file).
|
||||
* 발급사별 마감: 발급사(issuer) 단위 매입 집계 후 ISS 마감.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_ISSCLOSE.h"
|
||||
|
||||
void CL_ISSCLOSE(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char memo[48];
|
||||
long cid;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16], h_iss[24];
|
||||
long h_cnt, h_amt, h_fee;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
gets_(b, T_ISSUER, h_iss, sizeof(h_iss));
|
||||
if (h_iss[0] == 0) strcpy(h_iss, "UNKNOWN");
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0), coalesce(sum(fee),0)
|
||||
INTO :h_cnt, :h_amt, :h_fee
|
||||
FROM purchase WHERE biz_date = :h_bizdate AND issuer = :h_iss;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) FAIL(b);
|
||||
snprintf(memo, sizeof(memo), "발급사마감:%s", h_iss);
|
||||
if (cldb_insert_close(cid, "ISS", h_bizdate, h_bizdate, "C", h_cnt, h_amt, memo) < 0) FAIL(b);
|
||||
setl(b, T_ID1, cid);
|
||||
setl(b, T_COUNT, h_cnt);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
setl(b, T_FEE, h_fee);
|
||||
Bchg(b, T_ISSUER, 0, h_iss, 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_MAINCLOSE.h
Normal file
22
app/src/cl/svc/CL_MAINCLOSE.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_MAINCLOSE.h - cl 서비스 CL_MAINCLOSE 카피북 (copybook / record header).
|
||||
* 본마감: 가마감 이력을 확정(status=C)으로 승격.
|
||||
*/
|
||||
#ifndef CL_MAINCLOSE_H
|
||||
#define CL_MAINCLOSE_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_mainclose_rec_t;
|
||||
|
||||
void CL_MAINCLOSE(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_MAINCLOSE_H */
|
||||
34
app/src/cl/svc/CL_MAINCLOSE.pgc
Normal file
34
app/src/cl/svc/CL_MAINCLOSE.pgc
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* CL_MAINCLOSE.pgc - cl 모듈 서비스 CL_MAINCLOSE (one service = one file).
|
||||
* 본마감: 가마감(O) 이력을 당일 전체 매입으로 재집계해 확정(C)으로 승격.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_MAINCLOSE.h"
|
||||
|
||||
void CL_MAINCLOSE(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char st[2];
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_date[16];
|
||||
long h_cid, h_cnt, h_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
if (cldb_get_close_status(h_cid, st) < 0) FAIL(b);
|
||||
if (st[0] != 'O') { Bchg(b, T_MSG, 0, "가마감(O) 상태 아님-본마감 불가", 0L); FAIL(b); }
|
||||
EXEC SQL SELECT to_char(biz_date,'YYYY-MM-DD') INTO :h_date
|
||||
FROM cl_close_log WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_cnt, :h_amt
|
||||
FROM purchase WHERE biz_date = :h_date;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
if (cldb_update_close_totals(h_cid, h_cnt, h_amt) < 0) FAIL(b);
|
||||
if (cldb_update_close_status(h_cid, "C") < 0) FAIL(b);
|
||||
setl(b, T_ID1, h_cid);
|
||||
setl(b, T_COUNT, h_cnt);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
Bchg(b, T_STATUS, 0, "C", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_MERXCHECK.h
Normal file
22
app/src/cl/svc/CL_MERXCHECK.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_MERXCHECK.h - cl 서비스 CL_MERXCHECK 카피북 (copybook / record header).
|
||||
* 가맹점별 크로스검증: 스냅샷 gross와 매입 amount 가맹점 대사.
|
||||
*/
|
||||
#ifndef CL_MERXCHECK_H
|
||||
#define CL_MERXCHECK_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_merxcheck_rec_t;
|
||||
|
||||
void CL_MERXCHECK(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_MERXCHECK_H */
|
||||
44
app/src/cl/svc/CL_MERXCHECK.pgc
Normal file
44
app/src/cl/svc/CL_MERXCHECK.pgc
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* CL_MERXCHECK.pgc - cl 모듈 서비스 CL_MERXCHECK (one service = one file).
|
||||
* 가맹점별 크로스검증: 마감 스냅샷 gross 와 매입 amount 를 가맹점 단위로 대사해
|
||||
* 불일치 가맹점 수를 커서로 집계한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_MERXCHECK.h"
|
||||
|
||||
void CL_MERXCHECK(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long total = 0, mism = 0;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_date[16], h_mer[16];
|
||||
long h_cid, h_sg, h_pa;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT to_char(biz_date,'YYYY-MM-DD') INTO :h_date
|
||||
FROM cl_close_log WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL DECLARE crmx CURSOR FOR
|
||||
SELECT s.merchant_id, s.gross_amount, coalesce(pp.amt,0)
|
||||
FROM cl_snapshot s
|
||||
LEFT JOIN (SELECT merchant_id, sum(amount) AS amt FROM purchase
|
||||
WHERE biz_date = :h_date GROUP BY merchant_id) pp
|
||||
ON pp.merchant_id = s.merchant_id
|
||||
WHERE s.close_id = :h_cid;
|
||||
EXEC SQL OPEN crmx;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
for (;;) {
|
||||
EXEC SQL FETCH crmx INTO :h_mer, :h_sg, :h_pa;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE crmx; FAIL(b); }
|
||||
total++;
|
||||
if (h_sg != h_pa) mism++;
|
||||
}
|
||||
EXEC SQL CLOSE crmx;
|
||||
setl(b, T_COUNT, total);
|
||||
setl(b, T_ARG1, mism);
|
||||
setl(b, T_RC, (mism == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_MONVERIFY.h
Normal file
22
app/src/cl/svc/CL_MONVERIFY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_MONVERIFY.h - cl 서비스 CL_MONVERIFY 카피북 (copybook / record header).
|
||||
* 월 마감 검증: 월 마감이력과 월 매입 실집계 대사.
|
||||
*/
|
||||
#ifndef CL_MONVERIFY_H
|
||||
#define CL_MONVERIFY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_monverify_rec_t;
|
||||
|
||||
void CL_MONVERIFY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_MONVERIFY_H */
|
||||
36
app/src/cl/svc/CL_MONVERIFY.pgc
Normal file
36
app/src/cl/svc/CL_MONVERIFY.pgc
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* CL_MONVERIFY.pgc - cl 모듈 서비스 CL_MONVERIFY (one service = one file).
|
||||
* 월 마감 검증: 월 마감이력과 월 매입 실집계 대사.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_MONVERIFY.h"
|
||||
|
||||
void CL_MONVERIFY(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long dc, da;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_lc, h_la, h_rc, h_ra;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT coalesce(sum(txn_count),0), coalesce(sum(total_amount),0)
|
||||
INTO :h_lc, :h_la FROM cl_close_log
|
||||
WHERE close_type = 'MONTHLY'
|
||||
AND period_key = to_char(:h_bizdate::date, 'YYYY-MM') AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_rc, :h_ra
|
||||
FROM purchase WHERE to_char(biz_date,'YYYY-MM') = to_char(:h_bizdate::date,'YYYY-MM');
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
dc = h_lc - h_rc; if (dc < 0) dc = -dc;
|
||||
da = h_la - h_ra; if (da < 0) da = -da;
|
||||
setl(b, T_ARG1, h_lc);
|
||||
setl(b, T_COUNT, h_rc);
|
||||
setl(b, T_AMT1, h_la);
|
||||
setl(b, T_AMT2, h_ra);
|
||||
setl(b, T_DELTA, da);
|
||||
setl(b, T_RC, (dc == 0 && da == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_NETCROSS.h
Normal file
22
app/src/cl/svc/CL_NETCROSS.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_NETCROSS.h - cl 서비스 CL_NETCROSS 카피북 (copybook / record header).
|
||||
* 정산액 크로스검증: 마감 정산액과 매입 net 합계 대사.
|
||||
*/
|
||||
#ifndef CL_NETCROSS_H
|
||||
#define CL_NETCROSS_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_netcross_rec_t;
|
||||
|
||||
void CL_NETCROSS(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_NETCROSS_H */
|
||||
34
app/src/cl/svc/CL_NETCROSS.pgc
Normal file
34
app/src/cl/svc/CL_NETCROSS.pgc
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* CL_NETCROSS.pgc - cl 모듈 서비스 CL_NETCROSS (one service = one file).
|
||||
* 정산액 크로스검증: 마감 스냅샷 net 합계와 해당 영업일 매입 net 합계를 대사한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_NETCROSS.h"
|
||||
|
||||
void CL_NETCROSS(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long delta;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_date[16];
|
||||
long h_cid, h_sn, h_pn;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_cid = getl(b, T_ID1);
|
||||
EXEC SQL SELECT to_char(biz_date,'YYYY-MM-DD') INTO :h_date
|
||||
FROM cl_close_log WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(net_amount),0) INTO :h_sn
|
||||
FROM cl_snapshot WHERE close_id = :h_cid;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(net),0) INTO :h_pn
|
||||
FROM purchase WHERE biz_date = :h_date;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
delta = h_sn - h_pn; if (delta < 0) delta = -delta;
|
||||
setl(b, T_AMT1, h_sn);
|
||||
setl(b, T_AMT2, h_pn);
|
||||
setl(b, T_DELTA, delta);
|
||||
setl(b, T_RC, (delta == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_NEXTBIZ.h
Normal file
22
app/src/cl/svc/CL_NEXTBIZ.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_NEXTBIZ.h - cl 서비스 CL_NEXTBIZ 카피북 (copybook / record header).
|
||||
* 익영업일 산출: 휴일 스킵하여 다음 영업일 산출.
|
||||
*/
|
||||
#ifndef CL_NEXTBIZ_H
|
||||
#define CL_NEXTBIZ_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_nextbiz_rec_t;
|
||||
|
||||
void CL_NEXTBIZ(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_NEXTBIZ_H */
|
||||
29
app/src/cl/svc/CL_NEXTBIZ.pgc
Normal file
29
app/src/cl/svc/CL_NEXTBIZ.pgc
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CL_NEXTBIZ.pgc - cl 모듈 서비스 CL_NEXTBIZ (one service = one file).
|
||||
* 익영업일 산출: 기준일 포함 이후 주말을 건너뛴 첫 영업일과 건너뛴 일수를 반환.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_NEXTBIZ.h"
|
||||
|
||||
void CL_NEXTBIZ(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16], h_next[16];
|
||||
long h_skip;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT to_char(d,'YYYY-MM-DD') INTO :h_next FROM (
|
||||
SELECT (:h_bizdate::date + s) AS d,
|
||||
extract(dow from (:h_bizdate::date + s)) AS dw
|
||||
FROM generate_series(0,7) s) t
|
||||
WHERE dw NOT IN (0,6) ORDER BY d LIMIT 1;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
EXEC SQL SELECT (:h_next::date - :h_bizdate::date) INTO :h_skip;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
Bchg(b, T_KEY1, 0, h_next, 0L);
|
||||
setl(b, T_ARG1, h_skip);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_POSCLOSE.h
Normal file
22
app/src/cl/svc/CL_POSCLOSE.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_POSCLOSE.h - cl 서비스 CL_POSCLOSE 카피북 (copybook / record header).
|
||||
* POS 채널 마감: POS 채널 당일 매입 집계 후 POS 마감이력.
|
||||
*/
|
||||
#ifndef CL_POSCLOSE_H
|
||||
#define CL_POSCLOSE_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_posclose_rec_t;
|
||||
|
||||
void CL_POSCLOSE(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_POSCLOSE_H */
|
||||
32
app/src/cl/svc/CL_POSCLOSE.pgc
Normal file
32
app/src/cl/svc/CL_POSCLOSE.pgc
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* CL_POSCLOSE.pgc - cl 모듈 서비스 CL_POSCLOSE (one service = one file).
|
||||
* POS 채널 마감: POS 채널 당일 매입 집계 후 POS 마감이력.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_POSCLOSE.h"
|
||||
|
||||
void CL_POSCLOSE(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long cid;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_cnt, h_amt, h_fee, h_net;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0), coalesce(sum(fee),0), coalesce(sum(net),0)
|
||||
INTO :h_cnt, :h_amt, :h_fee, :h_net
|
||||
FROM purchase WHERE biz_date = :h_bizdate AND channel = 'POS';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
cid = cldb_next_close_id();
|
||||
if (cid < 0) FAIL(b);
|
||||
if (cldb_insert_close(cid, "POS", h_bizdate, h_bizdate, "C", h_cnt, h_amt, "POS채널마감") < 0) FAIL(b);
|
||||
setl(b, T_ID1, cid);
|
||||
setl(b, T_COUNT, h_cnt);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
setl(b, T_FEE, h_fee);
|
||||
setl(b, T_NET, h_net);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_PROVCMP.h
Normal file
22
app/src/cl/svc/CL_PROVCMP.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_PROVCMP.h - cl 서비스 CL_PROVCMP 카피북 (copybook / record header).
|
||||
* 가마감/본마감 비교: 잠정 집계와 확정 집계 차이 산출.
|
||||
*/
|
||||
#ifndef CL_PROVCMP_H
|
||||
#define CL_PROVCMP_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_provcmp_rec_t;
|
||||
|
||||
void CL_PROVCMP(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_PROVCMP_H */
|
||||
31
app/src/cl/svc/CL_PROVCMP.pgc
Normal file
31
app/src/cl/svc/CL_PROVCMP.pgc
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* CL_PROVCMP.pgc - cl 모듈 서비스 CL_PROVCMP (one service = one file).
|
||||
* 가마감/본마감 비교: 동일 영업일의 가마감(TENT) 잠정 집계와 확정(DAILY C) 차이 산출.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_PROVCMP.h"
|
||||
|
||||
void CL_PROVCMP(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long delta;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_prov, h_main;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT coalesce(sum(total_amount),0) INTO :h_prov FROM cl_close_log
|
||||
WHERE close_type = 'TENT' AND period_key = :h_bizdate AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(total_amount),0) INTO :h_main FROM cl_close_log
|
||||
WHERE close_type = 'DAILY' AND period_key = :h_bizdate AND status = 'C';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
delta = h_main - h_prov; if (delta < 0) delta = -delta;
|
||||
setl(b, T_AMT1, h_prov);
|
||||
setl(b, T_AMT2, h_main);
|
||||
setl(b, T_DELTA, delta);
|
||||
setl(b, T_RC, (delta == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_QTRVERIFY.h
Normal file
22
app/src/cl/svc/CL_QTRVERIFY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_QTRVERIFY.h - cl 서비스 CL_QTRVERIFY 카피북 (copybook / record header).
|
||||
* 분기 마감 검증: 분기 마감이력과 분기 매입 실집계 대사.
|
||||
*/
|
||||
#ifndef CL_QTRVERIFY_H
|
||||
#define CL_QTRVERIFY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_qtrverify_rec_t;
|
||||
|
||||
void CL_QTRVERIFY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_QTRVERIFY_H */
|
||||
32
app/src/cl/svc/CL_QTRVERIFY.pgc
Normal file
32
app/src/cl/svc/CL_QTRVERIFY.pgc
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* CL_QTRVERIFY.pgc - cl 모듈 서비스 CL_QTRVERIFY (one service = one file).
|
||||
* 분기 마감 검증: 분기 마감이력과 분기 매입 실집계 대사.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_QTRVERIFY.h"
|
||||
|
||||
void CL_QTRVERIFY(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long da;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_bizdate[16];
|
||||
long h_la, h_ra;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
gets_(b, T_BIZDATE, h_bizdate, sizeof(h_bizdate));
|
||||
EXEC SQL SELECT coalesce(sum(total_amount),0) INTO :h_la FROM cl_close_log
|
||||
WHERE close_type = 'QUARTER'
|
||||
AND period_key = to_char(:h_bizdate::date, 'YYYY"Q"Q') AND status <> 'X';
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
EXEC SQL SELECT coalesce(sum(amount),0) INTO :h_ra FROM purchase
|
||||
WHERE to_char(biz_date,'YYYY"Q"Q') = to_char(:h_bizdate::date,'YYYY"Q"Q');
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
da = h_la - h_ra; if (da < 0) da = -da;
|
||||
setl(b, T_AMT1, h_la);
|
||||
setl(b, T_AMT2, h_ra);
|
||||
setl(b, T_DELTA, da);
|
||||
setl(b, T_RC, (da == 0) ? 0 : 1);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_RECLOSECHK.h
Normal file
22
app/src/cl/svc/CL_RECLOSECHK.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_RECLOSECHK.h - cl 서비스 CL_RECLOSECHK 카피북 (copybook / record header).
|
||||
* 재마감 가능여부: 승인/잠금 상태면 재마감 불가 판정.
|
||||
*/
|
||||
#ifndef CL_RECLOSECHK_H
|
||||
#define CL_RECLOSECHK_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_reclosechk_rec_t;
|
||||
|
||||
void CL_RECLOSECHK(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_RECLOSECHK_H */
|
||||
22
app/src/cl/svc/CL_RECLOSECHK.pgc
Normal file
22
app/src/cl/svc/CL_RECLOSECHK.pgc
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_RECLOSECHK.pgc - cl 모듈 서비스 CL_RECLOSECHK (one service = one file).
|
||||
* 재마감 가능여부: 승인(A)/잠금(L) 상태면 재마감 불가로 판정한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_RECLOSECHK.h"
|
||||
|
||||
void CL_RECLOSECHK(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
char st[2];
|
||||
int allowed;
|
||||
long cid = getl(b, T_ID1);
|
||||
if (cldb_get_close_status(cid, st) < 0) FAIL(b);
|
||||
allowed = (st[0] == 'C' || st[0] == 'R') ? 1 : 0;
|
||||
setl(b, T_RC, allowed ? 0 : 1);
|
||||
Bchg(b, T_STATUS, 0, st, 0L);
|
||||
Bchg(b, T_MSG, 0, allowed ? "재마감 가능" : "승인/잠금-재마감 불가", 0L);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_RECLOSEREG.h
Normal file
22
app/src/cl/svc/CL_RECLOSEREG.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_RECLOSEREG.h - cl 서비스 CL_RECLOSEREG 카피북 (copybook / record header).
|
||||
* 재마감 등록: 기존 마감을 재마감(R) 표기하고 신규 이력 개시.
|
||||
*/
|
||||
#ifndef CL_RECLOSEREG_H
|
||||
#define CL_RECLOSEREG_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_reclosereg_rec_t;
|
||||
|
||||
void CL_RECLOSEREG(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_RECLOSEREG_H */
|
||||
34
app/src/cl/svc/CL_RECLOSEREG.pgc
Normal file
34
app/src/cl/svc/CL_RECLOSEREG.pgc
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* CL_RECLOSEREG.pgc - cl 모듈 서비스 CL_RECLOSEREG (one service = one file).
|
||||
* 재마감 등록: 기존 마감을 재마감(R) 표기하고 동일 기간에 신규 마감이력 개시.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_RECLOSEREG.h"
|
||||
|
||||
void CL_RECLOSEREG(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long newid;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_ct[16], h_pk[24], h_date[16];
|
||||
long h_old, h_cnt, h_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
h_old = getl(b, T_ID1);
|
||||
EXEC SQL SELECT close_type, period_key, to_char(biz_date,'YYYY-MM-DD')
|
||||
INTO :h_ct, :h_pk, :h_date FROM cl_close_log WHERE close_id = :h_old;
|
||||
if (sqlca.sqlcode < 0 || sqlca.sqlcode == 100) FAIL(b);
|
||||
if (cldb_update_close_status(h_old, "R") < 0) FAIL(b);
|
||||
EXEC SQL SELECT count(*), coalesce(sum(amount),0) INTO :h_cnt, :h_amt
|
||||
FROM purchase WHERE biz_date = :h_date;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
newid = cldb_next_close_id();
|
||||
if (newid < 0) FAIL(b);
|
||||
if (cldb_insert_close(newid, h_ct, h_pk, h_date, "C", h_cnt, h_amt, "재마감") < 0) FAIL(b);
|
||||
setl(b, T_ID1, newid);
|
||||
setl(b, T_ID2, h_old);
|
||||
setl(b, T_COUNT, h_cnt);
|
||||
setl(b, T_GROSS, h_amt);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_RPTAPPR.h
Normal file
22
app/src/cl/svc/CL_RPTAPPR.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_RPTAPPR.h - cl 서비스 CL_RPTAPPR 카피북 (copybook / record header).
|
||||
* 승인 마감 리포트: 승인(A) 마감 이력 목록 리포트.
|
||||
*/
|
||||
#ifndef CL_RPTAPPR_H
|
||||
#define CL_RPTAPPR_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_rptappr_rec_t;
|
||||
|
||||
void CL_RPTAPPR(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_RPTAPPR_H */
|
||||
38
app/src/cl/svc/CL_RPTAPPR.pgc
Normal file
38
app/src/cl/svc/CL_RPTAPPR.pgc
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* CL_RPTAPPR.pgc - cl 모듈 서비스 CL_RPTAPPR (one service = one file).
|
||||
* 승인 마감 리포트: 승인(A) 상태 마감이력을 최신순으로 나열한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_RPTAPPR.h"
|
||||
|
||||
void CL_RPTAPPR(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long occ = 0, totamt = 0;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_pk[24];
|
||||
long h_id, h_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL DECLARE crappr CURSOR FOR
|
||||
SELECT close_id, period_key, total_amount
|
||||
FROM cl_close_log WHERE status = 'A' ORDER BY close_id DESC;
|
||||
EXEC SQL OPEN crappr;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
for (;;) {
|
||||
EXEC SQL FETCH crappr INTO :h_id, :h_pk, :h_amt;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE crappr; FAIL(b); }
|
||||
if (occ >= 30) break;
|
||||
Bchg(b, T_ARG1, (BFLDOCC)occ, (char *)&h_id, 0L);
|
||||
Bchg(b, T_KEY1, (BFLDOCC)occ, h_pk, 0L);
|
||||
Bchg(b, T_AMT1, (BFLDOCC)occ, (char *)&h_amt, 0L);
|
||||
totamt += h_amt;
|
||||
occ++;
|
||||
}
|
||||
EXEC SQL CLOSE crappr;
|
||||
setl(b, T_COUNT, occ);
|
||||
setl(b, T_GROSS, totamt);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_RPTCXL.h
Normal file
22
app/src/cl/svc/CL_RPTCXL.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_RPTCXL.h - cl 서비스 CL_RPTCXL 카피북 (copybook / record header).
|
||||
* 취소 마감 리포트: 취소(X) 마감 이력 목록 리포트.
|
||||
*/
|
||||
#ifndef CL_RPTCXL_H
|
||||
#define CL_RPTCXL_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_rptcxl_rec_t;
|
||||
|
||||
void CL_RPTCXL(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_RPTCXL_H */
|
||||
36
app/src/cl/svc/CL_RPTCXL.pgc
Normal file
36
app/src/cl/svc/CL_RPTCXL.pgc
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* CL_RPTCXL.pgc - cl 모듈 서비스 CL_RPTCXL (one service = one file).
|
||||
* 취소 마감 리포트: 취소(X) 상태 마감이력을 취소 사유(memo)와 함께 나열한다.
|
||||
* 호출자의 XA 브랜치에서 수행(EXEC SQL CONNECT 없음); cl_svr 가 광고한다.
|
||||
*/
|
||||
#include "CL_RPTCXL.h"
|
||||
|
||||
void CL_RPTCXL(TPSVCINFO *p)
|
||||
{
|
||||
UBFH *b = (UBFH *)p->data;
|
||||
long occ = 0;
|
||||
EXEC SQL BEGIN DECLARE SECTION;
|
||||
char h_memo[64];
|
||||
long h_id, h_amt;
|
||||
EXEC SQL END DECLARE SECTION;
|
||||
EXEC SQL DECLARE crcxl CURSOR FOR
|
||||
SELECT close_id, memo, total_amount
|
||||
FROM cl_close_log WHERE status = 'X' ORDER BY close_id DESC;
|
||||
EXEC SQL OPEN crcxl;
|
||||
if (sqlca.sqlcode < 0) FAIL(b);
|
||||
for (;;) {
|
||||
EXEC SQL FETCH crcxl INTO :h_id, :h_memo, :h_amt;
|
||||
if (sqlca.sqlcode == 100) break;
|
||||
if (sqlca.sqlcode < 0) { EXEC SQL CLOSE crcxl; FAIL(b); }
|
||||
if (occ >= 30) break;
|
||||
Bchg(b, T_ARG1, (BFLDOCC)occ, (char *)&h_id, 0L);
|
||||
Bchg(b, T_STR1, (BFLDOCC)occ, h_memo, 0L);
|
||||
Bchg(b, T_AMT1, (BFLDOCC)occ, (char *)&h_amt, 0L);
|
||||
occ++;
|
||||
}
|
||||
EXEC SQL CLOSE crcxl;
|
||||
setl(b, T_COUNT, occ);
|
||||
OK(b);
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 et smartindent: */
|
||||
22
app/src/cl/svc/CL_RPTDELAY.h
Normal file
22
app/src/cl/svc/CL_RPTDELAY.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* CL_RPTDELAY.h - cl 서비스 CL_RPTDELAY 카피북 (copybook / record header).
|
||||
* 지연 마감 리포트: 예정일 경과 미마감 매입 리포트.
|
||||
*/
|
||||
#ifndef CL_RPTDELAY_H
|
||||
#define CL_RPTDELAY_H
|
||||
|
||||
#include "cl_svc.h"
|
||||
|
||||
typedef struct {
|
||||
long id1;
|
||||
long id2;
|
||||
long amount;
|
||||
long count;
|
||||
char status[8];
|
||||
char key1[32];
|
||||
char biz_date[16];
|
||||
} cl_cl_rptdelay_rec_t;
|
||||
|
||||
void CL_RPTDELAY(TPSVCINFO *p);
|
||||
|
||||
#endif /* CL_RPTDELAY_H */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue