Patch level : 10.0 740
Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento Bug 0001628: Gestione righe spese automatiche Se un tipo documento prevede l'addebito automatico delle spese cli/for, durante l'evasione di un ordine che contiene le stesse righe spese queste non vengono riportate sul documento destinazione, ma in questo modo perdo le impostazioni inserite sull'ordine come ad esempio la perc di indetraibilità Bug 0001627: Evasione righe spese in percentuale Durante l'evazione dei documenti di tipo ordine, vengono evase anche le righe di tipo spesa percentuale, dove la perc viene considerata come se fosse una quantità Bug 0001629: Cancellazione perc di indetraibilità Occorre rendere opzionalmente-cancellabile il codice di indetraibilità delle righe documenti anche se la commessa è del tipo esente iva. Attualmente se cancello il codice mi viene riproposto appena esco dal campo e di fatto non posso eliminarlo. git-svn-id: svn://10.65.10.50/trunk@20450 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2f2a76fc29
commit
105d301e4d
@ -124,6 +124,9 @@ public:
|
||||
|
||||
const TString& codice() const { return get("CODTAB"); }
|
||||
char tipo() const { return get_char("S6"); }
|
||||
bool is_qtavalore() const { return tipo() == 'V'; }
|
||||
bool is_tipo() const { return tipo() == 'Q'; }
|
||||
bool is_percentuale() const { return tipo() == 'P'; }
|
||||
const TString& descrizione() const { return get("S0"); }
|
||||
const TString& field_perc() const { return get("S5"); } // Solo spese
|
||||
const TString& revenue() const { return get("S5"); } // Solo attrezzature e risorse
|
||||
@ -536,7 +539,8 @@ public:
|
||||
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(); }
|
||||
bool is_evadibile() const { return is_merce() || is_omaggio() ||
|
||||
(is_spese() && !spesa().is_percentuale()) || is_prestazione(); }
|
||||
bool is_evasa() const; // Ritorna vero se la riga è evasa
|
||||
void checked(bool on = true) { put(RDOC_CHECKED, (bool)on); }
|
||||
void unchecked() { checked(FALSE); }
|
||||
@ -549,6 +553,8 @@ public:
|
||||
|
||||
virtual void zero(const char * fieldname);
|
||||
virtual void zero(char c = '\0');
|
||||
|
||||
void cms2tipodet();
|
||||
// row -> sheet
|
||||
void autoload(TSheet_field& f);
|
||||
// sheet -> row
|
||||
|
@ -666,8 +666,13 @@ real TRiga_documento::imponibile(bool lordo) const
|
||||
}
|
||||
else
|
||||
r = get_real(field);
|
||||
if (lordo)
|
||||
r = iva().lordo(r, doc().decimals(TRUE));
|
||||
if (lordo)
|
||||
{
|
||||
if (doc().tipo().calcolo_lordo())
|
||||
r = importo(true, lordo, doc().decimals());
|
||||
else
|
||||
r = iva().lordo(r, doc().decimals(TRUE));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
return importo(true, lordo, doc().decimals());
|
||||
@ -1060,6 +1065,29 @@ void TRiga_documento::zero(char c)
|
||||
TAuto_variable_rectype::zero(c);
|
||||
}
|
||||
|
||||
void TRiga_documento::cms2tipodet()
|
||||
{
|
||||
if (doc().modificabile())
|
||||
{
|
||||
TString4 cms_tipodet;
|
||||
const TString4 tipodet = get(RDOC_TIPODET);
|
||||
TString codcms = codice_commessa();
|
||||
|
||||
if (codcms.full() && get(RDOC_CODIVA).full())
|
||||
{
|
||||
const TRectype& rec_cms = cache().get(LF_COMMESSE, codcms);
|
||||
const TString& regiva = rec_cms.get(COMMESSE_REGIVA);
|
||||
|
||||
if (regiva.full())
|
||||
cms_tipodet = (regiva == "PR") ? rec_cms.get(COMMESSE_INDETR) : "9";
|
||||
|
||||
if (cms_tipodet != tipodet)
|
||||
if (cms_tipodet == "9" || tipodet.blank())
|
||||
put( RDOC_TIPODET, cms_tipodet );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TRiga_documento::autosave(TSheet_field& f)
|
||||
{
|
||||
const int num = numero() - 1;
|
||||
@ -1162,44 +1190,13 @@ void TRiga_documento::autosave(TSheet_field& f)
|
||||
|
||||
if (m.id2pos(FR_TIPODET) >= 0 && m.field(FR_TIPODET).active()) //solo se attivo il campo di indetraibilita'...
|
||||
{
|
||||
const TString & tipodet = row.get( f.cid2index(FR_TIPODET));
|
||||
put( RDOC_TIPODET, tipodet );
|
||||
if (tipodet != "9")
|
||||
{
|
||||
TString codcms = get(RDOC_CODCMS); //dalla rigadoc
|
||||
if (codcms.blank()) //se non la trova cerca nella maschera di testata
|
||||
{
|
||||
TDocumento_mask& doc_mask = (TDocumento_mask&)f.mask();
|
||||
const short cms_start = doc_mask.cms_start();
|
||||
const short cms_end = doc_mask.cms_end();
|
||||
codcms.cut(0);
|
||||
if (cms_start > 0 && cms_end >= cms_start)
|
||||
{
|
||||
for (short j = cms_start; j <= cms_end; j++)
|
||||
{
|
||||
const TEdit_field& fld = doc_mask.efield(j);
|
||||
TString80 str = fld.get();
|
||||
str.rpad(fld.size());
|
||||
codcms << str;
|
||||
}
|
||||
codcms.rtrim();
|
||||
}
|
||||
}
|
||||
if (codcms.full() && codiva.full())
|
||||
{
|
||||
const TRectype& rec_cms = cache().get(LF_COMMESSE, codcms);
|
||||
const TString& regiva = rec_cms.get(COMMESSE_REGIVA);
|
||||
TString4 tipodet = row.get( f.cid2index(FR_TIPODET));
|
||||
|
||||
if (regiva.full())
|
||||
{
|
||||
const TString4 tipod = regiva == "PR" ? rec_cms.get(COMMESSE_INDETR) : "9";
|
||||
|
||||
put( RDOC_TIPODET, tipod );
|
||||
row.add(tipod, f.cid2index(FR_TIPODET));
|
||||
m.set(FR_TIPODET, tipod);
|
||||
}
|
||||
}
|
||||
} //if(tipodet!=9)
|
||||
put(RDOC_TIPODET, tipodet);
|
||||
cms2tipodet();
|
||||
tipodet = get(RDOC_TIPODET);
|
||||
row.add(tipodet, f.cid2index(FR_TIPODET));
|
||||
m.set(FR_TIPODET, tipodet);
|
||||
} //if(m.field(...
|
||||
|
||||
// Salvo i campi con un FIELD manuale
|
||||
|
@ -2764,6 +2764,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
|
||||
riga.put(RDOC_CODCOSTO, sp.cdc());
|
||||
riga.put(RDOC_CODCMS, sp.cms());
|
||||
riga.put(RDOC_FASCMS, sp.fase());
|
||||
riga.cms2tipodet();
|
||||
|
||||
if (interactive)
|
||||
{
|
||||
|
@ -2660,7 +2660,30 @@ bool codcms_handler(TMask_field& f, KEY key)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((key == K_TAB && f.focusdirty()))
|
||||
{
|
||||
TDocumento & doc = mask.doc();
|
||||
|
||||
if (!doc.bloccato())
|
||||
{
|
||||
char name[8] = "CODSP0";
|
||||
TString_array spese;
|
||||
|
||||
const TRectype & ven_rec = doc.clifor().vendite();
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
name[5] = '0' + i;
|
||||
const TString& s = ven_rec.get(name);
|
||||
if (s.full())
|
||||
spese.add(s);
|
||||
}
|
||||
mask.mask2doc();
|
||||
doc.put(DOC_SPESEUPD, "");
|
||||
doc.update_spese_aut(spese, false, &mask.sfield(F_SHEET));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if (key == K_TAB && !mask.is_running())
|
||||
|
Loading…
x
Reference in New Issue
Block a user