Patch level : 12.0 360
Files correlati : li0|ve0|ve6 Commento : - Modificato costruttore classe TLi_manager, adesso non chiede più l'anno ma una data iniziale, se non c'è per il filtro prende l'anno attuale. - Sistemato problema se vengono passate delle liste vuote per il riepilogo della dichiarazione di intento. - Sistemato errori con date precedenti a quelle della dichiarazione di intento attuale. git-svn-id: svn://10.65.10.50/branches/R_10_00@23673 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									8df7f2dcc5
								
							
						
					
					
						commit
						8b0df94cf1
					
				@ -114,6 +114,8 @@ bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
 | 
			
		||||
			cli.rewrite(TLocalisamfile(LF_CFVEN));
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		// Abilito l'utilizzo delle dichiarazioni di intento
 | 
			
		||||
		ini_set_bool(CONFIG_DITTA, "ve", "USELETTERE", true);
 | 
			
		||||
	}
 | 
			
		||||
  default:
 | 
			
		||||
    break;
 | 
			
		||||
 | 
			
		||||
@ -25,9 +25,10 @@ void TLi_manager::elabPlafond()
 | 
			
		||||
	TRectype filtro(letint.curr());
 | 
			
		||||
	filtro.add("CODCLI", codcli);
 | 
			
		||||
 | 
			
		||||
	if(year == -1)
 | 
			
		||||
		year = TDate(TODAY).year();
 | 
			
		||||
	filtro.add("ANNO", year);
 | 
			
		||||
	TDate today(TODAY);
 | 
			
		||||
	if(!iniDicInt.ok())
 | 
			
		||||
		filtro.add("ANNO", today.year());
 | 
			
		||||
	filtro.add("ANNO", iniDicInt.year());
 | 
			
		||||
 | 
			
		||||
	// Creo un cursore ordinato e prelevo la prima riga non chiusa
 | 
			
		||||
	TCursor c_dicint(&letint, "", 2, &filtro, &filtro);
 | 
			
		||||
@ -42,11 +43,11 @@ void TLi_manager::elabPlafond()
 | 
			
		||||
			TRectype row = c_dicint.curr();
 | 
			
		||||
			if(!row.get_bool("CHIUSA"))
 | 
			
		||||
			{
 | 
			
		||||
				if(iniDicInt.ok() && row.get_date("DAL") > iniDicInt) continue; 
 | 
			
		||||
				done = true;
 | 
			
		||||
				if(row.get_int("TIPOOP") != FINO_A_PLAFOND && row.get_int("TIPOOP") != SOLUZIONE_UNICA)	continue;
 | 
			
		||||
 | 
			
		||||
				if(row.get_int("TIPOOP") == SOLUZIONE_UNICA) soluzione = true;
 | 
			
		||||
				year = row.get_int("ANNO");
 | 
			
		||||
				iniDicInt = row.get_date("DAL");
 | 
			
		||||
				plafond = row.get_real("IMPORTO");
 | 
			
		||||
				validPlafond = true;
 | 
			
		||||
@ -87,7 +88,7 @@ const real TLi_manager::elabPlaRes(TToken_string tipi, TToken_string stati, TDat
 | 
			
		||||
	TLista_documenti din;               // Legge tutti i documenti di input
 | 
			
		||||
 | 
			
		||||
	// Trovo tutti i documenti che mi interessano e sottraggo l'imponibile al plafond
 | 
			
		||||
	din.read('D', tipocf, codcli, year, tipi, stati, iniDicInt, ad);
 | 
			
		||||
	din.read('D', tipocf, codcli, iniDicInt.year(), tipi, stati, iniDicInt, ad);
 | 
			
		||||
	
 | 
			
		||||
	for(int i = 0; i < din.items(); i++)
 | 
			
		||||
	{
 | 
			
		||||
@ -115,13 +116,15 @@ const real TLi_manager::elabUtil(TToken_string tipi, TToken_string stati, TDate
 | 
			
		||||
{
 | 
			
		||||
	if(!validPlafond)
 | 
			
		||||
		return -UNO;
 | 
			
		||||
	if(tipi.items() == 0) 
 | 
			
		||||
		return ZERO;
 | 
			
		||||
 | 
			
		||||
	real utilizzato = ZERO;
 | 
			
		||||
 | 
			
		||||
	TLista_documenti din;               // Legge tutti i documenti di input
 | 
			
		||||
 | 
			
		||||
	// Trovo tutti i documenti che mi interessano e sottraggo l'imponibile al plafond
 | 
			
		||||
	din.read('D', tipocf, codcli, year, tipi, stati, iniDicInt, ad);
 | 
			
		||||
	din.read('D', tipocf, codcli, iniDicInt.year(), tipi, stati, iniDicInt, ad);
 | 
			
		||||
	
 | 
			
		||||
	for(int i = 0; i < din.items(); i++)
 | 
			
		||||
	{
 | 
			
		||||
@ -179,8 +182,8 @@ bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TIPOCF, CODCLI, ANNO
 | 
			
		||||
TLi_manager::TLi_manager(const char t, const long c, int y)
 | 
			
		||||
	 : tipocf(t), codcli(c), year(y), iniDicInt(), 
 | 
			
		||||
TLi_manager::TLi_manager(const char t, const long c, TDate iniDic)
 | 
			
		||||
	 : tipocf(t), codcli(c), iniDicInt(iniDic), 
 | 
			
		||||
	 tipidoc(ini_get_string(CONFIG_DITTA, "li", "TIPIDOC")), codiva(ini_get_string(CONFIG_DITTA, "li", "CODIVA")),
 | 
			
		||||
	 plafond(-UNO), validPlafond(false), soluzione(false)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ class TLi_manager : TObject
 | 
			
		||||
{
 | 
			
		||||
	bool validPlafond;
 | 
			
		||||
	bool soluzione;
 | 
			
		||||
	int year;
 | 
			
		||||
	const char tipocf;
 | 
			
		||||
	const long codcli;
 | 
			
		||||
 | 
			
		||||
@ -39,9 +38,6 @@ public:
 | 
			
		||||
	bool	hasValidPlafond() { return validPlafond; }	// Ritorno se il plafond è valido
 | 
			
		||||
	bool	isSoluzione()			{ return soluzione; }			// Ritorna se è una dichiarazione di tipo soluzione
 | 
			
		||||
 | 
			
		||||
	// Setters
 | 
			
		||||
	void setYear(int y) { year = y; }		// Imposta l'anno, mai usata
 | 
			
		||||
 | 
			
		||||
	// Functions
 | 
			
		||||
	void	elabPlafond();																						// Vado a estrapolare il plafond
 | 
			
		||||
	bool	testPlafond(TLista_documenti dout, TLog_report& lerr);		// Testo se con i documenti passati supero il plafond
 | 
			
		||||
@ -52,7 +48,7 @@ public:
 | 
			
		||||
	const real elabUtil(TToken_string tipi, TToken_string stati, TDate ad = 0L);		// Ritorna la quantità di plafond utilizzato dalla data della dichiarazione alla data passata
 | 
			
		||||
 | 
			
		||||
	// Costructors/Destructors
 | 
			
		||||
	TLi_manager(const char t, const long c, int y = -1);
 | 
			
		||||
	TLi_manager(const char t, const long c, TDate iniDic = 0L);
 | 
			
		||||
	~TLi_manager();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1269,7 +1269,7 @@ void TMotore_application::preview()
 | 
			
		||||
 | 
			
		||||
int TMotore_application::checkPlafondAvaibility(TDocumento d)
 | 
			
		||||
{
 | 
			
		||||
	TLi_manager plafond(d.tipocf(), d.codcf(), TDate(TODAY).year());
 | 
			
		||||
	TLi_manager plafond(d.tipocf(), d.codcf(), d.data());
 | 
			
		||||
	if(!plafond.hasValidPlafond())	// Se il cliente non mi interessa
 | 
			
		||||
		return NOERR;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -406,7 +406,7 @@ bool TFatturazione_bolle_app::test_dicint(const TMask& m)
 | 
			
		||||
	{
 | 
			
		||||
		const long codcli = clienti[c];     // Codice cliente in esame
 | 
			
		||||
 | 
			
		||||
		TLi_manager currentCli(tipocf, codcli, dd.year());	// Inizializzo l'oggetto per la gestione del plafond
 | 
			
		||||
		TLi_manager currentCli(tipocf, codcli, dd);	// Inizializzo l'oggetto per la gestione del plafond
 | 
			
		||||
 | 
			
		||||
		if(currentCli.hasValidPlafond())
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user