목화연
사는이야기
기술지원
회원게시판
공지사항
자료실
베타테스터
사는이야기
 
작성일 : 10-08-09 22:56
[세상사는이야기] 이자 계산 소스
 글쓴이 : 권오준
조회 : 5,220  
   oMeter := TDrMeta():New( "연체 이자를 계산중입니다.", "Wait...", ::oFindDb:RecCount() )

   WHILE !::oFindDb:Eof()

         cQuery := "select * from m_payin where "
         cQuery += " J_NO = "      + Clip2Sql( ::oFindDb:J_NO )+ " and "
         cQuery += " PAY_CODE = "  + Clip2Sql( ALLTRIM( ::oFindDb:PAY_CODE  ) ) + " and "
         cQuery += " PAY_CODE2 = " + Clip2Sql( ALLTRIM( ::oFindDb:PAY_CODE2 ) )
         cQuery += " order by PAY_IN_DATE"
         oFindDb2:Query( cQuery )
         //::Get_PayIn( oFindDb2, ::oFindDb:J_NO, ::oFindDb:PAY_CODE, ::oFindDb:PAY_CODE2 )
 

         IF (::oFindDb:PAY_MONEY == oFindDb2:PAY_IN_MONEY) .AND. (::oFindDb:PAY_DATE == oFindDb2:PAY_IN_DATE)
            ::oFindDb:Skip()
            LOOP
         ENDIF
         oMeter:SetData( ::oFindDb:RecNo(),,,,,.f. )
         /*
            완전미납
         */
         IF oFindDb2:RecCount() == 0
            oDispDb:Append()
               oDispDb:J_NO                := ::oFindDb:J_NO
               oDispDb:I_PAY_CODE          := ::oFindDb:PAY_CODE
               oDispDb:I_PAY_CODE2         := ::oFindDb:PAY_CODE2
               oDispDb:I_DESC              := ::oFindDb:PAY_NAME
               oDispDb:I_DATE1             := ::oFindDb:PAY_DATE
               oDispDb:I_DATE2             := dDate
               oDispDb:I_MONEY             := ::oFindDb:PAY_MONEY
               oDispDb:I_IN_MONEY          := 0
               oDispDb:I_JAN               := ::oFindDb:PAY_MONEY
               oDispDb:I_DAYS              := Dr_ELAPSED( oDispDb:I_DATE1, oDispDb:I_DATE2 )[1][1] + 1
               oDispDb:I_RATIO             := ::oFindDb:PAY_RATIO
               oDispDb:I_FEE               := Count_Fee( oDispDb:I_JAN, ::oFindDb:PAY_RATIO, oDispDb:I_DAYS, oDispDb )
            oDispDb:Save()
            ::oFindDb:Skip()
            LOOP
         ENDIF

         nPayMoney := ::oFindDb:PAY_MONEY
         nINMoney := oFindDb2:PAY_IN_MONEY
         dPaydate := ::oFindDb:PAY_DATE
 
         /*
           쉽게 생각 하기 위해 분리함
         */
         WHILE  !oFindDb2:Eof()
                nINMoney := oFindDb2:PAY_IN_MONEY
                IF oFinddb2:RecNo() > 1
                   IF EMPTY( oDispDb:I_DATE2 )
                      IF nInMoney == nPayMoney .AND. oDispDb:I_DATE1  == oFindDb2:PAY_IN_DATE
                         oDispDb:I_DATE2             := oFindDb2:PAY_IN_DATE
                      ELSE
                         oDispDb:I_DATE2             := oFindDb2:PAY_IN_DATE -1
                      ENDIF
                      oDispDb:I_JAN               := nPayMoney
                      oDispDb:I_RATIO             := ::oFindDb:PAY_RATIO
                      oDispDb:I_DAYS              := Dr_ELAPSED( oDispDb:I_DATE1, oDispDb:I_DATE2 )[1][1]
                      oDispDb:I_FEE               := Count_Fee( oDispDb:I_JAN, ::oFindDb:PAY_RATIO, oDispDb:I_DAYS, oDispDb )
                      oDispDb:Save()
                   ENDIF
               ENDIF
                oDispDb:Append()
                oDispDb:J_NO                := ::oFindDb:J_NO
                oDispDb:I_PAY_CODE          := ::oFindDb:PAY_CODE
                oDispDb:I_PAY_CODE2         := ::oFindDb:PAY_CODE2
                oDispDb:I_DESC              := ::oFindDb:PAY_NAME
                oDispDb:I_DATE1             := ::oFindDb:PAY_DATE
                oDispDb:I_MONEY             := nPayMoney
                oDispDb:Save()
                IF nPayMoney <= oFindDb2:PAY_IN_MONEY
                   oDispDb:I_DATE2             := oFindDb2:PAY_IN_DATE
                   oDispDb:I_IN_MONEY          := nInMoney
                   oDispDb:I_JAN               := nInMoney
                   oDispDb:I_RATIO             := ::oFindDb:PAY_RATIO
                   oDispDb:I_DAYS              := Dr_ELAPSED( oDispDb:I_DATE1, oDispDb:I_DATE2 )[1][1]
                   oDispDb:I_FEE               := Count_Fee( oDispDb:I_JAN, ::oFindDb:PAY_RATIO, oDispDb:I_DAYS,  oDispDb )
                   oDispDb:Save()
                   oFindDb2:Skip()
                   LOOP
                ELSE
                   oDispDb:I_DATE2             := oFindDb2:PAY_IN_DATE
                   oDispDb:I_IN_MONEY          := nInMoney
                   oDispDb:I_JAN               := nInMoney
                   oDispDb:I_RATIO             := ::oFindDb:PAY_RATIO
                   oDispDb:I_DAYS              := Dr_ELAPSED( oDispDb:I_DATE1, oDispDb:I_DATE2 )[1][1]
                   oDispDb:I_FEE               := Count_Fee( oDispDb:I_JAN, ::oFindDb:PAY_RATIO, oDispDb:I_DAYS, oDispDb )
                   oDispDb:Save()
                   nPayMoney := ::oFindDb:PAY_MONEY - oFindDb2:PAY_IN_MONEY
                   oDispDb:Append()
                   oDispDb:J_NO                := ::oFindDb:J_NO
                   oDispDb:I_PAY_CODE          := ::oFindDb:PAY_CODE
                   oDispDb:I_PAY_CODE2         := ::oFindDb:PAY_CODE2
                   oDispDb:I_DESC              := ::oFindDb:PAY_NAME
                   oDispDb:I_DATE1             := ::oFindDb:PAY_DATE
                   oDispDb:I_MONEY             := nPayMoney
                   oDispDb:Save()
                   oFindDb2:Skip()
                ENDIF

         ENDDO

         IF EMPTY( oDispDb:I_DATE2 )
            oDispDb:I_DATE2             := dDate
            oDispDb:I_JAN               := nPayMoney
            oDispDb:I_RATIO             := ::oFindDb:PAY_RATIO
            oDispDb:I_DAYS              := Dr_ELAPSED( oDispDb:I_DATE1, oDispDb:I_DATE2 )[1][1]
            IF nInMoney == 0
               oDispDb:I_DAYS              := oDispDb:I_DAYS + 1
            ENDIF
            oDispDb:I_FEE               := Count_Fee( oDispDb:I_JAN, ::oFindDb:PAY_RATIO, oDispDb:I_DAYS, oDispDb )
            oDispDb:Save()
         ENDIF

         ::oFindDb:Skip()
   ENDDO

권오준   10-08-09 22:56
이자 계산 소스입니다.
 
 

 
Total 303
번호 제   목 글쓴이 날짜 조회
258   [세상사는이야기] 안드로이드용 스마트폰 개발툴 구경좀 할까요. (1) 문병산 10-13 5805
257   [세상사는이야기] 변화의 시대... (3) 권오준 09-14 4829
256   [등급업요청] 언제나 등업이 되나요? (1) 서원 09-13 5488
255   [세상사는이야기] DrMySQL Sync성능을 100%높이기... (1) 권오준 09-02 4844
254   [등급업요청] Sugar Tech 입니다.. (1) 설탕가뤼 08-26 5775
253   [등급업요청] 권한 등업 didim 08-18 5083
252   [세상사는이야기] 이자 계산 소스 (1) 권오준 08-09 5221
251   [세상사는이야기] 이자 보다 더 어려운 입금을 맞추다... 권오준 08-09 4865
250   [세상사는이야기] 이자 계산을 하다... (2) 권오준 08-09 4567
249   [등급업요청] 등업부탁합니다. hoho 08-09 4864
248   [세상사는이야기] 안드로이드 만듭시다... 권오준 07-07 4663
247   [세상사는이야기] 아내구함 권오준 07-05 4981
246   [세상사는이야기] 과망간산칼륨을 조사하다... 권오준 07-02 5651
245   [세상사는이야기] iPhone이냐 안드로이드냐? (1) 권오준 06-26 4579
244   [세상사는이야기] 64비트로 가게되면 아이폰 등의 어플리케이션 개발이 … (1) 이병홍 06-25 4571
 1  2  3  4  5  6  7  8  9  10    
COPYRIGHT© Fivetech.net. All RIGHTS RESERVED.
For more information webmaster | webmaster@fivetech.net | Tel 02-566-6826 | (해외) +82-2-566-6826