تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
التفقيط بالدولار فقط
#1
السلام عليكم لدي فاتورة
واريد تفقيط بالدولار فقط
انا بحثت ووجدت تفقيط باللغة العربية وعند تحويله للدولار يعطيني تفقيط غلط

ساعطيكم الكود اذا امكن تصليحه حسب الدولار

هو بالاصل للعملات العربية بس بالدولار يعطي غلط
Private Function AmountWord(ByVal AMOUNT As Decimal) As String
On Error Resume Next
Dim n As Decimal = 0
Dim C1 As Decimal = 0
Dim C2 As Decimal = 0
Dim C3 As Decimal = 0
Dim C4 As Decimal = 0
Dim C5 As Decimal = 0
Dim C6 As Decimal = 0
Dim S1 As String = ""
Dim S2 As String = ""
Dim S3 As String = ""
Dim S4 As String = ""
Dim S5 As String = ""
Dim S6 As String = ""
Dim C As String = ""
n = Int(AMOUNT)
C = Format(n, "000000000000")
C1 = Val(Mid(C, 12, 1))
Select Case C1
Case Is = 1 : S1 = "One"
Case Is = 2 : S1 = "Two"
Case Is = 3 : S1 = "Three"
Case Is = 4 : S1 = "Four"
Case Is = 5 : S1 = "Five"
Case Is = 6 : S1 = "Six"
Case Is = 7 : S1 = "Seven"
Case Is = 8 : S1 = "Eight"
Case Is = 9 : S1 = "Nine"
End Select

C2 = Val(Mid(C, 11, 1))
Select Case C2
Case Is = 1 : S2 = "Ten"
Case Is = 2 : S2 = "twenty"
Case Is = 3 : S2 = "Thirty"
Case Is = 4 : S2 = "Fourty"
Case Is = 5 : S2 = "Fifty"
Case Is = 6 : S2 = "Sixty"
Case Is = 7 : S2 = "Seventy"
Case Is = 8 : S2 = "Eighty"
Case Is = 9 : S2 = "Ninty"
End Select

If S1 <> "" And C2 > 1 Then S2 = S1 + " And" + S2
If S2 = "" Then S2 = S1
'If C1 = 0 And C2 = 1 Then S2 = S2 + "ة"
If C1 = 1 And C2 = 1 Then S2 = "Eleven"
If C1 = 2 And C2 = 1 Then S2 = "Twelve"
If C1 > 2 And C2 = 1 Then S2 = S1 + " " + S2
C3 = Val(Mid(C, 10, 1))
Select Case C3
Case Is = 1 : S3 = "One Hundred"
Case Is = 2 : S3 = "Two Hundred"
Case Is > 2 : S3 = Left(AmountWord(C3), Len(AmountWord(C3)) - 1) + "One hundred"
End Select
If S3 <> "" And S2 <> "" Then S3 = S3 + " And" + S2
If S3 = "" Then S3 = S2

C4 = Val(Mid(C, 7, 3))
Select Case C4
Case Is = 1 : S4 = "One Thousand"
Case Is = 2 : S4 = "Two Thousand"
Case 3 To 10 : S4 = AmountWord(C4) + " Thousands"
Case Is > 10 : S4 = AmountWord(C4) + " Thousands"
End Select
If S4 <> "" And S3 <> "" Then S4 = S4 + " And" + S3
If S4 = "" Then S4 = S3
C5 = Val(Mid(C, 4, 3))
Select Case C5
Case Is = 1 : S5 = "One Million"
Case Is = 2 : S5 = "Two Million"
Case 3 To 10 : S5 = AmountWord(C5) + " Millions"
Case Is > 10 : S5 = AmountWord(C5) + " Million"
End Select
If S5 <> "" And S4 <> "" Then S5 = S5 + " And" + S4
If S5 = "" Then S5 = S4

C6 = Val(Mid(C, 1, 3))

Select Case C6
Case Is = 1 : S6 = "Billion"
Case Is = 2 : S6 = "Two Billion"
Case Is > 2 : S6 = AmountWord(C6) + " Billion"
End Select
If S6 <> "" And S5 <> "" Then S6 = S6 + " And" + S5
If S6 = "" Then S6 = S5
AmountWord = S6
End Function
الرد }}}}
تم الشكر بواسطة:


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم