Aggiunto metodo TRiga_documento::tipo_valido() per sapere se il tipo di

riga non e' vuoto. Corretto errore su bolli() e sul settaggio del tipo di
riga in caso di descrizione di riferimento.


git-svn-id: svn://10.65.10.50/trunk@3829 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-10-26 11:15:22 +00:00
parent 4e9575b1a5
commit e7a8be7908
2 changed files with 17 additions and 12 deletions

View File

@ -620,6 +620,7 @@ real TDocumento::bolli(real & imp, int ndec, bool netto) const
for (int i = 0; i < nscagl - 1; i++)
if ((real &) sca_bolli[i] >= imp)
break;
if (imp_bolli.items() > 0)
tot_bolli += (real &) imp_bolli[i];
}
break;
@ -1344,7 +1345,7 @@ bool TRiga_documento::sola_descrizione() const
void TRiga_documento::forza_sola_descrizione()
{
// In realta' il test serve anche a caricare la lista dei tipi riga!
if (tipo().tipo() != 'D')
if (!tipo_valido() || tipo().tipo() != 'D')
{
_tipi.restart();
for (const TObject* o = _tipi.get(); o; o = _tipi.get())
@ -1552,6 +1553,8 @@ void TRiga_documento::dirty_fields(bool dirty_document)
bool TRiga_documento::doc_dependent() const
{
if (tipo_valido())
{
const char tipor = tipo().tipo();
if (tipor == 'S')
@ -1559,21 +1562,22 @@ bool TRiga_documento::doc_dependent() const
else
if (tipor == 'C')
return get("SCONTO").not_empty();
}
return FALSE;
}
void TRiga_documento::put_str(const char* fieldname, const char* val)
{
if (strcmp(fieldname, "TIPORIGA") == 0 && TRectype::get("TIPORIGA") != val)
TString v(val);
if (strcmp(fieldname, "TIPORIGA") == 0 && TRectype::get("TIPORIGA") != v)
{
TAuto_variable_rectype::put_str(fieldname, val);
TAuto_variable_rectype::put_str(fieldname, v);
reset_fields(*this);
set_fields(*this);
}
else
{
TAuto_variable_rectype::put_str(fieldname, val);
TAuto_variable_rectype::put_str(fieldname, v);
dirty_fields();
}
}

View File

@ -280,6 +280,7 @@ public:
static const TIVA & iva(const char * codice);
const TIVA & iva() const {const TString16 cod(get("CODIVA")); return iva(cod);}
const bool tipo_valido() const { return get("TIPORIGA").not_empty(); }
void set_tipo(const char * tipo) { put("TIPORIGA", tipo);}
bool sola_descrizione() const;
void forza_sola_descrizione();