View Categories

Print total amount in Arabic numerals

< 1 min read

This script can be used to convert numbers to Arabic equivalent.

<!-- TOTAL AMOUNT IN ARABIC DIGITS-->
#set($artotal = "")
#set($start = 0)
#set($end = $ticket.printTotal().length())
#set($end = $end - 1)
#foreach ($i in [$start..$end])
  #if($ticket.printTotal().charAt($i)=="0")
    #set($artotal = $artotal+"٠")
  #elseif($ticket.printTotal().charAt($i)=="1")
    #set($artotal = $artotal+"١")
  #elseif($ticket.printTotal().charAt($i)=="2")
    #set($artotal = $artotal+"٢")
  #elseif($ticket.printTotal().charAt($i)=="3")
    #set($artotal = $artotal+"٣")
  #elseif($ticket.printTotal().charAt($i)=="4")
    #set($artotal = $artotal+"٤")
  #elseif($ticket.printTotal().charAt($i)=="5")
    #set($artotal = $artotal+"٥")
  #elseif($ticket.printTotal().charAt($i)=="6")
    #set($artotal = $artotal+"٦")
  #elseif($ticket.printTotal().charAt($i)=="7")
    #set($artotal = $artotal+"٧")
  #elseif($ticket.printTotal().charAt($i)=="8")
    #set($artotal = $artotal+"٨")
  #elseif($ticket.printTotal().charAt($i)=="9")
    #set($artotal = $artotal+"٩")
  #elseif($ticket.printTotal().charAt($i)==".")
    #set($artotal = $artotal+".")
  #else
    #set($artotal = $artotal+$ticket.printTotal().charAt($i))
  #end
#end
        
<line size="1">
 <text align ="right" length="48" bold="true">$artotal</text>
</line>

0 Comments

Leave a Reply

Arrow-up