Patch level : 12.0 1066
Files correlati : ve0.exe ve6.exe Commento : Corretta la ricerca della causale quando è impostato il tipo documento SDI. Interno : Controllare un pò di contabilizzazioni
This commit is contained in:
parent
aa482813dc
commit
9a1ebb700e
@ -560,9 +560,9 @@ static TBill _conto_sto; // Conto per storno articoli Omaggio
|
||||
static bool _contsclor; // Contabilizza sconti al netto o al lordo (sconti suddiviso per ogni contropartita)
|
||||
//static bool _loaded = false;// Flag per evitare di caricare i parametri più di una volta
|
||||
|
||||
static TCausale *_caus = NULL; // causale del documento corrente
|
||||
static TMovimentoPN_VE *_movimento = NULL; // Movimento di prima nota documento vendita
|
||||
static TMovimentoPN *_anticipo = NULL; // Movimento di prima nota relativamente all'anticipo indicato sul documento
|
||||
static TCausale *_caus = nullptr; // causale del documento corrente
|
||||
static TMovimentoPN_VE *_movimento = nullptr; // Movimento di prima nota documento vendita
|
||||
static TMovimentoPN *_anticipo = nullptr; // Movimento di prima nota relativamente all'anticipo indicato sul documento
|
||||
|
||||
class TIVA_array : public TAssoc_array
|
||||
{
|
||||
@ -805,8 +805,8 @@ void TContabilizzazione::init()
|
||||
_error = no_error;
|
||||
_nrow = 0;
|
||||
_total_docs = 0L;
|
||||
_caus = NULL;
|
||||
_viswin = NULL;
|
||||
_caus = nullptr;
|
||||
_viswin = nullptr;
|
||||
}
|
||||
|
||||
TContabilizzazione::TContabilizzazione(const char* cod) : TElaborazione(cod)
|
||||
@ -1042,18 +1042,20 @@ TCausale* TContabilizzazione::get_caus(const TDocumento& doc, const int year) co
|
||||
|
||||
if (main_app().has_module(F9AUT, CHK_DONGLE))
|
||||
{
|
||||
const TString & tipodoc = doc.get(DOC_TIPODOCSDI);
|
||||
const TString & tipodocsdi = doc.get(DOC_TIPODOCSDI);
|
||||
|
||||
if (tipodoc.full())
|
||||
if (tipodocsdi.full())
|
||||
{
|
||||
const TString & tipodoc_cont = cached_causale(doc.tipo().causale(), year).tipodoc();
|
||||
|
||||
#ifdef NEW_FP
|
||||
TClasse_doc * classe = __cats.tipo2class(tipodoc);
|
||||
TClasse_doc * classe = __cats.tipo2class(tipodocsdi, tipodoc_cont);
|
||||
|
||||
if (classe != nullptr)
|
||||
|
||||
codcaus = classe->caus_cont();
|
||||
#else
|
||||
codcaus =__cats.tipo2caus_cont(tipodoc);
|
||||
codcaus =__cats.tipo2caus_cont(tipodocsdi, tipodoc_cont);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1084,12 +1086,8 @@ TCausale* TContabilizzazione::get_caus(const TDocumento& doc, const int year) co
|
||||
codcaus = doc.tipo().causale(); // Istanzia la causale del documento corrente...
|
||||
}
|
||||
|
||||
if (_caus != nullptr && _caus->codice() == codcaus && _caus->reg().year() == year)
|
||||
return _caus;
|
||||
if (_caus != nullptr)
|
||||
safe_delete(_caus);
|
||||
if (codcaus.full())
|
||||
_caus = new TCausale(codcaus, year);
|
||||
_caus = (TCausale *) &cached_causale(codcaus, year);
|
||||
|
||||
return _caus;
|
||||
}
|
||||
@ -1176,7 +1174,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
_caus = get_caus(doc, data_reg.year());
|
||||
|
||||
_righe_iva->set_caus(_caus);
|
||||
if (_caus == NULL || !_caus->ok())
|
||||
if (_caus == nullptr || !_caus->ok())
|
||||
{
|
||||
_error = caus_error;
|
||||
return _error;
|
||||
@ -1563,7 +1561,7 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
|
||||
// Istanzia la causale del documento corrente...
|
||||
|
||||
_caus = get_caus(doc, data_reg.year());
|
||||
if (_caus == NULL || !_caus->ok() || _caus->iva() != nessuna_iva)
|
||||
if (_caus == nullptr || !_caus->ok() || _caus->iva() != nessuna_iva)
|
||||
{
|
||||
_error = causre_error;
|
||||
return _error;
|
||||
@ -3424,11 +3422,14 @@ error_type TContabilizzazione::compile_head_anticipo(TDocumento& doc, const TMov
|
||||
TString descr;
|
||||
|
||||
TString8 codcaus = doc.clifor().vendite().get(CFV_CODCAUSINC);
|
||||
|
||||
if (codcaus.blank())
|
||||
codcaus = doc.tipo().caus_anticipo();
|
||||
|
||||
const TDate datareg = movimento.curr().get_date(MOV_DATAREG);
|
||||
|
||||
if (!_caus->read(codcaus,datareg.year()))
|
||||
_caus = (TCausale *) & cached_causale(codcaus, datareg.year());
|
||||
if (!_caus->ok())
|
||||
return caus_ant_error;
|
||||
|
||||
long nr = doc_contabilized(doc, true);
|
||||
@ -4612,7 +4613,7 @@ void TContabilizzazione::display_error(TDocumento& doc)
|
||||
TToken_string msg(256, '.');
|
||||
const TString4 numerazione = doc.numerazione();
|
||||
const long numero = doc.numero();
|
||||
const char* causale = _caus == NULL ? "" : _caus->codice();
|
||||
const char* causale = _caus == nullptr ? "" : _caus->codice();
|
||||
|
||||
switch (_error)
|
||||
{
|
||||
@ -4790,9 +4791,9 @@ void TContabilizzazione::display_error(TDocumento& doc)
|
||||
bool TContabilizzazione::sc_enabled(const TDate& data) const
|
||||
{
|
||||
bool rt = _sc_enabled;
|
||||
if (_caus != NULL)
|
||||
if (_caus != nullptr)
|
||||
rt &= _caus->saldaconto(data);
|
||||
if (_clifo != NULL)
|
||||
if (_clifo != nullptr)
|
||||
rt &= !_clifo->curr().get_bool(CLI_OCCAS); // Saldaconto solo se C/F non occasionale
|
||||
return rt;
|
||||
}
|
||||
@ -4800,7 +4801,7 @@ bool TContabilizzazione::sc_enabled(const TDate& data) const
|
||||
bool TContabilizzazione::in_enabled() const
|
||||
{
|
||||
bool rt = _in_enabled;
|
||||
if (_caus != NULL)
|
||||
if (_caus != nullptr)
|
||||
rt &= _caus->intra();
|
||||
return rt;
|
||||
}
|
||||
@ -4879,12 +4880,6 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
||||
_nrow = 0;
|
||||
_total_docs = 0L;
|
||||
_data_reg = data_elab;
|
||||
if (_caus != NULL)
|
||||
{
|
||||
delete _caus;
|
||||
_caus = NULL;
|
||||
}
|
||||
|
||||
if (interattivo)
|
||||
{
|
||||
_auto_data = true;
|
||||
@ -5013,15 +5008,8 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
||||
}
|
||||
|
||||
_viswin->add_line("");
|
||||
if (_caus != NULL)
|
||||
{
|
||||
delete _caus;
|
||||
_caus = NULL;
|
||||
}
|
||||
export_movimento(*_movimento, *_viswin);
|
||||
delete _movimento;
|
||||
_movimento = NULL;
|
||||
|
||||
safe_delete(_movimento);
|
||||
// Let's free some valuable space
|
||||
if (!interattivo)
|
||||
doc_in.destroy(i, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user