Patch level : 12.0 1050

Files correlati     : ve0.exe
Commento        :

Sistemata la ricerca del codice iva nelle condizioni di vendita

Interno:

La ricerca era implementata con un trucco che le mofdifiche per il reverse charge parziale hanno evidenziato
This commit is contained in:
Alessandro Bonazzi 2021-04-08 00:05:35 +02:00
parent 20f951ae3e
commit 4259bc9d53
5 changed files with 30 additions and 11 deletions

View File

@ -566,7 +566,20 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
}
set_prezzo(prezzo, valuta);
set_iva(_anamag.get(_ivarid ? ANAMAG_CODIVAR : ANAMAG_CODIVA));
TString codiva = _anamag.get(_ivarid ? ANAMAG_CODIVAR : ANAMAG_CODIVA);
if (_testa != nullptr)
{
TString cod = _testa->condv().clifo().vendite().get(CFV_ASSFIS);
if (cod.blank())
cod =_testa->doc().codesiva();
if (cod.full())
codiva = cod;
}
set_iva(codiva);
// Gestione sconti di riga
const char gestione1 = ini_get_string(CONFIG_DITTA, "ve", "GESSCORIGA")[0];

View File

@ -138,8 +138,8 @@ void TMotore_application::init_insert_mode( TMask& m )
const TTipo_documento& tp = curdo.tipo();
const char stato = tp.stato_finale_inserimento();
curdo.stato(stato);
curdo.stato(stato);
_codnum = codnum;
_tipodoc = m.get(F_TIPODOC);
@ -152,7 +152,8 @@ void TMotore_application::init_insert_mode( TMask& m )
m.set(F_CODNUMRIF, codnum);
// Giro per supplire alla mancanza di una TMask::set(short id, char c);
char str_stato[2] = { stato, '\0' };
TString4 str_stato; str_stato << stato;
m.set(F_STATO, str_stato);
TDate data_doc(TODAY);

View File

@ -796,7 +796,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
{
TCond_vendita cv(NULL, NULL);
cv.set_sconto(get("SCONTO"));
cv.set_sconto(get(RDOC_SCONTO));
if (cv.get_sconto().full())
{
importo = doc().basesconto();
@ -1457,6 +1457,7 @@ void TRiga_documento::autosave(TSheet_field& f)
const int prezzo_id = f.cid2index(FR_PREZZO);
real prezzo(row.get(prezzo_id));
const TString4 codiva(row.get(f.cid2index(FR_CODIVA)));
if (doc().tipo().calcolo_lordo())
{
put(RDOC_PREZZOL, prezzo);
@ -1592,6 +1593,7 @@ void TRiga_documento::autoload(TSheet_field & f)
const TString4 codiva(get(RDOC_CODIVA));
real prezzo = get_real(RDOC_PREZZO);
if (doc().tipo().calcolo_lordo())
{
const real prezzol = get_real(RDOC_PREZZOL);

View File

@ -622,8 +622,7 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
real impon;
const bool sconto_lordo = t.tipo() != RIGA_SCONTI && _contsclor && _sco_perc_bill.ok();
const int firmdec = TCurrency::get_firm_dec();
const TRectype * rdoc = r.find_original_rdoc();
const TRectype * rdoc = r.find_original_rdoc();
if (rdoc != NULL && rdoc->get(RDOC_PROVV).not_empty())
{
@ -2656,10 +2655,13 @@ error_type TContabilizzazione::compile_rows_mov_re(TDocumento& doc)
if (good())
{
int righe = _movimento->iva_items();
for (int i=0; i<righe; i++)
for (int i = 0; i < righe; i++)
_movimento->add_row_re(i);
righe = _movimento->cg_items();
int row_to_add = righe - 1;
for (int j = row_to_add; j >= 0; j--)
if (!_movimento->add_row_cp_re(row_to_add))
row_to_add--;

View File

@ -598,27 +598,28 @@ bool iva_handler( TMask_field& f, KEY key )
TDocumento_mask & mask = (TDocumento_mask &) f.mask().get_sheet()->mask();
TMask & row_mask = f.mask();
if (key == 0 || (key == K_ENTER && f.empty()))
if (key == K_ENTER && f.empty())
{
const TString& codiva = mask.condv().clifo().vendite().get(CFV_ASSFIS);
if (codiva.full())
f.set(codiva);
f.check();
}
if (key == 0 || (key == K_ENTER && f.empty()))
if (key == K_ENTER && f.empty())
{
const TString& codiva = mask.doc().codesiva();
if (codiva.full())
f.set(codiva);
f.check();
}
if (key == K_ENTER && /*f.focusdirty() &&*/ f.empty())
if (key == K_ENTER && f.empty())
{
const int r = row_mask.get_sheet()->selected() + 1;
const TRiga_documento& riga = mask.doc()[r];
const int pos_ai = row_mask.id2pos(FR_ADDIVA);
bool addiva = false;