Patch level : 10.0 250
Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : Riportata la versione 3.2 patch 1350 git-svn-id: svn://10.65.10.50/trunk@18386 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3a03066a32
commit
c66486725c
@ -743,6 +743,7 @@ public:
|
|||||||
bool tipo_valido() const { return get("TIPODOC").not_empty(); }
|
bool tipo_valido() const { return get("TIPODOC").not_empty(); }
|
||||||
const TTipo_documento& tipo() const;
|
const TTipo_documento& tipo() const;
|
||||||
int tipo_riclassificato() const;
|
int tipo_riclassificato() const;
|
||||||
|
static const TCodice_numerazione& codice_numerazione(const char * numerazione);
|
||||||
const TCodice_numerazione& codice_numerazione() const;
|
const TCodice_numerazione& codice_numerazione() const;
|
||||||
void set_tipo(const char * tipo) { head().put("TIPODOC", tipo);}
|
void set_tipo(const char * tipo) { head().put("TIPODOC", tipo);}
|
||||||
bool provvisorio() const { return get_char("PROVV") == 'P'; }
|
bool provvisorio() const { return get_char("PROVV") == 'P'; }
|
||||||
@ -773,6 +774,8 @@ public:
|
|||||||
|
|
||||||
void set_fields(TAuto_variable_rectype & rec);
|
void set_fields(TAuto_variable_rectype & rec);
|
||||||
void set_riga_esenzione();
|
void set_riga_esenzione();
|
||||||
|
bool ha_riga_sconto() const { return _sconto != NULL; }
|
||||||
|
bool ha_riga_esenzione() const { return _esenzione != NULL; }
|
||||||
|
|
||||||
void iva_esente(TString & codiva_es) const;
|
void iva_esente(TString & codiva_es) const;
|
||||||
real spese_incasso(real &imp, int ndec, TTipo_importo netto = _lordo) const ;
|
real spese_incasso(real &imp, int ndec, TTipo_importo netto = _lordo) const ;
|
||||||
|
@ -1617,7 +1617,7 @@ TRiga_documento & TDocumento::row(int index)
|
|||||||
if (index == nrows + 1)
|
if (index == nrows + 1)
|
||||||
{
|
{
|
||||||
r = _sconto != NULL ? _sconto : _esenzione;
|
r = _sconto != NULL ? _sconto : _esenzione;
|
||||||
}
|
} else
|
||||||
if (index == nrows + 2)
|
if (index == nrows + 2)
|
||||||
r = _esenzione;
|
r = _esenzione;
|
||||||
}
|
}
|
||||||
@ -1670,6 +1670,12 @@ const TTipo_documento& TDocumento::tipo() const
|
|||||||
return cached_tipodoc(tipodoc);
|
return cached_tipodoc(tipodoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TCodice_numerazione& TDocumento::codice_numerazione(const char * numerazione)
|
||||||
|
{
|
||||||
|
return cached_numerazione(numerazione);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const TCodice_numerazione& TDocumento::codice_numerazione() const
|
const TCodice_numerazione& TDocumento::codice_numerazione() const
|
||||||
{
|
{
|
||||||
return cached_numerazione(numerazione());
|
return cached_numerazione(numerazione());
|
||||||
@ -1946,7 +1952,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
TString4 codiva_es;
|
TString4 codiva_es;
|
||||||
|
|
||||||
iva_esente(codiva_es);
|
iva_esente(codiva_es);
|
||||||
for (int i = righe.last_row(); i > 0; i = righe.pred_row(i))
|
for (int i = items; i > 0; i--)
|
||||||
{
|
{
|
||||||
const TRiga_documento& r = row(i);
|
const TRiga_documento& r = row(i);
|
||||||
const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
|
const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
|
||||||
@ -1993,6 +1999,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
TGeneric_distrib d(tot_sconti, ndec);
|
TGeneric_distrib d(tot_sconti, ndec);
|
||||||
real tot_sconti_imp = tot_sconti - tot_sconti_perc;
|
real tot_sconti_imp = tot_sconti - tot_sconti_perc;
|
||||||
|
|
||||||
|
if (!table.empty())
|
||||||
{
|
{
|
||||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,13 @@ void TFatturazione_bolle::campi_raggruppamento(TToken_string& campi) const
|
|||||||
if (doc_uguale(u)) campi.add(cond[u]);
|
if (doc_uguale(u)) campi.add(cond[u]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TFatturazione_bolle::doc_raggruppabili(const TDocumento& doc_in, const TDocumento& doc_out, TToken_string& campi) const
|
||||||
|
{
|
||||||
|
if (doc_in.ha_riga_esenzione() != doc_out.ha_riga_esenzione())
|
||||||
|
return false;
|
||||||
|
return doc_in.raggruppabile(doc_out, campi);
|
||||||
|
}
|
||||||
|
|
||||||
void TFatturazione_bolle::create_row(TDocumento& doc_out, const TRiga_documento & rin)
|
void TFatturazione_bolle::create_row(TDocumento& doc_out, const TRiga_documento & rin)
|
||||||
{
|
{
|
||||||
TRiga_documento& rout = doc_out.new_row(); // ... crea una riga nuova e
|
TRiga_documento& rout = doc_out.new_row(); // ... crea una riga nuova e
|
||||||
@ -289,7 +296,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
TBit_array closed;
|
TBit_array closed;
|
||||||
|
|
||||||
|
|
||||||
campi_raggruppamento( campi_doc);
|
campi_raggruppamento(campi_doc);
|
||||||
|
|
||||||
for (int id = 0; id < doc_in.items(); id++)
|
for (int id = 0; id < doc_in.items(); id++)
|
||||||
{
|
{
|
||||||
@ -305,32 +312,35 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
|
|
||||||
if (tipo != doc_out[od].get_char(DOC_TIPOCF) ||
|
if (tipo != doc_out[od].get_char(DOC_TIPOCF) ||
|
||||||
codice != doc_out[od].get_long(DOC_CODCF))
|
codice != doc_out[od].get_long(DOC_CODCF))
|
||||||
return error_box("Documenti incompatibili : cliente/fornitore diverso");
|
return error_box("Documenti incompatibili: cliente/fornitore diverso");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (doc_raggruppabile(campione)) // Se il documento ha il flag di raggruppabilita' ...
|
if (doc_raggruppabile(campione)) // Se il documento ha il flag di raggruppabilita' ...
|
||||||
// if (campione.raggruppabile()) // Se il documento ha il flag di raggruppabilita' ...
|
|
||||||
{
|
{
|
||||||
for (od = 0; od < tot; od++) // ... cerca un documento compatibile.
|
for (od = 0; od < tot; od++) // ... cerca un documento compatibile.
|
||||||
{
|
{
|
||||||
const int in_rows = campione.rows();
|
if (!closed[od])
|
||||||
const int out_rows = doc_out[od].rows();
|
{
|
||||||
|
const int in_rows = campione.rows();
|
||||||
|
const int out_rows = doc_out[od].rows();
|
||||||
|
|
||||||
if (in_rows + out_rows > 990)
|
if (in_rows + out_rows > 990)
|
||||||
closed.set(od);
|
closed.set(od);
|
||||||
else
|
else
|
||||||
if (!closed[od] && doc_raggruppabile(campione, doc_out[od], campi_doc))
|
{
|
||||||
// if (campione.raggruppabile(doc_out[od], campi_doc))
|
if (doc_raggruppabili(campione, doc_out[od], campi_doc))
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (od >= tot) // Se non ho trovato un documento compatibile ...
|
if (od >= tot) // Se non ho trovato un documento compatibile ...
|
||||||
{ // ... creane uno nuovo (certamente compatibile)
|
{ // ... creane uno nuovo (certamente compatibile)
|
||||||
const int anno = data_elab.year();
|
const int anno = data_elab.year();
|
||||||
const TString4 codnum(campione.get("CODNUM"));
|
const TString4 codnum(campione.get(DOC_CODNUM));
|
||||||
const TString4 tipo_out(get("S8")); // Tipo del documento di output
|
const TString4 tipo_out(get("S8")); // Tipo del documento di output
|
||||||
TDocumento* new_doc = new TDocumento('D', anno, codnum, -1);
|
TDocumento* new_doc = new TDocumento('D', anno, codnum, -1);
|
||||||
|
|
||||||
@ -342,7 +352,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
TDocumento::copy_data(new_doc->head(), campione.head()); // Copio la testata
|
TDocumento::copy_data(new_doc->head(), campione.head()); // Copio la testata
|
||||||
// td = old_tipo_in; // Ripristino il vecchio
|
// td = old_tipo_in; // Ripristino il vecchio
|
||||||
|
|
||||||
new_doc->put("DATADOC", data_elab);
|
new_doc->put(DOC_DATADOC, data_elab);
|
||||||
|
|
||||||
// Aggiungilo alla lista dei documenti in uscita
|
// Aggiungilo alla lista dei documenti in uscita
|
||||||
od = doc_out.add(new_doc);
|
od = doc_out.add(new_doc);
|
||||||
@ -360,7 +370,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
for (int i = 0; i < tot; i++) // Forza tipo e numerazione documento.
|
for (int i = 0; i < tot; i++) // Forza tipo e numerazione documento.
|
||||||
{
|
{
|
||||||
TDocumento & d = doc_out[i];
|
TDocumento & d = doc_out[i];
|
||||||
d.put("CODNUM", codnum);
|
d.put(DOC_CODNUM, codnum);
|
||||||
|
|
||||||
TToken_string key; key.add(d.get(DOC_TIPOCF)); key.add(d.get(DOC_CODCF));
|
TToken_string key; key.add(d.get(DOC_TIPOCF)); key.add(d.get(DOC_CODCF));
|
||||||
const TRectype & cfven = cache().get(LF_CFVEN, key);
|
const TRectype & cfven = cache().get(LF_CFVEN, key);
|
||||||
|
@ -2411,11 +2411,43 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
|
|
||||||
if (!iva_mov)
|
if (!iva_mov)
|
||||||
{
|
{
|
||||||
const int cgitems = _movimento->cg_items();
|
static int __check_sez = 2;
|
||||||
|
if (__check_sez > 1)
|
||||||
|
{
|
||||||
|
TConfig c(CONFIG_DITTA, "ve");
|
||||||
|
|
||||||
|
__check_sez = c.get_bool("CHECK_SEZ", false);
|
||||||
|
}
|
||||||
|
bool swap = false;
|
||||||
|
|
||||||
|
if (__check_sez)
|
||||||
|
{
|
||||||
|
const TString4 sz = _movimento->cg(0).get(RMV_SEZIONE);
|
||||||
|
|
||||||
|
for (int row = 1; !swap && row <= doc.physical_rows(); row++)
|
||||||
|
{
|
||||||
|
const TRiga_documento & r = doc[row];
|
||||||
|
|
||||||
|
if (r.is_spese())
|
||||||
|
{
|
||||||
|
const TSpesa_prest s(r.get(RDOC_CODART));
|
||||||
|
const TString & sez = s.get("S11");
|
||||||
|
|
||||||
|
swap = sez == sz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const int cgitems = _movimento->cg_items();
|
||||||
for (int i = cgitems - 1 ; i >= 0; i--)
|
for (int i = cgitems - 1 ; i >= 0; i--)
|
||||||
{
|
{
|
||||||
TRectype& rec_cg = _movimento->cg(i);
|
TRectype& rec_cg = _movimento->cg(i);
|
||||||
rec_cg.zero(RMV_ROWTYPE);
|
rec_cg.zero(RMV_ROWTYPE);
|
||||||
|
if (__check_sez && swap)
|
||||||
|
{
|
||||||
|
const TString4 sez = rec_cg.get(RMV_SEZIONE);
|
||||||
|
rec_cg.put(RMV_SEZIONE, sez == "D" ? "A" :"D");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_movimento->destroy_iva_row();
|
_movimento->destroy_iva_row();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user