Public Function LprExitValidityCheck(ByRef sCarNo As String, ByRef ValidityCheckHendler As Integer _
                                    , ByRef cnntMaster As Connection, ByRef cnntTrns As Connection, ByRef PssDat As Buffer_Passcard, ByRef ApbUpdtFlag As Boolean) As Boolean
    
    Dim CustomRs             As Recordset
    Dim nPassCardType        As Integer
    Dim nPassCardUseFlag     As Integer
    Dim nCarFreeUseFlag      As Integer
    Dim nCustomerGroupCode   As Integer
    Dim nPassCardCheckMethod As Integer
    Dim AvailableDays        As Integer
    Dim AvailableTimes       As Integer
    Dim nPssCardClass        As Integer
    Dim cDtChangTime         As String
    Dim StartDate            As Date
    Dim EndDate              As Date
    Dim dtToday              As Date
    Dim dtActionDate         As Date
    Dim tz_01                As String
    Dim tz_02                As String
    Dim sSql                 As String
    Dim sCarNoTmp            As String
    Dim PassRs      As Recordset
    Dim adoCom      As Command
    Dim adoPassCom  As Command
    Dim Echo As ICMP_ECHO_REPLY
    
    '2015-08-31 Hong Tak 후불제에서 통합.
    '------------------------------------------------ Start
    ' 2012-03-20 Park 올림픽공원 시간대정기권의 입차데이터 존재 유무
    Dim InDateExitanceFlag   As Boolean
    Dim InDtDate       As Date
    
    '//2012-04-10 yoon young tak
    Dim dTimeZoneErrPassTrnsOrgID   As Double
    Dim iTimeZoneInOutType          As Integer
    
    
    Dim trDate As Date                  '// 2012-03-21 Park Choong Yong
    Dim Days%
                                                        
    InDateExitanceFlag = False
    '------------------------------------------------ End
    
    On Error GoTo Err_Handler
    
    
    frmFC_Sub.PlateNo01.ForeColor = &H80000012 '2010-07-16 Ko Hyun Seok
    
    If cnntMaster.State <> adStateOpen Then
        Call SaveErrDescription("fcLpr(LprExitValidityCheck)" & " DB연결상태이상-MASTERDB:" & cnntMaster.State)
        LprExitValidityCheck = False
        Exit Function
    End If
    
    
    '2006-11-06 쿼리구문 Command개체로 변경
    Set adoCom = New Command
    
    With adoCom
        .ActiveConnection = cnntMaster
        .CommandType = adCmdText
    End With
    
    
    ' 2010-03-15 Park Choong Yong Length Check 없앰
    '2008-06-10 차량번호 숫자로만 검색 (앞2자리+뒤4자리)
    If LprSystem.iPlateCompNo = Use Then ' And (Len(sCarNo) = 7 Or Len(sCarNo) = 9) Then
        
        sSql = " Select iUser, acUserName, iUseFlg,iPsscrdType,iGroup,acUserName,dtvalidstartdate,dtValidStartTime, acTelNo1,isnull(icarfreeuseflg,0) as icarfreeuseflg ,"
        
        '2012-01-07 LEE 단체구분추가
        'sSql = sSql & " dtValidEndTime, dtvalidenddate,iTicket,iPayment, acPlate1, iPsscrdZone, iTendatedRule from CUSTDEF "
        sSql = sSql & " dtValidEndTime, dtvalidenddate,iTicket,iPayment, acPlate1, iPsscrdZone, iTendatedRule, acGroup,acReserved3 from CUSTDEF "
        sSql = sSql & " Where iLotArea= ? and acPlate3= ?"
        
        '//2012-03-31 yoon young tak - 지역구분 변경 남3,남4구분
        '//2012-03-05 yoon young tak - 지역별구분추가
        sSql = sSql & GetOlymp_ChkGateNoQuery_CustInfo()
        
        
        sCarNo = Trim(sCarNo)
        
        '// 2010-03-11, Park Choong Yong, 숫자만 Pick Up
        sCarNoTmp = NumericNoOfCarPlate(sCarNo)
        
        With adoCom
            .CommandText = sSql
            .Parameters.Append .CreateParameter("iLotArea", adInteger, adParamInput, , UserInfor.LotArea)
            .Parameters.Append .CreateParameter("acPlate3", adVarChar, adParamInput, 20, sCarNoTmp)
        End With
    
    Else
        sSql = "Select iUser,iUseFlg,iPsscrdType,iGroup,acUserName,dtvalidstartdate,dtValidStartTime, dtValidEndTime, dtvalidenddate, isnull(icarfreeuseflg,0) as icarfreeuseflg ," '2009-05-07 LEE
        
        '2012-01-07 LEE 단체구분추가
        'sSql = sSql & " iTicket,iPayment, acPlate1,acTelNo1,iPsscrdZone, acUserName, iTendatedRule from CUSTDEF "
        sSql = sSql & " iTicket,iPayment, acPlate1,acTelNo1,iPsscrdZone, acUserName, iTendatedRule, acGroup,acReserved3 from CUSTDEF "
        sSql = sSql & " Where iLotArea= ? and acPlate1= ?"
        
        '//2012-03-31 yoon young tak - 지역구분 변경 남3,남4구분
        '//2012-03-05 yoon young tak - 지역별구분추가
        sSql = sSql & GetOlymp_ChkGateNoQuery_CustInfo()
        
        
        sCarNo = Trim(sCarNo)
        With adoCom
            .CommandText = sSql
            .Parameters.Append .CreateParameter("iLotArea", adInteger, adParamInput, , UserInfor.LotArea)
            .Parameters.Append .CreateParameter("acPlate1", adVarChar, adParamInput, 20, sCarNo)
        End With

    End If
    
    Set CustomRs = New Recordset
    CustomRs.Open adoCom
        
    dtToday = Date
    
    dtActionDate = Now
    
    '////////////////////////////////////////////////////////////////////////////////////////////////////////////// 완료
    
    If Not CustomRs.EOF Then
        
        '-----------------------------------------------------------------------------------------------------------
        '2009-09-23 yoon young tak - 정기권 정보 PssDat구조체 - view로 쿼리시
        'If LprSystem.iPlateCompNo = Use Then
        '        Call GetTmLprUserInfor(sCarNo, PssDat, cnntMaster)
        'Else
        
        With PssDat
            
            .UserId = CustomRs.Fields("iUser")
            .dPasscardNo = CustomRs.Fields("iTicket")
            .UserName = "" & CustomRs.Fields("acUserName")
            .UserPlate = "" & CustomRs.Fields("acPlate1")
            .UserTelNo = "" & CustomRs.Fields("acTelNo1")
            .UserValidStartDate = "" & CustomRs.Fields("dtValidStartDate")
            .UserValidEndDate = "" & CustomRs.Fields("dtValidEndDate")
            
            If IsNull(CustomRs.Fields("iPsscrdZone")) Or CustomRs.Fields("iPsscrdZone") = 0 Then
                .UserType = 1
            Else
                .UserType = CustomRs.Fields("iPsscrdZone")
                If .UserType = 0 Then .UserType = 1
            End If
            
            If CustomRs.Fields("iPsscrdType") = 0 Then
                .UserPasscardType = 0
            Else
                .UserPasscardType = CustomRs.Fields("iPsscrdType")
            End If
            
            If IsNull(CustomRs("iGroup")) Then
                .UserGroup = 0
            Else
                .UserGroup = CustomRs("iGroup")
            End If
            
            .iTendatedRule = Val(CustomRs("iTendatedRule"))     '2010-05-31 LEE 부제 설정
            
            .sGroupType = CustomRs("acGroup") & ""              '2012-01-07 LEE 단체 구분
            .sGroupName = "" & CustomRs("acReserved3")          '2012-07-17 yoon young tak - 단체정보
            
        End With
        'End If
        
        '2008-06-10 LEE 숫자로만 비교했을때 일치하고 문자 오인식일때 차량번호를 DB에 등록된것으로 변경
        If LprSystem.iPlateCompNo = Use And sCarNo <> CustomRs!acPlate1 Then sCarNo = CustomRs!acPlate1
        
        nPassCardUseFlag = CustomRs("iUseFlg")
        nCarFreeUseFlag = CustomRs("icarfreeuseflg")
        nPassCardType = CustomRs("iPsscrdType")
        nCustomerGroupCode = CustomRs("iGroup")
        nPassCardCheckMethod = 0                                'CustomRs("iPsscrdUseMethod")
        AvailableDays = 0                                       'CustomRs("iAvailableDays")
        AvailableTimes = 0                                      'CustomRs("iAvailableTimes")
        nPssCardClass = 0                                       'CustomRs("iPsscrdZone")
       
        Dim ImagePath$
        
        If cnntTrns.State <> adStateOpen Then
            LprExitValidityCheck = False
            Call SaveErrDescription("fcLpr(LprExitCarNoProcedure)-TRNSDB연결실패:" & cnntTrns.State)
            Exit Function
        End If
                
        ' 2012-03-31 yoon young tak - 조조정기권에 한해 입차정보 조회
        ' 2012-01-03 yoon young tak
        ' 2011-12-27 Park 올림픽공원, 선정산
        'If FeeCalMode.FeeComputerMode <> 2 Then
        If (FeeCalMode.FeeComputerMode <> 2) And (PssDat.UserType = TIME_ZONE_PASSCARD) Then '2015-08-31 후불제에서 통합.  선불제는 위코드로 되어 있음.
        
        
            '2006-11-06 쿼리구문 변경
            Set adoPassCom = New Command
            
            With adoPassCom
                .ActiveConnection = cnntTrns
                .CommandType = adCmdText
            End With
                    
            sSql = "SELECT TOP 1 iID, iInOutStatus, dtInDate,acEntrancePicName FROM PASSTRNS "
            
            sSql = sSql & " WHERE iLotArea = ?"
            sSql = sSql & " And acPlate1 = ?"
            
            '2015-08-31 Hong Tak Gu 선불제/후불제 통합
            If FeeCalMode.FeeComputerMode <> 2 Then
                    '//2012-03-31 yoon young tak - 문별체크 쿼리추가
                    sSql = sSql & GetOlymp_ChkGateNoQuery_InOut()
            End If
    
            sSql = sSql & " ORDER BY iID desc"
            
            
            With adoPassCom
                .CommandText = sSql
                .Parameters.Append .CreateParameter("iLotarea", adInteger, adParamInput, , UserInfor.LotArea)
                .Parameters.Append .CreateParameter("acPlate1", adVarChar, adParamInput, 20, sCarNo)
            End With
            
            Set PassRs = New Recordset
            PassRs.Open adoPassCom
            
    '       //완료
            
            If Not PassRs.EOF Then
                ImagePath = Trim(LprSystem.NetworkShareFolder) & "\" & format(PassRs("dtInDate"), "YYYYMMDD") & "\" & "" & Trim(PassRs("acEntrancePicName"))
                
                With frmFC_Sub
                    If Dir(ImagePath) = "" Then
                        .LprImage.Picture = LoadPicture("")
                    Else
                        .LprImage.Picture = LoadPicture(ImagePath)
                    End If
                    .LprInfo(0) = "" & format(PassRs("dtInDate"), "YY/MM/dd")
                    .LprInfo(1) = "" & format(PassRs("dtInDate"), "Hh:Nn")
                End With
                
                '2015-08-31 Hong Tak Gu 선불제/후불제 통합  '후불제에서 통합 선불제는 없음.
                If FeeCalMode.FeeComputerMode <> 2 Then
                    ' 2012-03-21  Park 시간대정기권(올림픽공원)
                    InDateExitanceFlag = True
                    InDtDate = "" & PassRs("dtInDate")
            
                    '//2012-04-10 yoon young tak - 조조정기권 처리용
                    dTimeZoneErrPassTrnsOrgID = PassRs("iID")
                    iTimeZoneInOutType = PassRs("iInOutStatus")
                End If
                PassRs.Close
                
            End If
            
            
        End If
        
        ' 2010-02-03, START
        With frmFC_Sub
            .CustomerName.Caption = CustomRs("acUserName") & "(" & CustomRs("iTicket") & ")"
            .Validity01.Caption = format(CustomRs("dtvalidstartdate"), "yyyy/mm/dd")
            .Validity02.Caption = format(CustomRs("dtvalidenddate"), "yyyy/mm/dd")
            .PlateNo01 = Trim(CustomRs("acPlate1"))
            
            '2016-06-21 월주차 구분 출력
            If PssDat.UserGroup = "807" Then
                .PassCardMsg = "월주차"
            Else
                .PassCardMsg = "정기차량"
            End If
            
        End With
        
        
        If CustomRs("iPayment") = 2 Then        'vip고객일경우 이중입출차를 처리하지 않는다
            ApbUpdtFlag = True      '이플래그를 False로 하면 출차데이터 저장 안됨 2011-04-25 LEE
        Else
            If Anti_Pass_Back_Check(CustomRs("iTicket"), goOut, cnntTrns, ApbUpdtFlag) = False Then                          '이중입출차 확인
                ValidityCheckHendler = VALIDITY_CHECK_ANTI_PASS_ERROR
                LprExitValidityCheck = True
                Exit Function
            End If
        End If
        
        Select Case nPassCardType
            Case PASSCARD_TYPE_PERSONAL, PASSCARD_TYPE_GROUP
                Select Case nPassCardCheckMethod
                     Case PASSCARD_METHOD_VALIDITY_CHECK                            '기간체크 방식
                        '2015-08-31 Hong Tak Gu 선불제/후불제 통합
                        If FeeCalMode.FeeComputerMode = 2 Then
                        '------------------------------------------------------ 선불제 통합. Start
                        
                            StartDate = CDate(format(CustomRs("dtValidStartDate"), "YYYY-MM-DD") & " " & CustomRs("dtValidStartTime") & ":00")
                            EndDate = CDate(format(CustomRs("dtValidEndDate"), "YYYY-MM-DD") & " " & CustomRs("dtValidEndTime") & ":00")
                    
                            If nPassCardUseFlag = PASSCARD_USING_STOP Or nPassCardUseFlag = PASSCARD_USING_END Or nCarFreeUseFlag = 1 Then              '일시정지이면
                        
                                ValidityCheckHendler = VALIDITY_CHECK_USING_STOP
                                LprExitValidityCheck = True                            '일시정지이므로 진입불가
                                Exit Function
                        
                            Else
                    
                                If (StartDate <= dtActionDate) And (EndDate >= dtActionDate) Then  '// 기간중에 있다면
                            
                                    '//2012-08-08 yoon young tak - 시간대 위반유무 체크 (올림픽공원의 선불입구지역에 한해체크,선불후불지역은 출차처리)
                                    If PssDat.UserType <= 0 Then PssDat.UserType = 1
                                    tz_01 = tpPassBand.Intime(PssDat.UserType - 1)
                                    tz_02 = tpPassBand.OutTIme(PssDat.UserType - 1)
                                    If FeeCalMode.FeeComputerMode = 2 Then
                                        If TimeZoneCheck(tz_01, tz_02, Now) = False Then
                                            ValidityCheckHendler = VALIDITY_CHECK_TIMEZONE_ERROR
                                            LprExitValidityCheck = True
                                            Exit Function
                                        End If
                                    End If
                            
                                    '''// 2012-07-17 yoon young tak -  부제위반 방식 변경 (선불지역의 경우 입차시에만 처리하고 위반내역만 기록한다.)
                                    '''// 부제 체크 2010-05-31 LEE
                                    ''If PassCardOptrMode.AbsenceChkInOut = 1 Then    '입출차시 모두
                                    ''    If Car_Schdule_Check(format(Date, "YYYY-MM-DD"), cnntMaster, PssDat) = False Then
                                    ''        ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
                                    ''        LprExitValidityCheck = True
                                    ''        Exit Function
                                    ''    End If
                                    ''End If
                                    If FeeCalMode.FeeComputerMode = 2 Then
                                    
                                        '월주차차량
                                        If PssDat.UserGroup = "807" Then
                                            If (Weekday(Now) = vbSunday) Or (Weekday(Now) = vbSaturday) Or Holiday_Find(Date) = True Then
                                                gbCarFreeDay_Non_Apply = True
                                                ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_NON_APPLY
                                                LprExitValidityCheck = True
                                                Exit Function
                                            End If
                                        Else
                                            If Car_Schdule_Check(format(Date, "YYYY-MM-DD"), cnntMaster, PssDat) = False Then
                                                Call SaveDb_BujaeViolation(cnntTrns, PssDat)
                                        
                                                ''//2013-05-14 yoon young tak
                                                ''ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                ''LprExitValidityCheck = True
                                                ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
                                                LprExitValidityCheck = True
                                        
                                                Exit Function
                                            End If
                                        End If
                                    
                                    
'                                            If Car_Schdule_Check(format(Date, "YYYY-MM-DD"), cnntMaster, PssDat) = False Then
'
'                                                '요일제 미적용이면
'                                                If gbCarFreeDay_Non_Apply = True Then
'                                                    ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_NON_APPLY
'                                                    LprExitValidityCheck = True
'                                                Else
'                                                    ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
'                                                    LprExitValidityCheck = True
'                                                End If
'
'                                                frmFC_Sub.PassCardMsg = frmFC_Sub.PassCardMsg & ":부제위반"
'                                                Call SaveDb_BujaeViolation(cnntTrns, PssDat)
'
'                                                ''//2013-05-14 yoon young tak
'                                                ''ValidityCheckHendler = VALIDITY_CHECK_USING_OK
'                                                ''LprExitValidityCheck = True
''                                                ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
''                                                LprExitValidityCheck = True
'
'                                                Exit Function
'                                            End If
                                    End If
                                                            
                                    ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                    LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                    Exit Function
                                Else
                                    ValidityCheckHendler = VALIDITY_CHECK_USING_END     '기간만료이고 사용시간대가 아니므로.
                            
                                    If StartDate > dtActionDate Then
                                        ValidityCheckHendler = VALIDITY_CHECK_UNTIL_START_DATE
                                    Else
                                        ValidityCheckHendler = VALIDITY_CHECK_USING_END
                                    End If
                            
                                    LprExitValidityCheck = True
                            
                                    Exit Function
                                End If
                             End If
                         '------------------------------------------------------ 선불제 통합.  End
                        Else
                         '------------------------------------------------------ 후불제 통합.  Start
                            StartDate = CDate(format(CustomRs("dtValidStartDate"), "YYYY-MM-DD") & " " & CustomRs("dtValidStartTime") & ":00")
                            EndDate = CDate(format(CustomRs("dtValidEndDate"), "YYYY-MM-DD") & " " & CustomRs("dtValidEndTime") & ":00")
                    
                            If nPassCardUseFlag = PASSCARD_USING_STOP Or nPassCardUseFlag = PASSCARD_USING_END Or nCarFreeUseFlag = 1 Then              '일시정지이면
                        
                                ValidityCheckHendler = VALIDITY_CHECK_USING_STOP
                                LprExitValidityCheck = True                            '일시정지이므로 진입불가
                                Exit Function
                        
                            Else
                        
                                If (StartDate <= dtActionDate) And (EndDate >= dtActionDate) Then  '// 기간중에 있다면
                                    
                                    Dim PassOutDt       As Date
                                    Dim PassInDt        As Date
                                    Dim TcktInDt        As Date
                                    Dim sPassIid        As String
                                    Dim sTcktIid        As String
                                    Dim ParkingTime     As String
                                    Dim dTicketNo       As Double
                                    Dim RsPass          As ADODB.Recordset
                                    Dim RsTckt          As ADODB.Recordset
                                    Dim TRNSPT          As String           'P:PASSTRNS 데이터 사용, T:TCKTTRNS 데이터 사용
                                    
                                    ' 월주차차량 주말 및 휴일 요금계산
                                    
                                    'S0
                                    If PssDat.UserGroup = "807" Then
                                    
                                        ' 주말 및 휴일 입차한 차량은 TCKTTRNS에 데이터가 인서트 되므로
                                        ' TCKTTRNS 와 PASSTRNS에 입차한 데이터 중 가장 최근 입차데이터를 가져온다.
                                        Set RsPass = New Recordset
                                                
                                        sSql = ""
                                        sSql = sSql & "SELECT  TOP 1 *" & vbCrLf
                                        sSql = sSql & "FROM    (" & vbCrLf
                                        sSql = sSql & "        SELECT   TOP 1 'P' AS TRNSPT, IID, ILOTAREA, IINCLIENT, IINEQPM, ACPLATE1, DTINDATE, IINOUTSTATUS," & vbCrLf
                                        sSql = sSql & "                 ACINTIME, IOPERATOR, ITICKET, ICARDTYPE, DTMGMNTDATE," & vbCrLf
                                        sSql = sSql & "                 ACUSERNAME , ACENTRANCEPICNAME, iRate, groupno, IEXTENDLOTAREA" & vbCrLf
                                        sSql = sSql & "        From     PASSTRNS" & vbCrLf
                                        sSql = sSql & "        WHERE    ACPLATE1 = '" & sCarNo & "'" & vbCrLf
                                        sSql = sSql & "        AND      IINOUTSTATUS = 0" & vbCrLf
                                        sSql = sSql & "        ORDER BY DTINDATE DESC " & vbCrLf
                                        sSql = sSql & "        Union" & vbCrLf
                                        sSql = sSql & "        SELECT   TOP 1 'T' AS TRNSPT, IID, ILOTAREA, IINCLIENT, IINEQPM, ACPLATE1, DTINDATE, IINOUTSTATUS," & vbCrLf
                                        sSql = sSql & "                 ACINTIME, IOPERATOR, ITICKET, ICARDTYPE, DTMGMNTDATE," & vbCrLf
                                        sSql = sSql & "                 ACUSERNAME , ACENTRANCEPICNAME, iRate, groupno, IEXTENDLOTAREA" & vbCrLf
                                        sSql = sSql & "        From     TCKTTRNS" & vbCrLf
                                        sSql = sSql & "        WHERE    ACPLATE1 = '" & sCarNo & "'" & vbCrLf
                                        sSql = sSql & "        AND      IINOUTSTATUS = 0" & vbCrLf
                                        sSql = sSql & "        ORDER BY DTINDATE DESC " & vbCrLf
                                        sSql = sSql & "        ) A" & vbCrLf
                                        sSql = sSql & "ORDER BY A.dtInDate DESC" & vbCrLf
                                        
                                        RsPass.Open sSql, cnntTrns, adOpenForwardOnly, adLockReadOnly
                                        
                                        '티켓트랜스와 패스트랜스중 가장 최근 입차한 내역을 찾아 입차일을 가져온다
                                        '입차일과 현재일 사이에 휴일에 있으면 요금계산이 되게한다
                                        
                                        
                                        ' S1
                                        If Not RsPass.EOF Then
                                        
                                            TRNSPT = RsPass("TRNSPT")
                                            PassInDt = RsPass("DTINDATE")
                                            sPassIid = RsPass("IID")
                                        
                                            'S2
                                            If Holiday_Find_Term(sCarNo, sPassIid, PassInDt, TRNSPT) > 0 Then
                                                
                                                '출차일이 휴일인경우
                                                '입차일과 출차일이전(휴일시작전일)으로 출차처리(PASSTRNS)
                                                '휴일시작일로 입차처리(TCKTTRNS)
                                                'S3
                                                If (Weekday(Now) = vbSunday) Or (Weekday(Now) = vbSaturday) Or Holiday_Find(Date) = True Then
                                                
                                                    ' 휴일전날 자정으로 출차처리
                                                    PassOutDt = format(Holiday_Find_MonParking(sCarNo, 1, TRNSPT), "YYYY-MM-DD") & " 23:59"
                                                    ParkingTime = TF5620_Parking_Times(PassInDt, PassOutDt)
                                                
                                                    'S4
                                                    If TRNSPT = "P" Then
                                                
                                                        Set RsPass = New Recordset
                                                    
                                                        sSql = ""
                                                        sSql = sSql & "SELECT   IID, ILOTAREA, IINCLIENT, IINEQPM, ACPLATE1, DTINDATE, IINOUTSTATUS, " & vbCrLf
                                                        sSql = sSql & "         ACINTIME, IOPERATOR, ITICKET, ICARDTYPE, DTMGMNTDATE, " & vbCrLf
                                                        sSql = sSql & "         ACUSERNAME, ACENTRANCEPICNAME, IRATE, GROUPNO, IEXTENDLOTAREA" & vbCrLf
                                                        sSql = sSql & "FROM     PASSTRNS" & vbCrLf
                                                        sSql = sSql & "WHERE    iid = '" & sPassIid & "'" & vbCrLf
                                                        
                                                        RsPass.Open sSql, cnntTrns, adOpenForwardOnly, adLockReadOnly
        
                                                        If Not RsPass.EOF Then
                                                            
                                                            Month_Holiday_OutDt = format(Holiday_Find_MonParking(sCarNo, 1, TRNSPT), "YYYY-MM-DD") & " 23:59"
                                                        
                                                            sSql = "UPDATE PASSTRNS"
                                                            sSql = sSql & " SET iOperator = " & 0
                                                            sSql = sSql & ",iOutEqpm = " & UserInfor.Client
                                                            sSql = sSql & ",iPayEqpm = " & UserInfor.Client
                                                            sSql = sSql & ",iPayClient = " & UserInfor.Client
                                                            sSql = sSql & ",iOutClient = " & UserInfor.Client
                                                            sSql = sSql & ",iPaymentType = " & PAY_FLAG_USED_PASSCARD
                                                            sSql = sSql & ",dtOutDate = '" & PassOutDt & "'"
                                                            sSql = sSql & ",dtPayDate = '" & PassOutDt & "'"
                                                            sSql = sSql & ",dtPaymentDate= '" & PassOutDt & "'"
                                                            sSql = sSql & ",acOutTime = '" & format("23:59", "hh:mm") & "'"
                                                            sSql = sSql & ",acPayTime = '" & format("23:59", "hh:mm") & "'"
                                                            sSql = sSql & ",iInOutStatus = 1 "
                                                            sSql = sSql & ",dtMgmntDate = '" & Date & "'"
        '                                                        sSql = sSql & ",acGoOutPicName = '" & sImageName & "'"
                                                            If ParkingTime <> "" Then
                                                                sSql = sSql & ",acCarStayHours = '" & ParkingTime & "'"
                                                            End If
                                                            sSql = sSql & ",iSrvrUpdtFlag = 0"        '2012-01-29 LEE
                                                            sSql = sSql & " WHERE iid = '" & sPassIid & "'"
        
                                                            cnntTrns.Execute sSql
                                                                
                                                            dTicketNo = format(Now, "DDHHNNSS") '주차권번호 -> 일시분초
                                                            
                                                            ' 입차일이 평일인경우 휴일 시작일 00시00분으로 입차일로 한다.
                                                            If (Weekday(RsPass("dtindate")) = vbSunday) Or (Weekday(RsPass("dtindate")) = vbSaturday) Or Holiday_Find(RsPass("dtindate")) = True Then
    '                                                            PassInDt = RsPass("dtindate")
                                                                PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Now, "YYYY-MM-DD")) & " " & format(RsPass("dtindate"), "HH:MM")
                                                            Else
    '                                                            PassInDt = DateAdd("d", 1, format(PassOutDt, "YYYY-MM-DD")) & " 00:00"
                                                                PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Now, "YYYY-MM-DD")) & " " & "00:00"
                                                            End If
                                                            
    '                                                        PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Now, "YYYY-MM-DD")) & " " & format(RsPass("dtindate"), "HH:MM")
    '                                                            PassInDt = DateAdd("n", (Month_Parking_Min) * -1, Month_Holiday_OutDt)
                                                            
                                                            sSql = ""
                                                            sSql = sSql & "INSERT INTO TCKTTRNS (iLotArea," & vbCrLf
                                                            sSql = sSql & "iInClient," & vbCrLf
                                                            sSql = sSql & "iInEqpm," & vbCrLf
                                                            sSql = sSql & "dtIndate," & vbCrLf
                                                            sSql = sSql & "acInTime," & vbCrLf
                                                            sSql = sSql & "iOperator, " & vbCrLf
                                                            sSql = sSql & "iInOutStatus," & vbCrLf
                                                            sSql = sSql & "iTicket," & vbCrLf
                                                            sSql = sSql & "iCardType," & vbCrLf
                                                            sSql = sSql & "dtMgmntDate, " & vbCrLf
                                                            sSql = sSql & "acPlate1," & vbCrLf
                                                            sSql = sSql & "acUserName," & vbCrLf
                                                            sSql = sSql & "acEntrancePicName," & vbCrLf
                                                            sSql = sSql & "acPaymentMode," & vbCrLf
                                                            sSql = sSql & "iRate," & vbCrLf
                                                            sSql = sSql & "GroupNo," & vbCrLf
                                                            sSql = sSql & "iExtendLotArea)" & vbCrLf
                                                            sSql = sSql & " VALUES (" & RsPass("ILOTAREA") & "," & vbCrLf
                                                            sSql = sSql & RsPass("IINCLIENT") & "," & vbCrLf
                                                            sSql = sSql & RsPass("IINEQPM") & "," & vbCrLf
                                                            sSql = sSql & "'" & PassInDt & "'," & vbCrLf
                                                            sSql = sSql & "'" & "00:00" & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IOPERATOR") & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IINOUTSTATUS") & "'," & vbCrLf
                                                            sSql = sSql & "'" & dTicketNo & "'," & vbCrLf
                                                            sSql = sSql & 0 & "," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("DTMGMNTDATE") & "'," & vbCrLf
                                                            sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                            sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("ACENTRANCEPICNAME") & "'," & vbCrLf
                                                            sSql = sSql & "'PMM0100'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IRATE") & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("GROUPNO") & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IEXTENDLOTAREA") & "') "
                                                            
                                                            cnntTrns.Execute sSql
                                                            
        '                                                   Month_Parking_Holiday_Cal_YN = True
                                                        
                                                        End If
                                                
                                                    ElseIf TRNSPT = "T" Then
                                                
                                                        Month_Holiday_OutDt = format(Holiday_Find_MonParking(sCarNo, 1, TRNSPT), "YYYY-MM-DD") & " 23:59"
                                                        
                                                        sSql = "UPDATE TCKTTRNS"
                                                        sSql = sSql & " SET iOperator = " & 0
                                                        sSql = sSql & ",iOutEqpm = " & UserInfor.Client
                                                        sSql = sSql & ",iPayEqpm = " & UserInfor.Client
                                                        sSql = sSql & ",iPayClient = " & UserInfor.Client
                                                        sSql = sSql & ",iOutClient = " & UserInfor.Client
                                                        sSql = sSql & ",iPaymentType = " & PAY_FLAG_USED_PASSCARD
                                                        sSql = sSql & ",dtOutDate = '" & PassOutDt & "'"
                                                        sSql = sSql & ",dtPayDate = '" & PassOutDt & "'"
                                                        sSql = sSql & ",dtPaymentDate= '" & PassOutDt & "'"
                                                        sSql = sSql & ",acOutTime = '" & format("23:59", "hh:mm") & "'"
                                                        sSql = sSql & ",acPayTime = '" & format("23:59", "hh:mm") & "'"
                                                        sSql = sSql & ",iInOutStatus = 1 "
                                                        sSql = sSql & ",dtMgmntDate = '" & Date & "'"
    '                                                        sSql = sSql & ",acGoOutPicName = '" & sImageName & "'"
                                                        If ParkingTime <> "" Then
                                                            sSql = sSql & ",acCarStayHours = '" & ParkingTime & "'"
                                                        End If
                                                        sSql = sSql & ",iSrvrUpdtFlag = 0"        '2012-01-29 LEE
                                                        sSql = sSql & " WHERE iid = '" & sPassIid & "'"
    
                                                        cnntTrns.Execute sSql
                                                        
                                                        dTicketNo = format(Now, "DDHHNNSS") '주차권번호 -> 일시분초
                                                        
                                                        If (Weekday(PassInDt) = vbSunday) Or (Weekday(PassInDt) = vbSaturday) Or Holiday_Find(PassInDt) = True Then
                                                            PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " " & format(PassInDt, "HH:MM")
                                                        Else
                                                            PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " 00:00"
                                                        End If
                                                        
                                                        sSql = ""
                                                        sSql = sSql & "INSERT INTO TCKTTRNS (iLotArea," & vbCrLf
                                                        sSql = sSql & "iInClient," & vbCrLf
                                                        sSql = sSql & "iInEqpm," & vbCrLf
                                                        sSql = sSql & "dtIndate," & vbCrLf
                                                        sSql = sSql & "acInTime," & vbCrLf
                                                        sSql = sSql & "iOperator, " & vbCrLf
                                                        sSql = sSql & "iInOutStatus," & vbCrLf
                                                        sSql = sSql & "iTicket," & vbCrLf
                                                        sSql = sSql & "iCardType," & vbCrLf
                                                        sSql = sSql & "dtMgmntDate, " & vbCrLf
                                                        sSql = sSql & "acPlate1," & vbCrLf
                                                        sSql = sSql & "acUserName," & vbCrLf
                                                        sSql = sSql & "acEntrancePicName," & vbCrLf
                                                        sSql = sSql & "acPaymentMode," & vbCrLf
                                                        sSql = sSql & "iRate," & vbCrLf
                                                        sSql = sSql & "GroupNo," & vbCrLf
                                                        sSql = sSql & "iExtendLotArea)" & vbCrLf
                                                        sSql = sSql & " VALUES (" & RsPass("ILOTAREA") & "," & vbCrLf
                                                        sSql = sSql & RsPass("IINCLIENT") & "," & vbCrLf
                                                        sSql = sSql & RsPass("IINEQPM") & "," & vbCrLf
                                                        sSql = sSql & "'" & PassInDt & "'," & vbCrLf
                                                        sSql = sSql & "'" & "00:00" & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IOPERATOR") & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IINOUTSTATUS") & "'," & vbCrLf
                                                        sSql = sSql & "'" & dTicketNo & "'," & vbCrLf
                                                        sSql = sSql & 0 & "," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("DTMGMNTDATE") & "'," & vbCrLf
                                                        sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                        sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("ACENTRANCEPICNAME") & "'," & vbCrLf
                                                        sSql = sSql & "'PMM0100'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IRATE") & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("GROUPNO") & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IEXTENDLOTAREA") & "') "
                                                        
                                                        cnntTrns.Execute sSql
                                                        
    '                                                    Month_Parking_Holiday_Cal_YN = True
                                                    
                                                    End If
                                                    'E4
                                                
                                                    gbCarFreeDay_Non_Apply = True
                                                    ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_NON_APPLY
                                                    LprExitValidityCheck = False
                                                    Exit Function
                                                    
                                                    
                                                Else
                                                
                                                    ' 현재일 이전 마지막 휴일 자정으로 출차처리
                                                    PassOutDt = format(Holiday_Find_MonParking(sCarNo, 2, TRNSPT), "YYYY-MM-DD") & " 23:59"
                                                    ParkingTime = TF5620_Parking_Times(PassInDt, PassOutDt)
                                                    
                                                    If TRNSPT = "P" Then
                                                
                                                        Set RsPass = New Recordset
                                                    
                                                        sSql = ""
                                                        sSql = sSql & "SELECT   IID, ILOTAREA, IINCLIENT, IINEQPM, ACPLATE1, DTINDATE, IINOUTSTATUS, " & vbCrLf
                                                        sSql = sSql & "         ACINTIME, IOPERATOR, ITICKET, ICARDTYPE, DTMGMNTDATE, " & vbCrLf
                                                        sSql = sSql & "         ACUSERNAME, ACENTRANCEPICNAME, IRATE, GROUPNO, IEXTENDLOTAREA" & vbCrLf
                                                        sSql = sSql & "FROM     PASSTRNS" & vbCrLf
                                                        sSql = sSql & "WHERE    iid = '" & sPassIid & "'" & vbCrLf
                                                        
                                                        RsPass.Open sSql, cnntTrns, adOpenForwardOnly, adLockReadOnly
        
                                                        If Not RsPass.EOF Then
                                                            
                                                            Month_Holiday_OutDt = format(Holiday_Find_MonParking(sCarNo, 1, TRNSPT), "YYYY-MM-DD") & " 23:59"
                                                        
                                                            sSql = "UPDATE PASSTRNS"
                                                            sSql = sSql & " SET iOperator = " & 0
                                                            sSql = sSql & ",iOutEqpm = " & UserInfor.Client
                                                            sSql = sSql & ",iPayEqpm = " & UserInfor.Client
                                                            sSql = sSql & ",iPayClient = " & UserInfor.Client
                                                            sSql = sSql & ",iOutClient = " & UserInfor.Client
                                                            sSql = sSql & ",iPaymentType = " & PAY_FLAG_USED_PASSCARD
                                                            sSql = sSql & ",dtOutDate = '" & PassOutDt & "'"
                                                            sSql = sSql & ",dtPayDate = '" & PassOutDt & "'"
                                                            sSql = sSql & ",dtPaymentDate= '" & PassOutDt & "'"
                                                            sSql = sSql & ",acOutTime = '" & format("23:59", "hh:mm") & "'"
                                                            sSql = sSql & ",acPayTime = '" & format("23:59", "hh:mm") & "'"
                                                            sSql = sSql & ",iInOutStatus = 1 "
                                                            sSql = sSql & ",dtMgmntDate = '" & Date & "'"
        '                                                        sSql = sSql & ",acGoOutPicName = '" & sImageName & "'"
                                                            If ParkingTime <> "" Then
                                                                sSql = sSql & ",acCarStayHours = '" & ParkingTime & "'"
                                                            End If
                                                            sSql = sSql & ",iSrvrUpdtFlag = 0"        '2012-01-29 LEE
                                                            sSql = sSql & " WHERE iid = '" & sPassIid & "'"
        
                                                            cnntTrns.Execute sSql
                                                            
                                                            dTicketNo = format(Now, "DDHHNNSS") '주차권번호 -> 일시분초
        '                                                                PassInDt = DateAdd("d", 1, format(PassOutDt, "YYYY-MM-DD")) & " 00:00"
                                                            
        '                                                        PassInDt = DateAdd("n", (Month_Parking_Min) * -1, Month_Holiday_OutDt)
        '                                                        PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " " & format(RsPass("dtindate"), "HH:MM")
                                                            
                                                            If (Weekday(RsPass("dtindate")) = vbSunday) Or (Weekday(RsPass("dtindate")) = vbSaturday) Or Holiday_Find(RsPass("dtindate")) = True Then
                                                                PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " " & format(RsPass("dtindate"), "HH:MM")
                                                            Else
                                                                PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " 00:00"
                                                            End If
                                                            
                                                            sSql = ""
                                                            sSql = sSql & "INSERT INTO TCKTTRNS (iLotArea," & vbCrLf
                                                            sSql = sSql & "iInClient," & vbCrLf
                                                            sSql = sSql & "iInEqpm," & vbCrLf
                                                            sSql = sSql & "dtIndate," & vbCrLf
                                                            sSql = sSql & "acInTime," & vbCrLf
                                                            sSql = sSql & "iOperator, " & vbCrLf
                                                            sSql = sSql & "iInOutStatus," & vbCrLf
                                                            sSql = sSql & "iTicket," & vbCrLf
                                                            sSql = sSql & "iCardType," & vbCrLf
                                                            sSql = sSql & "dtMgmntDate, " & vbCrLf
                                                            sSql = sSql & "acPlate1," & vbCrLf
                                                            sSql = sSql & "acUserName," & vbCrLf
                                                            sSql = sSql & "acEntrancePicName," & vbCrLf
                                                            sSql = sSql & "acPaymentMode," & vbCrLf
                                                            sSql = sSql & "iRate," & vbCrLf
                                                            sSql = sSql & "GroupNo," & vbCrLf
                                                            sSql = sSql & "iExtendLotArea)" & vbCrLf
                                                            sSql = sSql & " VALUES (" & RsPass("ILOTAREA") & "," & vbCrLf
                                                            sSql = sSql & RsPass("IINCLIENT") & "," & vbCrLf
                                                            sSql = sSql & RsPass("IINEQPM") & "," & vbCrLf
                                                            sSql = sSql & "'" & PassInDt & "'," & vbCrLf
                                                            sSql = sSql & "'" & "00:00" & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IOPERATOR") & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IINOUTSTATUS") & "'," & vbCrLf
                                                            sSql = sSql & "'" & dTicketNo & "'," & vbCrLf
                                                            sSql = sSql & 0 & "," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("DTMGMNTDATE") & "'," & vbCrLf
                                                            sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                            sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("ACENTRANCEPICNAME") & "'," & vbCrLf
                                                            sSql = sSql & "'PMM0100'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IRATE") & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("GROUPNO") & "'," & vbCrLf
                                                            sSql = sSql & "'" & RsPass("IEXTENDLOTAREA") & "') "
                                                            
                                                            cnntTrns.Execute sSql
                                                            
                                                            Month_Parking_Holiday_Cal_YN = True
                                                        
                                                        End If
                                                    
                                                    ElseIf TRNSPT = "T" Then
                                                    
                                                        Month_Holiday_OutDt = format(Holiday_Find_MonParking(sCarNo, 1, TRNSPT), "YYYY-MM-DD") & " 23:59"
                                                        
                                                        sSql = "UPDATE TCKTTRNS"
                                                        sSql = sSql & " SET iOperator = " & 0
                                                        sSql = sSql & ",iOutEqpm = " & UserInfor.Client
                                                        sSql = sSql & ",iPayEqpm = " & UserInfor.Client
                                                        sSql = sSql & ",iPayClient = " & UserInfor.Client
                                                        sSql = sSql & ",iOutClient = " & UserInfor.Client
                                                        sSql = sSql & ",iPaymentType = " & PAY_FLAG_USED_PASSCARD
                                                        sSql = sSql & ",dtOutDate = '" & PassOutDt & "'"
                                                        sSql = sSql & ",dtPayDate = '" & PassOutDt & "'"
                                                        sSql = sSql & ",dtPaymentDate= '" & PassOutDt & "'"
                                                        sSql = sSql & ",acOutTime = '" & format("23:59", "hh:mm") & "'"
                                                        sSql = sSql & ",acPayTime = '" & format("23:59", "hh:mm") & "'"
                                                        sSql = sSql & ",iInOutStatus = 1 "
                                                        sSql = sSql & ",dtMgmntDate = '" & Date & "'"
    '                                                        sSql = sSql & ",acGoOutPicName = '" & sImageName & "'"
                                                        If ParkingTime <> "" Then
                                                            sSql = sSql & ",acCarStayHours = '" & ParkingTime & "'"
                                                        End If
                                                        sSql = sSql & ",iSrvrUpdtFlag = 0"        '2012-01-29 LEE
                                                        sSql = sSql & " WHERE iid = '" & sPassIid & "'"
    
                                                        cnntTrns.Execute sSql
                                                        
                                                        dTicketNo = format(Now, "DDHHNNSS") '주차권번호 -> 일시분초
                                                        
                                                        If (Weekday(PassInDt) = vbSunday) Or (Weekday(PassInDt) = vbSaturday) Or Holiday_Find(PassInDt) = True Then
                                                            PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " " & format(PassInDt, "HH:MM")
                                                        Else
                                                            PassInDt = DateAdd("d", (Month_Parking_Days - 1) * -1, format(Month_Holiday_OutDt, "YYYY-MM-DD")) & " 00:00"
                                                        End If
                                                        
                                                        sSql = ""
                                                        sSql = sSql & "INSERT INTO TCKTTRNS (iLotArea," & vbCrLf
                                                        sSql = sSql & "iInClient," & vbCrLf
                                                        sSql = sSql & "iInEqpm," & vbCrLf
                                                        sSql = sSql & "dtIndate," & vbCrLf
                                                        sSql = sSql & "acInTime," & vbCrLf
                                                        sSql = sSql & "iOperator, " & vbCrLf
                                                        sSql = sSql & "iInOutStatus," & vbCrLf
                                                        sSql = sSql & "iTicket," & vbCrLf
                                                        sSql = sSql & "iCardType," & vbCrLf
                                                        sSql = sSql & "dtMgmntDate, " & vbCrLf
                                                        sSql = sSql & "acPlate1," & vbCrLf
                                                        sSql = sSql & "acUserName," & vbCrLf
                                                        sSql = sSql & "acEntrancePicName," & vbCrLf
                                                        sSql = sSql & "acPaymentMode," & vbCrLf
                                                        sSql = sSql & "iRate," & vbCrLf
                                                        sSql = sSql & "GroupNo," & vbCrLf
                                                        sSql = sSql & "iExtendLotArea)" & vbCrLf
                                                        sSql = sSql & " VALUES (" & RsPass("ILOTAREA") & "," & vbCrLf
                                                        sSql = sSql & RsPass("IINCLIENT") & "," & vbCrLf
                                                        sSql = sSql & RsPass("IINEQPM") & "," & vbCrLf
                                                        sSql = sSql & "'" & PassInDt & "'," & vbCrLf
                                                        sSql = sSql & "'" & "00:00" & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IOPERATOR") & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IINOUTSTATUS") & "'," & vbCrLf
                                                        sSql = sSql & "'" & dTicketNo & "'," & vbCrLf
                                                        sSql = sSql & 0 & "," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("DTMGMNTDATE") & "'," & vbCrLf
                                                        sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                        sSql = sSql & "'" & sCarNo & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("ACENTRANCEPICNAME") & "'," & vbCrLf
                                                        sSql = sSql & "'PMM0100'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IRATE") & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("GROUPNO") & "'," & vbCrLf
                                                        sSql = sSql & "'" & RsPass("IEXTENDLOTAREA") & "') "
                                                        
                                                        cnntTrns.Execute sSql
                                                        
                                                        Month_Parking_Holiday_Cal_YN = True
                                                    
                                                    End If
                                                    
                                                    ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_NON_APPLY
                                                    LprExitValidityCheck = False
                                                    Exit Function
                                                    
                                                End If
                                                'E3
                                                
                                            End If
                                            'E2
                                            
                                        End If
                                        'E1
                                        
                                    End If
                                    'E0
                                
                                    '// 부제 체크 2010-05-31 LEE
                                    If PassCardOptrMode.AbsenceChkInOut = 1 Then    '입출차시 모두
                                    
                                        '월주차차량
                                        If PssDat.UserGroup = "807" Then
                                        Else
                                            If Car_Schdule_Check(format(Date, "YYYY-MM-DD"), cnntMaster, PssDat) = False Then
                                                ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
                                                LprExitValidityCheck = False
                                                Exit Function
                                            End If
                                        End If
                                    
                                    
'                                            If Car_Schdule_Check(format(Date, "YYYY-MM-DD"), cnntMaster, PssDat) = False Then
'
'                                                '요일제 미적용이면
'                                                If gbCarFreeDay_Non_Apply = True Then
'                                                    ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_NON_APPLY
'                                                    LprExitValidityCheck = False
'                                                Else
'                                                    ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
'                                                    LprExitValidityCheck = False
'                                                End If
'
''                                                frmFC_Sub.PassCardMsg.Caption = frmFC_Sub.PassCardMsg.Caption & ":부제위반"
'
''                                                ValidityCheckHendler = VALIDITY_CHECK_CAR_SCHDUL_ERROR
''                                                LprExitValidityCheck = True
'                                                Exit Function
'                                            End If
                                    End If
                                
                                
                                    '****************************************************************************
                                    ' 2012-03-20 Park 올림픽공원 시간대정기권, START
                                    '****************************************************************************
                                    '//2012-04-10 yoon young tak - 최종출입상태가 입차이거나,초기상태의 경우
                                    'If PssDat.UserType = TIME_ZONE_PASSCARD Then                                                ' 조조정기권 인 경우에만 적용
                                    If (PssDat.UserType = TIME_ZONE_PASSCARD) And (iTimeZoneInOutType = ENTRANCE_TYPE) Then      ' 조조정기권 인 경우에만 적용
                                        
                                        If gTimeZonePass.FeeCalUse = vbChecked Then                 '//
                                                
                                            tz_01 = tpPassBand.Intime(PssDat.UserType - 1)
                                            tz_02 = tpPassBand.OutTIme(PssDat.UserType - 1)
                                                
                                            If InDateExitanceFlag = True Then        ' 입차데이터가 존재하는 경우
                                                        
                                                With PassInfoSys
                                                    .sTz = tz_01
                                                    .eTz = tz_02
                                                    .InDt = InDtDate
                                                End With
                                        
                                                Days = DateDiff("d", InDtDate, Now)
                                                        
                                                If Days > 0 Then            ' 조조정기권이 1일 이상 머물렀으니 위반
                                                        
                                                    With parkfee
                                                    
                                                        '//2012-04-10 yoon young tak
                                                        '.TcketInputFlag = INPUT_HAND
                                                        .TcketInputFlag = INPUT_CARNO
                                                        .bTimeZoneErr = True
                                                        .dTimeZoneErrPassTrnsOrgID = dTimeZoneErrPassTrnsOrgID
                                                
                                                
                                                        .TicketNo = PssDat.UserId
                                                        .EtcMemo = "조조정기권 무효시간대 초과요금"
                                                        .PrdOverPassFeeFlag = True
                                                        .GoOutDate = format(Date, "YYYY-MM-DD")
                                                        .GoOutTime = format(Now, "Hh:Mm")
                                                    End With
                                                                
                                                                
                                                    '//2012-03-20 yoon young tak
                                                    'dspParkTimes = Compute_Parking_Times(format(InDtDate, "yyyy-mm-dd"), format(InDtDate, "hh:mm"), ParkFee.GoOutDate, ParkFee.GoOutTime)
                                                    frmFC_Sub.dspParkTimes = Compute_Parking_Times(format(InDtDate, "yyyy-mm-dd"), format(InDtDate, "hh:mm"), parkfee.GoOutDate, parkfee.GoOutTime)

                                                    With frmFC_Sub
                                                            .dspEntanceDate = format(InDtDate, "YYYY-MM-DD")
                                                            .dspEntranceTime = format(InDtDate, "Hh:Mm")
                                                    End With
                                            
                                                    g_PASS_OVER_FEE_CAL_USE = True
                                            
                                                    Call frmFC_Sub.cmdFeeClass_Click(0)
                                            
                                                    g_PASS_OVER_FEE_CAL_USE = False
                                            
                                                    Call SaveErrDescription("조조정기권 시간대위반:" & sCarNo)
                                            
                                                    If parkfee.dIncom > 0 Then
                                                
                                                        LprExitValidityCheck = True
                                                        ValidityCheckHendler = VALIDITY_CHECK_TIMEZONE_ERROR   ' 시간대 위반
                                            
                                                    Else
                                                
                                                        ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                        LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                            
                                                    End If
                                                        
                                                Else            ' 당일위반 여부 체크
                                                                
                                                                
                                                    If tz_01 > format(InDtDate, "Hh:Mm") Then           ' 입차 시 위반
                                                                            
                                                        With parkfee
                                                            '//2012-04-10 yoon young tak
                                                            '.TcketInputFlag = INPUT_HAND
                                                            .TcketInputFlag = INPUT_CARNO
                                                            .bTimeZoneErr = True
                                                            .dTimeZoneErrPassTrnsOrgID = dTimeZoneErrPassTrnsOrgID
                                                    
                                                            .TicketNo = PssDat.UserId
                                                            .EtcMemo = "조조정기권 무효시간대 초과요금"
                                                            .PrdOverPassFeeFlag = True
                                                            .GoOutDate = format(Date, "YYYY-MM-DD")
                                                            .GoOutTime = format(Now, "Hh:Mm")
                                                        End With
                                                                            
                                                        '//2012-03-20 yoon young tak
                                                        'dspParkTimes = Compute_Parking_Times(format(InDtDate, "yyyy-mm-dd"), format(InDtDate, "hh:mm"), ParkFee.GoOutDate, ParkFee.GoOutTime)
                                                        frmFC_Sub.dspParkTimes = Compute_Parking_Times(format(InDtDate, "yyyy-mm-dd"), format(InDtDate, "hh:mm"), parkfee.GoOutDate, parkfee.GoOutTime)
                                    
                                                        With frmFC_Sub
                                                            .dspEntanceDate = format(InDtDate, "YYYY-MM-DD")
                                                            .dspEntranceTime = format(InDtDate, "Hh:Mm")
                                                        End With
                                                
                                                        g_PASS_OVER_FEE_CAL_USE = True
                                                
                                                        Call frmFC_Sub.cmdFeeClass_Click(0)
                                                
                                                        g_PASS_OVER_FEE_CAL_USE = False
                                                
                                                        Call SaveErrDescription("조조정기권 시간대위반:" & sCarNo)
                                                
                                                        If parkfee.dIncom > 0 Then
                                                            LprExitValidityCheck = True
                                                            ValidityCheckHendler = VALIDITY_CHECK_TIMEZONE_ERROR   ' 시간대 위반
                                                        Else
                                                            ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                            LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                                
                                                        End If
                                            
                                                    Else
                                                                            
                                                                            
                                                        If tz_02 < format(Time, "Hh:Mm") Then           ' 출차 시 위반
                                                                            
                                                            With parkfee
                                                                '//2012-04-10 yoon young tak
                                                                '.TcketInputFlag = INPUT_HAND
                                                                .TcketInputFlag = INPUT_CARNO
                                                                .bTimeZoneErr = True
                                                                .dTimeZoneErrPassTrnsOrgID = dTimeZoneErrPassTrnsOrgID
                                                        
                                                                .TicketNo = PssDat.UserId
                                                                .EtcMemo = "조조정기권 무효시간대 초과요금"
                                                                .PrdOverPassFeeFlag = True
                                                                .GoOutDate = format(Date, "YYYY-MM-DD")
                                                                .GoOutTime = format(Now, "Hh:Mm")
                                                            End With
                                                                                        
                                                             '2012-03-20 yoon young tak
                                                             'dspParkTimes = Compute_Parking_Times(format(InDtDate, "yyyy-mm-dd"), format(InDtDate, "hh:mm"), ParkFee.GoOutDate, ParkFee.GoOutTime)
                                                             frmFC_Sub.dspParkTimes = Compute_Parking_Times(format(InDtDate, "yyyy-mm-dd"), format(InDtDate, "hh:mm"), parkfee.GoOutDate, parkfee.GoOutTime)
                             
                                                             With frmFC_Sub
                                                                 .dspEntanceDate = format(InDtDate, "YYYY-MM-DD")
                                                                 .dspEntranceTime = format(InDtDate, "Hh:Mm")
                                                             End With
                                                     
                                                             g_PASS_OVER_FEE_CAL_USE = True
                                                     
                                                             Call frmFC_Sub.cmdFeeClass_Click(0)
                                                     
                                                             g_PASS_OVER_FEE_CAL_USE = False
                                                     
                                                             Call SaveErrDescription("조조정기권 시간대위반:" & sCarNo)
                                                     
                                                             If parkfee.dIncom > 0 Then
                                                                 LprExitValidityCheck = True
                                                                 ValidityCheckHendler = VALIDITY_CHECK_TIMEZONE_ERROR   ' 시간대 위반
                                                             Else
                                                                 ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                                 LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                                             End If
                                                     
                                                        Else
                                                             ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                             LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                                        End If
                             
                                                    End If
                             
                                                End If
                     
                                            Else         ' 입차시각이 없는 경우, 출차 시각만 체크한다
                                               
                                                If tz_02 < format(Time, "Hh:Mm") Then               ' 출차시 위반
                                                                       
                                                   trDate = CDate(format(Date, "yyyy-mm-dd") & " " & tz_02 & ":00")
                                                                                                          
                                                   With PassInfoSys
                                                        .sTz = tz_01
                                                        .eTz = tz_02
                                                        .InDt = trDate
                                                    End With
                                    
                                                    LprExitValidityCheck = False
                                            
                                                    With parkfee
                                                        '//2012-04-10 yoon young tak
                                                        '.TcketInputFlag = INPUT_HAND
                                                        .TcketInputFlag = INPUT_CARNO
                                                        .dTimeZoneErrPassTrnsOrgID = 0
                                                
                                                        .TicketNo = PssDat.UserId
                                                        .EtcMemo = "조조정기권 무효시간대 초과요금"
                                                        .PrdOverPassFeeFlag = True
                                                        .GoOutDate = format(Date, "YYYY-MM-DD")
                                                        .GoOutTime = format(Now, "Hh:Mm")
                                                    End With
                                            
                                                    With frmFC_Sub
                                                        .dspEntanceDate = format(trDate, "YYYY-MM-DD")
                                                        .dspEntranceTime = format(trDate, "Hh:Mm")
                                                    End With
                                                                
                                                                
                                                    frmFC_Sub.dspParkTimes = Compute_Parking_Times(format(trDate, "yyyy-mm-dd"), format(trDate, "hh:mm"), parkfee.GoOutDate, parkfee.GoOutTime)
                                            
                                                    g_PASS_OVER_FEE_CAL_USE = True
                                            
                                                    Call frmFC_Sub.cmdFeeClass_Click(0)
                                            
                                                    g_PASS_OVER_FEE_CAL_USE = False
                                            
                                                    Call SaveErrDescription("조조정기권 시간대위반:" & sCarNo)
                                            
                                                    If parkfee.dIncom > 0 Then
                                                        LprExitValidityCheck = True
                                                        ValidityCheckHendler = VALIDITY_CHECK_TIMEZONE_ERROR   ' 시간대 위반
                                                    Else
                                                        ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                        LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                                    End If
                                    
                                                Else
                                                    ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                    LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                                End If
                                    
                                            End If
                            
                                        Else
                    
                                                ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                                LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                        End If
                                
                                    Else
                                        tz_01 = tpPassBand.Intime(PssDat.UserType - 1)
                                        tz_02 = tpPassBand.OutTIme(PssDat.UserType - 1)
                                                        
                                        If tz_02 < format(Time, "Hh:Mm") Then               ' 출차시 위반
                                        
                                            LprExitValidityCheck = True
                                            ValidityCheckHendler = VALIDITY_CHECK_TIMEZONE_ERROR   ' 시간대 위반
                                            
                                        Else
                                        
                                            ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                                            LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                        
                                        End If
                                                
'                                                ValidityCheckHendler = VALIDITY_CHECK_USING_OK
'                                                LprExitValidityCheck = True                         '기간만료 아니고 사용시간대이므로  진입가능
                                    
                                    End If
                                    ' 2012-03-20 Park 올림픽공원 시간대정기권, END
                            
                                    Exit Function
                                    
                                Else
                                    ValidityCheckHendler = VALIDITY_CHECK_USING_END     '기간만료이고 사용시간대가 아니므로.
                            
                                    If StartDate > dtActionDate Then
                                        ValidityCheckHendler = VALIDITY_CHECK_UNTIL_START_DATE
                                    Else
                                        ValidityCheckHendler = VALIDITY_CHECK_USING_END
                                    End If
                            
                                    LprExitValidityCheck = True
                            
                                    Exit Function
                                End If
                        
                             End If
                         '------------------------------------------------------ 후불제 통합.  End
                        End If
                         
                     Case PASSCARD_METHOD_DAYS_CHECK                                '사용일수 체크 방식
                        
                        If AvailableDays > 0 Then
                           ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                           LprExitValidityCheck = True                              '잔일수가 남았으므로 진입가능
                           Exit Function
                           
                        Else
                        
                           ValidityCheckHendler = VALIDITY_CHECK_VAILID_DAYS_ZERO
                           LprExitValidityCheck = False                             '잔일수가 없으므로 진입 불가능
                           Exit Function
                           
                        End If
                        
                     Case PASSCARD_METHOD_TIMES_CHECK                               '// 사용횟수 체크 방식
                           
                        If AvailableTimes > 0 Then
                           ValidityCheckHendler = VALIDITY_CHECK_USING_OK
                           LprExitValidityCheck = True                           ' 잔일수 가 남았으므로 진입가능
                           Exit Function
                           
                        Else
                           ValidityCheckHendler = VALIDITY_CHECK_VAILID_TIMES_ZERO
                           LprExitValidityCheck = False                          ' 잔횟수가 없으므로 진입 불가능
                           Exit Function
                           
                        End If
                           
                 End Select
            
            Case PASSCARD_TYPE_VIP                                      '// VIP 발급 정기권
                 ValidityCheckHendler = VALIDITY_CHECK_ENTRANCE_VIP
                 LprExitValidityCheck = True
                 Exit Function
        End Select
        
        LprExitValidityCheck = True
        Exit Function
        
    Else
     
        ValidityCheckHendler = VALIDITY_CHECK_CUSTOMER_NOTHING
        LprExitValidityCheck = False
        Exit Function
        
    End If
    
    Exit Function
    
Err_Handler:
    
    Dim sErrString
    sErrString = Err.Number & ":LprValidityCheck()" & Err.Description & vbCrLf
    Debug.Print sErrString
    Call SaveErrDescription(sErrString)
    
    '// 네트워크드라이브 연결이 끊어졌다면 새로 연결한다 2007-09-18 LEE
    Dim Rtn
    Dim imgPath        As String
    
    '2015-08-31 Hong Tak Gu 선불제/후불제 통합 '후불제는 주석 처리
    '--------------------------------------------------------- Start
    If FeeCalMode.FeeComputerMode = 2 Then
        If LprSystem.iLprType = 0 Then  '넥스파일때만 2009-02-04 LEE

            If Ping(Trim(LprSystem.HostIp), "", Echo) = True Then    '2008-01-23
                imgPath = Trim(LprSystem.HTSShareDrv)
                If Right(imgPath, 1) = "\" Then imgPath = Mid(imgPath, 1, Len(imgPath) - 1)
                Rtn = WNetCancelConnection2(imgPath, 0, True)
                Rtn = WNetAddConnection("\\" & Trim(LprSystem.HostIp) & "\" & Trim(LprSystem.sNexpaShareFolder), "", imgPath)
            End If
    
            ' 2010-01-15 Park Choong Yong, BLOCK
            'If LprSystem.NetworkSaveUseFlag > 0 Then
                If Ping(Trim(LprSystem.sServerImageIP), "", Echo) = True Then
                    imgPath = Trim(LprSystem.NetworkShareFolder)
                    If Right(imgPath, 1) = "\" Then imgPath = Mid(imgPath, 1, Len(imgPath) - 1)
                    Rtn = WNetCancelConnection2(imgPath, 0, True)
                    Rtn = WNetAddConnection("\\" & Trim(LprSystem.sServerImageIP) & "\Image", "", imgPath)
                End If
            'End If
        End If
    End If
        '--------------------------------------------------------- End

    LprExitValidityCheck = False
    
    '//2012-02-24 YOON YOUNG TAK -  주석처리
    'Resume Next
    
End Function
