Corretto errore 5906. Aggiunta la possibilita' di stampare campi composti.
git-svn-id: svn://10.65.10.50/trunk@3458 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									b5fa5a44c0
								
							
						
					
					
						commit
						588282acc0
					
				| @ -24,8 +24,8 @@ class BA3200_application : public TPrintapp | ||||
|   TMask*        _msk; | ||||
|   TString       _maskname; | ||||
|   int           _logicnum; | ||||
|   TString_array _string_roman;  | ||||
|   TString_array _field_roman;  | ||||
|   TString_array _string_roman, _string_compound;  | ||||
|   TString_array _field_roman, _field_compound;  | ||||
|   bool          _stampa_registri; | ||||
|   bool          _stampa_ca7; //tabella causali 770
 | ||||
|   bool          _tabella_comune; | ||||
| @ -91,6 +91,8 @@ void BA3200_application::set_page (int , int ) | ||||
| { | ||||
|   _string_roman.destroy(); | ||||
|   _field_roman.destroy(); | ||||
|   _string_compound.destroy(); | ||||
|   _field_compound.destroy(); | ||||
|   set_rows(); | ||||
| } | ||||
| 
 | ||||
| @ -110,6 +112,37 @@ bool BA3200_application::preprocess_page(int , int) | ||||
|       s = itor(n); | ||||
|     } | ||||
|   } | ||||
|    | ||||
|   const int compound = _field_compound.items(); | ||||
|   if (compound > 0) | ||||
|     // Scorre le righe settate
 | ||||
|     for (int i = 0; i < compound; i++) | ||||
|     { | ||||
|       TToken_string f(_field_compound.row(i),'+'); // campo composto
 | ||||
|       TString& s = _string_compound.row(i); // riga da stampare
 | ||||
|       s.cut(0); // Reset the row...
 | ||||
|       bool compile_row = TRUE; | ||||
|       const int cmp_items = f.items();  | ||||
|       // Scorre gli elementi della riga
 | ||||
|       for (int j = 0; j < cmp_items; j++) | ||||
|       { | ||||
|         // compone la stringa totale
 | ||||
|         TString xx(f.get(j)); | ||||
|         if (xx[0] != '"') // se non e' una costante stringa legge il valore
 | ||||
|         { | ||||
|           TFieldref fld(xx,0); | ||||
|           xx = fld.read(*_rel); | ||||
|           if (xx.empty()) compile_row = FALSE; | ||||
|           else compile_row = TRUE; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|           xx.ltrim(1);xx.rtrim(1); | ||||
|         } | ||||
|         if (compile_row) | ||||
|           s << xx; // appende alla stringa il valore ricavato (se il campo e' vuoto non appende nemmeno la stringa fissa)
 | ||||
|       } | ||||
|     } | ||||
|   // Stampa tabella registri. Calcolo: pagine residue = pagine - stampate
 | ||||
|   if (_stampa_registri) | ||||
|   { | ||||
| @ -227,20 +260,26 @@ void BA3200_application::set_rows() | ||||
|   { | ||||
|     riga_record = line.get_int(); | ||||
| 
 | ||||
|     TString s(line.get()); | ||||
|      | ||||
|     TString s(line.get()); | ||||
|     int logicnum = _logicnum; | ||||
|     const bool is_compound = s.find('+') >= 0; // Controlla se e' una stringa composta (usare #t nel formato)
 | ||||
|     if (!is_compound) | ||||
|     { | ||||
|       campo = s; | ||||
|       from = campo.from(); | ||||
|       to = campo.to(); | ||||
|       name = campo.name(); | ||||
|     int logicnum = campo.file() == 0 ? _logicnum : campo.file(); | ||||
|       if (campo.file != 0) | ||||
|         logicnum = campo.file(); | ||||
|     } | ||||
|        | ||||
|     formato_campo = line.get(); | ||||
|     formato_campo.trim(); | ||||
|     formato_campo.lower(); | ||||
|     const int p = formato_campo.find("@m"); | ||||
|        | ||||
|     if (p != -1) | ||||
|     if (p != -1 && !is_compound) | ||||
|     { | ||||
|       formato_campo.cut(p); | ||||
|       formato_campo << "#t"; | ||||
| @ -250,7 +289,7 @@ void BA3200_application::set_rows() | ||||
|    | ||||
|       set_row (riga_record, formato_campo, _string_roman.objptr(last)); | ||||
|     } | ||||
|     else | ||||
|     else if (!is_compound) | ||||
|     { | ||||
|       if (formato_campo.find("@pn")) | ||||
|         picture = line.get(); | ||||
| @ -265,7 +304,14 @@ void BA3200_application::set_rows() | ||||
|       else | ||||
|         set_row (riga_record, formato_campo, FLD(logicnum,name,from,to) ); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|       _string_compound.add(""); | ||||
|       _field_compound.add(s); | ||||
|       const int last = _string_compound.items() - 1; | ||||
|    | ||||
|       set_row (riga_record, formato_campo, _string_compound.objptr(last)); | ||||
|     } | ||||
|     line = (const char *) rpt.line(); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -9,16 +9,15 @@ Tabella Banche | ||||
| 1|@26g%s|Istituto | ||||
| 1|@78g%s|Dipendenza | ||||
| 2|@26g%s|Indirizzo | ||||
| 3|@26g%s|CAP | ||||
| 3|@32g%s|Comune | ||||
| 4|@26g%s|CAP | ||||
| 4|@32g%s|Comune | ||||
| 
 | ||||
| [Rows] | ||||
| 1|CODTAB[1,5]|@7g@5s | ||||
| 1|CODTAB[6,10]|@19g@5s | ||||
| 1|S0|@26g@50,ls | ||||
| 1|I0|@78g@4n | ||||
| 2|S2|@26g@40,ls | ||||
| 2|S7|@68g@10,ls | ||||
| 3|S3|@26g@5,ls | ||||
| 3|S5|@32g@4,ls | ||||
| 3|LF_COMUNI->DENCOM|@38g@50,ls | ||||
| 2|S2+", "+S7|@26g#-40t | ||||
| 3|S3|@26g@10,ls | ||||
| 3|LF_COMUNI->DENCOM+" ("+LF_COMUNI->PROVCOM+")"|@32g#-55t | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user