Supporto per split payment
git-svn-id: svn://10.65.10.50/branches/R_10_00@23049 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									e1b494f330
								
							
						
					
					
						commit
						240f2e8cf5
					
				| @ -29,13 +29,13 @@ | |||||||
| class TDoc_recordset : public TISAM_recordset | class TDoc_recordset : public TISAM_recordset | ||||||
| { | { | ||||||
|   TDocumentoEsteso* _doc; |   TDocumentoEsteso* _doc; | ||||||
|   TRecnotype _mypos; |   TRecnotype _mypos, _lastpos; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|   virtual const TVariant& get_field(int logic, const char* field) const; |   virtual const TVariant& get_field(int logic, const char* field) const; | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|   virtual TRecnotype items() const; |   virtual TRecnotype items() const { return _lastpos; } | ||||||
|   virtual TRecnotype current_row() const { return _mypos; } |   virtual TRecnotype current_row() const { return _mypos; } | ||||||
|   virtual bool move_to(TRecnotype pos); |   virtual bool move_to(TRecnotype pos); | ||||||
| 
 | 
 | ||||||
| @ -46,11 +46,6 @@ public: | |||||||
|   virtual ~TDoc_recordset(); |   virtual ~TDoc_recordset(); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| TRecnotype TDoc_recordset::items() const |  | ||||||
| { |  | ||||||
|   return _doc->rows(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| TRiga_documento& TDoc_recordset::riga_doc(int n) const | TRiga_documento& TDoc_recordset::riga_doc(int n) const | ||||||
| { | { | ||||||
|   if (n <= 0) |   if (n <= 0) | ||||||
| @ -59,7 +54,7 @@ TRiga_documento& TDoc_recordset::riga_doc(int n) const | |||||||
|     n = _doc->new_row("05").get_int(RDOC_NRIGA); // Crea ua riga descrizione fittizia
 |     n = _doc->new_row("05").get_int(RDOC_NRIGA); // Crea ua riga descrizione fittizia
 | ||||||
| 	if (n <= 0) | 	if (n <= 0) | ||||||
| 		n = 1; | 		n = 1; | ||||||
|   return (*_doc)[n]; |   return _doc->row(n); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool TDoc_recordset::move_to(TRecnotype pos) | bool TDoc_recordset::move_to(TRecnotype pos) | ||||||
| @ -130,7 +125,7 @@ static int compare_rdocs(const TObject** p1, const TObject** p2) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TDoc_recordset::TDoc_recordset(const TRecordset& doc, const TString& old_query) | TDoc_recordset::TDoc_recordset(const TRecordset& doc, const TString& old_query) | ||||||
|               : TISAM_recordset(old_query), _doc(NULL), _mypos(-1) |               : TISAM_recordset(old_query), _doc(NULL), _mypos(-1), _lastpos(-1) | ||||||
| { | { | ||||||
|   TRectype curr(LF_DOC); |   TRectype curr(LF_DOC); | ||||||
| 
 | 
 | ||||||
| @ -201,6 +196,8 @@ TDoc_recordset::TDoc_recordset(const TRecordset& doc, const TString& old_query) | |||||||
| 	} | 	} | ||||||
| 	_doc->set_riga_conai(); | 	_doc->set_riga_conai(); | ||||||
|   _doc->set_riga_tic(); |   _doc->set_riga_tic(); | ||||||
|  |   _doc->set_riga_split(); | ||||||
|  |   _lastpos = _doc->rows(); | ||||||
| 
 | 
 | ||||||
|   // Posiziona correttamente anche il cursore principale
 |   // Posiziona correttamente anche il cursore principale
 | ||||||
|   *cursor() = 0L; |   *cursor() = 0L; | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								ve/velib.h
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ve/velib.h
									
									
									
									
									
								
							| @ -636,11 +636,13 @@ public: | |||||||
|   real calc_conai_qta(TCONAI_class type) const; |   real calc_conai_qta(TCONAI_class type) const; | ||||||
| 
 | 
 | ||||||
| 	real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const; | 	real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const; | ||||||
| 	const TString & codice_costo() const; | 	const TString& codice_costo() const; | ||||||
| 	const TString & codice_commessa() const; | 	const TString& codice_commessa() const; | ||||||
| 	const TString & fase_commessa() const; | 	const TString& fase_commessa() const; | ||||||
| 	TArticolo & articolo() const; | 	TArticolo& articolo() const; | ||||||
| 	TArticolo_giacenza & articolo_giacenza() const; | 	TArticolo_giacenza& articolo_giacenza() const; | ||||||
|  | 
 | ||||||
|  |   void set_descr(const char* descr); // Setta DESCR ed eventualmente DESCLUNGA+DESCEST
 | ||||||
| 
 | 
 | ||||||
| 	TRiga_documento(TDocumento* doc, const char* tipo = NULL); | 	TRiga_documento(TDocumento* doc, const char* tipo = NULL); | ||||||
| 	TRiga_documento(const TRiga_documento & row); | 	TRiga_documento(const TRiga_documento & row); | ||||||
| @ -871,7 +873,7 @@ public: | |||||||
| 	real provvigione(bool first = true, int ndec = AUTO_DECIMALS) const; | 	real provvigione(bool first = true, int ndec = AUTO_DECIMALS) const; | ||||||
| 	real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const; | 	real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const; | ||||||
| 
 | 
 | ||||||
| 	TPagamento & pagamento(); | 	TPagamento& pagamento(); | ||||||
| 
 | 
 | ||||||
| 	void update_spese_aut(TString_array & spese, bool preserve_old = FALSE, TSheet_field * sh = NULL); | 	void update_spese_aut(TString_array & spese, bool preserve_old = FALSE, TSheet_field * sh = NULL); | ||||||
| 	real calc_conai_qta(TCONAI_class type); | 	real calc_conai_qta(TCONAI_class type); | ||||||
|  | |||||||
| @ -1096,6 +1096,30 @@ void TRiga_documento::cms2tipodet() | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void TRiga_documento::set_descr(const char* descr) | ||||||
|  | { | ||||||
|  |   const int descr_len = length(RDOC_DESCR); | ||||||
|  |   TString s = descr; s.rtrim(); | ||||||
|  |   int split_pos = s.find('\n');                                   | ||||||
|  |   if (split_pos < 0 && s.len() > descr_len) | ||||||
|  |     split_pos = descr_len; | ||||||
|  |   if (split_pos > descr_len) | ||||||
|  |     split_pos = descr_len; | ||||||
|  |   if (split_pos > 0) | ||||||
|  |   { | ||||||
|  |     put(RDOC_DESCR, s.left(split_pos)); | ||||||
|  |     const TString& dest = s.mid(split_pos); | ||||||
|  |     put(RDOC_DESCLUNGA, "X");   | ||||||
|  |     put(RDOC_DESCEST, dest); | ||||||
|  |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|  |     put(RDOC_DESCR, s); | ||||||
|  |     zero(RDOC_DESCLUNGA); | ||||||
|  |     zero(RDOC_DESCEST); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void TRiga_documento::autosave(TSheet_field& f) | void TRiga_documento::autosave(TSheet_field& f) | ||||||
| { | { | ||||||
|   const int num = numero() - 1; |   const int num = numero() - 1; | ||||||
| @ -1117,26 +1141,7 @@ void TRiga_documento::autosave(TSheet_field& f) | |||||||
|     for (int l = 0; l<4 ; l++) |     for (int l = 0; l<4 ; l++) | ||||||
|       doc().livelli().pack_grpcode(liv,row.get(f.cid2index(FR_LIV1+l)),l+1); |       doc().livelli().pack_grpcode(liv,row.get(f.cid2index(FR_LIV1+l)),l+1); | ||||||
|     put( RDOC_LIVELLO, liv); // da modificare
 |     put( RDOC_LIVELLO, liv); // da modificare
 | ||||||
|     TString s = row.get(f.cid2index(FR_DESCR)); s.rtrim(); |     set_descr(row.get(f.cid2index(FR_DESCR))); | ||||||
|     int split_pos = s.find('\n');                                   |  | ||||||
|     const int descr_len = length(RDOC_DESCR); |  | ||||||
|     if (split_pos < 0 && s.len() > descr_len) |  | ||||||
|       split_pos = descr_len; |  | ||||||
|     if (split_pos > descr_len) |  | ||||||
|       split_pos = descr_len; |  | ||||||
|     if (split_pos > 0) |  | ||||||
|     { |  | ||||||
|       put(RDOC_DESCR, s.left(split_pos)); |  | ||||||
|       const TString& dest = s.mid(split_pos); |  | ||||||
|       put(RDOC_DESCLUNGA, "X");   |  | ||||||
|       put(RDOC_DESCEST, dest); |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|       put(RDOC_DESCR, s); |  | ||||||
|       zero(RDOC_DESCLUNGA); |  | ||||||
|       zero(RDOC_DESCEST); |  | ||||||
|     } |  | ||||||
|      |      | ||||||
|     const int prezzo_id = f.cid2index(FR_PREZZO); |     const int prezzo_id = f.cid2index(FR_PREZZO); | ||||||
|     real prezzo(row.get(prezzo_id)); |     real prezzo(row.get(prezzo_id)); | ||||||
|  | |||||||
| @ -993,7 +993,7 @@ void TDocumento::set_riga_esenzione() | |||||||
|       { |       { | ||||||
|         _tipo_riga_es = "05"; |         _tipo_riga_es = "05"; | ||||||
|         conf.set("TRESENZ", _tipo_riga_es); |         conf.set("TRESENZ", _tipo_riga_es); | ||||||
|         warning_box("Il tipo riga esenzione non risultava impostato.\n L'applicazione usera' automaticamente il tipo %s", (const char*) _tipo_riga_es); |         warning_box("Il tipo riga esenzione non risultava impostato.\n L'applicazione userà automaticamente il tipo %s", (const char*) _tipo_riga_es); | ||||||
|       }                          |       }                          | ||||||
|       _des_esenz = conf.get("DESESENZ", "ve");  |       _des_esenz = conf.get("DESESENZ", "ve");  | ||||||
|       if (_des_esenz.not_empty()) |       if (_des_esenz.not_empty()) | ||||||
| @ -1005,12 +1005,9 @@ void TDocumento::set_riga_esenzione() | |||||||
|     TString d(256); d = _des_esenz; |     TString d(256); d = _des_esenz; | ||||||
| 
 | 
 | ||||||
|     d << format(" come da vostra dichiarazione n. %s del %s da noi annotata al n. %s il %s.", |     d << format(" come da vostra dichiarazione n. %s del %s da noi annotata al n. %s il %s.", | ||||||
|                 (const char *) v_esenzione, (const char *) v_data_esenzione,  |                 (const char*)v_esenzione, (const char*)v_data_esenzione,  | ||||||
|                 (const char *) n_registrazione, (const char *) n_data_registrazione); |                 (const char*)n_registrazione, (const char*)n_data_registrazione); | ||||||
|      |     _esenzione->set_descr(d); | ||||||
|     _esenzione->put(RDOC_DESCR, d.left(50));                                                      |  | ||||||
|     _esenzione->put(RDOC_DESCLUNGA, "X"); |  | ||||||
|     _esenzione->put(RDOC_DESCEST, d.mid(50)); |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|                                   |                                   | ||||||
| @ -1018,17 +1015,17 @@ void TDocumento::dirty_fields() | |||||||
| { | { | ||||||
|   if (!_dirty_deny) |   if (!_dirty_deny) | ||||||
|   { |   { | ||||||
|     for (TDocumento_variable_field * f = (TDocumento_variable_field *) first_variable_field();  |     for (TDocumento_variable_field* f = (TDocumento_variable_field*)first_variable_field();  | ||||||
|          f != NULL; f = (TDocumento_variable_field *) succ_variable_field())  |          f != NULL; f = (TDocumento_variable_field*)succ_variable_field())  | ||||||
|       f->set_dirty();    |       f->set_dirty();    | ||||||
|     dirty_tabella_iva(); |     dirty_tabella_iva(); | ||||||
| 
 | 
 | ||||||
|     if (loaded_rows(LF_RIGHEDOC)) // Se ho gia' caricato delle righe in memoria
 |     if (loaded_rows(LF_RIGHEDOC)) // Se ho già caricato delle righe in memoria
 | ||||||
|     { |     { | ||||||
| 		  TRecord_array& righe = body(LF_RIGHEDOC); | 		  TRecord_array& righe = body(LF_RIGHEDOC); | ||||||
|       for (int i = righe.last_row(); i > 0; i = righe.pred_row(i)) |       for (int i = righe.last_row(); i > 0; i = righe.pred_row(i)) | ||||||
|       { |       { | ||||||
|         TRiga_documento & r = (TRiga_documento &) righe[i];      |         TRiga_documento& r = (TRiga_documento&)righe[i];      | ||||||
|         r.dirty_fields(FALSE); |         r.dirty_fields(FALSE); | ||||||
|       }   |       }   | ||||||
|     } |     } | ||||||
| @ -2461,7 +2458,7 @@ real TDocumento::ritenute(const char tipo, bool lordo, int ndec) const | |||||||
|   real val; |   real val; | ||||||
|   for (int i = rows(); i > 0; i--) |   for (int i = rows(); i > 0; i--) | ||||||
|   { |   { | ||||||
|     const TRiga_documento& r = operator[](i); |     const TRiga_documento& r = ((TDocumento*)this)->row(i); | ||||||
|     val += r.ritenuta(tipo, lordo, ndec); |     val += r.ritenuta(tipo, lordo, ndec); | ||||||
| 	} | 	} | ||||||
| 	return val; | 	return val; | ||||||
| @ -2726,19 +2723,9 @@ void TDocumento::update_raee() | |||||||
| 						d << " - "; | 						d << " - "; | ||||||
| 					d << r1.get(RDOC_DESCR); | 					d << r1.get(RDOC_DESCR); | ||||||
| 					d << r1.get(RDOC_DESCEST); | 					d << r1.get(RDOC_DESCEST); | ||||||
| 			    r1.put(RDOC_DESCR, d.left(50));                                                      |           r1.set_descr(d); | ||||||
| 					if (d.len() > 50) |  | ||||||
| 					{ |  | ||||||
| 						r1.put(RDOC_DESCLUNGA, "X"); |  | ||||||
| 						r1.put(RDOC_DESCEST, d.mid(50)); |  | ||||||
| 					} |  | ||||||
| 					else |  | ||||||
| 					{ |  | ||||||
| 						r1.zero(RDOC_DESCLUNGA); |  | ||||||
| 						r1.zero(RDOC_DESCEST); |  | ||||||
| 					} |  | ||||||
| 					const TString & um = sp.um(); |  | ||||||
| 
 | 
 | ||||||
|  |           const TString& um = sp.um(); | ||||||
|           if (um.full()) |           if (um.full()) | ||||||
| 						r1.put(RDOC_UMQTA, um); | 						r1.put(RDOC_UMQTA, um); | ||||||
|           if (cod_iva_cli.blank()) |           if (cod_iva_cli.blank()) | ||||||
|  | |||||||
| @ -24,13 +24,10 @@ TTipo_documento::TTipo_documento(const char* tipodoc) | |||||||
| 
 | 
 | ||||||
| TTipo_documento::TTipo_documento(const TRectype& rec) | TTipo_documento::TTipo_documento(const TRectype& rec) | ||||||
|                : TRectype(rec), _tipocf('\0') |                : TRectype(rec), _tipocf('\0') | ||||||
| { | { read_formule(); } | ||||||
|   read_formule(); |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| TTipo_documento::~TTipo_documento() | TTipo_documento::~TTipo_documento() | ||||||
| {  | { } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| int TTipo_documento::read(const char* tipodoc) | int TTipo_documento::read(const char* tipodoc) | ||||||
| {  | {  | ||||||
|  | |||||||
| @ -274,16 +274,7 @@ bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out) | |||||||
|   				memo << " - "; |   				memo << " - "; | ||||||
|   			memo << riferimento; |   			memo << riferimento; | ||||||
|       } |       } | ||||||
| 			 | 			rout.set_descr(memo); | ||||||
|       const int maxlen = rout.length(RDOC_DESCR); |  | ||||||
| 			if (memo.len() < maxlen) |  | ||||||
| 				rout.put(RDOC_DESCR, memo); |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				rout.put(RDOC_DESCR, memo.left(maxlen)); |  | ||||||
| 				rout.put(RDOC_DESCEST, memo.mid(maxlen)); |  | ||||||
| 				rout.put(RDOC_DESCLUNGA, true); |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 		else  //else if(rif_packed)...
 | 		else  //else if(rif_packed)...
 | ||||||
| 		{ | 		{ | ||||||
|  | |||||||
| @ -1,5 +1,11 @@ | |||||||
| #include "velib05.h" | #include "velib05.h" | ||||||
|  | 
 | ||||||
| #include <diction.h> | #include <diction.h> | ||||||
|  | #include <utility.h> | ||||||
|  | 
 | ||||||
|  | #include "../cg/cglib03.h" | ||||||
|  | 
 | ||||||
|  | #include <causali.h> | ||||||
| 
 | 
 | ||||||
| /////////////////////////////////////////////////////////////
 | /////////////////////////////////////////////////////////////
 | ||||||
| //TDocumentoEsteso
 | //TDocumentoEsteso
 | ||||||
| @ -244,7 +250,7 @@ int TDocumentoEsteso::readat(TBaseisamfile& file, TRecnotype nrec, word lockop) | |||||||
| 
 | 
 | ||||||
| TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec) | TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec) | ||||||
|  : TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1), |  : TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1), | ||||||
|    _conai(NULL), _tic(NULL) |    _conai(NULL), _tic(NULL), _split(NULL) | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   // Inizializza i parametri di default
 |   // Inizializza i parametri di default
 | ||||||
| @ -253,20 +259,21 @@ TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec) | |||||||
| 
 | 
 | ||||||
| TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, dec_parm & parm) | TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, dec_parm & parm) | ||||||
|  : TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE),  _scadenze_current(-1), |  : TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE),  _scadenze_current(-1), | ||||||
|    _conai(NULL), _tic(NULL) |    _conai(NULL), _tic(NULL), _split(NULL) | ||||||
| {  | {  | ||||||
|   _parm = parm; |   _parm = parm; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TDocumentoEsteso::TDocumentoEsteso() | TDocumentoEsteso::TDocumentoEsteso() | ||||||
|  : TDocumento(), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1), |  : TDocumento(), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1), | ||||||
|     _conai(NULL), _tic(NULL) |     _conai(NULL), _tic(NULL), _split(NULL) | ||||||
| { } | { } | ||||||
| 
 | 
 | ||||||
| TDocumentoEsteso::~TDocumentoEsteso() | TDocumentoEsteso::~TDocumentoEsteso() | ||||||
| {  | {  | ||||||
|   if (_conai) delete _conai; |   if (_conai) delete _conai; | ||||||
|   if (_tic)   delete _tic; |   if (_tic)   delete _tic; | ||||||
|  |   if (_split) delete _split; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TDocumentoEsteso::set_riga_conai() | void TDocumentoEsteso::set_riga_conai() | ||||||
| @ -276,7 +283,7 @@ void TDocumentoEsteso::set_riga_conai() | |||||||
|     delete _conai; |     delete _conai; | ||||||
|     _conai = NULL; |     _conai = NULL; | ||||||
|   } |   } | ||||||
|   if (rows() > 0) |   if (physical_rows() > 0) | ||||||
|   { |   { | ||||||
| 		const bool has_conai = (tipo().add_conai() && clifor().vendite().get_bool(CFV_CONAIASS)); | 		const bool has_conai = (tipo().add_conai() && clifor().vendite().get_bool(CFV_CONAIASS)); | ||||||
| 		if (has_conai) | 		if (has_conai) | ||||||
| @ -318,11 +325,49 @@ void TDocumentoEsteso::set_riga_tic() | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool TDocumentoEsteso::is_split_payment() const  | ||||||
|  | { | ||||||
|  |   const long numregcg = get_long(DOC_NUMREG); | ||||||
|  |   if (numregcg > 0) | ||||||
|  |   { | ||||||
|  |     const TRectype& mov = cache().get(LF_MOV, numregcg); | ||||||
|  |     if (!mov.empty()) | ||||||
|  |       return ::is_split_payment(mov); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   bool yes =  get_int(DOC_ANNO) >= 2015 && clifor().get_bool(CLI_SPLITPAY) &&  | ||||||
|  |               (is_fattura() || is_nota_credito()) && !imposta().is_zero() && ritenute().is_zero(); | ||||||
|  |   if (yes) | ||||||
|  |   { | ||||||
|  |     const TRectype& causale = cache().get(LF_CAUSALI, tipo().causale()); | ||||||
|  |     const int rsi = causale.get_int(CAU_REGSPIVA); | ||||||
|  |     yes = rsi != 13 && rsi != 50 && rsi != 51; // No reverse charge
 | ||||||
|  |   } | ||||||
|  |   return yes; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TDocumentoEsteso::set_riga_split() | ||||||
|  | {                                   | ||||||
|  |   if (_split != NULL) | ||||||
|  |   { | ||||||
|  |     delete _split; | ||||||
|  |     _split = NULL; | ||||||
|  |   } | ||||||
|  |   if (is_split_payment()) | ||||||
|  |   { | ||||||
|  |     _split = new TRiga_documento(this, "05");  | ||||||
|  | 		TString split = esc(ini_get_string(CONFIG_DITTA, "ve", "DESCSPLIT", TR("SCISSIONE DEI PAGAMENTI Art.17-ter D.P.R. 633/72"))); | ||||||
|  |     if (split[0] > ' ') split.insert("\n"); | ||||||
|  |     _split->set_descr(split); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int TDocumentoEsteso::rows() const  | int TDocumentoEsteso::rows() const  | ||||||
| {  | {  | ||||||
|   int n = TDocumento::rows();  |   int n = TDocumento::rows();  | ||||||
|   if (_conai) n++; |   if (_conai) n++; | ||||||
|   if (_tic) n++; |   if (_tic)   n++; | ||||||
|  |   if (_split) n++; | ||||||
|   return n;  |   return n;  | ||||||
| }  | }  | ||||||
| 
 | 
 | ||||||
| @ -331,10 +376,12 @@ TRiga_documento& TDocumentoEsteso::row(int index) | |||||||
|   const int n = TDocumento::rows();  |   const int n = TDocumento::rows();  | ||||||
|   if (index > n) |   if (index > n) | ||||||
|   { |   { | ||||||
|     if (_conai != NULL && _tic != NULL) |     TRiga_documento* extra[4] = { NULL }; | ||||||
| 	   	return index == n+1 ? *_conai : *_tic; |     int ne = 0; | ||||||
|     else |     if (_conai) extra[ne++] = _conai; | ||||||
| 	   	return _conai ? *_conai : *_tic; |     if (_tic  ) extra[ne++] = _tic; | ||||||
|  |     if (_split) extra[ne++] = _split; | ||||||
|  |     return *extra[index-n-1]; | ||||||
|   } |   } | ||||||
| 	return TDocumento::row(index); | 	return TDocumento::row(index); | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								ve/velib05.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ve/velib05.h
									
									
									
									
									
								
							| @ -22,6 +22,7 @@ class TDocumentoEsteso : public TDocumento | |||||||
| 	dec_parm _parm;									// Parametri per gli arrotondamenti
 | 	dec_parm _parm;									// Parametri per gli arrotondamenti
 | ||||||
| 	TRiga_documento* _conai; | 	TRiga_documento* _conai; | ||||||
|   TRiga_documento* _tic; |   TRiga_documento* _tic; | ||||||
|  |   TRiga_documento* _split; | ||||||
| 
 | 
 | ||||||
| 	// membri per il calcolo del riepilogo IVA
 | 	// membri per il calcolo del riepilogo IVA
 | ||||||
| 
 | 
 | ||||||
| @ -51,13 +52,14 @@ public: | |||||||
| 	int	summary_items() { return tabella_iva().items();} // ritorna il numero di righe in totale della tabellina
 | 	int	summary_items() { return tabella_iva().items();} // ritorna il numero di righe in totale della tabellina
 | ||||||
| 	const TAssoc_array& summary() const { return _summary_table; } | 	const TAssoc_array& summary() const { return _summary_table; } | ||||||
| 	const TArray& summary_array() const { return _summary_array;} | 	const TArray& summary_array() const { return _summary_array;} | ||||||
| 	 |   bool is_split_payment() const; | ||||||
|  | 
 | ||||||
| 	// Funzioni per il ricalcolo delle scadenze
 | 	// Funzioni per il ricalcolo delle scadenze
 | ||||||
| 	void scadenze_reset(); // riposiziona sulla prima scadenza
 | 	void scadenze_reset(); // riposiziona sulla prima scadenza
 | ||||||
| 	void scadenze_recalc(); // resetta e ricalcola le scadenze
 | 	void scadenze_recalc(); // resetta e ricalcola le scadenze
 | ||||||
| 	void scadenze_set_next(); // seleziona il prossimo elemento dell'array delle scadenze
 | 	void scadenze_set_next(); // seleziona il prossimo elemento dell'array delle scadenze
 | ||||||
| 	const char * scadenze_get(const TString& w); // reperisce l'informazione richiesta dall'elemento corrente
 | 	const char * scadenze_get(const TString& w); // reperisce l'informazione richiesta dall'elemento corrente
 | ||||||
| 	int	scadenze_items() { return _scadenze_array.items(); }	// restituisce il numero di scadenze
 | 	int	scadenze_items() const { return _scadenze_array.items(); }	// restituisce il numero di scadenze
 | ||||||
| 	TString_array& scadenze() { return _scadenze_array; } | 	TString_array& scadenze() { return _scadenze_array; } | ||||||
| 
 | 
 | ||||||
| 	// restituisce tot_imponibili, tot_esenti, tot_nonsoggetti a seconda del selettore:	
 | 	// restituisce tot_imponibili, tot_esenti, tot_nonsoggetti a seconda del selettore:	
 | ||||||
| @ -72,8 +74,9 @@ public: | |||||||
| 	virtual int rows() const; | 	virtual int rows() const; | ||||||
| 	virtual TRiga_documento& row(int index); | 	virtual TRiga_documento& row(int index); | ||||||
| 
 | 
 | ||||||
| 	void set_riga_conai(); |   void set_riga_conai(); | ||||||
|   void set_riga_tic(); |   void set_riga_tic(); | ||||||
|  |   void set_riga_split(); | ||||||
| 	 | 	 | ||||||
| 	// Funzioni per settare i parametri
 | 	// Funzioni per settare i parametri
 | ||||||
| 	void set_decimals(const dec_parm & parm) { _parm = parm ; } | 	void set_decimals(const dec_parm & parm) { _parm = parm ; } | ||||||
| @ -85,3 +88,4 @@ public: | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1195,11 +1195,13 @@ void TDocumento_mask::cli2mask(bool force_load) | |||||||
| 		set_or_def(F_CATVEN, ven_rec.get(CFV_CATVEN)); | 		set_or_def(F_CATVEN, ven_rec.get(CFV_CATVEN)); | ||||||
| 
 | 
 | ||||||
|     const int alleg = c.get_int(CLI_ALLEG); |     const int alleg = c.get_int(CLI_ALLEG); | ||||||
|     const bool ivadiff = (alleg == 7) && ven_rec.get_bool(CFV_FATTSOSP); |     const TDate datadoc = doc().get(DOC_DATADOC); | ||||||
|  | 
 | ||||||
|  |     const bool split_payment = datadoc.year() >= 2015 && c.get_bool(CLI_SPLITPAY); | ||||||
|  |     const bool ivadiff = !split_payment && alleg == 7 && ven_rec.get_bool(CFV_FATTSOSP); | ||||||
| 		set(F_LIQDIFF, ivadiff ? "X" : ""); | 		set(F_LIQDIFF, ivadiff ? "X" : ""); | ||||||
| 
 | 
 | ||||||
|     const TDate datadoc = doc().get(DOC_DATADOC); |     const bool IVAxCassa = !split_payment && !ivadiff && alleg < 5 && gestione_IVAxCassa(datadoc);  | ||||||
|     const bool IVAxCassa = !ivadiff && (alleg < 5 || alleg == 7) && gestione_IVAxCassa(datadoc);  |  | ||||||
| 		set(F_IVAXCASSA, IVAxCassa ? "X" : ""); | 		set(F_IVAXCASSA, IVAxCassa ? "X" : ""); | ||||||
| 
 | 
 | ||||||
| 		pos = id2pos(F_CODLIST);	 | 		pos = id2pos(F_CODLIST);	 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user