Patch level : 12.0 728
Files correlati : ve Commento : Aggiunta scritta valenza fiscale nella stampa documento come nuova riga logica
This commit is contained in:
		
							parent
							
								
									1c79b335aa
								
							
						
					
					
						commit
						a3607965b6
					
				@ -750,6 +750,7 @@ class TDocumento : public TMultiple_rectype	// velib03
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	TRiga_documento * _sconto;		// Riga per lo sconto di testata
 | 
						TRiga_documento * _sconto;		// Riga per lo sconto di testata
 | 
				
			||||||
	TRiga_documento * _esenzione; // Riga per l' esenzione iva
 | 
						TRiga_documento * _esenzione; // Riga per l' esenzione iva
 | 
				
			||||||
 | 
						TRiga_documento * _valfisc;		// Riga di valenza fiscale per fatture 2019+
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	bool _dirty_deny;
 | 
						bool _dirty_deny;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -820,7 +821,7 @@ public:
 | 
				
			|||||||
  void sort_rows(const char * key);
 | 
					  void sort_rows(const char * key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int physical_rows() const { return	body().rows(); } 
 | 
						int physical_rows() const { return	body().rows(); } 
 | 
				
			||||||
	virtual int rows() const { return physical_rows() + (ha_riga_sconto() ? 1 : 0) + (ha_riga_esenzione() ? 1 : 0); } 
 | 
						virtual int rows() const { return physical_rows() + (ha_riga_sconto() ? 1 : 0) + (ha_riga_esenzione() ? 1 : 0) + (ha_riga_valfisc() ? 1 : 0); }
 | 
				
			||||||
	const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)((TDocumento *)this)->row(index); }
 | 
						const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)((TDocumento *)this)->row(index); }
 | 
				
			||||||
	TRiga_documento& operator[](int index) { return (TRiga_documento&)row(index); } 
 | 
						TRiga_documento& operator[](int index) { return (TRiga_documento&)row(index); } 
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@ -890,9 +891,11 @@ public:
 | 
				
			|||||||
	void set_fields(TAuto_variable_rectype & rec);
 | 
						void set_fields(TAuto_variable_rectype & rec);
 | 
				
			||||||
	void update_esenzione();
 | 
						void update_esenzione();
 | 
				
			||||||
	void set_riga_esenzione();
 | 
						void set_riga_esenzione();
 | 
				
			||||||
 | 
						void set_riga_valfisc();
 | 
				
			||||||
	const TRiga_documento&  get_riga_esenzione() const { return *_esenzione; }
 | 
						const TRiga_documento&  get_riga_esenzione() const { return *_esenzione; }
 | 
				
			||||||
  bool ha_riga_sconto() const { return _sconto != NULL; }
 | 
					  bool ha_riga_sconto() const { return _sconto != NULL; }
 | 
				
			||||||
  bool ha_riga_esenzione() const { return _esenzione != NULL; }
 | 
					  bool ha_riga_esenzione() const { return _esenzione != NULL; }
 | 
				
			||||||
 | 
						bool ha_riga_valfisc() const { return _valfisc != NULL; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void iva_esente(TString & codiva_es) const;
 | 
						void iva_esente(TString & codiva_es) const;
 | 
				
			||||||
	real spese_incasso(real &imp, int ndec, TTipo_importo netto = _lordo) const ;
 | 
						real spese_incasso(real &imp, int ndec, TTipo_importo netto = _lordo) const ;
 | 
				
			||||||
 | 
				
			|||||||
@ -250,7 +250,7 @@ void TDocumento::init()
 | 
				
			|||||||
  _codcf     = new TRecfield(*this, DOC_CODCF);
 | 
					  _codcf     = new TRecfield(*this, DOC_CODCF);
 | 
				
			||||||
  _cod_occas = new TRecfield(*this, DOC_OCFPI);
 | 
					  _cod_occas = new TRecfield(*this, DOC_OCFPI);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _sconto = _esenzione = NULL;
 | 
					  _sconto = _esenzione = _valfisc = NULL;
 | 
				
			||||||
  _stato_originale = ' ';
 | 
					  _stato_originale = ' ';
 | 
				
			||||||
  _dirty_deny = false;
 | 
					  _dirty_deny = false;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@ -306,6 +306,7 @@ TDocumento::~TDocumento()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (_sconto != NULL) delete _sconto;
 | 
					  if (_sconto != NULL) delete _sconto;
 | 
				
			||||||
  if (_esenzione != NULL) delete _esenzione;
 | 
					  if (_esenzione != NULL) delete _esenzione;
 | 
				
			||||||
 | 
						if (_valfisc != NULL) delete _valfisc;
 | 
				
			||||||
}  
 | 
					}  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TString& TDocumento::codiva_spese() const 
 | 
					const TString& TDocumento::codiva_spese() const 
 | 
				
			||||||
@ -820,7 +821,10 @@ void TDocumento::on_read(int err, word lockop)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  set_riga_sconto();
 | 
					  set_riga_sconto();
 | 
				
			||||||
	if (is_fattura())
 | 
						if (is_fattura())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		set_riga_esenzione();
 | 
							set_riga_esenzione();
 | 
				
			||||||
 | 
							set_riga_valfisc();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
  _stato_originale = stato();
 | 
					  _stato_originale = stato();
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
#ifdef LIVE_STATISTICS
 | 
					#ifdef LIVE_STATISTICS
 | 
				
			||||||
@ -1004,15 +1008,15 @@ void TDocumento::set_riga_esenzione()
 | 
				
			|||||||
  TString16 v_data_esenzione;
 | 
					  TString16 v_data_esenzione;
 | 
				
			||||||
  TString16 n_registrazione; 
 | 
					  TString16 n_registrazione; 
 | 
				
			||||||
  TString16 n_data_registrazione;
 | 
					  TString16 n_data_registrazione;
 | 
				
			||||||
	bool multiPlaf = c.use_lettere() && get("PLAFOND").full();		// Gestione multiplafond su documento
 | 
					  const bool multi_plaf = c.use_lettere() && get("PLAFOND").full();		// Gestione multiplafond su documento
 | 
				
			||||||
	if (codes.codice().full() && !multiPlaf)
 | 
						if (codes.codice().full() && !multi_plaf)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		get_protocolli_esenzione(v_esenzione, v_data_esenzione, n_registrazione, n_data_registrazione);
 | 
							get_protocolli_esenzione(v_esenzione, v_data_esenzione, n_registrazione, n_data_registrazione);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Tradotto: se ha il cod. esenzione AND (i protocolli pieni OR multiplaf)
 | 
						// Tradotto: se ha il cod. esenzione AND (i protocolli pieni OR multiplaf)
 | 
				
			||||||
  bool esente = codes.tipo().not_empty() && ((v_esenzione.not_empty() &&
 | 
					  bool esente = codes.tipo().not_empty() && ((v_esenzione.not_empty() &&
 | 
				
			||||||
                v_data_esenzione.not_empty() && n_registrazione.not_empty() &&  
 | 
					                v_data_esenzione.not_empty() && n_registrazione.not_empty() &&  
 | 
				
			||||||
                n_data_registrazione.not_empty()) || multiPlaf);
 | 
					                n_data_registrazione.not_empty()) || multi_plaf);
 | 
				
			||||||
  if (esente)                         
 | 
					  if (esente)                         
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    esente = false;
 | 
					    esente = false;
 | 
				
			||||||
@ -1054,7 +1058,7 @@ void TDocumento::set_riga_esenzione()
 | 
				
			|||||||
      _esenzione = new TRiga_documento(this, _tipo_riga_es); 
 | 
					      _esenzione = new TRiga_documento(this, _tipo_riga_es); 
 | 
				
			||||||
    TString d = _des_esenz;
 | 
					    TString d = _des_esenz;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if(multiPlaf)
 | 
							if(multi_plaf)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			d << " come dalle vostre dichiarazioni:\n";
 | 
								d << " come dalle vostre dichiarazioni:\n";
 | 
				
			||||||
			TToken_string lePlafs(get("PLAFOND"), ',');
 | 
								TToken_string lePlafs(get("PLAFOND"), ',');
 | 
				
			||||||
@ -1077,6 +1081,19 @@ void TDocumento::set_riga_esenzione()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TDocumento::set_riga_valfisc()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						static TDate anno_fatt_elett = TDate(01, 01, 2019);
 | 
				
			||||||
 | 
						if(is_fattura() && tipo().tipo_doc_sdi().full() && data() >= anno_fatt_elett)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (_valfisc == nullptr)
 | 
				
			||||||
 | 
								_valfisc = new TRiga_documento(this, "05");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Uno \n all'inizio per staccarla dal resto, ATTENZIONE!!! Senza lo spazio iniziale scrive solo una parte di questo messaggio!
 | 
				
			||||||
 | 
							_valfisc->set_descr(" \nStampa priva di valenza giuridico-fiscale ai sensi dell'art.21 DPR 633/72, salvo per i soggetti non titolari di partita iva e/o non residenti ai sensi del comma 909 art.1 L.205/2017.");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					                                 
 | 
				
			||||||
void TDocumento::dirty_fields()
 | 
					void TDocumento::dirty_fields()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (!_dirty_deny)
 | 
					  if (!_dirty_deny)
 | 
				
			||||||
@ -1933,14 +1950,30 @@ TRiga_documento & TDocumento::row(int index)
 | 
				
			|||||||
  }         
 | 
					  }         
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {             
 | 
					  {             
 | 
				
			||||||
    CHECKD((index == nrows + 1 && (_sconto != NULL || _esenzione != NULL)) || (index == nrows + 2 && _sconto != NULL && _esenzione != NULL),
 | 
					
 | 
				
			||||||
           "Riga documento non esistente ", index);
 | 
					    CHECKD(index <= rows(), "Riga documento non esistente ", index);
 | 
				
			||||||
    if (index == nrows + 1)
 | 
					
 | 
				
			||||||
 | 
							switch (index - nrows)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							case 1:
 | 
				
			||||||
 | 
								if (_sconto != NULL)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									r = _sconto;
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							case 2:
 | 
				
			||||||
 | 
								if (_esenzione != NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
      r = _sconto != NULL ? _sconto : _esenzione;
 | 
					 | 
				
			||||||
    } else
 | 
					 | 
				
			||||||
    if (index == nrows + 2)
 | 
					 | 
				
			||||||
				r = _esenzione;
 | 
									r = _esenzione;
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							case 3:
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									r = _valfisc;
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }       
 | 
					  }       
 | 
				
			||||||
  return *r;
 | 
					  return *r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -2730,7 +2763,10 @@ TDocumento& TDocumento::copy(const TDocumento & d)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  set_riga_sconto();
 | 
					  set_riga_sconto();
 | 
				
			||||||
	if (is_fattura())
 | 
						if (is_fattura())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		set_riga_esenzione();
 | 
							set_riga_esenzione();
 | 
				
			||||||
 | 
							set_riga_valfisc();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
  _occas = d.occas();
 | 
					  _occas = d.occas();
 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user