Corretto agiiornamento PLM
git-svn-id: svn://10.65.10.50/trunk@1090 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ac7e657bb1
commit
e42e6b0018
@ -553,7 +553,7 @@ int TPrimanota_application::read(TMask& m)
|
|||||||
|
|
||||||
cgs().reset();
|
cgs().reset();
|
||||||
|
|
||||||
if (_iva != nessuna_iva)
|
if (iva() != nessuna_iva)
|
||||||
{
|
{
|
||||||
ivas().reset();
|
ivas().reset();
|
||||||
|
|
||||||
@ -593,7 +593,7 @@ int TPrimanota_application::read(TMask& m)
|
|||||||
TImporto import(sezione, im);
|
TImporto import(sezione, im);
|
||||||
import.add_to(riga); // Dare/Avere 101-102
|
import.add_to(riga); // Dare/Avere 101-102
|
||||||
|
|
||||||
TConto conto; get_conto(r, conto);
|
TBill conto; get_conto(r, conto);
|
||||||
riga.add(conto.string(0x3)); // Conto 103-107
|
riga.add(conto.string(0x3)); // Conto 103-107
|
||||||
_saldi.aggiorna(conto, im, sezione, FALSE);
|
_saldi.aggiorna(conto, im, sezione, FALSE);
|
||||||
|
|
||||||
@ -607,6 +607,9 @@ int TPrimanota_application::read(TMask& m)
|
|||||||
const char tipo = r.get_char("ROWTYPE");
|
const char tipo = r.get_char("ROWTYPE");
|
||||||
riga.add(tipo); // Tipo di riga 115
|
riga.add(tipo); // Tipo di riga 115
|
||||||
|
|
||||||
|
if (iva() == nessuna_iva && tipo > ' ')
|
||||||
|
error_box("Riga %d con tipo incompatibile con un movimento puramente contabile", i+1);
|
||||||
|
|
||||||
cgs().row(i) = riga;
|
cgs().row(i) = riga;
|
||||||
disable_cgs_cells(i, tipo);
|
disable_cgs_cells(i, tipo);
|
||||||
}
|
}
|
||||||
@ -691,7 +694,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
TToken_string& row = (TToken_string&)rows[i];
|
TToken_string& row = (TToken_string&)rows[i];
|
||||||
|
|
||||||
TImporto n; n = row;
|
TImporto n; n = row;
|
||||||
const TConto conto(row, 2, 0x3);
|
const TBill conto(row, 2, 0x3);
|
||||||
_saldi.aggiorna(conto, n.valore(), n.sezione(), TRUE);
|
_saldi.aggiorna(conto, n.valore(), n.sezione(), TRUE);
|
||||||
|
|
||||||
TRectype &r = _rel->cg(i);
|
TRectype &r = _rel->cg(i);
|
||||||
@ -718,6 +721,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
r.put("ROWTYPE", row.get()); // Tipo riga
|
r.put("ROWTYPE", row.get()); // Tipo riga
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_iva == nessuna_iva) return;
|
if (_iva == nessuna_iva) return;
|
||||||
|
|
||||||
if (causale().corrispettivi())
|
if (causale().corrispettivi())
|
||||||
@ -766,9 +770,9 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
|
|
||||||
TRectype &r = _rel->iva(i);
|
TRectype &r = _rel->iva(i);
|
||||||
r.zero();
|
r.zero();
|
||||||
r.put("ANNOES", annoes);
|
r.put("ANNOES", annoes); // Anno d'esercizio della testata (che ca$$ata!)
|
||||||
r.put("NUMREG", numreg);
|
r.put("NUMREG", numreg);
|
||||||
r.put("INTRA", intra); // Causale intra
|
r.put("INTRA", intra); // Causale intra (che ca$$ata!)
|
||||||
r.put("NUMRIG", i+1);
|
r.put("NUMRIG", i+1);
|
||||||
|
|
||||||
real imponibile(row.get(0));
|
real imponibile(row.get(0));
|
||||||
@ -792,6 +796,29 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TPrimanota_application::check_saldi()
|
||||||
|
{
|
||||||
|
TString_array& rows = cgs().rows_array();
|
||||||
|
const int anno = _rel->lfile().get_int("ANNOES");
|
||||||
|
|
||||||
|
for (int i = 0; i < rows.items(); i++)
|
||||||
|
{
|
||||||
|
TToken_string& row = (TToken_string&)rows[i];
|
||||||
|
TBill conto(row, 2, 0x3);
|
||||||
|
conto.find();
|
||||||
|
const char sez = conto.sezione();
|
||||||
|
if (sez > ' ')
|
||||||
|
{
|
||||||
|
const TConto* c = _saldi.find(conto, anno);
|
||||||
|
if (c && !c->saldo_finale().is_zero() && c->saldo_finale().sezione() != sez)
|
||||||
|
warning_box("Il conto della riga %i ha un saldo finale in %s, "
|
||||||
|
"contrariamente a quanto indicato sul piano dei conti",
|
||||||
|
i+1, sez == 'A' ? "dare" : "avere");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int TPrimanota_application::write(const TMask& m)
|
int TPrimanota_application::write(const TMask& m)
|
||||||
{
|
{
|
||||||
const long numreg = m.get_long(F_NUMREG);
|
const long numreg = m.get_long(F_NUMREG);
|
||||||
@ -802,6 +829,7 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
|
check_saldi();
|
||||||
|
|
||||||
if (iva() != nessuna_iva)
|
if (iva() != nessuna_iva)
|
||||||
{
|
{
|
||||||
@ -826,7 +854,10 @@ int TPrimanota_application::rewrite(const TMask& m)
|
|||||||
mask2rel(m);
|
mask2rel(m);
|
||||||
const int err = _rel->rewrite(TRUE);
|
const int err = _rel->rewrite(TRUE);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
|
{
|
||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
|
check_saldi();
|
||||||
|
}
|
||||||
if (gestione_saldaconto() && causale().saldaconto())
|
if (gestione_saldaconto() && causale().saldaconto())
|
||||||
write_scadenze(m);
|
write_scadenze(m);
|
||||||
return err;
|
return err;
|
||||||
@ -837,7 +868,10 @@ bool TPrimanota_application::remove()
|
|||||||
{
|
{
|
||||||
const bool ok = TRelation_application::remove();
|
const bool ok = TRelation_application::remove();
|
||||||
if (ok)
|
if (ok)
|
||||||
|
{
|
||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
|
check_saldi();
|
||||||
|
}
|
||||||
// TBI eliminazione partita
|
// TBI eliminazione partita
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -994,12 +1028,13 @@ void TPrimanota_application::genera_incasso(const char* causimm)
|
|||||||
for (int r = 0; r < i; r++)
|
for (int r = 0; r < i; r++)
|
||||||
{
|
{
|
||||||
const TRectype& rec = inc.cg(r);
|
const TRectype& rec = inc.cg(r);
|
||||||
TConto c; get_conto(rec, c);
|
TBill c; get_conto(rec, c);
|
||||||
const real im(rec.get("IMPORTO"));
|
const real im(rec.get("IMPORTO"));
|
||||||
const char sezione = rec.get_char("SEZIONE");
|
const char sezione = rec.get_char("SEZIONE");
|
||||||
_saldi.aggiorna(c, im, sezione, TRUE);
|
_saldi.aggiorna(c, im, sezione, TRUE);
|
||||||
}
|
}
|
||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
|
check_saldi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,8 +281,8 @@ int TMovimentoPN::registra(bool re, bool force)
|
|||||||
for (int a = 1; a <= att; a++)
|
for (int a = 1; a <= att; a++)
|
||||||
{
|
{
|
||||||
TString16 chiave;
|
TString16 chiave;
|
||||||
chiave << annoiva << registro.attivita() << a
|
TString16 attivita(registro.attivita()); attivita.right_just(5, '0');
|
||||||
<< format("%02d", date2liq(datareg));
|
chiave << annoiva << attivita << a << format("%02d", date2liq(datareg));
|
||||||
plm.put("CODTAB", chiave);
|
plm.put("CODTAB", chiave);
|
||||||
if (plm.read() == NOERR)
|
if (plm.read() == NOERR)
|
||||||
{
|
{
|
||||||
|
@ -167,21 +167,19 @@ bool TRegistro::read_att()
|
|||||||
bool TRegistro::agenzia_viaggi()
|
bool TRegistro::agenzia_viaggi()
|
||||||
{
|
{
|
||||||
bool av = FALSE;
|
bool av = FALSE;
|
||||||
if (iva() == iva_vendite && read_att())
|
if (iva() == iva_vendite)
|
||||||
av = _att.get_bool("REG74TER");
|
av = _att.get_bool("REG74TER");
|
||||||
return av;
|
return av;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString& TRegistro::tipo_attivita()
|
const TString& TRegistro::tipo_attivita()
|
||||||
{
|
{
|
||||||
read_att();
|
|
||||||
return _att.get("TIPOATT");
|
return _att.get("TIPOATT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const real& TRegistro::prorata()
|
const real& TRegistro::prorata()
|
||||||
{
|
{
|
||||||
read_att();
|
|
||||||
return _prorata;
|
return _prorata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,6 +394,7 @@ bool TCausale::ok() const
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char TCausale::sezione(int riga) const
|
char TCausale::sezione(int riga) const
|
||||||
{
|
{
|
||||||
const TRectype& r = row(riga);
|
const TRectype& r = row(riga);
|
||||||
@ -494,65 +493,3 @@ bool TCodiceIVA::read(const char* cod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// Importo
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
const TImporto& TImporto::add_to(TToken_string& s) const
|
|
||||||
{
|
|
||||||
const bool dare = sezione() == 'D';
|
|
||||||
const char* v = valore().string();
|
|
||||||
s.add(dare ? v : "", 0);
|
|
||||||
s.add(dare ? "" : v, 1);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cerified 99%
|
|
||||||
// Ambigous section for ZERO
|
|
||||||
const TImporto& TImporto::operator =(TToken_string& sv)
|
|
||||||
{
|
|
||||||
_valore = real(sv.get(0));
|
|
||||||
if (_valore == ZERO)
|
|
||||||
{
|
|
||||||
_valore = real(sv.get());
|
|
||||||
_sezione = 'A';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_sezione = 'D';
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const TImporto& TImporto::set(char s, const real& v)
|
|
||||||
{
|
|
||||||
CHECKD(s == 'D' || s == 'A', "Sezione errata per importo: codice ", (int)s);
|
|
||||||
_sezione = s; _valore = v;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const TImporto& TImporto::operator += (const TImporto& i)
|
|
||||||
{
|
|
||||||
if (_sezione == i._sezione)
|
|
||||||
_valore += i._valore;
|
|
||||||
else
|
|
||||||
_valore -= i._valore;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const TImporto& TImporto::operator -= (const TImporto& i)
|
|
||||||
{
|
|
||||||
if (_sezione == i._sezione)
|
|
||||||
_valore -= i._valore;
|
|
||||||
else
|
|
||||||
_valore += i._valore;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TImporto& TImporto::swap_section()
|
|
||||||
{
|
|
||||||
_sezione = (_sezione == 'D') ? 'A' : 'D';
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user