Patch level : 10.0 738
Files correlati : cg2.exe Ricompilazione Demo : [ ] Commento Bug: 0001532: 001982 - Pharmatex - richiamo causali da prima nota è richiesto di poter richiamare, (così come già possibile per le causali a regime iva speciale) qualsiasi causale ad un'altra. Valutare anche la possibilità di concatenare più di 2 causali, controllando che non avvenga un loop di richiamo infinito tra una causale e l'altra. git-svn-id: svn://10.65.10.50/trunk@20445 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
23076b22d4
commit
24d509402e
@ -395,7 +395,7 @@ bool TCaus_app::mostra_campi()
|
||||
m.hide(F_OP_INTRACOM);
|
||||
m.hide(F_VALINTRA);
|
||||
|
||||
m.hide(F_COD_CAUS_IM);
|
||||
// m.hide(F_COD_CAUS_IM);
|
||||
m.hide(F_CODCAUREG);
|
||||
|
||||
const int tpm = m.get_int(F_TIPO_MOV);
|
||||
@ -425,8 +425,8 @@ bool TCaus_app::mostra_campi()
|
||||
m.hide(F_OP_FINE_ANNO);
|
||||
|
||||
m.enable(F_MOV_VALU, valuta());
|
||||
m.show(F_COD_CAUS_IM);
|
||||
m.enable(F_COD_CAUS_IM, !saldaconto());
|
||||
// m.show(F_COD_CAUS_IM);
|
||||
// m.enable(F_COD_CAUS_IM, !saldaconto());
|
||||
m.show(F_CODCAUREG);
|
||||
|
||||
m.show(F_AUTO_FAT);
|
||||
@ -874,7 +874,7 @@ void TCaus_app::on_config_change()
|
||||
_msk->show(F_TIPO_MOV_1, saldaconto());
|
||||
_msk->show(F_TIPO_MOV_2, saldaconto());
|
||||
|
||||
_msk->enable(F_COD_CAUS_IM, !saldaconto());
|
||||
// _msk->enable(F_COD_CAUS_IM, !saldaconto());
|
||||
_msk->enable(F_MOV_VALU, valuta());
|
||||
|
||||
if (saldaconto())
|
||||
|
@ -26,7 +26,7 @@ BEGIN
|
||||
DISPLAY "Documento" TIPODOC
|
||||
DISPLAY "Registro" REG
|
||||
DISPLAY "Tipo movimento" TIPOMOV
|
||||
DISPLAY "Inc./Pag." CODCAUSIM
|
||||
DISPLAY "Colleg." CODCAUSIM
|
||||
DISPLAY "770" M770
|
||||
DISPLAY "Cespiti" COLLCESP
|
||||
OUTPUT F_COD_CAUS CODCAUS
|
||||
@ -46,7 +46,7 @@ BEGIN
|
||||
DISPLAY "Documento" TIPODOC
|
||||
DISPLAY "Registro" REG
|
||||
DISPLAY "Movimento" TIPOMOV
|
||||
DISPLAY "Inc./Pag." CODCAUSIM
|
||||
DISPLAY "Colleg." CODCAUSIM
|
||||
DISPLAY "770" M770
|
||||
DISPLAY "Cespiti" COLLCESP
|
||||
COPY OUTPUT F_COD_CAUS
|
||||
@ -247,10 +247,10 @@ END
|
||||
|
||||
STRING F_COD_CAUS_IM 3
|
||||
BEGIN
|
||||
PROMPT 34 8 "Codice causale per l'incasso immediato "
|
||||
PROMPT 34 8 "Codice causale collegata "
|
||||
FLAGS "UZ"
|
||||
FIELD CODCAUSIM
|
||||
USE LF_CAUSALI SELECT REG==""
|
||||
USE LF_CAUSALI
|
||||
INPUT CODCAUS F_COD_CAUS_IM
|
||||
DISPLAY "Codice" CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
|
216
cg/cg2100.cpp
216
cg/cg2100.cpp
@ -31,8 +31,8 @@ public:
|
||||
TDate _datadoc;
|
||||
TString8 _numdoc;
|
||||
real _totale;
|
||||
TString4 _causale_fattura;
|
||||
TipoIVA _iva_fattura;
|
||||
TString4 _causale_originale;
|
||||
TipoIVA _iva_originale;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -262,7 +262,10 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
||||
bool ok = true;
|
||||
|
||||
if (cod != NULL)
|
||||
{
|
||||
ok = causale().read(cod, year);
|
||||
_iva = causale().iva();
|
||||
}
|
||||
|
||||
bool nob = false, dob = false;
|
||||
_is_saldaconto = false;
|
||||
@ -667,12 +670,18 @@ bool TPrimanota_application::get_next_key(TToken_string& tmp)
|
||||
case 1:
|
||||
tmp.add(_automatico->_causale);
|
||||
_msk[0]->set(F_CODCAUS, _automatico->_causale); // Joke get_mask
|
||||
_iva = nessuna_iva; // Impedisce incremento del numero documento
|
||||
if (_automatico->_tipo == 3)
|
||||
{
|
||||
TCausale c(_automatico->_causale);
|
||||
_iva = c.iva();
|
||||
}
|
||||
else
|
||||
_iva = nessuna_iva; // Impedisce incremento del numero documento
|
||||
break;
|
||||
case 2:
|
||||
tmp.add(_automatico->_causale_fattura);
|
||||
_msk[0]->set(F_CODCAUS, _automatico->_causale_fattura); // Joke get_mask
|
||||
_iva = _automatico->_iva_fattura; // Provoca incremento del numero documento
|
||||
tmp.add(_automatico->_causale_originale);
|
||||
_msk[0]->set(F_CODCAUS, _automatico->_causale_originale); // Joke get_mask
|
||||
_iva = _automatico->_iva_originale; // Provoca incremento del numero documento
|
||||
break;
|
||||
default:
|
||||
tmp.add(m.get(F_CODCAUS)); // Ultima causale usata
|
||||
@ -1219,51 +1228,59 @@ int TPrimanota_application::write(const TMask& m)
|
||||
bool salvaconto = false;
|
||||
const long old_nreg = NUMREG_PROVVISORIO;
|
||||
|
||||
if (iva() != nessuna_iva)
|
||||
{
|
||||
int tipauto = 0; // Tipo movimento automatico
|
||||
TString4 causauto; // Possibile causale per incasso immediato
|
||||
|
||||
causale().reg().reread(); // Aggiorna protocollo IVA
|
||||
if (is_saldaconto())
|
||||
{
|
||||
switch (causale().tipomov())
|
||||
{
|
||||
case tm_fattura:
|
||||
write_scadenze(m); // Salva fattura
|
||||
break;
|
||||
case tm_nota_credito:
|
||||
salvaconto = true; // Salva nota credito
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m.get_bool(F_SOLAIVA) && !gestione_saldaconto())
|
||||
{
|
||||
causauto = causale().causale_inc_imm();
|
||||
tipauto = causauto.full() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
if (iva() == iva_acquisti && tipauto <= 0)
|
||||
{
|
||||
// Genera regolarizzazione IVA acquisti
|
||||
causauto = causale().causale_reg_iva();
|
||||
tipauto = causauto.full() ? 2 : 0;
|
||||
}
|
||||
|
||||
if (tipauto > 0 && causauto.full())
|
||||
genera_automatico(tipauto, causauto);
|
||||
}
|
||||
else
|
||||
if (iva() == nessuna_iva)
|
||||
{
|
||||
if (is_fattura())
|
||||
write_scadenze(m); // Salva fattura
|
||||
|
||||
salvaconto = is_pagamento();
|
||||
}
|
||||
int tipauto = 0; // Tipo movimento automatico
|
||||
TString4 causauto; // Possibile causale per incasso immediato
|
||||
|
||||
causale().reg().reread(); // Aggiorna protocollo IVA
|
||||
if (is_saldaconto())
|
||||
{
|
||||
switch (causale().tipomov())
|
||||
{
|
||||
case tm_fattura:
|
||||
write_scadenze(m); // Salva fattura
|
||||
break;
|
||||
case tm_nota_credito:
|
||||
salvaconto = true; // Salva nota credito
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iva() != nessuna_iva && !m.get_bool(F_SOLAIVA))
|
||||
{
|
||||
causauto = causale().causale_collegata();
|
||||
if (causauto.full())
|
||||
{
|
||||
TCausale c(causauto);
|
||||
|
||||
if ((!gestione_saldaconto() || c.tipomov() == 0) && c.iva() == nessuna_iva)
|
||||
tipauto = causauto.full() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iva() == iva_acquisti && tipauto <= 0)
|
||||
{
|
||||
// Genera regolarizzazione IVA acquisti
|
||||
causauto = causale().causale_reg_iva();
|
||||
tipauto = causauto.full() ? 2 : 0;
|
||||
}
|
||||
if (tipauto <= 0)
|
||||
{
|
||||
causauto = causale().causale_collegata();
|
||||
tipauto = causauto.full() ? 3 : 0;
|
||||
}
|
||||
|
||||
if (tipauto > 0 && causauto.full())
|
||||
genera_automatico(tipauto, causauto);
|
||||
|
||||
if (salvaconto)
|
||||
{
|
||||
@ -1374,12 +1391,15 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
// Parte comune a tutti i movimenti automatici
|
||||
_automatico->_tipo = tipo;
|
||||
_automatico->_causale = causimm;
|
||||
_automatico->_causale_fattura = m.get(F_CODCAUS);
|
||||
_automatico->_iva_fattura = caus.iva();
|
||||
_automatico->_datadoc = m.get(F_DATADOC);
|
||||
_automatico->_numdoc = m.get(F_NUMDOC);
|
||||
_automatico->_clifo.get(_rel->cg(0));
|
||||
_automatico->_totale = m.get_real(F_TOTALE);
|
||||
_automatico->_causale_originale = m.get(F_CODCAUS);
|
||||
_automatico->_iva_originale = caus.iva();
|
||||
if (tipo != 3)
|
||||
{
|
||||
_automatico->_datadoc = m.get(F_DATADOC);
|
||||
_automatico->_numdoc = m.get(F_NUMDOC);
|
||||
_automatico->_clifo.get(_rel->cg(0));
|
||||
_automatico->_totale = m.get_real(F_TOTALE);
|
||||
}
|
||||
|
||||
// Solo regolarizzazioni IVA
|
||||
if (_automatico->_tipo == 2)
|
||||
@ -1395,8 +1415,11 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
}
|
||||
else // Step 1
|
||||
{
|
||||
m.set(F_DATADOC, _automatico->_datadoc);
|
||||
m.set(F_NUMDOC, _automatico->_numdoc);
|
||||
if (_automatico->_tipo != 3)
|
||||
{
|
||||
m.set(F_DATADOC, _automatico->_datadoc);
|
||||
m.set(F_NUMDOC, _automatico->_numdoc);
|
||||
}
|
||||
|
||||
switch (_automatico->_tipo)
|
||||
{
|
||||
@ -1852,12 +1875,15 @@ bool TPrimanota_application::save(bool check_dirty)
|
||||
return TRelation_application::save(check_dirty);
|
||||
}
|
||||
|
||||
void TPrimanota_application::dump_rec(TConfig & ini, const TRectype & rec, int row)
|
||||
void TPrimanota_application::dump_rec(TConfig & ini, const TRectype & rec, int row, int pref)
|
||||
{
|
||||
if (row > 0)
|
||||
ini.set_paragraph(format("%d,%d", rec.num(), row));
|
||||
if (pref > 0)
|
||||
ini.set_paragraph(format("%d,%d,%d", rec.num(), row, pref));
|
||||
else
|
||||
ini.set_paragraph(format("%d", rec.num()));
|
||||
if (row > 0)
|
||||
ini.set_paragraph(format("%d,%d", rec.num(), row));
|
||||
else
|
||||
ini.set_paragraph(format("%d", rec.num()));
|
||||
for (int f = rec.items()-1; f >= 0; f--)
|
||||
{
|
||||
const char* name = rec.fieldname(f);
|
||||
@ -1865,7 +1891,7 @@ void TPrimanota_application::dump_rec(TConfig & ini, const TRectype & rec, int r
|
||||
}
|
||||
}
|
||||
|
||||
void TPrimanota_application::dump_fatt(TConfig& ini, TPartita & game, int rigafatt)
|
||||
void TPrimanota_application::dump_fatt(TConfig& ini, TPartita & game, int rigafatt, int pref)
|
||||
{
|
||||
CHECKD(rigafatt > 0 && rigafatt < 9999, "Riga fattura errata ", rigafatt);
|
||||
|
||||
@ -1879,20 +1905,21 @@ void TPrimanota_application::dump_fatt(TConfig& ini, TPartita & game, int rigafa
|
||||
rec.fill_array();
|
||||
const int lastrow = rec.last();
|
||||
|
||||
dump_rec(ini, rec, r);
|
||||
for (int rp = rec.first(); rp <= lastrow; rp = rec.succ(rp))
|
||||
{
|
||||
const TRectype & recpag = rec.row(rp);
|
||||
dump_rec(ini, rec, r, pref);
|
||||
for (int rp = rec.first(); rp <= lastrow; rp = rec.succ(rp))
|
||||
{
|
||||
const TRectype & recpag = rec.row(rp);
|
||||
|
||||
dump_rec(ini, recpag, rp);
|
||||
}
|
||||
}
|
||||
for ( ; ; r++)
|
||||
{
|
||||
if (ini.set_paragraph(format("%d,%d", LF_SCADENZE, r+1)))
|
||||
ini.remove_all();
|
||||
else
|
||||
break;
|
||||
dump_rec(ini, recpag, rp, pref);
|
||||
}
|
||||
}
|
||||
for ( ; ; r++)
|
||||
{
|
||||
if (ini.set_paragraph(format("%d,%d", LF_SCADENZE, r+1)))
|
||||
ini.remove_all();
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1933,39 +1960,28 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
||||
}
|
||||
else
|
||||
{
|
||||
int pref = 1;
|
||||
for (TPartita* game = p.first(); game != NULL; game = p.next())
|
||||
{
|
||||
TBit_array dumped;
|
||||
const int rigapag = game->primo_pagamento(numreg);
|
||||
if (rigapag > 0)
|
||||
{
|
||||
// Ricava la lista dei pagamenti dal database invece di leggerli dalla struttura in memoria :-(
|
||||
const TRiga_partite& riga = game->riga(rigapag);
|
||||
TRelation rel(LF_PAGSCA);
|
||||
TCursor pag(&rel);
|
||||
TRectype& recpag = pag.curr();
|
||||
const int lastrow = game->last();
|
||||
|
||||
recpag.put(PAGSCA_TIPOC, riga.get(PART_TIPOCF));
|
||||
recpag.put(PAGSCA_GRUPPO, riga.get(PART_GRUPPO));
|
||||
recpag.put(PAGSCA_CONTO, riga.get(PART_CONTO));
|
||||
recpag.put(PAGSCA_SOTTOCONTO, riga.get(PART_SOTTOCONTO));
|
||||
recpag.put(PAGSCA_ANNO, riga.get(PART_ANNO));
|
||||
recpag.put(PAGSCA_NUMPART, riga.get(PART_NUMPART));
|
||||
pag.setregion(recpag, recpag);
|
||||
const int items = pag.items();
|
||||
for (pag = 0L; pag.pos() < items; ++pag)
|
||||
{
|
||||
if (rigapag == recpag.get_int(PAGSCA_NRIGP))
|
||||
{
|
||||
const int rigafatt = recpag.get_int(PAGSCA_NRIGA);
|
||||
if (rigafatt > 0 && rigafatt < 9999 && !dumped[rigafatt])
|
||||
{
|
||||
dump_fatt(ini, *game, rigafatt);
|
||||
dumped.set(rigafatt);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int r = game->first(); r <= lastrow; r = game->succ(r))
|
||||
{
|
||||
dump_rec(ini, game->riga(r), r, pref);
|
||||
if (((tipo_movimento)game->riga(r).get_int(PART_TIPOMOV)) == tm_fattura)
|
||||
dump_fatt(ini, *game, r, pref);
|
||||
}
|
||||
TRecord_array uns = game->unassigned();
|
||||
const int rows = uns.rows();
|
||||
const int last = uns.last_row();
|
||||
|
||||
if (rows > 0)
|
||||
{
|
||||
pref++;
|
||||
for (int r = uns.first_row(); r <= last; r = uns.succ_row(r))
|
||||
dump_rec(ini, uns.row(r), r, pref);
|
||||
}
|
||||
pref++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +164,8 @@ protected: // TApplication
|
||||
virtual void on_firm_change();
|
||||
virtual void on_config_change();
|
||||
virtual void print();
|
||||
void dump_rec(TConfig & ini, const TRectype & rec, int row = 0);
|
||||
void dump_fatt(TConfig& ini, TPartita & game, int rigafatt);
|
||||
void dump_rec(TConfig & ini, const TRectype & rec, int row = 0, int pref = 0);
|
||||
void dump_fatt(TConfig& ini, TPartita & game, int rigafatt, int pref = 0);
|
||||
virtual void ini2mask(TConfig& ini, TMask& msk, bool query);
|
||||
virtual void mask2ini(const TMask& msk, TConfig& ini);
|
||||
virtual bool save(bool check_dirty);
|
||||
|
@ -138,7 +138,7 @@ int TCausale::regime_speciale() const
|
||||
bool TCausale::esclusione_allegati() const
|
||||
{ return _rec.get_bool(CAU_ALLEG); }
|
||||
|
||||
const TString& TCausale::causale_inc_imm() const
|
||||
const TString& TCausale::causale_collegata() const
|
||||
{ return _rec.get(CAU_CODCAUSIM); }
|
||||
|
||||
const TString& TCausale::causale_reg_iva() const
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
bool valintra() const;
|
||||
bool soloiva() const;
|
||||
char provvisorio() const { return _provvisorio; }
|
||||
const TString& causale_inc_imm() const;
|
||||
const TString& causale_collegata() const;
|
||||
const TString& causale_reg_iva() const;
|
||||
const TString& tipo_doc() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user