2013. 4. 19. 13:17

세금 계산 하는 로직입니다.

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

매크로 처음하시는 분들 참고하시라고 올려봅니다. 

아래 주소의 첨부 파일을 참조하세요. 


수입품_최종가격_계산표1.xlsm




Sub goCalcMoney()


'관세율

    tradeTaxRate = Cells(2, 2)

    addTaxRate = Cells(3, 2)

    moneyRate = Cells(4, 2)

    Range(Cells(13, 2), Cells(21, 7)).Value = 0

    

        

    k = 2

    

    Do While k < 8

        

        goodsMoney = Cells(8, k)

        InType = Cells(6, k)

        If goodsMoney < 1 Or goodsMoney = "" Then

        Else

            transFee = Cells(9, k)

            taxFee = Cells(10, k)

            weightAll = Cells(11, k)

            

            '1차 합계

            totalDallor = goodsMoney + transFee + taxFee

            sumKoreaWon = totalDallor * moneyRate

            Cells(13, k) = sumKoreaWon

            

            '과세운임


            i = 2

            Do While i < 999

                    

                startWeight = Cells(i, 16)

                If startWeight < weightAll Then

                    i = i + 1

                Else

                    

                    If sumKoreaWon > 200000 Then

                        transTaxFee = Cells(i - 1, 19).Value

                        Cells(14, k).Value = transTaxFee

                    Else

                        transTaxFee = Cells(i - 1, 18).Value

                        Cells(14, k).Value = transTaxFee

                    End If

                        

                    i = 999

                End If

                

            Loop

            

            

            '과세기준

            standardTax = sumKoreaWon + transTaxFee

            Cells(15, k) = standardTax

            

            '관세

            If standardTax < 150000 Or InType = "목록" Then

                afterTax = sumKoreaWon

                afterAddTax = sumKoreaWon

                tradeType = "비과세"

            Else

                afterTax = standardTax * (1 + (tradeTaxRate / 100))

                afterAddTax = afterTax * (1 + (addTaxRate) / 100)

                tradeType = ""

            End If

            Cells(16, k) = afterTax

            Cells(17, k) = afterAddTax

            Cells(12, k) = tradeType

            '운송비

            i = 4

            Do While i < 999

                    

                '몰테일 배송비

                mstartWeight = Cells(i, 10)

                If mstartWeight < weightAll Then

                    i = i + 1

                Else

                    mTransFee = Cells(i, 11).Value

                    i = 999

                End If

            Loop

            

            i = 4

            Do While i < 999

                '이하넥스 배송비

                estartWeight = Cells(i, 10)

                If estartWeight < weightAll Then

                    i = i + 1

                Else

                    eLTransFee = Cells(i, 13).Value

                    eNTransFee = Cells(i, 14).Value

                    i = 999

                End If

                

            Loop

            

            If mTransFee > eLTransFee Then

                If eLTransFee > eNTransFee Then

                    lastTransFee = eNTransFee

                    feeSource = "이하넥스 뉴저지"

                Else

                    lastTransFee = eLTransFee

                    feeSource = "이하넥스 LA"

                End If

             ElseIf mTransFee > eNTransFee Then

                lastTransFee = eNTransFee

                feeSource = "이하넥스 뉴저지"

             Else

                lastTransFee = mTransFee

                feeSource = "몰테일"

             End If

             wonLastTF = lastTransFee * moneyRate

             Cells(18, k) = wonLastTF

             

            If standardTax < 150000 Or InType = "목록" Then

                 Cells(19, k) = afterAddTax + wonLastTF

                 Cells(21, k) = afterAddTax - sumKoreaWon

            Else

                 Cells(19, k) = afterAddTax + wonLastTF - transTaxFee

                 Cells(21, k) = afterAddTax - sumKoreaWon

            End If

                 Cells(20, k) = feeSource

    

        End If

        

        k = k + 1

    Loop

End Sub