Visualizzazione dei risultati da 1 a 10 su 10

Discussione: importo in lettere

  1. #1

    importo in lettere

    Vorrei se fosse possibile formattare un importo in modo che venga visualizzato in lettere.
    esempio ho un importo di € 500,00 e vorrei che , oltre questo formato, fosse visualizzato lo stesso imèporto in lettere:
    Euro cinquecento//00

    Tutto ciò è possibile in asp o no?

    Grazie per le risposte

    Maurizio

  2. #2
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    Devi fare un algoritmo che effettua la traduzione...
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  3. #3
    Tutto qua?
    pensavo peggio!

    Sto scherzando ovviamente, attendo degli aiuti concreti!

    Grazie

    Maurizio

  4. #4
    Utente di HTML.it L'avatar di KLINKO
    Registrato dal
    Sep 2002
    Messaggi
    285
    carina come idea

    ho la trovi gia fatta ... oppure ti armi di pazienza e te la tiri su.

    senza pensarci molto penso si possa fare.

  5. #5
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  6. #6
    Utente di HTML.it L'avatar di morphy79
    Registrato dal
    Jun 2004
    Messaggi
    1,568
    so che mi darai un bacio per questo....
    Questa è la funzione per asp... !!!!
    la chiami passandogli la cifra e te la converte in lettere !!!!!

    es
    <%=convertNumber(564)%>

    Devi implementarla perchè arriva a novemila (4 cifre) ma è facilissimo...
    l'ho fatta io... usala pure free....

    codice:
    <%
    
    Public Function convertNumber(numero)
    
    A1 = Array("","uno","due","tre","quattro","cinque","sei","sette","otto","nove","dieci","undici","dodici","tredici","quattordici","quindici","sedici","diciassette","diciotto","diciannove")
    A2 = Array("","","vent","trent","quarant","cinquant","sessant","settant","ottant","novant")
    A3 = Array("","","venti","trenta","quaranta","cinquanta","sessanta","settanta","ottanta","novanta")
    A4 = Array("","cento","duecento","trecento","quattrocento","cinquecento","seicento","settecento","ottocento","novecento")
    A5 = Array("","mille","duemila","tremila","quattromila","cinquemila","seimila","settemila","ottomila","novemila")
    
    numero_s = ""
    
    'SE NUMERO NON VALIDO 
    if len(numero) =< 0 or len(numero) > 4 then
    	numero_s = ""
    end if
    
    
    'SE NUMERO HA 1 CIFRA
    if len(numero) = 1 then
    	numero_s = A1(numero)
    end if
    
    
    
    'SE NUMERO HA 2 CIFRE
    if len(numero) = 2 then
    
    	' SE LA PRIMA CIFRA è UNO
    	if left(numero,1) = "1" then
    		numero_s = A1(numero)
    	else	
    		' SE LA SECONDA CIFRA è ZERO
    		if right(numero,1) = "0" then
    			numero_s = A3(numero)	
    		else
    			'SE LA SECONDA CIFRA è 1 o 8
    			if right(numero,1) = "1" or right(numero,1) = "8" then
    				numero_s = A2(left(numero,1))
    			else
    				numero_s = A3(left(numero,1))
    			end if
    		
    			numero_s = numero_s & A1(right(numero,1))
    
    		end if
    	end if
    
    end if
    
    
    'SE NUMERO HA 3 CIFRE
    if len(numero) = 3 then
    
    	primaCifra = left(numero,1)
    	numero_cent = A4(primaCifra)
    
    	numeroDecimale = right(numero,2)
    
    	' SE LA PRIMA CIFRA è UNO
    	if left(numeroDecimale,1) = "1" then
    		numero_s = numero_cent & A1(numeroDecimale)
    	else	
    		' SE LA SECONDA CIFRA è ZERO
    		if right(numeroDecimale,1) = "0" then
    			numero_s = numero_cent & A3(numeroDecimale)	
    		else
    			'SE LA SECONDA CIFRA è 1 o 8
    			if right(numeroDecimale,1) = "1" or right(numeroDecimale,1) = "8" then			
    				numero_s = A2(left(numeroDecimale,1))
    			else
    				numero_s = A3(left(numeroDecimale,1))
    			end if
    		
    			numero_s = numero_cent & numero_s & A1(right(numeroDecimale,1))
    
    		end if
    	end if
    	
    end if
    
    
    'SE NUMERO HA 4 CIFRE
    if len(numero) = 4 then
    
    	primaCifra = left(numero,1)
    	numero_mill = A5(primaCifra)
    	
    	primaCifra = mid(numero,2,1)
    	numero_cent = A4(primaCifra)
    
    	numeroDecimale = right(numero,2)
    
    	' SE LA PRIMA CIFRA è UNO
    	if left(numeroDecimale,1) = "1" then
    		numero_s = numero_mill & numero_cent & A1(numeroDecimale)
    	else	
    		' SE LA SECONDA CIFRA è ZERO
    		if right(numeroDecimale,1) = "0" then
    			numero_s = numero_mill & numero_cent & A3(numeroDecimale)	
    		else
    			'SE LA SECONDA CIFRA è 1 o 8
    			if right(numeroDecimale,1) = "1" or right(numeroDecimale,1) = "8" then
    				numero_s = A2(left(numeroDecimale,1))
    			else
    				numero_s = A3(left(numeroDecimale,1))
    			end if
    		
    			numero_s = numero_mill & numero_cent & numero_s & A1(right(numeroDecimale,1))
    
    		end if
    	end if
    	
    end if
    
    
    
    
    
    
    
    convertNumber = numero_s
    
    End Function
    %>

  7. #7
    prima di baciarti....( che sch...) ti ringrazio, cercherò di fare il meglio per implementarla.

    Grazie

    Maurizio

  8. #8
    Già provata!

    Sei un grande!

    Maurizio

  9. #9
    Utente di HTML.it L'avatar di morphy79
    Registrato dal
    Jun 2004
    Messaggi
    1,568
    ... se l'hai implementata... me la ripassi ????
    non ho il tempo e la necessità per farla... però averla aggiornata il più possibile mi piacerebbe !!!

  10. #10
    appena modifico te la ripasso,
    grazie.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.