Patch level : 2.2 no patch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Aggiunta la funzione cost2revenue per fatturara le risorse e le attrezzature


git-svn-id: svn://10.65.10.50/trunk@12961 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2005-04-19 10:09:52 +00:00
parent 2881f95a20
commit 701c1e8b2b
2 changed files with 27 additions and 9 deletions

View File

@ -126,14 +126,14 @@ public:
const TString& field_perc() const { return get("S5"); }
const TString & um() const { return get("S7"); }
const TString& cod_iva() const { return get("S3").left(4); }
const TString& revenue() const { return get("S5"); }
real prezzo() const { return get_real("R0"); }
real qta() const { return get_real("R1"); }
real perc() const { return get_real("R2"); }
char tipo() const { return get_char("S6"); }
char tipo_ritenuta() const { return get_char("S9"); }
const TString & tipo_riga() const { return get("S8"); }
char genere() const { return get("COD") == "SPP" ? 'S' : 'P'; }
TSpesa_prest(const char* codice = NULL, char tipo = 'S');
TSpesa_prest(const TRectype& rec);
virtual ~TSpesa_prest() {}
@ -447,13 +447,15 @@ public:
void set_numero(int numero) { put(RDOC_NRIGA, numero);}
bool is_generata() const { return get_bool(RDOC_GENERATA);}
void generata(bool on = TRUE) { put(RDOC_GENERATA, on);}
bool is_merce() const { return tipo().tipo() == 'M';}
bool is_spese() const { return tipo().tipo() == 'S';}
bool is_prestazione() const { return tipo().tipo() == 'P';}
bool is_sconto() const {return tipo().tipo() == 'C';}
bool is_sconto_perc() const { return get(RDOC_SCONTO).not_empty();}
bool is_omaggio() const { return tipo().tipo() == 'O';}
bool is_descrizione() const { return tipo().tipo() == 'D';}
bool is_merce() const { return tipo().tipo() == RIGA_MERCE;}
bool is_spese() const { return tipo().tipo() == RIGA_SPESEDOC;}
bool is_prestazione() const { return tipo().tipo() == RIGA_PRESTAZIONI;}
bool is_risorsa() const { return tipo().tipo() == RIGA_RISORSE;}
bool is_attrezzatura() const { return tipo().tipo() == RIGA_ATTREZZATURE;}
bool is_sconto() const {return tipo().tipo() == RIGA_SCONTI;}
bool is_sconto_perc() const { return is_sconto() && get(RDOC_SCONTO).not_empty();}
bool is_omaggio() const { return tipo().tipo() == RIGA_OMAGGI;}
bool is_descrizione() const { return tipo().tipo() == RIGA_DESCRIZIONI;}
bool is_articolo() const;
bool is_checked() const { return get_bool(RDOC_CHECKED);}
bool is_evadibile() const { return is_merce() || is_omaggio() || is_spese() || is_prestazione(); }
@ -490,6 +492,7 @@ public:
virtual TRectype& operator =(const TRectype & r);
virtual TRectype& operator =(const char * r);
void cost2revenue();
bool raggruppabile(const TRiga_documento& r, TToken_string& campi) const;
TRiga_documento& operator +=(const TRiga_documento& r);

View File

@ -370,6 +370,21 @@ TRectype & TRiga_documento::operator =(const char * r)
}
// Ritorna TRUE se le due righe del documento possono essere sommate
void TRiga_documento::cost2revenue()
{
if (is_attrezzatura() || is_risorsa())
{
const TSpesa_prest & s = spesa();
const TString4 tipo(s.tipo());
const TString codice(s.revenue());
if (tipo.not_empty())
put(RDOC_TIPORIGA, tipo);
if (codice.not_empty())
put(RDOC_TIPORIGA, codice);
}
}
bool TRiga_documento::raggruppabile(const TRiga_documento& r, TToken_string& campi) const
{
bool ok = TRUE;