corretta gestione fatture extra-contabili

git-svn-id: svn://10.65.10.50/trunk@2631 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-02-22 10:56:58 +00:00
parent 3df72bb904
commit 13e3280a79
2 changed files with 21 additions and 18 deletions

View File

@ -2,9 +2,10 @@
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -13 -1 ""
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_DELREC 10 2

View File

@ -164,7 +164,6 @@ bool TFattura_mask::pag_notify(TSheet_field& ps, int riga, KEY k)
newt = ns.get(4); // Tipo pagamento
newu = ns.get(5); // Ulteriore classificazione
// qui viene il bello, si fa per dire
if (news != ts.get(0)) // modificata data scadenza
mod = m_scad = TRUE;
@ -187,7 +186,8 @@ bool TFattura_mask::pag_notify(TSheet_field& ps, int riga, KEY k)
if (newu != ts.get(5)) // modificata ulteriore classificazione
mod = m_ulc = TRUE;
else if (m_tipo) {
else if (m_tipo)
{
// forza reset di ulc se si e' modificato il tipo rata
m_ulc = TRUE;
newu = "";
@ -408,13 +408,13 @@ bool TFattura_mask::clifo_handler(TMask_field& f, KEY key)
TMask_field& cp = m.field(E_CODPAG);
if (cp.get().empty())
{
cp.set(CLI_CODPAG);
cp.set(cur.get(CLI_CODPAG));
cp.check(STARTING_CHECK);
}
TMask_field& cv = m.field(E_VALUTA);
if (cv.get().empty())
{
cv.set(CLI_CODVAL);
cv.set(cur.get(CLI_CODVAL));
cv.on_hit();
}
}
@ -675,27 +675,29 @@ bool TFattura_mask::tipopag_handler(TMask_field& f, KEY key)
void TFattura_mask::write_scadenze() const
{
const int anno = get_int(E_ANNORIF);
const TString numpart(get(E_NUMRIF));
const TBill conto(_fattura); // Conto cliente/fornitore della partita
const int anno = get_int(E_ANNORIF); // Anno di riferimento
const TString numpart(get(E_NUMRIF)); // Numero di riferimento
TPartita* oldgame = NULL;
int vecchia_riga = 0;
if (edit_mode())
TPartita* oldgame = &_fattura.partita();;
int vecchia_riga = _fattura.get_int(PART_NRIGA);
if (insert_mode())
{
oldgame = &_fattura.partita();
vecchia_riga = _fattura.get_int(PART_NRIGA);
oldgame->rimuovi_riga(vecchia_riga); // Elimina riga creata provvisoriamente
oldgame = NULL; // Annulla vecchia partita
vecchia_riga = 0; // Annulla vecchio numero riga fattura
}
TPartita* newgame = NULL;
int nuova_riga = 0;
if (anno > 0 && !numpart.blank())
if (anno > 0 && !numpart.blank()) // In realta' e' sempre cosi' nell'extra-contabile
{
// Campi invarianti per ogni rata
const TString codpag(get(E_CODPAG));
const TValuta cambio(*this, E_VALUTA, E_DATACAMBIO, E_CAMBIO);
const TString agente(get(FS_AGENTE));
const TBill conto(_fattura);
newgame = new TPartita(conto, anno, numpart);
TRiga_partite& partita = (oldgame != NULL && *newgame == *oldgame) ?
@ -781,11 +783,13 @@ void TFattura_mask::write_scadenze() const
{
oldgame->sposta_riga(vecchia_riga, *newgame, nuova_riga);
}
oldgame->rewrite();
}
if (newgame != NULL) // Se non ho cancellato il numero partita ...
{
app().partite().insert(newgame); // Aggiungi nuova partita
newgame->write(edit_mode());
}
}
@ -1088,11 +1092,9 @@ void TSaldaconto_app::edit_partite(const TMask& m)
const int g = m.get_int(F_GRUPPO);
const int c = m.get_int(F_CONTO);
const long s = m.get_long(F_SOTTOCONTO);
const TBill b(g, c, s, t); // Legge il conto della riga selezionata
const TBill b(g, c, s, t); // Legge il conto della riga selezionata
TGame_mask gm(b, 0, 0);
gm.run();
if (gm.changed() && yesno_box("Registrare le partite modificate?"))
partite().rewrite();
partite().destroy();
partite().destroy(); // Azzera memoria
}