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 TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2 BUTTON DLG_SAVEREC 10 2
BEGIN BEGIN
PROMPT -13 -1 "" PROMPT -13 -1 ""
MESSAGE EXIT,K_ENTER
END END
BUTTON DLG_DELREC 10 2 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 newt = ns.get(4); // Tipo pagamento
newu = ns.get(5); // Ulteriore classificazione newu = ns.get(5); // Ulteriore classificazione
// qui viene il bello, si fa per dire // qui viene il bello, si fa per dire
if (news != ts.get(0)) // modificata data scadenza if (news != ts.get(0)) // modificata data scadenza
mod = m_scad = TRUE; 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 if (newu != ts.get(5)) // modificata ulteriore classificazione
mod = m_ulc = TRUE; mod = m_ulc = TRUE;
else if (m_tipo) { else if (m_tipo)
{
// forza reset di ulc se si e' modificato il tipo rata // forza reset di ulc se si e' modificato il tipo rata
m_ulc = TRUE; m_ulc = TRUE;
newu = ""; newu = "";
@ -408,13 +408,13 @@ bool TFattura_mask::clifo_handler(TMask_field& f, KEY key)
TMask_field& cp = m.field(E_CODPAG); TMask_field& cp = m.field(E_CODPAG);
if (cp.get().empty()) if (cp.get().empty())
{ {
cp.set(CLI_CODPAG); cp.set(cur.get(CLI_CODPAG));
cp.check(STARTING_CHECK); cp.check(STARTING_CHECK);
} }
TMask_field& cv = m.field(E_VALUTA); TMask_field& cv = m.field(E_VALUTA);
if (cv.get().empty()) if (cv.get().empty())
{ {
cv.set(CLI_CODVAL); cv.set(cur.get(CLI_CODVAL));
cv.on_hit(); cv.on_hit();
} }
} }
@ -675,27 +675,29 @@ bool TFattura_mask::tipopag_handler(TMask_field& f, KEY key)
void TFattura_mask::write_scadenze() const void TFattura_mask::write_scadenze() const
{ {
const int anno = get_int(E_ANNORIF); const TBill conto(_fattura); // Conto cliente/fornitore della partita
const TString numpart(get(E_NUMRIF)); const int anno = get_int(E_ANNORIF); // Anno di riferimento
const TString numpart(get(E_NUMRIF)); // Numero di riferimento
TPartita* oldgame = NULL; TPartita* oldgame = &_fattura.partita();;
int vecchia_riga = 0; int vecchia_riga = _fattura.get_int(PART_NRIGA);
if (edit_mode()) if (insert_mode())
{ {
oldgame = &_fattura.partita(); oldgame->rimuovi_riga(vecchia_riga); // Elimina riga creata provvisoriamente
vecchia_riga = _fattura.get_int(PART_NRIGA); oldgame = NULL; // Annulla vecchia partita
vecchia_riga = 0; // Annulla vecchio numero riga fattura
} }
TPartita* newgame = NULL; TPartita* newgame = NULL;
int nuova_riga = 0; 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 TString codpag(get(E_CODPAG));
const TValuta cambio(*this, E_VALUTA, E_DATACAMBIO, E_CAMBIO); const TValuta cambio(*this, E_VALUTA, E_DATACAMBIO, E_CAMBIO);
const TString agente(get(FS_AGENTE)); const TString agente(get(FS_AGENTE));
const TBill conto(_fattura);
newgame = new TPartita(conto, anno, numpart); newgame = new TPartita(conto, anno, numpart);
TRiga_partite& partita = (oldgame != NULL && *newgame == *oldgame) ? 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->sposta_riga(vecchia_riga, *newgame, nuova_riga);
} }
oldgame->rewrite();
} }
if (newgame != NULL) // Se non ho cancellato il numero partita ... if (newgame != NULL) // Se non ho cancellato il numero partita ...
{ {
app().partite().insert(newgame); // Aggiungi nuova 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 g = m.get_int(F_GRUPPO);
const int c = m.get_int(F_CONTO); const int c = m.get_int(F_CONTO);
const long s = m.get_long(F_SOTTOCONTO); 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); TGame_mask gm(b, 0, 0);
gm.run(); gm.run();
if (gm.changed() && yesno_box("Registrare le partite modificate?")) partite().destroy(); // Azzera memoria
partite().rewrite();
partite().destroy();
} }