Corretti errori Gabri10

git-svn-id: svn://10.65.10.50/trunk@2151 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-11-14 15:58:25 +00:00
parent c861253041
commit 017ac5407f
10 changed files with 97 additions and 62 deletions

View File

@ -98,7 +98,7 @@ public:
TMask& ss_mask() const { return _sheet->sheet_mask(); } TMask& ss_mask() const { return _sheet->sheet_mask(); }
void add_riga (int numrig, char sz, TConto& tc, const TString& d, const TString& da); void add_riga (int numrig, char sz, TConto& tc, const TString& d, const TString& da);
bool mostra_campi(TMask_field& f); bool mostra_campi();
bool valuta() const { return _valuta; } bool valuta() const { return _valuta; }
bool saldaconto() const { return _saldaconto; } bool saldaconto() const { return _saldaconto; }
@ -333,7 +333,8 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
if (val.not_empty() && val != "IN" && val != "PG" && val != "AN") if (val.not_empty() && val != "IN" && val != "PG" && val != "AN")
{ {
m.hide(F_TIPO_MOV_2); m.hide(F_TIPO_MOV_2);
if (app().saldaconto()) m.show(F_TIPO_MOV_1); // if (app().saldaconto())
m.show(F_TIPO_MOV_1);
field_reg.enable(); field_reg.enable();
m.enable(F_DES_REG); m.enable(F_DES_REG);
@ -347,7 +348,7 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
m.enable(F_DES_REG, m.query_mode()); m.enable(F_DES_REG, m.query_mode());
m.hide(F_TIPO_MOV_1); m.hide(F_TIPO_MOV_1);
if (app().saldaconto()) // if (app().saldaconto())
m.show(F_TIPO_MOV_2); m.show(F_TIPO_MOV_2);
} }
@ -361,7 +362,7 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
(const char *)codreg, app().anno_iva()); (const char *)codreg, app().anno_iva());
} }
app().mostra_campi(f); app().mostra_campi();
app().fill_sheet(m); app().fill_sheet(m);
} }
return TRUE; return TRUE;
@ -371,7 +372,7 @@ bool TCaus_app::tipomov_hndl (TMask_field& f, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
{ {
app().mostra_campi(f); app().mostra_campi();
if (f.focusdirty()) if (f.focusdirty())
app().fill_sheet(f.mask()); app().fill_sheet(f.mask());
} }
@ -402,11 +403,11 @@ bool TCaus_app::codcausim_hndl (TMask_field& f, KEY k)
} }
bool TCaus_app::mostra_campi(TMask_field& f) bool TCaus_app::mostra_campi()
{ {
TMask& m = f.mask(); TMask& m = curr_mask();
const int tpm = m.get_int(F_TIPO_MOV);
TString16 codreg = m.get(F_COD_REG); const TString& codreg = m.get(F_COD_REG);
if (codreg.empty()) if (codreg.empty())
{ {
m.hide(F_AUTO_FAT); m.hide(F_AUTO_FAT);
@ -417,21 +418,22 @@ bool TCaus_app::mostra_campi(TMask_field& f)
m.hide(F_COD_CAUS_IM); m.hide(F_COD_CAUS_IM);
const int tpm = m.get_int(F_TIPO_MOV);
switch (tpm) switch (tpm)
{ {
case 0: case 0:
m.show(F_OP_FINE_ANNO);
m.enable(F_OP_FINE_ANNO, m.insert_mode()); m.enable(F_OP_FINE_ANNO, m.insert_mode());
m.show(F_COLL_CESP); m.show(F_MOV_VALU, !saldaconto());
m.show(F_M_770);
if (saldaconto()) m.hide(F_MOV_VALU);
m.hide(F_MOV_SEZ); m.hide(F_MOV_SEZ);
m.show(F_M_770);
m.show(F_OP_FINE_ANNO);
m.show(F_COLL_CESP);
break; break;
case 3: case 3:
case 5: case 5:
case 6: case 6:
if (valuta()) m.show(F_MOV_VALU); m.show(F_MOV_VALU, valuta());
if (saldaconto()) m.show(F_MOV_SEZ); m.show(F_MOV_SEZ, saldaconto());
m.show(F_M_770); m.show(F_M_770);
m.hide(F_OP_FINE_ANNO); m.hide(F_OP_FINE_ANNO);
m.hide(F_COLL_CESP); m.hide(F_COLL_CESP);
@ -444,8 +446,7 @@ bool TCaus_app::mostra_campi(TMask_field& f)
{ // codreg non vuoto { // codreg non vuoto
m.hide(F_OP_FINE_ANNO); m.hide(F_OP_FINE_ANNO);
m.hide(F_MOV_SEZ); m.hide(F_MOV_SEZ);
if (valuta()) m.show(F_MOV_VALU); m.show(F_MOV_VALU, valuta());
// if (!saldaconto())
m.show(F_COD_CAUS_IM); m.show(F_COD_CAUS_IM);
m.show(F_AUTO_FAT); m.show(F_AUTO_FAT);
m.show(F_ALLEGAT); m.show(F_ALLEGAT);
@ -461,7 +462,7 @@ bool TCaus_app::cod_reg_hndl (TMask_field& f, KEY k)
{ {
if (k == K_TAB) if (k == K_TAB)
{ {
app().mostra_campi(f); app().mostra_campi();
if (f.focusdirty()) app().fill_sheet(f.mask()); if (f.focusdirty()) app().fill_sheet(f.mask());
return TRUE; return TRUE;
} }

View File

@ -103,6 +103,7 @@ TMask* TPrimanota_application::load_mask(int n)
// add saldaconto // add saldaconto
TSheet_field& ps = (TSheet_field&)m->field(FS_RATESHEET); TSheet_field& ps = (TSheet_field&)m->field(FS_RATESHEET);
ps.set_notify(pag_notify); ps.set_notify(pag_notify);
m->set_handler(F_NUMRIF, numrif_handler);
m->set_handler(FS_RATESHEET, pag_sheet_handler); m->set_handler(FS_RATESHEET, pag_sheet_handler);
m->set_handler(FS_RESET, reset_handler); m->set_handler(FS_RESET, reset_handler);
m->set_handler(FS_NRATE, nrate_handler); m->set_handler(FS_NRATE, nrate_handler);

View File

@ -214,13 +214,12 @@ BEGIN
HELP "Numero finale del documento ripilogativo di protocollo IVA" HELP "Numero finale del documento ripilogativo di protocollo IVA"
FIELD UPROTIVA FIELD UPROTIVA
NUM_EXPR {(#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA)} NUM_EXPR {(#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA)}
WARNING "Inserire un riepilogo non inferiore al protocollo IVA (Obbigatorio se il cliete/fornitore ha codice inserimento in allegati uguale a 3)" WARNING "Inserire un riepilogo non inferiore al protocollo IVA (Obbigatorio se il cliete/fornitore ha codice inserimento in allegati uguale a 3)"
END END
STRING F_CODPAG 4 STRING F_CODPAG 4
BEGIN BEGIN
PROMPT 60 9 "Pagamento " PROMPT 60 9 "Pagamento "
HELP "Codice del pagamento concordato per il movimento"
FIELD CODPAG FIELD CODPAG
FLAGS "UZ" FLAGS "UZ"
USE %CPG USE %CPG
@ -231,6 +230,7 @@ BEGIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
ADD RUN ba3 -6 ADD RUN ba3 -6
WARNING "Codice pagamento assente" WARNING "Codice pagamento assente"
VALIDATE REQIF_FUNC 1 F_NUMRIF
END END
STRING F_CLIFO 1 STRING F_CLIFO 1
@ -526,7 +526,8 @@ NUMBER F_ANNORIF 4
BEGIN BEGIN
PROMPT 50 15 "Rif.partita " PROMPT 50 15 "Rif.partita "
FIELD LF_PARTITE->ANNO FIELD LF_PARTITE->ANNO
HELP "Anno di riferimento partita" VALIDATE REQIF_FUNC 1 F_NUMRIF
WARNING "Manca l'anno relativo al numero partita"
END END
STRING F_NUMRIF 7 STRING F_NUMRIF 7

View File

@ -118,7 +118,7 @@ END
NUMBER S_RESIDUORATA 15 NUMBER S_RESIDUORATA 15
BEGIN BEGIN
PROMPT 43 5 "Residuo rata " PROMPT 48 5 "Residuo rata "
PICTURE "." PICTURE "."
FLAGS "DRV" FLAGS "DRV"
END END
@ -157,7 +157,7 @@ END
RADIOBUTTON S_SALDOACC 1 24 RADIOBUTTON S_SALDOACC 1 24
BEGIN BEGIN
PROMPT 2 9 "" PROMPT 1 9 ""
FLAGS "Z" FLAGS "Z"
ITEM "A|Acconto" ITEM "A|Acconto"
ITEM "S|Saldo" ITEM "S|Saldo"

View File

@ -490,12 +490,12 @@ real TPrimanota_application::calcola_saldo() const
switch (sbilancio.sign()) switch (sbilancio.sign())
{ {
case +1: // Il dare supera l'avere in valore assoluto case +1: // Il dare supera l'avere in valore assoluto
m.set(F_DARE, absbilancio.string()); m.set(F_DARE, absbilancio);
m.reset(F_AVERE); m.reset(F_AVERE);
break; break;
case -1: // L'avere supera il dare in valore assoluto case -1: // L'avere supera il dare in valore assoluto
m.reset(F_DARE); m.reset(F_DARE);
m.set(F_AVERE, absbilancio.string()); m.set(F_AVERE, absbilancio);
break; break;
default: // Sbilancio nullo default: // Sbilancio nullo
m.reset(F_DARE); m.reset(F_DARE);
@ -577,7 +577,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
const real valore = saldaconto.normalize().valore(); const real valore = saldaconto.normalize().valore();
if (totdoc != valore) if (totdoc != valore)
{ {
const TString16 td(totdoc.string(".")); const TString td(totdoc.string("."));
const char* ss = valore.string("."); const char* ss = valore.string(".");
return f.error_box("Il totale documento inserito e' %s\n" return f.error_box("Il totale documento inserito e' %s\n"
"mentre i pagamenti ammontano a %s", (const char*)td, ss); "mentre i pagamenti ammontano a %s", (const char*)td, ss);
@ -1179,17 +1179,17 @@ else
} }
oldiva = imposta; oldiva = imposta;
oldposiva = newposiva; oldposiva = newposiva;
TMask& m = app().curr_mask();
if (r == 0) // Se cambio la prima riga ...
app().add_cgs_tot(m); // ... ricalcola conti
if (app().is_saldaconto() && m.page_enabled(2)) TMask& m = app().curr_mask();
app().set_scadenze(m); if (r == 0) // Se cambio la prima riga ...
} app().add_cgs_tot(m); // ... ricalcola conti
return TRUE;
if (app().is_saldaconto() && m.insert_mode())
app().set_scadenze(m); // Aggiorna rate
}
return TRUE;
} }
@ -1578,15 +1578,14 @@ bool TPrimanota_application::doc_handler(TMask_field& f, KEY key)
const TDate dd(val); const TDate dd(val);
m.set(F_ANNORIF, dd.year()); // copia data documento m.set(F_ANNORIF, dd.year()); // copia data documento
// TBI modifica scadenze pagamento if (app().pagamento() != NULL && m.insert_mode())
if (app().pagamento() != NULL && !m.edit_mode())
app().recalc_scadenze(dd); app().recalc_scadenze(dd);
} }
else if (!app().npart_is_prot()) else
if (m.insert_mode() && !app().npart_is_prot())
{ {
if (m.get(F_NUMRIF).empty()) if (m.get(F_NUMRIF).empty())
m.set(F_NUMRIF, val); // copia numero documento m.set(F_NUMRIF, val); // copia numero documento
} }
} }
} }
@ -1711,11 +1710,10 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
TEdit_field& upi = m.efield(F_RIEPILOGO); TEdit_field& upi = m.efield(F_RIEPILOGO);
upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL); upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL);
if (m.get(F_CODPAG).empty()) if (m.insert_mode() && m.get(F_CODPAG).empty())
{ {
const TString& s = clifo.get(CLI_CODPAG); const TString& s = clifo.get(CLI_CODPAG);
if (s.not_empty()) m.set(F_CODPAG, s, s.not_empty());
m.set(F_CODPAG, s, TRUE);
} }
if (app().is_saldaconto() && f.focusdirty()) if (app().is_saldaconto() && f.focusdirty())
@ -1840,7 +1838,8 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
if (app().iva() != nessuna_iva) if (app().iva() != nessuna_iva)
{ {
app().add_cgs_tot(m); app().add_cgs_tot(m);
m.field(F_CODIVA).on_hit(); if (m.insert_mode()) // Se si e' in inserimento provoca ricalcolo
m.field(F_CODIVA).on_hit(); // dello sheet iva e delle scadenze
} }
else else
{ {
@ -1934,7 +1933,9 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
protiva, protocol); protiva, protocol);
} }
else if (key == K_TAB && app().is_saldaconto() && m.get(F_NUMRIF).empty()) else
if (key == K_TAB && app().is_saldaconto() &&
m.insert_mode() && m.get(F_NUMRIF).empty())
{ {
const TString16 piva(f.get()); const TString16 piva(f.get());
if (app().npart_is_prot() && piva.not_empty()) if (app().npart_is_prot() && piva.not_empty())

View File

@ -78,7 +78,7 @@ class TPrimanota_application : public TRelation_application
static bool datacomp_handler(TMask_field& f, KEY key); static bool datacomp_handler(TMask_field& f, KEY key);
static bool data74ter_handler(TMask_field& f, KEY key); static bool data74ter_handler(TMask_field& f, KEY key);
static bool doc_handler(TMask_field& f, KEY key); static bool doc_handler(TMask_field& f, KEY key);
// static bool numrif_handler(TMask_field& f, KEY key); static bool numrif_handler(TMask_field& f, KEY key);
static bool protiva_handler(TMask_field& f, KEY key); static bool protiva_handler(TMask_field& f, KEY key);
static bool clifo_handler(TMask_field& f, KEY key); static bool clifo_handler(TMask_field& f, KEY key);
static bool totdoc_handler(TMask_field& f, KEY key); static bool totdoc_handler(TMask_field& f, KEY key);

View File

@ -176,6 +176,35 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
return TRUE; return TRUE;
} }
bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
if (f.to_check(key))
{
const TPartita* old = app().partite().first();
if (old && f.get().blank()) // Se esisteva una partita ma ora non piu'
{
TMask& m = f.mask();
const KEY k = yesnocancel_box("Attenzione la fattura della partita %d %s verra' eliminata.\n"
"Premere SI per cancellarla, NO per ripristinarla, ANNULLA modificarla",
old->anno(), (const char*)old->numero());
switch (k)
{
case K_NO:
m.set(F_ANNORIF, old->anno());
m.set(F_NUMRIF, old->numero());
break;
case K_ESC:
ok = FALSE;
default:
f.reset();
break;
}
}
}
return ok;
}
bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key) bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
{ {
if (key == K_TAB && f.focusdirty()) if (key == K_TAB && f.focusdirty())
@ -488,8 +517,10 @@ void TPrimanota_application::write_scadenze(const TMask& m)
const int anno = m.get_int(F_ANNORIF); const int anno = m.get_int(F_ANNORIF);
const TString numpart(m.get(F_NUMRIF)); const TString numpart(m.get(F_NUMRIF));
TPartita* oldgame = partite().first();
TPartita* newgame = NULL; TPartita* newgame = NULL;
if (anno > 0 && numpart.not_empty())
if (anno > 0 && !numpart.blank())
{ {
real imponibile(0.0); real imponibile(0.0);
real imposta(0.0); real imposta(0.0);
@ -574,11 +605,10 @@ void TPrimanota_application::write_scadenze(const TMask& m)
} }
} }
TPartita* oldgame = partite().first();
if (oldgame != NULL) if (oldgame != NULL)
{ {
const int primafatt = oldgame->prima_fattura(nreg); const int rigafatt = oldgame->prima_fattura(nreg);
if (primafatt > 0) if (rigafatt > 0)
{ {
if (newgame == NULL || *oldgame != *newgame) if (newgame == NULL || *oldgame != *newgame)
{ {
@ -590,23 +620,23 @@ void TPrimanota_application::write_scadenze(const TMask& m)
sposta = yesno_box("Spostare le righe nella nuova partita?"); sposta = yesno_box("Spostare le righe nella nuova partita?");
} }
if (sposta) if (sposta)
oldgame->sposta_riga(primafatt, *newgame); oldgame->sposta_riga(rigafatt, *newgame);
else else
{ {
oldgame->scollega_pagamenti(primafatt); oldgame->scollega_pagamenti(rigafatt);
oldgame->rimuovi_riga(primafatt); oldgame->rimuovi_riga(rigafatt);
} }
oldgame->rewrite(); oldgame->rewrite();
} }
else else
{ {
oldgame->sposta_riga(primafatt, *newgame); oldgame->sposta_riga(rigafatt, *newgame);
} }
} }
} }
if (newgame != NULL) if (newgame != NULL) // Se ho cancellato il numero partita ...
newgame->write(); newgame->write(); // Salva nuova partita
} }

View File

@ -237,9 +237,9 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
#ifndef __EXTRA__ #ifndef __EXTRA__
TMask& cm = app().curr_mask(); TMask& cm = app().curr_mask();
val.get(cm, S_VALUTA, S_DATACAMBIO, S_CAMBIO); val.get(cm, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
#endif
cerca_valuta(val); cerca_valuta(val);
val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO); val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
#endif
enable(-3, val.in_valuta()); enable(-3, val.in_valuta());
set_handler(P_ANNO, annopart_handler); set_handler(P_ANNO, annopart_handler);

View File

@ -54,7 +54,7 @@ END
STRING 106 1 STRING 106 1
BEGIN BEGIN
PROMPT 21 5 "Ulter. class. " PROMPT 24 5 "Ulteriore classific. "
USE %CLR USE %CLR
INPUT CODTAB[1,1] 105 SELECT INPUT CODTAB[1,1] 105 SELECT
INPUT CODTAB[2,2] 106 INPUT CODTAB[2,2] 106

View File

@ -1252,8 +1252,6 @@ int TPagamento::remove(TTable& r)
void TPagamento::set_rate_auto() void TPagamento::set_rate_auto()
{ {
main_app().begin_wait();
// vedi rate esistenti e tipo prima rata // vedi rate esistenti e tipo prima rata
// deve fare riferimento ad un tipo pagamento esistente // deve fare riferimento ad un tipo pagamento esistente
// e sensato // e sensato
@ -1261,7 +1259,10 @@ void TPagamento::set_rate_auto()
real toslice = _firstr; real toslice = _firstr;
if (n_rate() == 0 || !_inited || (_tpr > 3 && n_rate() == 1)) return; if (n_rate() == 0 || !_inited || (_tpr > 3 && n_rate() == 1))
return;
main_app().begin_wait();
if (_tpr > 3) // ripartisci _firstr su tutte le rate if (_tpr > 3) // ripartisci _firstr su tutte le rate
{ {