Migliorata gestione degli sheet per quanto riguarda i controlli e i campi

maiuscoli e zerofilled


git-svn-id: svn://10.65.10.50/trunk@351 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-10-11 17:36:33 +00:00
parent bb4dd09abb
commit 35aabacbc8
18 changed files with 267 additions and 194 deletions

View File

@ -393,15 +393,16 @@ bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
} }
app()->MostraCampi(f); app()->MostraCampi(f);
if (f.focusdirty()) // if (f.focusdirty())
app()->fill_sheet(f.mask()); app()->fill_sheet(f.mask());
} }
return TRUE; return TRUE;
} }
bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k) bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k)
{ {
if (k == K_SPACE) { if (k == K_SPACE)
{
app()->MostraCampi(f); app()->MostraCampi(f);
if (f.focusdirty()) app()->fill_sheet(f.mask()); if (f.focusdirty()) app()->fill_sheet(f.mask());
} }
@ -412,7 +413,8 @@ bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k)
// essere puramente contabile (= codreg vuoto e tpm = Nessuno // essere puramente contabile (= codreg vuoto e tpm = Nessuno
bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k) bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
{ {
if (f.to_check(k)) { if (f.to_check(k))
{
TString16 causim(f.get()); TString16 causim(f.get());
TLocalisamfile& caus = app()->_rel->lfile(LF_CAUSALI); TLocalisamfile& caus = app()->_rel->lfile(LF_CAUSALI);
caus.zero(); caus.zero();
@ -442,9 +444,11 @@ bool CG0500_application::MostraCampi(TMask_field& f)
m.hide(F_FAT_RITARDO); m.hide(F_FAT_RITARDO);
m.hide(F_OP_INTRACOM); m.hide(F_OP_INTRACOM);
m.hide(F_VALINTRA); m.hide(F_VALINTRA);
if (salda_conto()) m.hide(F_COD_CAUS_IM); // if (salda_conto())
m.hide(F_COD_CAUS_IM);
switch (tpm) { switch (tpm)
{
case 0: case 0:
m.show(F_OP_FINE_ANNO); m.show(F_OP_FINE_ANNO);
m.show(F_COLL_CESP); m.show(F_COLL_CESP);
@ -465,11 +469,13 @@ bool CG0500_application::MostraCampi(TMask_field& f)
break; break;
} }
} }
else { // codreg non vuoto else
{ // 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 (gestione_valuta()) m.show(F_MOV_VALU); if (gestione_valuta()) m.show(F_MOV_VALU);
if (!salda_conto()) m.show(F_COD_CAUS_IM); if (!salda_conto())
m.show(F_COD_CAUS_IM);
m.show(F_AUTO_FAT); m.show(F_AUTO_FAT);
m.show(F_ALLEGAT); m.show(F_ALLEGAT);
m.show(F_FAT_RITARDO); m.show(F_FAT_RITARDO);
@ -482,7 +488,8 @@ bool CG0500_application::MostraCampi(TMask_field& f)
bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k) bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
{ {
if (k == K_TAB) { if (k == K_TAB)
{
app()->MostraCampi(f); app()->MostraCampi(f);
if (f.focusdirty()) app()->fill_sheet(f.mask()); if (f.focusdirty()) app()->fill_sheet(f.mask());
return TRUE; return TRUE;
@ -1049,13 +1056,15 @@ bool CG0500_application::user_create()
_msk = new TMask("cg0500a"); _msk = new TMask("cg0500a");
if (!salda_conto()) { if (!salda_conto())
{
_msk->hide (F_MOV_SEZ); _msk->hide (F_MOV_SEZ);
_msk->hide (F_TIPO_MOV_1); _msk->hide (F_TIPO_MOV_1);
_msk->hide (F_TIPO_MOV_2); _msk->hide (F_TIPO_MOV_2);
_msk->show (F_COD_CAUS_IM); _msk->show (F_COD_CAUS_IM);
} }
else { else
{
_msk->show (F_MOV_SEZ); _msk->show (F_MOV_SEZ);
_msk->hide (F_COD_CAUS_IM); _msk->hide (F_COD_CAUS_IM);
} }
@ -1066,7 +1075,8 @@ bool CG0500_application::user_create()
_msk->hide (F_MOV_VALU); _msk->hide (F_MOV_VALU);
_msk->set_handler(F_TIPO_DOC, tipodoc_hndl); _msk->set_handler(F_TIPO_DOC, tipodoc_hndl);
if (salda_conto()) { if (salda_conto())
{
_msk->set_handler(F_TIPO_MOV_1, tipomov_hndl); _msk->set_handler(F_TIPO_MOV_1, tipomov_hndl);
_msk->set_handler(F_TIPO_MOV_2, tipomov_hndl); _msk->set_handler(F_TIPO_MOV_2, tipomov_hndl);
} }

View File

@ -73,9 +73,11 @@ BEGIN
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
OUTPUT 103 GRUPPO DISPLAY "Tipo C/F" TMCF
OUTPUT 104 CONTO
OUTPUT 105 SOTTOCONTO OUTPUT 105 SOTTOCONTO
OUTPUT 102 TMCF
OUTPUT 104 CONTO
OUTPUT 103 GRUPPO
OUTPUT 107 DESCR OUTPUT 107 DESCR
ADD RUN CG0 -0 ADD RUN CG0 -0
CHECKTYPE NORMAL CHECKTYPE NORMAL
@ -93,11 +95,10 @@ BEGIN
USE LF_CLIFO KEY 1 USE LF_CLIFO KEY 1
INPUT TIPOCF "C" INPUT TIPOCF "C"
INPUT CODCF 205 INPUT CODCF 205
DISPLAY "Sottoconto" CODCF
DISPLAY "Ragione sociale cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" CODCF
DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Tipo C/F" TIPOCF
OUTPUT 205 CODCF OUTPUT 205 CODCF
OUTPUT 207 RAGSOC OUTPUT 207 RAGSOC
CHECKTYPE NORMAL CHECKTYPE NORMAL
@ -113,11 +114,10 @@ BEGIN
USE LF_CLIFO KEY 1 USE LF_CLIFO KEY 1
INPUT TIPOCF "F" INPUT TIPOCF "F"
INPUT CODCF 305 INPUT CODCF 305
DISPLAY "Sottoconto" CODCF
DISPLAY "Ragione sociale fornitore@50" RAGSOC
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" CODCF
DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Tipo C/F" TIPOCF
OUTPUT 305 CODCF OUTPUT 305 CODCF
OUTPUT 307 RAGSOC OUTPUT 307 RAGSOC
CHECKTYPE NORMAL CHECKTYPE NORMAL

View File

@ -25,12 +25,14 @@ TMask* TPrimanota_application::load_mask(int n)
return _msk[n]; return _msk[n];
if (n == 1 || n == 2) if (n == 1 || n == 2)
for (int i = 1; i < 3; i++) // Try to save windows resources! {
if (_msk[i] != NULL) const int d = 3-n;
{ if (_msk[d] != NULL)
delete _msk[i]; {
_msk[i] = NULL; delete _msk[d];
} _msk[d] = NULL;
}
}
TFilename name("cg2100"); name << char(n == 3 ? 'o' : 'a'+n); TFilename name("cg2100"); name << char(n == 3 ? 'o' : 'a'+n);
TMask* m = new TMask(name); TMask* m = new TMask(name);
@ -55,6 +57,7 @@ TMask* TPrimanota_application::load_mask(int n)
case 2: case 2:
{ {
m->set_handler(F_CODREG, reg_handler); m->set_handler(F_CODREG, reg_handler);
m->set_handler(F_PROTIVA, protiva_handler);
m->set_handler(F_CLIENTE, clifo_handler); m->set_handler(F_CLIENTE, clifo_handler);
m->set_handler(F_FORNITORE, clifo_handler); m->set_handler(F_FORNITORE, clifo_handler);
m->set_handler(F_TOTALE, totale_handler); m->set_handler(F_TOTALE, totale_handler);
@ -96,8 +99,8 @@ if (n == 1 || n == 2)
TMask& cgm = cg.sheet_mask(); TMask& cgm = cg.sheet_mask();
cgm.set_handler(101, dareavere_handler); cgm.set_handler(101, dareavere_handler);
cgm.set_handler(102, dareavere_handler); cgm.set_handler(102, dareavere_handler);
cgm.set_handler(105, suspended_handler);
cgm.set_handler(106, suspended_handler); cgm.set_handler(106, suspended_handler);
cgm.set_handler(105, cg_conto_handler);
cgm.set_handler(206, cg_clifo_handler); cgm.set_handler(206, cg_clifo_handler);
cgm.set_handler(306, cg_clifo_handler); cgm.set_handler(306, cg_clifo_handler);
cgm.set_handler(112, suspended_handler); cgm.set_handler(112, suspended_handler);
@ -175,7 +178,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
iva = _causale.iva(); iva = _causale.iva();
} }
TMask& m = *load_mask(iva == nessuna_iva ? 1 : 2); TMask& m = *_msk[iva == nessuna_iva ? 1: 2];
m.efield(F_NUMDOC).check_type(nob ? CHECK_REQUIRED : CHECK_NORMAL); // Num. doc. obbligatorio m.efield(F_NUMDOC).check_type(nob ? CHECK_REQUIRED : CHECK_NORMAL); // Num. doc. obbligatorio
m.efield(F_DATADOC).check_type(dob ? CHECK_REQUIRED : CHECK_NORMAL); // Data doc. obbligatoria m.efield(F_DATADOC).check_type(dob ? CHECK_REQUIRED : CHECK_NORMAL); // Data doc. obbligatoria
@ -208,46 +211,53 @@ void TPrimanota_application::print()
bool TPrimanota_application::changing_mask(int mode) bool TPrimanota_application::changing_mask(int mode)
{ {
if (mode == MODE_QUERY) if (mode == MODE_QUERY)
return _mode != MODE_QUERY;
_iva = nessuna_iva;
TString16 causale;
// TString16 registro;
int annoes = 0, annoiva = 0;
switch (mode)
{ {
case MODE_INS: const bool flag = _mode != MODE_QUERY;
annoes = _msk[0]->get_int(F_ANNOES); if (flag && _iva != nessuna_iva)
annoiva = _msk[0]->get_int(F_ANNOIVA); {
causale = _msk[0]->get(F_CODCAUS); WINDOW w = ivas().parent();
read_caus(causale, annoiva); show_window(w, TRUE);
break; set_front_window(w);
case MODE_MOD: process_events();
annoes = _rel->lfile().get_int("ANNOES"); show_window(w, FALSE);
annoiva = _rel->lfile().get_int("ANNOIVA"); }
causale = _rel->lfile().get("CODCAUS"); return flag;
giornale().read(annoes);
// registro = _rel->lfile()->get("REG");
// _causale.read(causale, 0);
// _causale.reg().read(registro, annoiva);
read_caus(causale, annoiva);
break;
default:
break;
} }
_iva = _causale.iva(); _iva = iva_errata;
return TRUE; return TRUE;
} }
TMask* TPrimanota_application::get_mask(int mode) TMask* TPrimanota_application::get_mask(int mode)
{ {
int annoes = 0, annoiva = 0;
TString16 caus;
_mode = mode; _mode = mode;
const int m = (mode == MODE_QUERY) ? 0 : (iva() == nessuna_iva ? 1 : 2);
return load_mask(m); switch (mode)
{
case MODE_INS:
annoes = _msk[0]->get_int(F_ANNOES);
annoiva = _msk[0]->get_int(F_ANNOIVA);
caus = _msk[0]->get(F_CODCAUS);
break;
case MODE_MOD:
annoes = _rel->lfile().get_int("ANNOES");
annoiva = _rel->lfile().get_int("ANNOIVA");
caus = _rel->lfile().get("CODCAUS");
break;
default:
return load_mask(0);
}
TCausale c(caus, annoiva);
_iva = causale().iva();
TMask* m = load_mask(_iva == nessuna_iva ? 1 : 2);
giornale().read(annoes);
read_caus(caus, annoiva);
return m;
} }
@ -276,7 +286,7 @@ void TPrimanota_application::init_mask(TMask& m)
else else
{ {
forg = 'h'; forg = 'h';
clig = causale().reg().corrispettivi() ? 'h' : 's'; clig = causale().corrispettivi() ? 'h' : 's';
} }
m.send_key(K_SHIFT+K_CTRL+clig, -1); // group 1 (clienti) m.send_key(K_SHIFT+K_CTRL+clig, -1); // group 1 (clienti)
m.send_key(K_SHIFT+K_CTRL+forg, -2); // group 2 (fornitori) m.send_key(K_SHIFT+K_CTRL+forg, -2); // group 2 (fornitori)
@ -286,14 +296,14 @@ void TPrimanota_application::init_mask(TMask& m)
const bool corrval = intra && _causale.corrval(); const bool corrval = intra && _causale.corrval();
m.show(F_CORRVALUTA, corrval); m.show(F_CORRVALUTA, corrval);
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_VISVAL (GROUP 3)
const bool valuta = _causale.valuta() && gestione_valuta();
m.send_key(K_SHIFT+K_CTRL+(valuta ? 's' : 'h'), -3);
if (valuta)
m.set(F_VISVAL, "X");
} }
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_VISVAL (GROUP 3)
const bool valuta = _causale.valuta() && gestione_valuta();
m.send_key(K_SHIFT+K_CTRL+(valuta ? 's' : 'h'), -3);
if (valuta)
m.set(F_VISVAL, "X");
m.disable(DLG_NEWREC); m.disable(DLG_NEWREC);
} }
@ -431,6 +441,9 @@ void TPrimanota_application::put_conto(TRectype& r, const TBill& c) const
r.put("SOTTOCONTO", c.sottoconto()); r.put("SOTTOCONTO", c.sottoconto());
} }
// Controlla sulla causale se il segno del totale documento (ritsoc=FALSE)
// o quello delle ritenute sociali (ritsoc=TRUE) e' invertito rispetto al normale
bool TPrimanota_application::test_swap(bool ritsoc) bool TPrimanota_application::test_swap(bool ritsoc)
{ {
bool s = FALSE; bool s = FALSE;
@ -456,19 +469,12 @@ int TPrimanota_application::read(TMask& m)
error_box("Registrazione di acquisto attribuita ad un cliente"); else error_box("Registrazione di acquisto attribuita ad un cliente"); else
if (_iva == iva_vendite && clifo == 'F') if (_iva == iva_vendite && clifo == 'F')
error_box("Registrazione di vendita attribuita ad un fornitore"); error_box("Registrazione di vendita attribuita ad un fornitore");
if (_iva == iva_vendite)
{
TEdit_field& f = (TEdit_field&)m.field(F_CLIENTE);
f.check_type(clifo == 'C' ? CHECK_REQUIRED : CHECK_NORMAL);
}
} }
TSheet_field& cgs = (TSheet_field&)m.field(F_SHEETCG); cgs().reset();
cgs.reset();
_saldi.reset(); // Azzera saldi _saldi.reset(); // Azzera saldi
_saldi.set_movprovv(_rel->lfile().get_char("PROVVIS") > ' ' ? TRUE : FALSE); _saldi.set_movprovv(_rel->lfile().get_bool("PROVVIS"));
_saldi.set_movap(_causale.apertura()); _saldi.set_movap(_causale.apertura());
_saldi.set_anno_es(m.get_int(F_ANNOES)); _saldi.set_anno_es(m.get_int(F_ANNOES));
_saldi.set_num_ulmov(m.get_long(F_NUMREG)); _saldi.set_num_ulmov(m.get_long(F_NUMREG));
@ -482,10 +488,8 @@ int TPrimanota_application::read(TMask& m)
riga.cut(0); // Vuota la riga riga.cut(0); // Vuota la riga
const int rcontr = r.get_int("RCONTR") -1; const int rcontr = r.get_int("RCONTR") -1;
#ifdef DBG
if (rcontr < -1 || rcontr >= _rel->cg_items() || rcontr == i) if (rcontr < -1 || rcontr >= _rel->cg_items() || rcontr == i)
error_box("La riga %d non puo' avere per contropartita la %d", i+1, rcontr+1); error_box("La riga %d non puo' avere per contropartita la %d", i+1, rcontr+1);
#endif
const real im(r.get_real("IMPORTO")); const real im(r.get_real("IMPORTO"));
const char sezione = toupper(r.get_char("SEZIONE")); const char sezione = toupper(r.get_char("SEZIONE"));
@ -511,7 +515,7 @@ 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
cgs.row(i) = riga; cgs().row(i) = riga;
disable_cgs_cells(i, tipo); disable_cgs_cells(i, tipo);
} }
@ -522,8 +526,7 @@ int TPrimanota_application::read(TMask& m)
m.set(F_SOLAIVA, solaiva ? "X" : " "); m.set(F_SOLAIVA, solaiva ? "X" : " ");
m.field(F_SOLAIVA).on_hit(); m.field(F_SOLAIVA).on_hit();
TSheet_field& ivas = (TSheet_field&)m.field(F_SHEETIVA); ivas().reset();
ivas.reset();
const bool to_swap = test_swap(FALSE); const bool to_swap = test_swap(FALSE);
@ -546,7 +549,7 @@ int TPrimanota_application::read(TMask& m)
else else
riga.add(" | | | | | "); riga.add(" | | | | | ");
ivas.row(i) = riga; ivas().row(i) = riga;
} }
TMask_field& vv = m.field(F_VISVAL); TMask_field& vv = m.field(F_VISVAL);
@ -616,7 +619,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
rcontr = bill2contr(contro, n.sezione())+1; rcontr = bill2contr(contro, n.sezione())+1;
if (rcontr < 1) if (rcontr < 1)
{ {
warning_box("La riga contabile %d non ha una contropartita", cur); warning_box("La riga contabile %d non ha una contropartita valida", cur);
rcontr = 0; rcontr = 0;
} }
} }
@ -628,7 +631,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
} }
if (_iva == nessuna_iva) return; if (_iva == nessuna_iva) return;
if (causale().reg().corrispettivi()) if (causale().corrispettivi())
{ {
TRectype& rec = _rel->lfile().curr(); TRectype& rec = _rel->lfile().curr();
rec.put("TIPO", ""); rec.put("TIPO", "");
@ -699,9 +702,13 @@ int TPrimanota_application::write(const TMask& m)
if (err == NOERR) if (err == NOERR)
{ {
_saldi.registra(); _saldi.registra();
const TString16 causimm(_causale.causale_inc_imm());
if (causimm.not_empty()) if (iva() == iva_vendite && !gestione_saldaconto())
genera_incasso(causimm); {
const TString16 causimm(_causale.causale_inc_imm());
if (causimm.not_empty())
genera_incasso(causimm);
}
if (gestione_saldaconto() && _causale.saldaconto()) if (gestione_saldaconto() && _causale.saldaconto())
aggiorna_scadenzario(m); aggiorna_scadenzario(m);
@ -768,15 +775,20 @@ void TPrimanota_application::genera_incasso(const char* causimm)
r.put("NUMREG", _lastreg); r.put("NUMREG", _lastreg);
r.put("NUMRIG", 1); r.put("NUMRIG", 1);
r.put("IMPORTO", imp); r.put("IMPORTO", imp);
r.put("ROWTYPE", ' ');
r.put("SEZIONE", sez == 'A' ? 'D' : 'A'); r.put("SEZIONE", sez == 'A' ? 'D' : 'A');
r.put("TIPOC", m.get(F_CLIFO));
r.put("GRUPPO", m.get_int(F_GRUPPOCLIFO));
r.put("CONTO", m.get_int(F_CONTOCLIFO));
r.put("SOTTOCONTO", m.get_long(F_CLIENTE));
r.put("ROWTYPE", ' ');
inc.cg(0) = r; inc.cg(0) = r;
r.put("NUMRIG", 2); r.put("NUMRIG", 2);
r.put("SEZIONE", sez); r.put("SEZIONE", sez);
inc.cg(1) = r; inc.cg(1) = r;
while (inc.write() == _isreinsert) // In caso di riscrittura while (inc.write() == _isreinsert) // In caso di riscrittura
inc.lfile().put("NUMREG", ++_lastreg); // Incrementa numero registrazione inc.lfile().put("NUMREG", ++_lastreg); // Incrementa numero registrazione
} }
} }

View File

@ -50,6 +50,7 @@ BEGIN
PROMPT 43 3 "Data del documento " PROMPT 43 3 "Data del documento "
FIELD LF_MOV->DATADOC FIELD LF_MOV->DATADOC
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Specificare la data del documento"
END END
STRING F_DESCR 50 50 STRING F_DESCR 50 50
@ -154,16 +155,14 @@ END
NUMBER F_GRUPPOCLIFO 3 NUMBER F_GRUPPOCLIFO 3
BEGIN BEGIN
PROMPT 1 8 "Gruppo " PROMPT 1 8 "Gruppo "
FIELD LF_MOV->GRUPPO
END END
NUMBER F_CONTOCLIFO 3 NUMBER F_CONTOCLIFO 3
BEGIN BEGIN
PROMPT 16 8 "Conto " PROMPT 16 8 "Conto "
FIELD LF_MOV->CONTO
END END
NUMBER F_TOTALE 14 NUMBER F_TOTALE 15
BEGIN BEGIN
PROMPT 1 9 "Totale documento " PROMPT 1 9 "Totale documento "
FIELD LF_MOV->TOTDOC FIELD LF_MOV->TOTDOC

View File

@ -25,7 +25,7 @@ TipoIVA TPrimanota_application::cau2IVA(const char* causale, int annoiva)
if (*causale > ' ') if (*causale > ' ')
{ {
TCausale c; TCausale& c = app().causale();
if (c.read(causale, annoiva)) if (c.read(causale, annoiva))
i = c.iva(); i = c.iva();
else else
@ -64,22 +64,25 @@ real TPrimanota_application::scorpora(real& imponibile, const real& percent)
return imposta; return imposta;
} }
// Calcola il totale del documento tenenod conto del segno della prima riga e di quella delle
// ritenute sociali sulla causale
real TPrimanota_application::totale_documento() real TPrimanota_application::totale_documento()
{ {
const TMask& m = mask(); const TMask& m = curr_mask();
const bool swapt = test_swap(FALSE); // Totale invertito ? const bool swapt = test_swap(FALSE); // Totale invertito ?
const bool swaps = test_swap(TRUE); // Ritenute sociali invertite ? const bool swaps = test_swap(TRUE); // Ritenute sociali invertite ?
real tot(m.get(F_TOTALE)); real tot(m.get(F_TOTALE)); // Legge totale
const real ritfis(m.get(F_RITFIS)); const real ritfis(m.get(F_RITFIS));
tot += ritfis; tot += ritfis; // Somma ritenute fiscali
real ritsoc(m.get(F_RITSOC)); real ritsoc(m.get(F_RITSOC));
if (swapt ^ swaps) if (swapt ^ swaps)
ritsoc = -ritsoc; ritsoc = -ritsoc;
tot += ritsoc; // Somma ritenute sociali con segno
tot += ritsoc;
return tot; return tot;
} }
@ -120,7 +123,7 @@ bool TPrimanota_application::detraibile(TToken_string& row)
TRegistro& reg = app().causale().reg(); TRegistro& reg = app().causale().reg();
TString16 chiave; TString16 chiave;
chiave << app().mask().get(F_ANNOIVA) << reg.attivita(); chiave << app().curr_mask().get(F_ANNOIVA) << reg.attivita();
int tipoatt = 1; int tipoatt = 1;
if (reg.attivita_mista()) // Se attivita mista ... if (reg.attivita_mista()) // Se attivita mista ...
@ -237,18 +240,9 @@ int TPrimanota_application::det_used(char det) const
// Gestione sheet CG // Gestione sheet CG
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TMask& TPrimanota_application::mask() const
{
const TipoIVA i = app().iva();
const int m = i == nessuna_iva ? 1 : 2;
CHECKD(_msk[m], "Maschera non attiva! ", m);
return *_msk[m];
}
TSheet_field& TPrimanota_application::cgs() const TSheet_field& TPrimanota_application::cgs() const
{ {
TSheet_field& s = (TSheet_field&)mask().field(F_SHEETCG); TSheet_field& s = (TSheet_field&)curr_mask().field(F_SHEETCG);
return s; return s;
} }
@ -448,16 +442,16 @@ real TPrimanota_application::calcola_saldo() const
switch (sbilancio.sign()) switch (sbilancio.sign())
{ {
case 1: case 1:
mask().set(F_DARE, (tdare-tavere).string()); curr_mask().set(F_DARE, (tdare-tavere).string());
mask().reset(F_AVERE); curr_mask().reset(F_AVERE);
break; break;
case -1: case -1:
mask().reset(F_DARE); curr_mask().reset(F_DARE);
mask().set(F_AVERE, (tavere-tdare).string()); curr_mask().set(F_AVERE, (tavere-tdare).string());
break; break;
default: default:
mask().reset(F_DARE); curr_mask().reset(F_DARE);
mask().reset(F_AVERE); curr_mask().reset(F_AVERE);
break; break;
} }
@ -522,12 +516,15 @@ bool TPrimanota_application::cg_notify(int r, KEY k)
TImporto i; i = row; TImporto i; i = row;
if (i.valore() != 0.0) if (i.valore() != 0.0)
{ {
i.swap_section();
TBill contro(row, 9, 0x3); TBill contro(row, 9, 0x3);
app().set_cgs_row(1, i, contro, "", ' '); if (contro.ok())
TBill conto(row, 2, 0x3); {
conto.add_to(cg.row(1), 9, 0x3); i.swap_section();
app().cgs().force_update(1); app().set_cgs_row(1, i, contro, "", ' ');
TBill conto(row, 2, 0x3);
conto.add_to(cg.row(1), 9, 0x3);
app().cgs().force_update(1);
}
} }
} }
app().calcola_saldo(); app().calcola_saldo();
@ -596,7 +593,7 @@ bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)
TString16 iva(m.get(102)); TString16 iva(m.get(102));
if (iva.empty()) if (iva.empty())
{ {
iva = app().mask().get(F_CODIVA); iva = app().curr_mask().get(F_CODIVA);
m.set(102, iva); m.set(102, iva);
} }
if (iva.not_empty() && !app().causale().corrispettivi()) if (iva.not_empty() && !app().causale().corrispettivi())
@ -678,8 +675,8 @@ real TPrimanota_application::calcola_imp() const
imposte += real(row.get(3)); imposte += real(row.get(3));
} }
mask().set(F_IMPONIBILI, imponibili.string()); curr_mask().set(F_IMPONIBILI, imponibili.string());
mask().set(F_IMPOSTE, imposte.string()); curr_mask().set(F_IMPOSTE, imposte.string());
return imponibili+imposte; return imponibili+imposte;
} }
@ -710,9 +707,9 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
if (oldposiva < 0 && oldiva != ZERO) if (oldposiva < 0 && oldiva != ZERO)
{ {
const int r = tipod == 'D' ? 3 : 4; const int ri = tipod == 'D' ? 3 : 4;
TBill c; cau.bill(r, c); TBill c; cau.bill(ri, c);
const TString80 d(cau.desc_agg(r)); const TString80 d(cau.desc_agg(ri));
oldposiva = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, d, tipod); oldposiva = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, d, tipod);
} }
@ -785,8 +782,8 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
// Aggiorna conto IVA sulla riga contabile // Aggiorna conto IVA sulla riga contabile
const bool detrarre = detraibile(row); // Determina se IVA detraibile const bool detrarre = detraibile(row); // Determina se IVA detraibile
const int r = detrarre ? 3 : 4; const int ri = detrarre ? 3 : 4;
app().causale().bill(r, conto); app().causale().bill(ri, conto);
const char tipod = detrarre ? 'D' : 'N'; const char tipod = detrarre ? 'D' : 'N';
int newposiva = type2pos(tipod); int newposiva = type2pos(tipod);
@ -795,7 +792,7 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
const TImporto val(app().real2imp(imposta, 'I')); const TImporto val(app().real2imp(imposta, 'I'));
if (val.valore() != ZERO) if (val.valore() != ZERO)
{ {
d = cau.desc_agg(r); d = cau.desc_agg(ri);
newposiva = app().set_cgs_row(-1, val, conto, d, tipod); newposiva = app().set_cgs_row(-1, val, conto, d, tipod);
} }
} }
@ -814,7 +811,7 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
oldposiva = newposiva; oldposiva = newposiva;
if (r == 0) if (r == 0)
app().add_cgs_tot(app().mask()); app().add_cgs_tot(app().curr_mask());
app().calcola_imp(); app().calcola_imp();
app().calcola_saldo(); app().calcola_saldo();
} }
@ -844,6 +841,26 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
{
if (key == K_TAB)
{
const TipoIVA i = app().iva();
if (i != nessuna_iva)
{
TMask& m = f.mask();
const short id = f.dlg();
const short clifo = id + (i == iva_vendite ? 101 : 201);
if (!m.field(clifo).enabled())
{
char cf = m.get(id-2)[0];
if (cf != app().clifo())
return error_box("Tipo di conto incongruente col tipo di registrazione");
}
}
}
return TRUE;
}
bool TPrimanota_application::cg_clifo_handler(TMask_field& f, KEY k) bool TPrimanota_application::cg_clifo_handler(TMask_field& f, KEY k)
{ {
@ -932,7 +949,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
ok = app().causale().similar(c); ok = app().causale().similar(c);
if (!ok) if (!ok)
{ {
f.error_box("Causale incongruente con quella precedentemente inserita"); f.error_box("Causale incongruente con quella inserita precedentemente");
return FALSE; return FALSE;
} }
app().read_caus(cau, ann); app().read_caus(cau, ann);
@ -990,7 +1007,9 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
if (mov.read() == NOERR) if (mov.read() == NOERR)
m.set(F_CODCAUS, mov.get(MOV_CODCAUS)); m.set(F_CODCAUS, mov.get(MOV_CODCAUS));
} }
app().read_caus(m.get(F_CODCAUS), dr.year()); // Forza aggiornamento registro causale essendo cambiato l'anno
const bool ok = app().causale().read(m.get(F_CODCAUS), dr.year());
if (!ok) return FALSE;
} }
TRegistro& reg = app().causale().reg(); TRegistro& reg = app().causale().reg();
@ -1254,6 +1273,19 @@ void TPrimanota_application::add_cgs_rit(bool fiscali)
set_cgs_imp(pos, real2imp(imp, tipo)); set_cgs_imp(pos, real2imp(imp, tipo));
} }
// Handler of the F_PROTIVA
bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
{
if (key == K_ENTER && f.dirty() && f.mask().mode() == MODE_INS)
{
const long protiva = atol(f.get());
const long protocol = app().causale().reg().protocol() + 1;
if (protiva != protocol)
f.warning_box("Protocollo IVA fuori sequenza: %ld invece di %ld", protiva, protocol);
}
return TRUE;
}
// Handler of the F_RITFIS // Handler of the F_RITFIS
// Certified 99% // Certified 99%
@ -1302,7 +1334,9 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
TMask& m = f.mask(); TMask& m = f.mask();
const bool anchecg = !m.get_bool(F_SOLAIVA); const bool anchecg = !m.get_bool(F_SOLAIVA);
app().cgs().show(anchecg); m.show(F_SHEETCG, anchecg);
m.show(F_DARE, anchecg);
m.show(F_AVERE, anchecg);
if (m.is_running() && anchecg) if (m.is_running() && anchecg)
{ {

View File

@ -58,6 +58,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 reg_handler(TMask_field& f, KEY key); static bool reg_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 totale_handler(TMask_field& f, KEY key); static bool totale_handler(TMask_field& f, KEY key);
static bool ritfis_handler(TMask_field& f, KEY key); static bool ritfis_handler(TMask_field& f, KEY key);
@ -73,6 +74,7 @@ class TPrimanota_application : public TRelation_application
static bool codiva_handler(TMask_field& f, KEY key); static bool codiva_handler(TMask_field& f, KEY key);
static bool imposta_handler(TMask_field& f, KEY key); static bool imposta_handler(TMask_field& f, KEY key);
static bool dareavere_handler(TMask_field& f, KEY k); static bool dareavere_handler(TMask_field& f, KEY k);
static bool cg_conto_handler(TMask_field& f, KEY key);
static bool cg_clifo_handler(TMask_field& f, KEY k); static bool cg_clifo_handler(TMask_field& f, KEY k);
static bool iva_notify(int r, KEY key); static bool iva_notify(int r, KEY key);
@ -111,7 +113,6 @@ protected:
TipoIVA iva() const { return _iva; } TipoIVA iva() const { return _iva; }
char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; } char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; }
TMask& TPrimanota_application::mask() const;
bool gestione_valuta() const { return _ges_val; } bool gestione_valuta() const { return _ges_val; }
bool gestione_saldaconto() const { return _ges_sal; } bool gestione_saldaconto() const { return _ges_sal; }
bool riferimento_partita() const { return _rif_par; } bool riferimento_partita() const { return _rif_par; }

View File

@ -117,7 +117,7 @@ BEGIN
PROMPT 2 3 "Descriz. " PROMPT 2 3 "Descriz. "
FIELD LF_PCON->DESCR FIELD LF_PCON->DESCR
USE LF_PCON KEY 2 USE LF_PCON KEY 2
INPUT DESCR 107 INPUT DESCR 110
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO

View File

@ -24,7 +24,6 @@ MENUBAR MENU_BAR(3)
MENU MENU_BAR(3) MENU MENU_BAR(3)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
ITEM BAR_ITEM(1) "~Scelta parametri"
/* cg4 -4 Apertura nuovo esercizio/nuovo esercizio IVA */ /* cg4 -4 Apertura nuovo esercizio/nuovo esercizio IVA */
@ -41,5 +40,4 @@ MENUBAR MENU_BAR(5)
MENU MENU_BAR(5) MENU MENU_BAR(5)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
ITEM BAR_ITEM(1) "~Chiusura Apertura Conti"

View File

@ -132,12 +132,12 @@ BEGIN
END END
BUTTON DLG_OK 8 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 7 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END

View File

@ -20,24 +20,24 @@ BEGIN
PROMPT 2 4 "Scelta ditte" PROMPT 2 4 "Scelta ditte"
END END
BUTTON DLG_SELECT 9 2 BUTTON DLG_SELECT 10 2
BEGIN BEGIN
PROMPT -12 5 "Scegli" PROMPT -12 5 "Scegli"
MESSAGE EXIT,DLG_SELECT MESSAGE EXIT,DLG_SELECT
END END
BUTTON BUT_CGB_ALL 9 2 BUTTON BUT_CGB_ALL 10 2
BEGIN BEGIN
PROMPT -22 5 "Tutte" PROMPT -22 5 "Tutte"
MESSAGE EXIT,BUT_CGB_ALL MESSAGE EXIT,BUT_CGB_ALL
END END
BUTTON DLG_OK 8 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 7 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END

View File

@ -35,24 +35,24 @@ BEGIN
PROMPT 3 6 "Scelta ditte" PROMPT 3 6 "Scelta ditte"
END END
BUTTON DLG_SELECT 9 2 BUTTON DLG_SELECT 10 2
BEGIN BEGIN
PROMPT -12 7 "Scegli" PROMPT -12 7 "Scegli"
MESSAGE EXIT,DLG_SELECT MESSAGE EXIT,DLG_SELECT
END END
BUTTON BUT_CGC_ALL 9 2 BUTTON BUT_CGC_ALL 10 2
BEGIN BEGIN
PROMPT -22 7 "Tutte" PROMPT -22 7 "Tutte"
MESSAGE EXIT,BUT_CGC_ALL MESSAGE EXIT,BUT_CGC_ALL
END END
BUTTON DLG_OK 8 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 7 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END

View File

@ -218,6 +218,7 @@ void TMask::read_mask(const char* name, int mode, int num)
_source_file.ext(MASK_EXT); _source_file.ext(MASK_EXT);
TScanner scanner(_source_file); TScanner scanner(_source_file);
_sheetmask = num > 0;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
while (scanner.ok()) while (scanner.ok())
@ -417,7 +418,7 @@ void TMask::enable_page(int page, bool on)
bool TMask::page_enabled(int page) const bool TMask::page_enabled(int page) const
{ {
unsigned long n = 1 << page; const unsigned long n = 1 << page;
return (_enabled & n) > 0; return (_enabled & n) > 0;
} }
@ -460,6 +461,8 @@ bool TMask::check_fields()
{ {
WINDOW curpage = NULL_WIN; // Page under test WINDOW curpage = NULL_WIN; // Page under test
const bool sheet = is_sheetmask() && !is_open();
const int max = fields(); const int max = fields();
for (int i = 0; i < max; i++) for (int i = 0; i < max; i++)
{ {
@ -472,6 +475,9 @@ bool TMask::check_fields()
break; // Page disabled: end of test break; // Page disabled: end of test
curpage = f.parent(); // Update current page curpage = f.parent(); // Update current page
} }
if (sheet) f.set_dirty(); // Force check in sheets
if (f.on_key(K_ENTER) == FALSE) if (f.on_key(K_ENTER) == FALSE)
{ {
if (is_open()) f.set_focus(); if (is_open()) f.set_focus();
@ -510,12 +516,12 @@ int TMask::id2pos(short id) const
} }
} }
for (pos = 0; pos < max; pos++) // Standard linear search for (pos = 0; pos < max; pos++) // Standard linear search
{ {
const TMask_field& f = fld(pos); const TMask_field& f = fld(pos);
if (f.dlg() == id) if (f.dlg() == id)
{ {
if (j >= 0 && j < MAX_FIELDS) // Store position for the next clock if (j >= 0 && j < MAX_FIELDS) // Store position for the next time
positions[j] = pos; positions[j] = pos;
return pos; return pos;
} }
@ -1137,8 +1143,9 @@ void TMask::send_key(KEY key, short to) const
} }
else else
{ {
const int max = fields();
to = -to; to = -to;
for (int i = 0; i < fields(); i++) for (int i = 0; i < max; i++)
{ {
TMask_field& campo = fld(i); TMask_field& campo = fld(i);
if (campo.in_group((int)to)) if (campo.in_group((int)to))

View File

@ -49,6 +49,7 @@ class TMask : public TWindow
long _lastpos; // last read offset on savefile long _lastpos; // last read offset on savefile
real _exchange; // Current value exhange real _exchange; // Current value exhange
bool _sheetmask; // Mask owned by a sheet
protected: protected:
// Ritorna la finestra della pagina corrente (Usare con attenzione) // Ritorna la finestra della pagina corrente (Usare con attenzione)
@ -177,6 +178,7 @@ public:
bool load(bool reset = FALSE); bool load(bool reset = FALSE);
short dirty() const; // Ritorna il primo campo dirty short dirty() const; // Ritorna il primo campo dirty
bool is_sheetmask() const { return _sheetmask; }
bool no_mode() const { return _mode == NO_MODE; } bool no_mode() const { return _mode == NO_MODE; }
bool query_mode() const { return _mode == MODE_QUERY || _mode == MODE_QUERYINS; } bool query_mode() const { return _mode == MODE_QUERY || _mode == MODE_QUERYINS; }

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.27 1994-10-07 17:26:45 alex Exp $ // $Id: maskfld.cpp,v 1.28 1994-10-11 17:36:23 guy Exp $
#include <xvt.h> #include <xvt.h>
#include <applicat.h> #include <applicat.h>
@ -762,17 +762,17 @@ HIDDEN char* const _msg = &__tmp_string[512];
bool TMask_field::error_box(const char* fmt, ...) const bool TMask_field::error_box(const char* fmt, ...) const
{ {
build_msg(); build_msg();
if (mask().is_running()) if (mask().is_sheetmask() && !mask().is_running())
{
xvt_statbar_set(_msg);
beep();
}
else
{ {
set_focus(); set_focus();
::error_box("%s", _msg); ::error_box("%s", _msg);
set_focus(); set_focus();
} }
else
{
xvt_statbar_set(_msg);
beep();
}
return FALSE; return FALSE;
} }
@ -789,17 +789,17 @@ bool TMask_field::warning_box(const char* fmt, ...) const
{ {
build_msg(); build_msg();
if (mask().is_running()) if (mask().is_sheetmask() && !mask().is_running())
{
xvt_statbar_set(_msg);
beep();
}
else
{ {
set_focus(); set_focus();
::warning_box("%s", _msg); ::warning_box("%s", _msg);
set_focus(); set_focus();
} }
else
{
xvt_statbar_set(_msg);
beep();
}
return FALSE; return FALSE;
} }
@ -1851,6 +1851,7 @@ const char* TEdit_field::picture_data(const char* data, bool video)
{ {
if (video) if (video)
{ {
data = format(data);
set_title(win(), (char*)data); set_title(win(), (char*)data);
return get_window_data(); return get_window_data();
} }

View File

@ -83,6 +83,7 @@ public:
TSpreadsheet(short x, short y, short dx, short dy, const char* maskname, int maskno, TSpreadsheet(short x, short y, short dx, short dy, const char* maskname, int maskno,
const char* head, WINDOW parent); const char* head, WINDOW parent);
virtual ~TSpreadsheet();
}; };
// Certified 99% // Certified 99%
@ -230,6 +231,12 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
_list = xi_get_obj(_itf, LIST_CID); _list = xi_get_obj(_itf, LIST_CID);
} }
TSpreadsheet::~TSpreadsheet()
{
set_win(NULL_WIN);
}
// Converts a row number in the correspondig record number // Converts a row number in the correspondig record number
int TSpreadsheet::row2rec(int row) int TSpreadsheet::row2rec(int row)
@ -438,6 +445,13 @@ break;
else else
*dst = '\0'; *dst = '\0';
} }
break;
case XIE_CHAR_CELL:
if (!_row_dirty)
{
notify(_cur_row, K_SPACE);
_row_dirty = TRUE;
}
break; break;
case XIE_BUTTON: case XIE_BUTTON:
if (xiev->v.xi_obj->type == XIT_CELL) if (xiev->v.xi_obj->type == XIT_CELL)
@ -453,8 +467,9 @@ break;
mask2str(_cur_row); // Update row mask2str(_cur_row); // Update row
_row_dirty = TRUE; _row_dirty = TRUE;
} }
_check_enabled = TRUE; // Enable checks set_front_window(win()); // It seems necessary to make xi_set_focus work properly
xi_set_focus(xiev->v.xi_obj); // Restore focus to cell xi_set_focus(xiev->v.xi_obj); // Restore focus to cell
_check_enabled = TRUE; // Enable checks
} }
} else } else
if (xiev->v.xi_obj->type == XIT_LIST) if (xiev->v.xi_obj->type == XIT_LIST)
@ -536,22 +551,15 @@ break;
case XIE_OFF_CELL: case XIE_OFF_CELL:
if (_edit_field && _check_enabled) if (_edit_field && _check_enabled)
{ {
TMask_field* c = _edit_field; // Save field, it could turn out to be NULL on error _check_enabled = FALSE;
const TString80 old(c->get()); // Save old value on mask if (_row_dirty)
const TString80 nuo(c->picture_data(xi_get_text(xiev->v.xi_obj, NULL, -1), TRUE));
if (old != nuo)
{ {
_check_enabled = FALSE; TMask_field* c = _edit_field; // Save field, it could turn out to be NULL on error
if (!_row_dirty) const char* nuo = c->picture_data(xi_get_text(xiev->v.xi_obj, NULL, -1), TRUE);
{
notify(_cur_row, K_SPACE);
_row_dirty = TRUE;
}
c->set(nuo); // Set new mask value c->set(nuo); // Set new mask value
c->set_dirty(); // Get it dirty! c->set_dirty(); // Get it dirty!
if (c->on_key(c->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it if (c->on_key(c->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
{ {
c->set(old);
xiev->refused = TRUE; xiev->refused = TRUE;
} }
else else
@ -559,8 +567,8 @@ break;
mask2str(_cur_row); // Update sheet row mask2str(_cur_row); // Update sheet row
_edit_field = NULL; // Reset current field _edit_field = NULL; // Reset current field
} }
_check_enabled = TRUE;
} }
_check_enabled = TRUE;
} }
break; break;
case XIE_GET_PERCENT: case XIE_GET_PERCENT:
@ -571,7 +579,6 @@ break;
} }
break; break;
case XIE_CLEANUP: case XIE_CLEANUP:
set_win(NULL_WIN);
break; break;
case XIE_XVT_EVENT: case XIE_XVT_EVENT:
{ {

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.13 1994-10-07 14:59:09 guy Exp $ // $Id: relapp.cpp,v 1.14 1994-10-11 17:36:29 guy Exp $
#include <mailbox.h> #include <mailbox.h>
#include <sheet.h> #include <sheet.h>
#include <urldefid.h> #include <urldefid.h>
@ -330,9 +330,10 @@ bool TRelation_application::autonum(TMask* m, bool rec)
void TRelation_application::query_mode(bool pre_ins) void TRelation_application::query_mode(bool pre_ins)
{ {
TMask* old = _mask; TMask* old = _mask;
const bool changing = changing_mask(MODE_QUERY) || old == NULL; const bool changing = changing_mask(MODE_QUERY) || old == NULL;
if (changing && old) if (changing && old != NULL)
old->close_modal(); old->close_modal();
_mask = get_mask(MODE_QUERY); _mask = get_mask(MODE_QUERY);
@ -373,7 +374,7 @@ void TRelation_application::insert_mode()
const bool changing = changing_mask(MODE_INS); const bool changing = changing_mask(MODE_INS);
TFilename workname; workname.temp("rim.$$"); TFilename workname; workname.temp("rim$$");
if (changing) if (changing)
{ {
@ -427,7 +428,7 @@ bool TRelation_application::modify_mode()
if (err != NOERR) if (err != NOERR)
{ {
error_box("Errore di caricamento dati nella maschera %d", err); error_box("Errore di caricamento dati nella maschera: %d", err);
query_mode(); query_mode();
return FALSE; return FALSE;
} }
@ -745,8 +746,8 @@ bool TRelation_application::main_loop()
} }
break; break;
case K_F9: case K_F9:
if (save(TRUE)); if (save(TRUE))
search_mode(); search_mode();
break; break;
default: default:
if (save(TRUE)) if (save(TRUE))

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.15 1994-10-07 14:55:43 alex Exp $ // $Id: relation.cpp,v 1.16 1994-10-11 17:36:31 guy Exp $
// relation.cpp // relation.cpp
// fv 12/8/93 // fv 12/8/93
// relation class for isam files // relation class for isam files
@ -661,7 +661,7 @@ FILE* TCursor::open_index(bool create) const
FILE* f = fopen(_indexname, create ? w : r); FILE* f = fopen(_indexname, create ? w : r);
if (f == NULL) if (f == NULL)
fatal_box("Can't use cursor index for file %d\n", file().filehnd()->ln); fatal_box("Can't use cursor index for file %d: '%s'\n", file().filehnd()->ln, _indexname);
return f; return f;
} }

View File

@ -149,6 +149,7 @@ void TWindow_manager::unreg(const TWindow* m)
{ {
cur_win()->enable(); cur_win()->enable();
win_menu_enable(TASK_WIN, M_FILE_QUIT, _current == 0); win_menu_enable(TASK_WIN, M_FILE_QUIT, _current == 0);
win_update_menu_bar(TASK_WIN);
} }
} }