
/*
	==========================================================================
	Modulo:			FJs-Gen.iasp
	Descrizione:	Funzioni ad uso Globale
	Data creazione:	04/06/2005
	Elenco funzioni:
					
					
	==========================================================================
	The Software, including this file, is subject to the End User License
	Agreement.
	Copyright (c) 2003 - 2008 PcSitter. All rights reserved 
	==========================================================================
*/
/**Funzioni Matematiche*/
/**
	--------------------------------------------------------------------------------------
	Nome:			f_setSconto
	Descrizione:	Funzione la gestione dello sconto
	Argomenti:	
					
					
	Return: 		
	Autore:			Garnero P.
	Modifiche:		10/05/2005
	--------------------------------------------------------------------------------------
	Note: 
	--------------------------------------------------------------------------------------
*/
function f_setSconto(strSconto,strImporto){
    var newValue = "";
	var ris = 0;
	var i=0;
	var value =0;
	if(strImporto!=null && strImporto!="")
		ris = strImporto;    
    if(strSconto==null)
    strSconto="";
    if(strSconto!=""){
        var Matrix = new Array();
        Matrix=f_Split(strSconto,"+","-");
        while(i<Matrix.length){
		  value=getDouble(Matrix[i]);
          ris = ris*(1-(value/100));
          i++;
        }
    }
    newValue = ris;
    return newValue;
 }
/**
	--------------------------------------------------------------------------------------
	Nome:			f_setArrotonda
	Descrizione:	Funzione l' arrotondamento
	Argomenti:	
					
					
	Return: 		
	Autore:			Garnero P.
	Modifiche:		10/05/2005
	--------------------------------------------------------------------------------------
	Note: 
	--------------------------------------------------------------------------------------
*/
function f_setArrotonda(strImporto){
	var vTemp=getDouble(strImporto);
	var Prova ="";
	vTemp =vTemp+0.0005;
	Prova=vTemp +"";
	 if(Prova.indexOf(".")!=-1)
    	vTemp = Prova.replace(".",",");
	return vTemp;
	
}
/**
--------------------------------------------------------------------------
	Nome:			f_Remove_alpha
	Descrizione:	rimuove dalla Stringa passata tutti i valori
					non compresi tra 0 e 9
	Argomenti:		
					vString: Stringa da formattare 
					
	Return: 		la Stringa corretta
	Autore:			Garnero P.
	Modifiche:		27/08/2001
	--------------------------------------------------------------------------
	Note: Utilizzata dai File JS Formatting_Currency - Formatting_Perc 
	--------------------------------------------------------------------------
*/
function f_Remove_alpha(vString){
	var len  = vString.length;
	var temp = "";	
	for(var i=0;i<len;i++){
		var num = vString.charAt(i);
		if(num!=" ")
			if(num<10)
				temp = temp + num;
	} 
	vString = temp;
	return vString;
}

