Aggiunto strumento per controllare e correggere IBAN su documenti
git-svn-id: svn://10.65.10.50/branches/R_10_00@22867 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									6de44e6502
								
							
						
					
					
						commit
						f3d54d4fe9
					
				| @ -1,7 +1,5 @@ | |||||||
| #include <xvt.h> | #include <xvt.h> | ||||||
| 
 | 
 | ||||||
| #include <checks.h> |  | ||||||
| 
 |  | ||||||
| #include "ve4.h" | #include "ve4.h" | ||||||
| 
 | 
 | ||||||
| int main(int argc, char** argv) | int main(int argc, char** argv) | ||||||
| @ -10,6 +8,7 @@ int main(int argc, char** argv) | |||||||
|   switch(k) |   switch(k) | ||||||
|   {  |   {  | ||||||
|   case  1: ve4200(argc, argv); break; // Aggiorna IVA
 |   case  1: ve4200(argc, argv); break; // Aggiorna IVA
 | ||||||
|  |   case  2: ve4300(argc, argv); break; // Correzione IBAN
 | ||||||
|   default: ve4100(argc, argv); break; // Modifica Valori
 |   default: ve4100(argc, argv); break; // Modifica Valori
 | ||||||
|   } |   } | ||||||
|   return 0; |   return 0; | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								ve/ve4.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								ve/ve4.h
									
									
									
									
									
								
							| @ -1,2 +1,3 @@ | |||||||
| int ve4100(int argc, char* argv[]); | int ve4100(int argc, char* argv[]); | ||||||
| int ve4200(int argc, char* argv[]); | int ve4200(int argc, char* argv[]); | ||||||
|  | int ve4300(int argc, char* argv[]); | ||||||
|  | |||||||
							
								
								
									
										200
									
								
								ve/ve4300.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								ve/ve4300.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,200 @@ | |||||||
|  | #include <applicat.h> | ||||||
|  | #include <automask.h> | ||||||
|  | #include <progind.h> | ||||||
|  | #include <recarray.h> | ||||||
|  | #include <recset.h> | ||||||
|  | #include <relation.h> | ||||||
|  | #include <reputils.h> | ||||||
|  | #include <validate.h> | ||||||
|  | 
 | ||||||
|  | #include "ve4.h" | ||||||
|  | #include "ve4300a.h" | ||||||
|  | 
 | ||||||
|  | #include "../cg/cfban.h" | ||||||
|  | #include <clifo.h> | ||||||
|  | #include <doc.h> | ||||||
|  | 
 | ||||||
|  | ///////////////////////////////////////////////////////////
 | ||||||
|  | // TAggiornaIBAN_msk
 | ||||||
|  | ///////////////////////////////////////////////////////////
 | ||||||
|  | 
 | ||||||
|  | class TAggiornaIBAN_msk : public TAutomask | ||||||
|  | { | ||||||
|  |   TAssoc_array _iban; | ||||||
|  | 
 | ||||||
|  | protected: | ||||||
|  |   virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); | ||||||
|  |   const TString& get_iban(const TRectype& doc, TLog_report& log); | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  |   bool elabora(); | ||||||
|  |   TAggiornaIBAN_msk() : TAutomask("ve4300a") {} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | const TString& TAggiornaIBAN_msk::get_iban(const TRectype& doc, TLog_report& log)  | ||||||
|  | { | ||||||
|  |   TToken_string key; | ||||||
|  | 	key = doc.get(DOC_TIPOCF); | ||||||
|  | 	key.add(doc.get(DOC_CODCF)); | ||||||
|  |    | ||||||
|  |   TString* iban = (TString*)_iban.objptr(key); | ||||||
|  |   if (iban != NULL) | ||||||
|  |     return *iban; | ||||||
|  |   iban = new TString80; | ||||||
|  |   _iban.add(key, iban); | ||||||
|  |    | ||||||
|  |   const TRectype& clifo = cache().get(LF_CLIFO, key); | ||||||
|  | 	key.add("V"); | ||||||
|  | 	key.add("1"); | ||||||
|  | 	const TRectype& cfban = cache().get(LF_CFBAN, key); | ||||||
|  | 
 | ||||||
|  |   *iban = cfban.get(CFBAN_IBAN); | ||||||
|  |   if (iban->blank()) | ||||||
|  |   { | ||||||
|  |     *iban = clifo.get(CLI_IBAN); | ||||||
|  |     if (iban->blank()) | ||||||
|  |     { | ||||||
|  |       TString msg; | ||||||
|  |       msg << "Impossibile trovare un IBAN per " << clifo.get(CLI_RAGSOC); | ||||||
|  |       log.log(2, msg); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return *iban; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TAggiornaIBAN_msk::elabora()  | ||||||
|  | { | ||||||
|  |   const bool definitiva = get_bool(F_DEFINITIVA); | ||||||
|  | 
 | ||||||
|  |   TLog_report log; | ||||||
|  | 
 | ||||||
|  |   TFast_isamfile docs(LF_DOC); | ||||||
|  |   TString query; | ||||||
|  |   query << "USE DOC SELECT BETWEEN(DATADOC,#DAL,#AL)&&BETWEEN(STATO,#STATO,#STATO)\n" | ||||||
|  |         << "FROM PROVV=D ANNO=#ANNO CODNUM=#CODNUM\n" | ||||||
|  |         << "TO   PROVV=D ANNO=#ANNO CODNUM=#CODNUM"; | ||||||
|  | 
 | ||||||
|  |   const TDate dal = get(F_DAL); | ||||||
|  |   const TDate al = get(F_AL); | ||||||
|  |   TISAM_recordset recset(query); | ||||||
|  |   recset.set_var("#DAL", dal); | ||||||
|  |   recset.set_var("#AL", al); | ||||||
|  |   recset.set_var("#STATO", get(F_STATO)); | ||||||
|  |   recset.set_var("#ANNO", long(dal.year())); | ||||||
|  |   recset.set_var("#CODNUM", get(F_CODNUM)); | ||||||
|  | 
 | ||||||
|  |   const TRecnotype n = recset.items(); | ||||||
|  | 
 | ||||||
|  |   if (n > 0 && definitiva && !yesno_box("Confermare l'elaborazione di %ld documenti", n)) | ||||||
|  |     return false; | ||||||
|  | 
 | ||||||
|  |   if (n > 0) | ||||||
|  |   { | ||||||
|  |     TProgind pi(n, main_app().title()); | ||||||
|  |     TRectype& doc = recset.cursor()->curr(); | ||||||
|  | 
 | ||||||
|  |     TString msg, ibaner; | ||||||
|  |     TToken_string key; | ||||||
|  | 
 | ||||||
|  |     for (bool ok = recset.move_first(); ok; ok = recset.move_next()) | ||||||
|  |     { | ||||||
|  | #ifdef DBG | ||||||
|  |       const long ndoc = doc.get_long(DOC_NDOC); | ||||||
|  |       if (ndoc == 82) | ||||||
|  |         int cazzone = 1; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  |       const TString8 abi = doc.get(DOC_CODABIA); | ||||||
|  |       const TString8 cab = doc.get(DOC_CODCABA); | ||||||
|  |       const TString80 iban = doc.get(DOC_IBAN); | ||||||
|  |       if (abi.blank() && cab.blank() && iban.blank()) | ||||||
|  |         continue; | ||||||
|  | 
 | ||||||
|  |       int err = iban_check(iban, ibaner); | ||||||
|  |       if (err == 0 && iban.starts_with("IT") && iban.mid(5, 5) == abi && iban.mid(10, 5) == cab) | ||||||
|  |         continue; | ||||||
|  | 
 | ||||||
|  | 		  key = doc.get(DOC_TIPOCF); | ||||||
|  | 		  key.add(doc.get(DOC_CODCF)); | ||||||
|  |       const TRectype& clifo = cache().get(LF_CLIFO, key); | ||||||
|  | 
 | ||||||
|  |       msg.cut(0) << doc.get(DOC_ANNO) << '/' << doc.get(DOC_CODNUM) << '/' << doc.get(DOC_NDOC) | ||||||
|  |                  << ' ' << clifo.get(CLI_RAGSOC); | ||||||
|  |       log.log(1, msg); | ||||||
|  | 
 | ||||||
|  |       if (err != NOERR && iban.full()) | ||||||
|  |       { | ||||||
|  |         msg.cut(0) << '"' << iban << '"' << ' ' << ibaner; | ||||||
|  |         log.log(2, msg); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       const TString& newiban = get_iban(doc, log); | ||||||
|  |       if (newiban == iban) | ||||||
|  |         continue; | ||||||
|  | 
 | ||||||
|  |       doc.put(DOC_IBAN, newiban); | ||||||
|  |       if (iban.starts_with("IT")) | ||||||
|  |       { | ||||||
|  |         doc.put(DOC_CODABIA, newiban.mid( 5,5)); | ||||||
|  |         doc.put(DOC_CODCABA, newiban.mid(10,5)); | ||||||
|  |       } | ||||||
|  |       msg.cut(0) << '"' << iban << '"' << " -> " << '"' << newiban << '"'; | ||||||
|  |       log.log(0, msg); | ||||||
|  | 
 | ||||||
|  |       if (definitiva) | ||||||
|  |       { | ||||||
|  |         err = doc.rewrite(docs); | ||||||
|  |         if (err != NOERR) | ||||||
|  |           log.log(2, TR("Impossibile aggiornare il documento")); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   log.preview(); | ||||||
|  | 
 | ||||||
|  |   return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TAggiornaIBAN_msk::on_field_event(TOperable_field& o, TField_event e, long jolly) | ||||||
|  | { | ||||||
|  |   switch (o.dlg()) | ||||||
|  |   { | ||||||
|  |   case F_AL: | ||||||
|  |     if (e == fe_modify || e == fe_close) | ||||||
|  |     { | ||||||
|  |       const TDate dal = get(F_DAL); | ||||||
|  |       const TDate al = get(F_AL); | ||||||
|  |       if (!dal.ok() || !al.ok() || dal.year() != al.year() || dal > al) | ||||||
|  |         return error_box("Le date devono essere valide ed appartenere allo stesso anno"); | ||||||
|  |     } | ||||||
|  |     break; | ||||||
|  |   default: break; | ||||||
|  |   } | ||||||
|  |   return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ///////////////////////////////////////////////////////////
 | ||||||
|  | // TAggiornaIBAN_app
 | ||||||
|  | ///////////////////////////////////////////////////////////
 | ||||||
|  | 
 | ||||||
|  | class TAggiornaIBAN_app : public TSkeleton_application | ||||||
|  | { | ||||||
|  | protected: | ||||||
|  |   virtual void main_loop(); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | void TAggiornaIBAN_app::main_loop() | ||||||
|  | { | ||||||
|  |   TAggiornaIBAN_msk m; | ||||||
|  |   while (m.run() == K_ENTER) | ||||||
|  |     m.elabora(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int ve4300(int argc, char* argv[]) | ||||||
|  | {               | ||||||
|  |   TAggiornaIBAN_app r; | ||||||
|  |   r.run(argc, argv, TR("Aggiornamento IBAN")); | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								ve/ve4300a.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								ve/ve4300a.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | #define F_DAL        101 | ||||||
|  | #define F_AL         102 | ||||||
|  | #define F_CODNUM     103 | ||||||
|  | #define F_STATO      104 | ||||||
|  | #define F_DEFINITIVA 105 | ||||||
							
								
								
									
										55
									
								
								ve/ve4300a.uml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								ve/ve4300a.uml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | |||||||
|  | #include "ve4300a.h" | ||||||
|  | 
 | ||||||
|  | PAGE "Aggiornamento IBAN" -1 -1 35 6 | ||||||
|  | 
 | ||||||
|  | STRING F_CODNUM 4 | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 1 1 "Numerazione    " | ||||||
|  |   FLAGS "U" | ||||||
|  |   USE %NUM | ||||||
|  |   INPUT CODTAB F_CODNUM | ||||||
|  |   DISPLAY "Codice" CODTAB | ||||||
|  |   DISPLAY "Descrizione@60" S0 | ||||||
|  |   OUTPUT F_CODNUM CODTAB | ||||||
|  |   CHECKTYPE REQUIRED | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | DATE F_DAL  | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 1 2 "Intervallo dal " | ||||||
|  |   CHECKTYPE REQUIRED | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | DATE F_AL  | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 13 3 "al " | ||||||
|  |   FLAGS "A" | ||||||
|  |   CHECKTYPE REQUIRED | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | STRING F_STATO 1 | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 1 4 "Stato          " | ||||||
|  |   FLAGS "U" | ||||||
|  |   USE %STD | ||||||
|  |   INPUT CODTAB F_STATO | ||||||
|  |   DISPLAY "Codice" CODTAB | ||||||
|  |   DISPLAY "Descrizione@60" S0 | ||||||
|  |   OUTPUT F_STATO CODTAB | ||||||
|  |   CHECKTYPE NORMAL | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | BOOLEAN F_DEFINITIVA | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 1 5 "Elaborazioe definitiva" | ||||||
|  | END | ||||||
|  | 
 | ||||||
|  | ENDPAGE | ||||||
|  | 
 | ||||||
|  | TOOLBAR "" 0 0 0 2 | ||||||
|  | 
 | ||||||
|  | #include <elabar.h> | ||||||
|  | 
 | ||||||
|  | ENDPAGE | ||||||
|  | 
 | ||||||
|  | ENDMASK | ||||||
| @ -67,7 +67,10 @@ bool TListaRitFisc::crea_righe(const TListaRitFisc_mask& m) const | |||||||
| 
 | 
 | ||||||
| 	int err=NOERR; | 	int err=NOERR; | ||||||
| 	TLocalisamfile righe(LF_RIGHEF24); | 	TLocalisamfile righe(LF_RIGHEF24); | ||||||
| 	TDocument_recordset rdoc("USE RDOC\nSELECT (TIPORIGA=='04')&&(110@->S10!='')&&(33.NDOC>=#DANUM)&&(33.NDOC<=#ANUM)\nJOIN SPP ALIAS 110 INTO CODTAB=CODART\nJOIN DOC INTO PROVV=PROVV ANNO=ANNO CODNUM=CODNUM NDOC=NDOC\nFROM CODNUM=#NUM\nTO CODNUM=#NUM"); | 	TDocument_recordset rdoc("USE RDOC\nSELECT (TIPORIGA=='04')&&(110@->S10!='')&&(33.NDOC>=#DANUM)&&(33.NDOC<=#ANUM)\n" | ||||||
|  |                            "JOIN SPP ALIAS 110 INTO CODTAB=CODART\n" | ||||||
|  |                            "JOIN DOC INTO PROVV=PROVV ANNO=ANNO CODNUM=CODNUM NDOC=NDOC\n" | ||||||
|  |                            "FROM CODNUM=#NUM\nTO CODNUM=#NUM"); | ||||||
| 	TVariant var; | 	TVariant var; | ||||||
| 	var = m.get(F_NUMINI); | 	var = m.get(F_NUMINI); | ||||||
| 	rdoc.set_var("#DANUM", var); | 	rdoc.set_var("#DANUM", var); | ||||||
| @ -81,7 +84,8 @@ bool TListaRitFisc::crea_righe(const TListaRitFisc_mask& m) const | |||||||
| 	for (bool ok = rdoc.move_first(); ok; ok = rdoc.move_next()) | 	for (bool ok = rdoc.move_first(); ok; ok = rdoc.move_next()) | ||||||
| 		totale += curr.get("RDOC.RITENUTA").as_real(); | 		totale += curr.get("RDOC.RITENUTA").as_real(); | ||||||
| 	err = NOERR; | 	err = NOERR; | ||||||
| 	if (yesno_box("Verranno generate %d righe per un importo di %s euro. Si desidera creare le righe?", rdoc.items(), totale.string())) | 	if (yesno_box("Verranno generate %d righe per un importo di %s euro.\n" | ||||||
|  |                 "Si desidera proseguire?", rdoc.items(), totale.string())) | ||||||
| 	{ | 	{ | ||||||
| 		long cont = get_next_progr_f24(); | 		long cont = get_next_progr_f24(); | ||||||
| 		long numf24 = get_next_f24(); | 		long numf24 = get_next_f24(); | ||||||
| @ -140,6 +144,7 @@ void TListaRitFisc::main_loop() | |||||||
| 			  } | 			  } | ||||||
| 			  rep.print_or_preview();	//stampa il book dei report
 | 			  rep.print_or_preview();	//stampa il book dei report
 | ||||||
| 		  } | 		  } | ||||||
|  |       break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -650,5 +650,5 @@ bool TCopia_documento::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o | |||||||
| 	post_process_input(doc_in); | 	post_process_input(doc_in); | ||||||
|   post_process(doc_out, doc_in); |   post_process(doc_out, doc_in); | ||||||
| 
 | 
 | ||||||
|   return TRUE;      |   return true;      | ||||||
| }  | }  | ||||||
|  | |||||||
| @ -374,7 +374,9 @@ bool TContabilizzazione_analitica::find_conti_iva_indetraibile(const TRiga_docum | |||||||
|   return !conti.empty(); |   return !conti.empty(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool TContabilizzazione_analitica::find_conti(const TRiga_documento& riga, TString_array& conti, int annoes, bool riclassifica_fdr_fde, const char tipomov, real & amount_to_split, real & no_ca_amount, const real & valore, bool & pareggio) | bool TContabilizzazione_analitica::find_conti(const TRiga_documento& riga, TString_array& conti, int annoes,  | ||||||
|  |                                               bool riclassifica_fdr_fde, const char tipomov,  | ||||||
|  |                                               real& amount_to_split, real& no_ca_amount, const real& valore, bool& pareggio) | ||||||
| { | { | ||||||
|   bool bArcticleFound = false; |   bool bArcticleFound = false; | ||||||
| 
 | 
 | ||||||
| @ -663,7 +665,7 @@ bool TContabilizzazione_analitica::elabora(TDocumento& doc, long numreg_cg, TVis | |||||||
| 		if (tiva != iva_vendite && !riga.is_sconto()) | 		if (tiva != iva_vendite && !riga.is_sconto()) | ||||||
| 		{ | 		{ | ||||||
| 			const TString4 tipodet = riga.get(RDOC_TIPODET); | 			const TString4 tipodet = riga.get(RDOC_TIPODET); | ||||||
| 			int td; | 			int td = 0; | ||||||
| 			const real pind = indetraibile_al(tipodet, caus, datareg.year(), td); | 			const real pind = indetraibile_al(tipodet, caus, datareg.year(), td); | ||||||
| 
 | 
 | ||||||
| 			if (pind > ZERO) | 			if (pind > ZERO) | ||||||
| @ -815,7 +817,7 @@ bool TContabilizzazione_analitica::elabora(TDocumento& doc, long numreg_cg, TVis | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (amount_to_split != ZERO) | 	if (!amount_to_split.is_zero()) | ||||||
| 		split_sp_amount(mov, has_pareggio, totdoc, spese, amount_to_split, no_ca_amount, doc.decimals()); | 		split_sp_amount(mov, has_pareggio, totdoc, spese, amount_to_split, no_ca_amount, doc.decimals()); | ||||||
| 
 | 
 | ||||||
|   if (can_write && mov.rows() > 0) |   if (can_write && mov.rows() > 0) | ||||||
|  | |||||||
| @ -1029,9 +1029,9 @@ void TDocumento_mask::cli2mask(bool force_load) | |||||||
| 		if (id2pos(F_IBAN_STATO) > 0) | 		if (id2pos(F_IBAN_STATO) > 0) | ||||||
| 		{ | 		{ | ||||||
| 			set(F_IBAN, iban); | 			set(F_IBAN, iban); | ||||||
| 			efield(F_IBAN_STATO).validate(K_TAB); | 			if (iban.full()) | ||||||
| 			if (iban.not_empty()) |  | ||||||
| 			{ | 			{ | ||||||
|  |   			efield(F_IBAN_STATO).validate(K_TAB); | ||||||
| 				set(F_IBAN_STATO, iban.left(2)); | 				set(F_IBAN_STATO, iban.left(2)); | ||||||
| 				set(F_IBAN_CHECK, iban.mid(2,2)); | 				set(F_IBAN_CHECK, iban.mid(2,2)); | ||||||
| 				set(F_BBAN			, iban.mid(4)); | 				set(F_BBAN			, iban.mid(4)); | ||||||
| @ -1040,6 +1040,16 @@ void TDocumento_mask::cli2mask(bool force_load) | |||||||
| 				set(F_BBAN_CAB	, iban.mid(10,5)); | 				set(F_BBAN_CAB	, iban.mid(10,5)); | ||||||
| 				set(F_BBAN_CONTO, iban.mid(15,12)); | 				set(F_BBAN_CONTO, iban.mid(15,12)); | ||||||
| 			} | 			} | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  | 				reset(F_IBAN_STATO); | ||||||
|  | 				reset(F_IBAN_CHECK); | ||||||
|  | 				reset(F_BBAN			); | ||||||
|  | 				reset(F_BBAN_CIN	); | ||||||
|  | 				reset(F_BBAN_ABI	); | ||||||
|  | 				reset(F_BBAN_CAB	); | ||||||
|  | 				reset(F_BBAN_CONTO); | ||||||
|  |       } | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		key.cut(0); | 		key.cut(0); | ||||||
| @ -1374,6 +1384,7 @@ void TDocumento_mask::doc2mask(bool reload_clifo, bool force_load, bool update) | |||||||
| 		  check_field(F_CODCF); | 		  check_field(F_CODCF); | ||||||
| 		  check_field(F_CODINDSP); | 		  check_field(F_CODINDSP); | ||||||
|     } |     } | ||||||
|  | /*
 | ||||||
| 	  if (id2pos(F_IBAN_STATO) > 0) | 	  if (id2pos(F_IBAN_STATO) > 0) | ||||||
| 	  { | 	  { | ||||||
| 		  const TString80 iban = doc().get(DOC_IBAN); | 		  const TString80 iban = doc().get(DOC_IBAN); | ||||||
| @ -1390,8 +1401,37 @@ void TDocumento_mask::doc2mask(bool reload_clifo, bool force_load, bool update) | |||||||
| 			  set(F_BBAN_CONTO, iban.mid(15,12)); | 			  set(F_BBAN_CONTO, iban.mid(15,12)); | ||||||
| 		  } | 		  } | ||||||
|     } |     } | ||||||
|  | */ | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | 	if (id2pos(F_IBAN_STATO) > 0) | ||||||
|  | 	{ | ||||||
|  | 		const TString80 iban = doc().get(DOC_IBAN); | ||||||
|  | 		set(F_IBAN, iban); | ||||||
|  | 		if (iban.full()) | ||||||
|  | 		{ | ||||||
|  | 			set(F_IBAN_STATO, iban.left(2)); | ||||||
|  | 			set(F_IBAN_CHECK, iban.mid(2,2)); | ||||||
|  | 			set(F_BBAN			, iban.mid(4)); | ||||||
|  | 			set(F_BBAN_CIN	, iban.mid(4,1)); | ||||||
|  | 			set(F_BBAN_ABI	, iban.mid(5,5)); | ||||||
|  | 			set(F_BBAN_CAB	, iban.mid(10,5)); | ||||||
|  | 			set(F_BBAN_CONTO, iban.mid(15,12)); | ||||||
|  |   		efield(F_IBAN_STATO).validate(K_TAB); | ||||||
|  | 		} | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  | 			reset(F_IBAN_STATO); | ||||||
|  | 			reset(F_IBAN_CHECK); | ||||||
|  | 			reset(F_BBAN			); | ||||||
|  | 			reset(F_BBAN_CIN	); | ||||||
|  | 			reset(F_BBAN_ABI	); | ||||||
|  | 			reset(F_BBAN_CAB	); | ||||||
|  | 			reset(F_BBAN_CONTO); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|   TSheet_field& s = sfield(F_SHEET); |   TSheet_field& s = sfield(F_SHEET); | ||||||
|   s.destroy(); |   s.destroy(); | ||||||
| 	const int righe = doc().physical_rows(); | 	const int righe = doc().physical_rows(); | ||||||
| @ -1419,7 +1459,7 @@ void TDocumento_mask::mask2doc() | |||||||
| { | { | ||||||
| 	for (int p = fields()-1; p >= 0; p--) | 	for (int p = fields()-1; p >= 0; p--) | ||||||
| 	{ | 	{ | ||||||
| 		TMask_field& f = fld(p); | 		const TMask_field& f = fld(p); | ||||||
| 		const TFieldref* fr = f.field(); | 		const TFieldref* fr = f.field(); | ||||||
| 		if (fr) | 		if (fr) | ||||||
| 			fr->write(f.get(), doc()); | 			fr->write(f.get(), doc()); | ||||||
| @ -3143,7 +3183,7 @@ int TElabora_mask::update_list() | |||||||
| 
 | 
 | ||||||
| bool TElabora_mask::elabora() | bool TElabora_mask::elabora() | ||||||
| {	  | {	  | ||||||
| 	bool update_mask = FALSE; | 	bool update_mask = false; | ||||||
| 
 | 
 | ||||||
| 	TLista_documenti in; | 	TLista_documenti in; | ||||||
| 	TLista_documenti out;																  | 	TLista_documenti out;																  | ||||||
| @ -3151,10 +3191,10 @@ bool TElabora_mask::elabora() | |||||||
| 	const long numdoc = field(F_NDOC_ELAB).active() ? get_long(F_NDOC_ELAB) : app_doc.get_long(DOC_NDOC); | 	const long numdoc = field(F_NDOC_ELAB).active() ? get_long(F_NDOC_ELAB) : app_doc.get_long(DOC_NDOC); | ||||||
| 	const bool update_header = get_bool(F_UPDATE_HEADER); | 	const bool update_header = get_bool(F_UPDATE_HEADER); | ||||||
| 	const bool from_elab = !get_bool(F_TYPE);	  | 	const bool from_elab = !get_bool(F_TYPE);	  | ||||||
| 	TElaborazione * e = curr_elab(); |  | ||||||
| 
 | 
 | ||||||
|  |   TElaborazione* e = curr_elab(); | ||||||
| 	if (e == NULL) | 	if (e == NULL) | ||||||
| 		return FALSE; | 		return false; | ||||||
| 	 | 	 | ||||||
| 	if (e->tipo() == _consegna_ordini) | 	if (e->tipo() == _consegna_ordini) | ||||||
| 	{ | 	{ | ||||||
| @ -3221,7 +3261,7 @@ bool TElabora_mask::elabora() | |||||||
| 			return false ; | 			return false ; | ||||||
| 		char provv = get(F_PROVV_ELAB)[0]; | 		char provv = get(F_PROVV_ELAB)[0]; | ||||||
| 		int anno = get_int(F_ANNO_ELAB); | 		int anno = get_int(F_ANNO_ELAB); | ||||||
| 		TString16 codnum(get(F_CODNUM_ELAB)); | 		const TString4 codnum = get(F_CODNUM_ELAB); | ||||||
| 		long ndoc = get_long(F_NDOC_ELAB); | 		long ndoc = get_long(F_NDOC_ELAB); | ||||||
| 
 | 
 | ||||||
| 		if (ndoc > 0L && !in.find(provv, anno, codnum, ndoc)) | 		if (ndoc > 0L && !in.find(provv, anno, codnum, ndoc)) | ||||||
| @ -3231,13 +3271,13 @@ bool TElabora_mask::elabora() | |||||||
| 		} | 		} | ||||||
| 		if (update_header)									  | 		if (update_header)									  | ||||||
| 		{																											 | 		{																											 | ||||||
| 			const TString4 tipo_doc(app_doc.get(DOC_TIPODOC)); | 			const TString4 tipo_doc=app_doc.get(DOC_TIPODOC); | ||||||
| 			const TString8 caus_mag(app_doc.get(DOC_CAUSMAG)); | 			const TString8 caus_mag=app_doc.get(DOC_CAUSMAG); | ||||||
| 			const long movmag      = app_doc.get_long(DOC_MOVMAG); | 			const long movmag      = app_doc.get_long(DOC_MOVMAG); | ||||||
| 			const TDate datadoc    = app_doc.get_date(DOC_DATADOC); | 			const TDate datadoc    = app_doc.get_date(DOC_DATADOC); | ||||||
| 			const TDate datainsc   = app_doc.get_date(DOC_DATAINSC); | 			const TDate datainsc   = app_doc.get_date(DOC_DATAINSC); | ||||||
| 			const TDate datapart   = app_doc.get_date(DOC_DATAPART); | 			const TDate datapart   = app_doc.get_date(DOC_DATAPART); | ||||||
| 			const TString8 orapart(app_doc.get(DOC_ORAPART)); | 			const TString8 orapart = app_doc.get(DOC_ORAPART); | ||||||
| 			const char stato       = app_doc.stato(); | 			const char stato       = app_doc.stato(); | ||||||
| 			 | 			 | ||||||
| 			TDocumento::copy_data(app_doc.head(), in[0].head()); | 			TDocumento::copy_data(app_doc.head(), in[0].head()); | ||||||
| @ -3247,6 +3287,8 @@ bool TElabora_mask::elabora() | |||||||
| 			app_doc.put(DOC_MOVMAG,   movmag); | 			app_doc.put(DOC_MOVMAG,   movmag); | ||||||
| 			app_doc.put(DOC_DATADOC,  datadoc); | 			app_doc.put(DOC_DATADOC,  datadoc); | ||||||
| 			app_doc.put(DOC_DATAINSC, datainsc); | 			app_doc.put(DOC_DATAINSC, datainsc); | ||||||
|  | 			app_doc.put(DOC_DATAPART, datapart); | ||||||
|  | 			app_doc.put(DOC_ORAPART,  orapart); | ||||||
| 			app_doc.put(DOC_STATO,    stato); | 			app_doc.put(DOC_STATO,    stato); | ||||||
| 		} | 		} | ||||||
| 		out.add(app_doc); | 		out.add(app_doc); | ||||||
| @ -3291,7 +3333,7 @@ bool TElabora_mask::elabora() | |||||||
| 
 | 
 | ||||||
| TElaborazione* TElabora_mask::curr_elab() | TElaborazione* TElabora_mask::curr_elab() | ||||||
| { | { | ||||||
| 	const TString16 cod_elab(get(F_ELAB)); | 	const TString8 cod_elab(get(F_ELAB)); | ||||||
| 	return cod_elab.not_empty() ? &_elab[cod_elab] : NULL; | 	return cod_elab.not_empty() ? &_elab[cod_elab] : NULL; | ||||||
| }		  | }		  | ||||||
| 
 | 
 | ||||||
| @ -3569,7 +3611,7 @@ bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key ) | |||||||
| 		if (!m.check_fields()) // Check values
 | 		if (!m.check_fields()) // Check values
 | ||||||
|       return false; |       return false; | ||||||
| 		 | 		 | ||||||
|     TElabora_mask* selection = new TElabora_mask(m); // No woman no stack
 |     TElabora_mask* selection = new TElabora_mask(m);  | ||||||
| 		bool do_checks = false; | 		bool do_checks = false; | ||||||
| 		const char stato_iniziale = m.doc().stato(); | 		const char stato_iniziale = m.doc().stato(); | ||||||
| 		m.update_father_rows(); | 		m.update_father_rows(); | ||||||
|  | |||||||
| @ -180,17 +180,25 @@ bool fido_hndl(TMask_field& field, KEY key) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ora_hndl( TMask_field& field, KEY key ) | bool ora_hndl( TMask_field& field, KEY key ) | ||||||
| 
 |  | ||||||
| { | { | ||||||
| 	if (field.to_check(key,true)) | 	if (field.to_check(key,true)) | ||||||
| 	{ | 	{ | ||||||
| 		TString16 ora; | 		TString8 ora; | ||||||
| 		 | 		 | ||||||
| 		if (field.automagic() && field.get().empty()) | 		if (field.automagic() && field.empty()) | ||||||
| 		{ | 		{ | ||||||
| 			struct tm* t = xvt_time_now(); | 			struct tm* t = xvt_time_now(); | ||||||
| 			ora.format("%02d%02d", t->tm_hour, t->tm_min); | 			ora.format("%02d%02d", t->tm_hour, t->tm_min); | ||||||
| 			field.set((ora)); | 			field.set((ora)); | ||||||
|  | 
 | ||||||
|  |       TMask& m = field.mask(); | ||||||
|  |       const int pos_data = m.id2pos(field.dlg()) - 1; | ||||||
|  |       TMask_field& dt = m.fld(pos_data); | ||||||
|  |       if (dt.is_kind_of(CLASS_DATE_FIELD) && dt.automagic()) | ||||||
|  |       { | ||||||
|  |         const TDate oggi(TODAY); | ||||||
|  |         dt.set(oggi.string()); | ||||||
|  |       } | ||||||
| 		} | 		} | ||||||
| 		else | 		else | ||||||
| 		{ | 		{ | ||||||
| @ -199,11 +207,13 @@ bool ora_hndl( TMask_field& field, KEY key ) | |||||||
| 			{ | 			{ | ||||||
| 				if (!isdigit(ora[0]) ||	!isdigit(ora[1]) ||	!isdigit(ora[2]) || | 				if (!isdigit(ora[0]) ||	!isdigit(ora[1]) ||	!isdigit(ora[2]) || | ||||||
| 						!isdigit(ora[3]) ||	atoi(ora.left(2)) > 23 || atoi(ora.mid(2)) > 59) | 						!isdigit(ora[3]) ||	atoi(ora.left(2)) > 23 || atoi(ora.mid(2)) > 59) | ||||||
| 					return error_box(TR("Ora errata")); | 					return field.error_box(TR("Ora errata")); | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
|  |       { | ||||||
| 				if (field.required()) | 				if (field.required()) | ||||||
| 					 return error_box(TR("Ora obbligatoria")); | 				  return field.error_box(TR("Ora obbligatoria")); | ||||||
|  |       } | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -2838,7 +2848,7 @@ bool codcms_handler(TMask_field& f, KEY key) | |||||||
| 				mask.set(mask.field(F_CODCABA).active() ? F_CODCABA : F_CODCABA1, cfban.get(CFBAN_CAB), 3); | 				mask.set(mask.field(F_CODCABA).active() ? F_CODCABA : F_CODCABA1, cfban.get(CFBAN_CAB), 3); | ||||||
| 				mask.set(F_IBAN, cfban.get(CFBAN_IBAN)); | 				mask.set(F_IBAN, cfban.get(CFBAN_IBAN)); | ||||||
| 			} | 			} | ||||||
| 		} //if (main_app().has_module(CUAUT) && (...
 | 		} //if (main_app().has_module(CTAUT) && (...
 | ||||||
| 
 | 
 | ||||||
|     //aggiornamento automatico del campo codice contabilita' separata nel caso di commessa che ce lo abbia
 |     //aggiornamento automatico del campo codice contabilita' separata nel caso di commessa che ce lo abbia
 | ||||||
|     if (main_app().has_module(NPAUT) && (key == K_TAB && f.focusdirty())) |     if (main_app().has_module(NPAUT) && (key == K_TAB && f.focusdirty())) | ||||||
|  | |||||||
| @ -32,6 +32,7 @@ Item_04 = "Copia documenti", "ve5 -2", "F" | |||||||
| Item_05 = "Compattamento documenti", "ve5 -4", "F" | Item_05 = "Compattamento documenti", "ve5 -4", "F" | ||||||
| Item_06 = "Invio e ricezione documenti", "ve5 -3", "F" | Item_06 = "Invio e ricezione documenti", "ve5 -3", "F" | ||||||
| Item_07 = "Lista ritenute per F24", "ve8 -0", "F" | Item_07 = "Lista ritenute per F24", "ve8 -0", "F" | ||||||
|  | Item_08 = "Controllo IBAN su documenti", "ve4 -2", "F" | ||||||
| 
 | 
 | ||||||
| [VEMENU_052] | [VEMENU_052] | ||||||
| Caption = "Configurazione" | Caption = "Configurazione" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user