/*
 *========================================================================
 *
 *   시스템명 : 요금징수 시스템
 *   파 일 명 : ft_basictbl.pc
 *   작 성 자 : 오효섭 (catacath@neighbor21.co.kr)
 *   작 성 일 : 2012.10.10
 *   수 정 일 :
 *   설    명 : 기초상태테이블의 파일/테이블간 변환처리
 *
 *========================================================================
*/

#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include "file_lb.h"
#include "def_set.h"
#include "dir_path.h"
#include "file_no.h"
#include "ora_sql.h"
#include "hi_packet_format.h"
#include "passraw.h"
#include "bas_tbl.h"
#include "snd_rcv_knd.h"
#include "tcs_db_def.h"
#include "lo_tcs_packet_format.h"
#include "lo_etc_packet_format.h"

int	show_gmgsbg();
int 	show_h_gmjcp();
int 	show_ecardcj();

#if 1
static    struct    write_info         wi;
struct    hi_packet_format    *hi_frame;
#endif
int main(int argc, char *argv[])
{
    int     isfd, isrc;
    int     ii, jj, kk, mm, options;

    struct    trmn_rcv    trmn_rcv;
    struct    trmn_rcv    *sp_trmn_rcv;
    char        trmn_rcv_b[4096];

    char    path[128];
    char    fstread[16];
    char    temp[3+1];
    char    msg[128];
    char    kmij[9];
    char    plz_id[4];
    char    kmbh[5];
    char    leng[3];
    char    j_buf[PASSRAWSIZE];
    char    x_buf[40960];
    printf("start \n");

    memset(kmij, 0x00, sizeof(kmij));
    memset(kmbh, 0x00, sizeof(kmbh));
    memset(plz_id, 0x00, sizeof(plz_id));
    memset(fstread, 0x00, sizeof(fstread));

    while((options = getopt(argc, argv, "d:k:p:")) != EOF)
    {
        switch (options)
        {
             case 'k': /* 근무번호    */
                  sprintf(kmbh, "%.4s", optarg);
                  break;
             case 'p': /* 영업소ID    */
                  sprintf(plz_id, "%.3s", optarg);
                  break;
             case 'd': /* 근무일자    */
                  sprintf(kmij, "%.8s", optarg);
                  break;
             default:  break;
        }
    }
    sp_trmn_rcv = (struct trmn_rcv *)x_buf;
    sprintf(path, "%s/%s/%.8s/TERMRECV%.03s%.04s",DIR_TCS, DIR_LOG, kmij, plz_id, kmbh);
    printf("%s\n",path);
    isfd = open(path, FINPUT+FC_MANULOCK);
    if(isfd < 0)
    {
	printf("open error\n");
	exit(0);
    }
    ii = 0;	
    for (;;)
    {
    	memset(&trmn_rcv, 0, sizeof(trmn_rcv));
        isrc = read(isfd, &trmn_rcv, sizeof(struct trmn_rcv));
        if (isrc < 1)
	{
	    printf("read error\n");
            break;
	}
	memcpy(sp_trmn_rcv, &trmn_rcv, sizeof(struct trmn_rcv));
	for(;trmn_rcv.flag != F_END;)
	{
		isrc = read(isfd, &trmn_rcv, sizeof(struct trmn_rcv));
        	if (isrc < 1)
		{
	    		printf("read error\n");
            		break;
		}
	
		memcpy(&sp_trmn_rcv->data[sp_trmn_rcv->leng], &trmn_rcv.data, trmn_rcv.leng);		
		sp_trmn_rcv->leng += trmn_rcv.leng;
	}
        switch(sp_trmn_rcv->data[4])
        {
        case D_WRK_STRT :   /* 근무개시보고[-] */
	case HD_WRK_STRT :
	    show_gmgsbg(&sp_trmn_rcv->data[0]);
            break;

        case D_WRK_END_DATA1:    /* 출구근무종료 1     */
	    show_i_cggmjr(&sp_trmn_rcv->data[0]);
            break;

        case D_WRK_END_DATA2:    /* 출구근무 종료 2    */
	    show_i_cggmjr2(&sp_trmn_rcv->data[0]);
            break;

        case D_WRK_END_DATA3:    /* 출구근무 종료 3    */
	    show_i_cggmjr3(&sp_trmn_rcv->data[0]);
            break;

        case D_WRK_END_DATA4:    /* 출구근무 종료 4    */
	    show_i_cggmjr4(&sp_trmn_rcv->data[0]);
            break;

        case D_HOURLY_TRAFFIC:    /* 시간별 교통량    */
	    show_p_sgbgtr(&sp_trmn_rcv->data[0]);
            break;

        default:
            printf( "UNKNOWN DATA 확인 요망 \n" );
	    printf("종별 0X%02x\n", trmn_rcv.data[4]);
            continue;
        }
    }
    close(isfd);
}

int show_gmgsbg(gsda)
struct	hi_wrk_start	*gsda;
{
	int	ii;

	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] <근무개시보고> [low packet %d Byte]\n", (int)sizeof(struct lo_wrk_start)+1);
	fprintf(stdout, "전송연번            : %d\n", gsda->seq_no);
	fprintf(stdout, "근무일자/번호       : %d-%02d-%02d %.4s %.4s\n", 
			gsda->year, gsda->month, gsda->day,
			gsda->wrk_no, gsda->wrkr_no);
	fprintf(stdout, "근무개시일시        : %d-%02d-%02d %02d:%02d:%02d\n",  
			gsda->wrk_start_year, gsda->wrk_start_month, gsda->wrk_start_day,
			gsda->wrk_start_hour, gsda->wrk_start_min, gsda->wrk_start_sec);
	fprintf(stdout, "단말번호            : %.4s\n", gsda->terminal_no);
	fprintf(stdout, "차로TYPE            : 0x%02x\n", gsda->lane_typ);
	fprintf(stdout, "TCS/Hi-pass혼용구분 : %02s(00:TCS전용, 01:혼용)\n", gsda->wrk_div);
	fprintf(stdout, "[테이블 명     테이블개정일시    개정번호    수정일시]\n");
	fprintf(stdout, "\n");
	for(ii = 0; ii < 20;ii++)
	{
		switch (ii)
		{
		case  0: fprintf(stdout, "기초사항테이블   : "); break;
		case  1: fprintf(stdout, "근무자           : "); break;
		case  2: fprintf(stdout, "통행요금         : "); break;
		case  3: fprintf(stdout, "무효신용         : "); break;
		case  4: fprintf(stdout, "무효면제         : "); break;
		case  5: fprintf(stdout, "무효고속         : "); break;
		case  6: fprintf(stdout, "할증일자(휴일)   : "); break;
		case  7: fprintf(stdout, "출퇴근 할인미적용: "); break;
		case  8: fprintf(stdout, "전자카드 B/L     : "); break;
		case  9: fprintf(stdout, "연계요금         : "); break;
		case 10: fprintf(stdout, "교통카드 BIN     : "); break;
		case 11: fprintf(stdout, "교통카드 B/L     : "); break;
		case 12: fprintf(stdout, "시간별할인       : "); break;
#if 0
		case 13: continue; break;
		case 14: fprintf(stdout, "주말할증기본       : "); break;
#endif
		default: continue;
		}
		fprintf(stdout, "%04d/%02d/%02d %02d:%02d     %02d    %04d/%02d/%02d %02d:%02d\n", gsda->rvs_info[ii].rvs_year, gsda->rvs_info[ii].rvs_month, 
                 gsda->rvs_info[ii].rvs_day, gsda->rvs_info[ii].rvs_hour, 
                 gsda->rvs_info[ii].rvs_min, gsda->rvs_info[ii].rvs_no, 
                 gsda->rvs_info[ii].modf_year, gsda->rvs_info[ii].modf_month, 
                 gsda->rvs_info[ii].modf_day, gsda->rvs_info[ii].modf_hour, 
                 gsda->rvs_info[ii].modf_min);
	}
	fprintf(stdout, "선/후불 전자카드 B/L 최종관리연번   %d\n", gsda->ecrd_seq_no);
	fprintf(stdout, "교통 카드 B/L 최종관리연번   %d\n", gsda->gcrd_seq_no);
	fprintf(stdout, "자동근무 개시 여부          %d\n", gsda->auto_wrk_start);
	fprintf(stdout, "\n");
}

int show_thghi_j(thda_j)
struct  hi_hnd_data  *thda_j;
{
	fprintf(stdout, "==================================================\n");
        fprintf(stdout, "[TCS] < 통행권확인DATA > [low packet %d Byte]\n", (int)sizeof(struct hi_hnd_data));
        fprintf(stdout, "전송연번        : %x\n", thda_j->seq_no);
        fprintf(stdout, "근무일자/번호   : %d-%02d-%02d %.4s %.4s\n",
                        thda_j->wrk_year, thda_j->wrk_month, thda_j->wrk_day,
                        thda_j->wrk_no, thda_j->wrkr_no);
        fprintf(stdout, "일련번호  (출)  : %d\n",   thda_j->serial_no);
        fprintf(stdout, "차종            : %d\n",   thda_j->carkind);
        fprintf(stdout, "\n");
        fprintf(stdout, "시스템종별(입)  : %d\n",   thda_j->system_kind);
        fprintf(stdout, "입구IC    (입)  : %.3s\n", thda_j->ent_plz_id);
        fprintf(stdout, "발행일시  (입)  : %d-%02d-%02d %02d:%02d:%02d\n",
                        thda_j->ent_year, thda_j->ent_month, thda_j->ent_day,
                        thda_j->ent_hour, thda_j->ent_min, thda_j->ent_sec);

        fprintf(stdout, "일련번호  (입)  : %d\n",    thda_j->ent_issuing_no);
        fprintf(stdout, "입구근무자구분  : %d\n",    thda_j->wrkr_div);
        fprintf(stdout, "적격차구분(입)  : %d\n",    thda_j->qlfd);
        fprintf(stdout, "차로번호  (입)  : %.2s\n",  thda_j->lane_no);
        fprintf(stdout, "예비권구분(입)  : %d\n",    thda_j->rsv_div);
        fprintf(stdout, "축수코드  (입)  : %d\n",    thda_j->ent_axle_code);
        fprintf(stdout, "\n");
        fprintf(stdout, "확인일시  (출)  : %04d-%02d-%02d %02d:%02d:%02d\n",
                        thda_j->wo_year, thda_j->wo_month, thda_j->wo_day,
                        thda_j->wo_hour, thda_j->wo_min, thda_j->wo_sec);
    
        fprintf(stdout, "원통행요금      : %d\n", thda_j->org_fare);
        fprintf(stdout, "통행요금        : %d\n", thda_j->pass_fare);
        fprintf(stdout, "징수할 현금     : %d\n", thda_j->col_csh);

        fprintf(stdout, "미소지구분      : %d\n", thda_j->nohave_div);
        fprintf(stdout, "축수코드        : %d\n", thda_j->axle_code);
        fprintf(stdout, "수입구분        : %d\n", thda_j->imp_div);

        fprintf(stdout, "\n");
        fprintf(stdout, "할인카드번호    : [%.10s]\n",  thda_j->dccrd_no);
        fprintf(stdout, "카드변호        : [%.20s]\n",  thda_j->ccrd_no);

        fprintf(stdout, "2매처리 구분    : %d\n", thda_j->two_hnd_div);
        fprintf(stdout, "2매처리데이터   : [%.16s]\n", thda_j->two_hnd);
        fprintf(stdout, "신구요금구분    : %d\n", thda_j->new_fare_div);
        fprintf(stdout, "수납구분-출구   : %d\n", thda_j->rct_div);
        fprintf(stdout, "부분납구분      : %d\n", thda_j->partrct_div);
        fprintf(stdout, "연계면제구분    : %d\n", thda_j->lnk_exmt_div);
        fprintf(stdout, "지불유형        : %d\n", thda_j->pay_typ);

        fprintf(stdout, "연계 영업소번호 : %03s\n", thda_j->lnk_plz_id);
        fprintf(stdout, "연계   통과일시 : %04d-%02d-%02d %02d:%02d\n",
                        thda_j->lnk_pass_year, thda_j->lnk_pass_month, thda_j->lnk_pass_day,
                        thda_j->lnk_pass_hour, thda_j->lnk_pass_min);

        fprintf(stdout, "할증구분        : %d\n", thda_j->extr_div);
        fprintf(stdout, "\n");
        return (0);
}

int show_cgtbcr(ctda)
struct	hi_wout_spcl_hnd	*ctda;
{
	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] < 출구 특별 처리 > [low packet %d Byte]\n", 
			(int)sizeof(struct lo_wout_spcl_hnd));
	fprintf(stdout, "전송연번        : %x\n", ctda->seq_no);
	fprintf(stdout, "근무일자/번호   : %d-%02d-%02d %.4s %.4s\n", 
			ctda->wrk_year, ctda->wrk_month, ctda->wrk_day,
			ctda->wrk_no, ctda->wrkr_no);
	fprintf(stdout, "일련    번호    : %d\n", ctda->serial_no);
	fprintf(stdout, "특별처리코드    : %02d\n", ctda->spcl_code);
	fprintf(stdout, "발생    일시    : %d-%02d-%02d %02d:%02d:%02d\n",
			ctda->year, ctda->month, ctda->day,
			ctda->hour, ctda->min, ctda->sec);
	fprintf(stdout, "SYSTEM  종별    : %d\n", ctda->system_kind);
	fprintf(stdout, "입구      IC    : %.3s\n", ctda->ent_plz_id);
	fprintf(stdout, "차종    (권)    : %d\n", ctda->carkind_ticket);
	fprintf(stdout, "차종    (인)    : %d\n", ctda->carkind_wrkr);
	fprintf(stdout, "축수    코드    : %d\n", ctda->axle_code);
	fprintf(stdout, "통행    요금    : %d\n", ctda->pass_fare);
	fprintf(stdout, "카드    번호    : [%.16s]\n", ctda->crd_no); 
	fprintf(stdout, "\n");
	return (0);
}

int show_ecardjb(ecjb)
struct	hi_ecrd_pay	*ecjb;
{
	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] <선/후불 전자카드 지불 데이터> [low packet %d Byte]\n", 
		(int)sizeof(struct lo_ecrd_pay));
	fprintf(stdout, "전송연번         : %x\n",  ecjb->seq_no);
	fprintf(stdout, "근무일자/번호    : %04d-%02d-%02d %.4s %.4s\n",	  
			ecjb->wrk_year, ecjb->wrk_month, ecjb->wrk_day,
			ecjb->wrk_no, ecjb->wrkr_no);
	fprintf(stdout, "일련    번호     : %d\n",    ecjb->serial_no);
	fprintf(stdout, "운영    구분     : %s\n",    ecjb->manage_div);
	fprintf(stdout, "처리    구분     : %s\n",    ecjb->hnd_div);
	fprintf(stdout, "이전처리일시     : %04d-%02d-%02d %02d:%02d:%02d\n",	  
			ecjb->behnd_year, ecjb->behnd_month, ecjb->behnd_day,
			ecjb->behnd_hour, ecjb->behnd_min, ecjb->behnd_sec);
	fprintf(stdout, "운영기관         : %s\n",    ecjb->manage_orgn);
	fprintf(stdout, "이전IC  번호     : %.03s\n", ecjb->be_plz_id);
	fprintf(stdout, "이전 차로타입    : %.s\n",   ecjb->be_lane_typ);
	fprintf(stdout, "이전차로번호     : %.02s\n", ecjb->be_lane_no);
	fprintf(stdout, "이전근무순번     : %.02s\n", ecjb->be_lane_order);
	fprintf(stdout, "이전일련번호     : %d\n",    ecjb->be_serial_no);
	fprintf(stdout, "이전원통행요금   : %d\n", ecjb->be_org_pass_fare);
	fprintf(stdout, "이전수납금액     : %d\n", ecjb->be_rct_fare);
	fprintf(stdout, "이전차종         : %.02s\n",    ecjb->be_carkind);
	fprintf(stdout, "전전IC  번호     : %.03s\n",    ecjb->c_be_plz_id);
	fprintf(stdout, "이전카드정보구분 : %.02s\n",    ecjb->be_crd_info_div);
	fprintf(stdout, "입구 처리일시    : %d-%02d-%02d %02d:%02d:%02d\n", 
			ecjb->ent_year, ecjb->ent_month, ecjb->ent_day,
			ecjb->ent_hour, ecjb->ent_min, ecjb->ent_sec);
	fprintf(stdout, "입구운영기관     : %s\n", ecjb->ent_orgn);
	fprintf(stdout, "입구 IC 번호     : %.3s\n", ecjb->ent_plz_id);
	fprintf(stdout, "입구발권일련번호 : %d\n", ecjb->ent_issuing_serial_no);
	fprintf(stdout, "입구발권차로번호 : %.02s\n", ecjb->ent_issuing_lane_no);
	fprintf(stdout, "입구근무순번     : %.02s\n", ecjb->ent_wrk_order);
	fprintf(stdout, "입구차종         : %d\n", ecjb->ent_carkind);
	fprintf(stdout, "입구축수코드     : %d\n", ecjb->ent_axle_code);
	fprintf(stdout, "출구 IC 번호     : %.3s\n", ecjb->wo_plz_id);
	fprintf(stdout, "확인일시  (출)   : %d-%02d-%02d %02d:%02d:%02d:%d\n", 
			ecjb->year, ecjb->month, ecjb->day,
			ecjb->hour, ecjb->min, ecjb->sec, ecjb->milisec);
	fprintf(stdout, "위반코드         : %.02s\n", ecjb->vio_code);
	fprintf(stdout, "\n");
	fprintf(stdout, "원통행요금       : %d\n", ecjb->org_fare);
	fprintf(stdout, "통행요금         : %d\n", ecjb->pass_fare);
	fprintf(stdout, "수납금액         : %d\n", ecjb->rct_fare);

	fprintf(stdout, "\n");
	fprintf(stdout, "수납전카드잔액     %06d                     \t수납구분                 %d\n", ecjb->berct_crd_balc, ecjb->imp_div);
	fprintf(stdout, "카드종류           %.02s                    \t처리차종                 %d\n", ecjb->crd_kind, ecjb->carkind);
	fprintf(stdout, "선/후불 전자카드번호 %.16s          \t지불처리구분             %02d\n", ecjb->ecrd_no, ecjb->pay_hnd_div);
	fprintf(stdout, "근무구분(0:정상, 1:보수)   %1d                   \t감지차종                 %d\n", ecjb->wrk_div, ecjb->sens_carkind);
	fprintf(stdout, "지불할인율       : %.02s                        \t할인카드번호          %.10s\n", ecjb->pay_rte, ecjb->dccrd_no);
	fprintf(stdout, "OBU차종            %d                           \t영상번호                 %d\n", ecjb->obu_carkind, ecjb->video_no);
	fprintf(stdout, "OBU번호            %.16s                        \tOBU TYPE(00:RF,01:IR)    %.2s\n", ecjb->obu_no, ecjb->obu_typ);
	fprintf(stdout, "처리 상태 정보     %.5s               \n", ecjb->hnd_stat_info);

	fprintf(stdout, "누적통행횟수     : %02s\n", ecjb->accu_pass_cnt);
	fprintf(stdout, "\n");
	fprintf(stdout, "연계IC 번호      : %.3s\n", ecjb->lnk_plz_id);
	fprintf(stdout, "연계IC 근무번호  : %.4s\n", ecjb->lnk_plz_wrk_no);
	fprintf(stdout, "수납구분         : %.2s                        \t위반상태                 %02d\n", ecjb->rct_div, ecjb->vio_stat);

	fprintf(stdout, "연계IC통과일시   : %d-%02d-%02d %02d:%02d:%02d\n", 
			ecjb->lnk_pass_year, ecjb->lnk_pass_month, ecjb->lnk_pass_day,
			ecjb->lnk_pass_hour, ecjb->lnk_pass_min, ecjb->lnk_pass_sec);
	fprintf(stdout, "도로공사 발급 IC : %.16s\n", ecjb->khc_id);
	fprintf(stdout, "연계IC 금액      : %d\n", ecjb->lnk_plz_pass_fare);
	fprintf(stdout, "연계IC 차종      : %d\n", ecjb->lnk_plz_pass_car_knd);

	fprintf(stdout, "\n");
	fprintf(stdout, "알고리즘ID       : %.2s\n", ecjb->algo_id);
	fprintf(stdout, "PSAM ID          : %.16s\n", ecjb->psam_id);
	fprintf(stdout, "구매일자         : %.8s\n", ecjb->pcha_date);	       
	fprintf(stdout, "거래유형         : %.2s\n", ecjb->tran_typ);
	fprintf(stdout, "발행기관ID       : %.6s\n", ecjb->publish_orgn_id);
	fprintf(stdout, "전자화폐ID       : %.10s\n", ecjb->et_mny_id);
	fprintf(stdout, "전자화폐거래일련번호 :  %.8s\n", ecjb->et_mny_no);

	fprintf(stdout, "\n");
	fprintf(stdout, "거래일련번호     : %.8s\n", ecjb->tran_no);
	fprintf(stdout, "거래총액         : %.8s\n", ecjb->tran_total_mny);
	fprintf(stdout, "발행기관별개별거래수 :  %.4s\n", ecjb->et_mny_cnt);
	fprintf(stdout, "거래수집일련번호 : %.8s\n", ecjb->tran_serial_no);

	fprintf(stdout, "\n");
	fprintf(stdout, "서명키버젼1      : %.2s\n", ecjb->sign_key1);
	fprintf(stdout, "PSAM 서명1       : %.8s\n", ecjb->psam_sign1);
	fprintf(stdout, "서명키버젼2      : %.2s\n", ecjb->sign_key2);
	fprintf(stdout, "PSAM 서명2       : %.8s\n", ecjb->psam_sign2);
	fprintf(stdout, "CENTER ID        : %.2s\n", ecjb->center_id);
	fprintf(stdout, "\n");
	return (0);
}

int show_h_gmjcp(h_cpda)
struct	hi_sens_data	*h_cpda;
{
	fprintf(stdout, "==================================================\n");
	fprintf(stdout, " < 근무중 차판(감지) DATA > [low packet %d Byte]\n", (int)sizeof(struct lo_sens_data));
	fprintf(stdout, "전송연번            %8x       근무일자/번호          %04d-%02d-%02d %.4s\n",	h_cpda->seq_no, h_cpda->wrk_year, h_cpda->wrk_month, h_cpda->wrk_day, h_cpda->wrk_no);
	fprintf(stdout, "발생일시            %04d-%02d-%02d %02d:%02d:%02d\n", h_cpda->year, h_cpda->month, h_cpda->day, h_cpda->hour, h_cpda->min, h_cpda->sec); 
	fprintf(stdout, "감지 1/2            %1d (0:GT1감지/1:GT2감지)\n", h_cpda->sens_div);
	fprintf(stdout, "전,후진             %1d              감지차종                 %6d\n", h_cpda->adv_rev_div, h_cpda->sens_carkind);
	fprintf(stdout, "더블구분            %d              축수                     %6d\n", h_cpda->double_div, h_cpda->axle_code);
	fprintf(stdout, "윤폭           %6d              윤거                     %6d\n", h_cpda->tire_width, h_cpda->tire_distance);
	fprintf(stdout, "차폭           %6d              차장                     %6d\n", h_cpda->car_width, h_cpda->car_length);
	fprintf(stdout, "차고           %6d              위치                     %6d\n", h_cpda->car_height, h_cpda->location);
	fprintf(stdout, "속도           %6d              처리구분(0:처리,1:미처리)%6d\n", h_cpda->speed, h_cpda->hnd_yn);
	fprintf(stdout, "\n");
	return (0);
}

int show_smscr(ycda)
struct	hi_ofc_data	*ycda;
{
	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] < 사무실 처리 > [low packet %d Byte]\n", (int)sizeof(struct lo_ofc_data));
	fprintf(stdout, "전송연번        : %x\n",    ycda->seq_no);
	fprintf(stdout, "근무일자/번호   : %04d-%02d-%02d %.4s %.4s\n",	  
			ycda->wrk_year, ycda->wrk_month, ycda->wrk_day,
			ycda->wrk_no, ycda->wrkr_no);
	fprintf(stdout, "일련    번호    : %d\n",    ycda->serial_no);
	fprintf(stdout, "사무실  코드    : %d\n",    ycda->ofc_code);
	fprintf(stdout, "발생    일시    : %d-%02d-%02d %02d:%02d:%02d\n",
			ycda->year, ycda->month, ycda->day,
			ycda->hour, ycda->min, ycda->sec);
	fprintf(stdout, "SYSTEM  종별    : %d\n",    ycda->system_kind);
	fprintf(stdout, "입구      IC    : %.3s\n",  ycda->ent_plz_id);
	fprintf(stdout, "차종    (권)    : %d\n",    ycda->carkind_ticket);
	fprintf(stdout, "차종    (인)    : %d\n",    ycda->carkind_wrkr);
	fprintf(stdout, "축수    코드    : %d\n",    ycda->axle_code);
	fprintf(stdout, "무효카드번호    : [%.16s]\n", ycda->bl_crd_no);
	fprintf(stdout, "\n");
	return (0);
}

int show_ecardcj(eccj)
struct	hi_ecrd_chrg	*eccj;
{
	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] <선불 전자카드 충전처리> [low packet %d Byte]\n", 
			(int)sizeof(struct lo_ecrd_chrg));
	fprintf(stdout, "전송연번        	: %x\n",  eccj->seq_no);
	fprintf(stdout, "근무일자/번호   	: %04d-%02d-%02d %.4s %.4s\n",	  
			eccj->wrk_year, eccj->wrk_month, eccj->wrk_day,
			eccj->wrk_no, eccj->wrkr_no);
	fprintf(stdout, "일련    번호    	: %d\n",    eccj->serial_no);
	fprintf(stdout, "차로구분        	: P%.3s\n",  eccj->lane_div);
	fprintf(stdout, "근무자 ID       	: %.8s\n",  eccj->admin_id);
	fprintf(stdout, "충전시각        	: %04d/%02d/%02d  %02d:%02d:%02d \n",
			eccj->chrg_year, eccj->chrg_month, eccj->chrg_day, eccj->chrg_hour, 
			eccj->chrg_min, eccj->chrg_sec );	       
	fprintf(stdout, "이용자카드번호  	: %.16s\n", eccj->crd_no);

	fprintf(stdout, "\n");
	fprintf(stdout, "알고리즘 ID     	: %.2s\n", eccj->algo_id);
	fprintf(stdout, "KEY VERSION     	: %.2s\n", eccj->key_ver);
	fprintf(stdout, "이용자카드거래일련번호  : %.8s\n", eccj->tran_no);
	fprintf(stdout, "LSAM거래 일련번호       : %.8s\n", eccj->lsam_no);
	fprintf(stdout, "이용자카드난수  	: %.16s\n", eccj->usercrd_random_no);
	fprintf(stdout, "LSAM카드난수    	: %.16s\n", eccj->lsam_random_no);

	fprintf(stdout, "\n");
	fprintf(stdout, "발행기관ID      	: %.6s\n", eccj->publish_orgn_id);
	fprintf(stdout, "이용자카드ID    	: %.10s\n", eccj->usercrd_id);
	fprintf(stdout, "LSAM ID         	: %.10s\n", eccj->lsam_id );

	fprintf(stdout, "\n");
	fprintf(stdout, "충전전잔액      	: %d\n", eccj->be_chrg_balc );
	fprintf(stdout, "충전후잔액      	: %d\n", eccj->after_chrg_balc );
	fprintf(stdout, "PAN             	: %.20s\n", eccj->pan );

	fprintf(stdout, "\n");
	fprintf(stdout, "CENTER ID       	: %.2s\n", eccj->center_id );
	fprintf(stdout, "카드발행자고유ID  	: %.6s\n", eccj->crd_publisher_unq_id );
	fprintf(stdout, "이용자카드 서명 	: %.8s\n", eccj->usercrd_sign );
	fprintf(stdout, "LSAM 서명       	: %.8s\n", eccj->lsam_sign );

	fprintf(stdout, "\n");
	fprintf(stdout, "충전거래금액    	: %d\n", eccj->chrg_tran_mny );
	fprintf(stdout, "충전할증금액    	: %d\n", eccj->chrg_extr_mny );
	fprintf(stdout, "충전할증율      	: %d\n", eccj->chrg_extr_rte );

	fprintf(stdout, "\n");
	fprintf(stdout, "수납유형        	: %s\n", eccj->rct_typ );
	fprintf(stdout, "직전충전시각     	: %04d/%02d/%02d  %02d:%02d:%02d \n",
			eccj->be_chrg_year, eccj->be_chrg_month, eccj->be_chrg_day, eccj->be_chrg_hour, 
			eccj->be_chrg_min, eccj->be_chrg_sec );	       
	fprintf(stdout, "신용카드번호    	: %.16s\n", eccj->ccrd_no );
	fprintf(stdout, "신용카드승인번호 	: %.6s\n", eccj->ccrd_confirm_no );
	fprintf(stdout, "\n");
	return (0);
}

int show_i_cggmjr(i_cjda)
struct	hi_wout_wrk_end1	*i_cjda;
{
	int	ii,	jj,	kk;

	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] < 근무종료 > [low packet %d Byte]\n", 
							(int)sizeof(struct lo_wout_wrk_end1));
	fprintf(stdout, "전송연번        %04x\n", i_cjda->seq_no);
	fprintf(stdout, "근무일자        %d-%02d-%02d\n",     
			i_cjda->wrk_year, i_cjda->wrk_month, i_cjda->wrk_day);
	fprintf(stdout, "근무번호        %.4s\n", i_cjda->wrk_no);
	fprintf(stdout, "근무개시일시    %d-%02d-%02d %02d:%02d:%02d\n", 
		  i_cjda->wrk_start_year, i_cjda->wrk_start_month, i_cjda->wrk_start_day, 
		  i_cjda->wrk_start_hour, i_cjda->wrk_start_min, i_cjda->wrk_start_sec);
	fprintf(stdout, "근무종료일시    %d-%02d-%02d %02d:%02d:%02d\n",
		  i_cjda->wrk_end_year, i_cjda->wrk_end_month, i_cjda->wrk_end_day, 
		  i_cjda->wrk_end_hour, i_cjda->wrk_end_min, i_cjda->wrk_end_sec);
	fprintf(stdout, "처리대수        %d\n",  i_cjda->hnd_cnt);
	fprintf(stdout, "차판전진대수    %d\n",  i_cjda->car_adv_cnt);
	fprintf(stdout, "차판후진대수    %d\n",  i_cjda->car_rev_cnt);
	fprintf(stdout, "차판후진축수    %d\n",  i_cjda->car_rev_axle_cnt);
	fprintf(stdout, "예비권확인수    %d\n",  i_cjda->reserve_ticket_cnt);
	fprintf(stdout, "할인카드 사용 제외 금액[현금/신용/고속/전자/교통카드]\n");
	for (ii = 0; ii < 5; ii++)
	{
		fprintf(stdout, "[%d][0-8] = ", ii);
		for (jj = 0; jj < 8; jj++)
	        {
			fprintf(stdout, "[%7d] ", i_cjda->dc_nouse_mny[ii][jj]);
	        }
		fprintf(stdout, "\n");
	}

	fprintf(stdout, "할인카드 사용시 금액[할인전금액/현/신/정/전/교]\n");
	for (ii = 0; ii < 6; ii++)
	{
		fprintf(stdout, "[%d][0-8] = ", ii);
		for (jj = 0; jj < 8; jj++)
			fprintf(stdout, "[%7d] ", i_cjda->dc_use_mny[ii][jj]);
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "대수\n");
	for (ii = 0; ii < 2; ii++)
	{
	    for (jj = 0; jj < 4; jj++)
	    {
		fprintf(stdout, "[%d][%d][0-8] = ", ii, jj);
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ", i_cjda->dc_cnt[ii][jj][kk]);
		}
		fprintf(stdout, "\n");
	    }
	}
#if 0
	fprintf(stdout, "면제카드건수    %d\n",  i_cjda->mcgs);

	fprintf(stdout, "특별처리건수\n     ");
	for (ii = 0; ii < 14; ii++)
		fprintf(stdout, "%6d ",  i_cjda->tbcr[ii]);
	fprintf(stdout, "\n     ");	
	for (ii = 14; ii < 27; ii++)
	{		
		fprintf(stdout, "%6d ",  i_cjda->tbcr[ii]);
	}
	fprintf(stdout, "\n");	
	fprintf(stdout, "사무실처리수    %d\n",  i_cjda->yugs);
	fprintf(stdout, "도주건수      ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%3d ", i_cjda->djgs[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "카드재발행매수  %d\n",  i_cjda->jjms);
	fprintf(stdout, "권이상건수      %d\n",  i_cjda->kiss);
	fprintf(stdout, "강제 종료       %d\n",  i_cjda->kjjr);
	fprintf(stdout, "근무 종단       %d\n",  i_cjda->kmjd);
	fprintf(stdout, "커버 오픈       %d\n",  i_cjda->kbop);
	fprintf(stdout, "면제건수      ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%3d ", i_cjda->mjgs[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "권미소지건수\n");
	for (ii = 0; ii < 4; ii++)
	{
		fprintf(stdout, "[%d][0-7] =     ", ii);
		for (jj = 0; jj < 8; jj++)
			fprintf(stdout, "%2d  ",  i_cjda->msgs[ii][jj]);
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "통행권상대수\n");
	for (ii = 0; ii < 8; ii++)
	{
		fprintf(stdout, "[%d][0-8] =  ", ii);
		for (jj = 0; jj < 9; jj++)
			fprintf(stdout, "%6d  ",  i_cjda->ksds[ii][jj]);
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "차판대수    ");
	for (ii = 0; ii < 9; ii++)
		fprintf(stdout, "%6d  ", i_cjda->cpds[ii]);

	fprintf(stdout, "\n");
	fprintf(stdout, "할인시간대 원요금   [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_cjda->hiwk[ii]);

	fprintf(stdout, "\n");
	fprintf(stdout, "할인시간대 할인요금 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_cjda->hiyk[ii]);

	fprintf(stdout, "\n");
	fprintf(stdout, "할증시간대 원요금   [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_cjda->hjwk[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "할증시간대 할증요금  [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_cjda->hjyk[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "할인시간대대수       [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_cjda->hids[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "할증시간대대수       [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_cjda->hjds[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "출퇴근 할인시간대 원요금 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_cjda->ctwk[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "출퇴근 할인시간대할인요금[1-8종]\n ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_cjda->ctyk[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "출퇴근 할인시간대할인대수[1-8종]\n ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_cjda->ctds[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "LSAM 충전금액          :  %8d\n", i_cjda->cjke);
	fprintf(stdout, "이용자카드 충전금액    :  %8d\n", i_cjda->cscj);
	fprintf(stdout, "LSAM 잔액              :  %8d\n", i_cjda->lsje);
#endif
	return (0);
}

int show_i_cggmjr2(i_ncjda)
struct	hi_wout_wrk_end2	*i_ncjda;
{
	int	ii,	jj,	kk;

	fprintf(stdout, "==================================================\n");
	fprintf(stdout, "[TCS] < 근무종료 2 > [low packet %d Byte]\n", 
							(int)sizeof(struct lo_wout_wrk_end2));
	fprintf(stdout, "전송연번        %04x\n", i_ncjda->seq_no);
	fprintf(stdout, "근무일자        %d-%02d-%02d\n",     
			i_ncjda->wrk_year, i_ncjda->wrk_month, i_ncjda->wrk_day);
	fprintf(stdout, "근무번호        %.4s\n", i_ncjda->wrk_no);
	fprintf(stdout, "근무자번호      %.4s\n", i_ncjda->wrkr_no);

	fprintf(stdout, "면제카드건수    \n");  
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%6d ",  i_ncjda->exmt_crd_cnt[ii]);
	fprintf(stdout, "\n");	
	fprintf(stdout, "\n");	

	fprintf(stdout, "위반유형별건수  \n");  
	for (ii = 0; ii < 10; ii++)
		fprintf(stdout, "%6d ",  i_ncjda->vio_cnt[ii]);
	fprintf(stdout, "\n");	
	for (ii = 10; ii < 20; ii++)
		fprintf(stdout, "%6d ",  i_ncjda->vio_cnt[ii]);
	fprintf(stdout, "\n");	
	for (ii = 20; ii < 30; ii++)
		fprintf(stdout, "%6d ",  i_ncjda->vio_cnt[ii]);
	fprintf(stdout, "\n");	
	fprintf(stdout, "\n");	
	fprintf(stdout, "특별처리건수\n");
	for (ii = 0; ii < 10; ii++)
		fprintf(stdout, "%6d ",  i_ncjda->spcl_hnd_cnt[ii]);
	fprintf(stdout, "\n");	
	for (ii = 10; ii < 20; ii++)
	{		
		fprintf(stdout, "%6d ",  i_ncjda->spcl_hnd_cnt[ii]);
	}
	fprintf(stdout, "\n");	
	for (ii = 20; ii < 30; ii++)
	{		
		fprintf(stdout, "%6d ",  i_ncjda->spcl_hnd_cnt[ii]);
	}
	fprintf(stdout, "\n");	
	for (ii = 30; ii < 37; ii++)
	{		
		fprintf(stdout, "%6d ",  i_ncjda->spcl_hnd_cnt[ii]);
	}
	fprintf(stdout, "\n");	
	fprintf(stdout, "\n");	
	fprintf(stdout, "사무실처리수    %d\n",  i_ncjda->ofc_hnd_cnt);
	fprintf(stdout, "\n");
	fprintf(stdout, "도주건수");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%6d ", i_ncjda->escp_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");
	fprintf(stdout, "미납/부분납/완납 위반 유형별 대수\n");
	for(jj = 0; jj < 3; jj++)
	{
		for (ii = 0; ii < 8; ii++)
		{
			fprintf(stdout, "%6d ", i_ncjda->vio_hnd_cnt[jj][ii]);
		}
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "\n");
	fprintf(stdout, "부분납/완납 위반 유형별 금액\n");
	for(jj = 0; jj < 2; jj++)
	{
		for (ii = 0; ii < 8; ii++)
		{
			fprintf(stdout, "%6d ", i_ncjda->vio_mny[jj][ii]);
		}
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "연계면제       ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%6d ", i_ncjda->lnk_exmt_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");
	fprintf(stdout, "감지/처리대수  ");
	for (ii = 0; ii < 9; ii++)
		fprintf(stdout, "%6d ", i_ncjda->sens_hnd_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");
	fprintf(stdout, "감지/미처리대수");
	for (ii = 0; ii < 9; ii++)
		fprintf(stdout, "%6d ", i_ncjda->nohnd_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");
	fprintf(stdout, "카드재발행매수  %d\n",  i_ncjda->hiwy_republish_cnt);
	fprintf(stdout, "권이상건수      %d\n",  i_ncjda->ticket_abnormal_cnt);
	fprintf(stdout, "강제 종료       %d\n",  i_ncjda->force_end);
	fprintf(stdout, "근무 종단       %d\n",  i_ncjda->wrk_stop);
	fprintf(stdout, "커버 오픈       %d\n",  i_ncjda->cover_open);
	fprintf(stdout, "\n");

	fprintf(stdout, "면제건수    ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%6d ", i_ncjda->exmt_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "권미소지건수\n");
	for (ii = 0; ii < 4; ii++)
	{
		fprintf(stdout, "[%d][0-7] =      ", ii);
		for (jj = 0; jj < 8; jj++)
			fprintf(stdout, "%2d  ",  i_ncjda->ticket_nohave_cnt[ii][jj]);
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "통행권상대수\n");
	for (ii = 0; ii < 8; ii++)
	{
		fprintf(stdout, "[%d][0-8] =  ", ii);
		for (jj = 0; jj < 9; jj++)
			fprintf(stdout, "%6d  ",  i_ncjda->ticket_cnt[ii][jj]);
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "\n");
	fprintf(stdout, "차판대수    ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%6d  ", i_ncjda->car_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "사무실처리 건수 ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%6d ", i_ncjda->carkind_ofc_hnd_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "부가세\n");
	for (ii = 0; ii < 5; ii++)
	{
		fprintf(stdout, "[%d][0-8] =  ", ii);
		for (jj = 0; jj < 8; jj++)
			fprintf(stdout, "%6d  ",  i_ncjda->vat[ii][jj]);
		fprintf(stdout, "\n");
	}
	fprintf(stdout, "\n");

	fprintf(stdout, "빈차면제 대수\n    ");
	for (ii = 0; ii < 4; ii++)
		fprintf(stdout, "%7d ", i_ncjda->ecar_exmt_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");


	fprintf(stdout, "할인시간대 원요금   [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->dctime_org_pass_fare[ii]);

	fprintf(stdout, "\n");
	fprintf(stdout, "할인시간대 할인요금 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->dctime_pass_fare[ii]);

	fprintf(stdout, "\n");
	fprintf(stdout, "할증시간대 원요금   [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->extrtime_org_pass_fare[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "할증시간대 할증요금  [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->extrtime_pass_fare[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "할인시간대대수       [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->dctime_car_cnt[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "할증시간대대수       [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->extrtime_car_cnt[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "출퇴근 할인시간대 원요금 [1-8종]\n   ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->cmut_org_pass_fare[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "출퇴근 할인시간대할인요금[1-8종]\n   ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->cmut_pass_fare[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "출퇴근 할인시간대할인대수[1-8종]\n   ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%7d ", i_ncjda->cmut_car_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "차량처리대수           :  %8d\n", i_ncjda->car_hnd_cnt);
	fprintf(stdout, "TCS 처리 이관 대수     :  %8d\n", i_ncjda->hnd_transfer_cnt);
	fprintf(stdout, "LSAM 충전금액          :  %8d\n", i_ncjda->lsam_chrg_mny);
	fprintf(stdout, "이용자카드 충전금액    :  %8d\n", i_ncjda->usercrd_chrg_mny);
	fprintf(stdout, "LSAM 잔액              :  %8d\n", i_ncjda->lsam_balc);
	fprintf(stdout, "차로미납금 수납 금액   :  %8d\n", i_ncjda->lane_upid_rct);
	fprintf(stdout, "\n");
	return (0);
}

int show_i_cggmjr3(i_ncjda2)
struct  hi_wout_wrk_end3 *i_ncjda2;
{
	int	ii,	jj,	kk;

	fprintf(stdout, "==================================================\n");
        fprintf(stdout, "[TCS] < 근무종료 3 > [low packet %d Byte]\n",
                                                        (int)sizeof(struct lo_wout_wrk_end3));
	fprintf(stdout, "전송연번        %04x\n", i_ncjda2->seq_no);
	fprintf(stdout, "종    별        %02x\n", i_ncjda2->kind);
	fprintf(stdout, "근무일자        %d-%02d-%02d\n",
                  i_ncjda2->wrk_year, i_ncjda2->wrk_month, i_ncjda2->wrk_day);
        fprintf(stdout, "근무번호        %.4s\n", i_ncjda2->wrk_no);
        fprintf(stdout, "근무자번호      %.4s\n", i_ncjda2->wrkr_no);
	for (ii = 0; ii < 8; ii++)
	{
		switch(ii)
		{
		case	0:
			fprintf(stdout,"[시간대 평  일][시간대%d]",ii+1);
			break;

		case	1:
			fprintf(stdout,"               [시간대%d]",ii+1);
			break;

		case	2:
			fprintf(stdout,"               [시간대%d]",ii+1);
			break;

		case	3:
			fprintf(stdout,"               [시간대%d]",ii+1);
			break;

		case	4:
			fprintf(stdout,"[시간대 토요일][시간대%d]",ii-3);
			break;

		case	5:
			fprintf(stdout,"               [시간대%d]",ii-3);
			break;

		case	6:
			fprintf(stdout,"               [시간대%d]",ii-3);
			break;

		case	7:
			fprintf(stdout,"               [시간대%d]",ii-3);
			break;

		}
		fprintf(stdout, "[대  수]");
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ",  i_ncjda2->tm_zone[ii].cnt[kk]);
		}
		fprintf(stdout, "\n");

		fprintf(stdout, "                        [원금액]");
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ",  i_ncjda2->tm_zone[ii].orgn_fare[kk]);
		}
		fprintf(stdout, "\n");
		fprintf(stdout, "                        [금  액]");
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ",  i_ncjda2->tm_zone[ii].pass_fare[kk]);
		}
		fprintf(stdout, "\n");
		fprintf(stdout, "                        [수납액]");
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ",  i_ncjda2->tm_zone[ii].rct_fare[kk]);
		}
		fprintf(stdout, "\n");

	}
	fprintf(stdout, "\n");

	return (0); 
}

int show_i_cggmjr4(i_ncjda2)
struct  hi_wout_wrk_end4 *i_ncjda2;
{
	int	ii,	jj,	kk;

	fprintf(stdout, "==================================================\n");
        fprintf(stdout, "[TCS] < 근무종료 4 > [low packet %d Byte]\n",
                                                        (int)sizeof(struct lo_wout_wrk_end4));
	fprintf(stdout, "전송연번        %04x\n", i_ncjda2->seq_no);
	fprintf(stdout, "종    별        %02x\n", i_ncjda2->kind);
	fprintf(stdout, "근무일자        %d-%02d-%02d\n",
                  i_ncjda2->wrk_year, i_ncjda2->wrk_month, i_ncjda2->wrk_day);
        fprintf(stdout, "근무번호        %.4s\n", i_ncjda2->wrk_no);
        fprintf(stdout, "근무자번호      %.4s\n", i_ncjda2->wrkr_no);
	fprintf(stdout, "빈차면제 대수[1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->ecar_exmt_cnt[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "빈차면제 금액[1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->ecar_exmt_mny[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "연계처리 대수[1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->lnk_hnd_cnt[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "연계처리 원 통행요금 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->lnk_hnd_org_pass_fare[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "연계처리 징수할 금액 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->lnk_hnd_col_pass_fare[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "연계처리 수납 금액 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->lnk_hnd_rct_pass_fare[ii]);
	fprintf(stdout, "\n");

	for (ii = 0; ii < 5; ii++)
	{
		switch(ii)
		{
		case	0:
			fprintf(stdout,"[미납수납][현  금]");
			break;

		case	1:
			fprintf(stdout,"          [후불전]");
			break;

		case	2:
			fprintf(stdout,"          [고  카]");
			break;

		case	3:
			fprintf(stdout,"          [선불전]");
			break;

		case	4:
			fprintf(stdout,"          [교  통]");
			break;
		}
		fprintf(stdout, "[건수]");
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ",  i_ncjda2->upid_rct[ii].cnt);
		}
		fprintf(stdout, "\n");

		fprintf(stdout, "                  [금액]");
		for (kk = 0; kk < 8; kk++)
		{
			fprintf(stdout, "[%6d] ",  i_ncjda2->upid_rct[ii].mny);
		}
		fprintf(stdout, "\n");
		fprintf(stdout, "\n");

	}
	fprintf(stdout, "차종별 사무실 처리 건수 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->ofc_hnd_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "차종별 부적격 건수 [1-8종]\n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->unqf_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "면제 유형별 건수 \n  ");
	for (ii = 0; ii < 10; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->exmt_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "근무자 카드 건수 \n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->wrkr_crd_cnt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "\n");

	fprintf(stdout, "근무자 카드 금액 \n  ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "   %6d ", i_ncjda2->wrkr_crd_mny[ii]);
	fprintf(stdout, "\n");

	fprintf(stdout, "\n");

	return (0); 
}
#if 0
int show_h_outproc3(h_ncgda1)
struct  hl_ecrd_pay_hnd *h_ncgda1;
{
    fprintf(stdout, "[Hi-pass] < 처리데이터(감면단말) : 0x80 >   [low packet %d Byte]\n", (int)sizeof(struct hl_ecrd_pay_hnd));
    fprintf(stdout, "전송연번            %8x        구분(2:개방식) %d\n", h_ncgda1->seq_no, h_ncgda1->kind);

    fprintf(stdout, "근무일자/근무번호   %d-%02d-%02d %.4s 일련번호                 %d\n", h_ncgda1->wkr_year, h_ncgda1->wkr_month, h_ncgda1->wkr_day, h_ncgda1->wkr_no, h_ncgda1->serial_no);
    fprintf(stdout, "운영구분/처리구분   %.2s/%.2s           HPS처리일련번호          %d\n", h_ncgda1->yygb, h_ncgda1->proc, h_ncgda1->hiir);
    fprintf(stdout, "++++이전영업소정보+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
    fprintf(stdout, "처리시각            %04d-%02d-%02d      %02d:%02d:%02d\n",  h_ncgda1->ygyy, h_ncgda1->ygmm, h_ncgda1->ygdd, h_ncgda1->yghh, h_ncgda1->ygbb, h_ncgda1->ygcc);
    fprintf(stdout, "운영기관번호        0x%02x            영업소번호               %.4s\n", h_ncgda1->gwcd, h_ncgda1->ygic);
    fprintf(stdout, "차로유형            %02x              차로번호                 %02d\n", h_ncgda1->crht, h_ncgda1->crbh);
    fprintf(stdout, "근무순번            %02d              일련번호                 %5d\n", h_ncgda1->ygkm, h_ncgda1->crno);
    fprintf(stdout, "원통행요금          %08d        수납요금                 %d\n", h_ncgda1->thyk, h_ncgda1->ijsn);
    fprintf(stdout, "차종\t\t    %d               전영업소번호             %.4s\n", h_ncgda1->ygcj, h_ncgda1->cano);
    fprintf(stdout, "정보구분(0:CARD,1:OBU)   %d\n", h_ncgda1->cdgb);

    fprintf(stdout, "++++입구영업소정보[개방:DUMMY]++++++++++++++++++++++++++++++++++++++++++++\n");
    fprintf(stdout, "처리시각            %04d-%02d-%02d      %02d:%02d:%02d\n",  h_ncgda1->igyy, h_ncgda1->igmm, h_ncgda1->igdd, h_ncgda1->ighh, h_ncgda1->igbb, h_ncgda1->igcc);
    fprintf(stdout, "운영기관번호        0x%02x            영업소번호               %.4s\n", h_ncgda1->iggw, h_ncgda1->igic);
    fprintf(stdout, "차로번호            %02d              근무번호                 %02d\n", h_ncgda1->igcr, h_ncgda1->igkm);
    fprintf(stdout, "처리번호            %05d           처리차종                 %1d\n", h_ncgda1->igir, h_ncgda1->igcj);
    fprintf(stdout, "정보구분(0:CARD,1:OBU)   %d\n", h_ncgda1->ecgb);

    fprintf(stdout, "++++현영업소처리정보++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
    fprintf(stdout, "영업소번호         %.3s              위반코드                 %.2s\n", h_ncgda1->cgic, h_ncgda1->cgob);
    fprintf(stdout, "처리시각           %04d-%02d-%02d       %02d:%02d:%02d[%.3s]\n",  h_ncgda1->hiyy, h_ncgda1->himm, h_ncgda1->hidd, h_ncgda1->hihh, h_ncgda1->hibb, h_ncgda1->hicc, h_ncgda1->himi);
    fprintf(stdout, "원통행요금         %6d           통행요금                 %d\n", h_ncgda1->wthy, h_ncgda1->tgyk);
    fprintf(stdout, "수납금액           %6d           수납전카드잔액           %d\n", h_ncgda1->snyk, h_ncgda1->sjyk);
    fprintf(stdout, "지불할인율         %.5s            수납구분                 %.2s\n", h_ncgda1->jbhi, h_ncgda1->sngb);
    fprintf(stdout, "카드종류           %.2s               처리차종                 %d\n", h_ncgda1->cdjr, h_ncgda1->cgcj);
    fprintf(stdout, "전자카드번호       %4.4s-%4.4s-%4.4s-%4.4s 지불처리구분             %.2s\n",
            h_ncgda1->cdno, h_ncgda1->cdno+4, h_ncgda1->cdno+8, h_ncgda1->cdno+12, h_ncgda1->jbgb);
    fprintf(stdout, "근무구분(0:정상, 1:보수)   %1d        감지차종                 %d\n", h_ncgda1->cgkm, h_ncgda1->gjcj);
    fprintf(stdout, "OBU차종            %d                영상번호                 %d\n", h_ncgda1->obcj, h_ncgda1->ysno);
    fprintf(stdout, "OBU번호            %.16s OBU TYPE(00:RF,01:IR)    %.2s\n", h_ncgda1->obno, h_ncgda1->obty);
    fprintf(stdout, "OBU 상태           %.2s               전자카드상태             %.2s\n", h_ncgda1->obst, h_ncgda1->ecst);
    fprintf(stdout, "징수상태(CCU)      %.2s               인증상태                 %.2s\n", h_ncgda1->must, h_ncgda1->ijst);
    fprintf(stdout, "통합처리상태       %.2s               위반상태                 %.4s\n", h_ncgda1->ttst, h_ncgda1->wbst);
    fprintf(stdout, "차량번호           %.16s              \n", h_ncgda1->cabh);
    fprintf(stdout, "연계면제구분       %1d                수납구분                 %1d\n", h_ncgda1->ygif, h_ncgda1->crgb);
    fprintf(stdout, "카드차량번호       %.16s 단말기차량번호           %.16s   \n", h_ncgda1->ccar, h_ncgda1->dcar);
    fprintf(stdout, "단말기속성         0x%02x             전자카드속성             0x%02x\n", h_ncgda1->obat, h_ncgda1->kdss);
    fprintf(stdout, "+++++++++++이하는 전자지불측 서명검증용+++++++++++++++++++++++++++++++++++++++++\n");
    fprintf(stdout, "LOGICAL ID         %.16s 알고리즘ID               %.2s\n", h_ncgda1->loid, h_ncgda1->algi);
    fprintf(stdout, "PSAM ID            %.16s 구매일자                 %.8s\n", h_ncgda1->psid, h_ncgda1->gmil);
    fprintf(stdout, "거래유형           %.2s               발행기관ID               %.6s\n", h_ncgda1->gtrt, h_ncgda1->bhid);
    fprintf(stdout, "전자화폐ID         %.10s       전자화폐거래일련번호     %.8s\n", h_ncgda1->ecid, h_ncgda1->erno);
    fprintf(stdout, "거래일련번호       %.8s         거래총액                 %.8s\n", h_ncgda1->grno, h_ncgda1->grtt);
    fprintf(stdout, "발행기관별개별거래수  %.4s          거래수집일련번호         %.8s\n", h_ncgda1->gbgr, h_ncgda1->sjno);
    fprintf(stdout, "서명키버젼1        %.2s               PSAM 서명1               %.8s\n", h_ncgda1->smk1, h_ncgda1->psm1);
    fprintf(stdout, "서명키버젼2        %.2s               PSAM 서명2               %.8s\n", h_ncgda1->smk2, h_ncgda1->psm2);
    fprintf(stdout, "CENTER ID          %.2s\n", h_ncgda1->ctid);
    return (0);
}
#endif

int	show_p_sgbgtr(p_sgda)
struct	hi_hourly_traffic	*p_sgda;
{
	int	ii;

	fprintf(stdout, "[TCS:P-LAN] < 시간별 교통량 >\n");
	fprintf(stdout, "전송연번        %x\n", p_sgda->seq_no);
	fprintf(stdout, "차로번호        %d\n", p_sgda->lane_no);
	fprintf(stdout, "일자 시간대     %d-%02d-%02d %02d:%02d %02d\n",
			p_sgda->year, p_sgda->month, p_sgda->day, p_sgda->hour, p_sgda->min, p_sgda->tm_zone);
	fprintf(stdout, "정상통행        ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->normal[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "면    제        ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->exmt[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "면제카드        ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->exmtcrd[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "도주(미납)      ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->escp[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "할인카드        ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->dccrd[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "할인/할증       ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->dc_extr[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "부적격          ");
	for (ii = 0; ii < 8; ii++)
		fprintf(stdout, "%4d ", p_sgda->unqf[ii]);
	fprintf(stdout, "\n");
	fprintf(stdout, "차종변경           %d\n", p_sgda->carkind_chng);
	fprintf(stdout, "\n");
	return(0);
}
