diff --git a/sc/sc0100.h b/sc/sc0100.h index 989dfb6c2..b483a05eb 100755 --- a/sc/sc0100.h +++ b/sc/sc0100.h @@ -50,6 +50,8 @@ public: void type2colors(char tipor, COLOR& back, COLOR& fore); void gioca_cambi(TMask& m, int force = 0x0); + + static bool descr_handler(TMask_field& f, KEY k); static bool totale_handler(TMask_field& f, KEY k); static bool imposte_handler(TMask_field& f, KEY k); static bool totval_handler(TMask_field& f, KEY k); diff --git a/sc/sc0100p.uml b/sc/sc0100p.uml index b360b0dbf..173546f50 100755 --- a/sc/sc0100p.uml +++ b/sc/sc0100p.uml @@ -127,8 +127,6 @@ BEGIN DISPLAY "Descrizione@50" S0 DISPLAY "Codice" CODTAB COPY OUTPUT E_DESCAGG - WARNING "La descrizione e' obbligatoria" - VALIDATE NOT_EMPTY_FUNC END LIST E_CLIFO 1 16 diff --git a/sc/sc0101.cpp b/sc/sc0101.cpp index 89f1360d8..a0123e1e4 100755 --- a/sc/sc0101.cpp +++ b/sc/sc0101.cpp @@ -62,8 +62,9 @@ TFattura_mask::TFattura_mask(TRiga_partite& fattura) enable(DLG_DELREC, edit); - set_handler(E_TOTALE, TSaldaconto_app::totale_handler); + set_handler(E_TOTALE, TSaldaconto_app::totale_handler); set_handler(E_IMPOSTE, TSaldaconto_app::imposte_handler); + set_handler(E_DESCR, TSaldaconto_app::descr_handler); if (app().gestione_valuta()) { @@ -404,8 +405,7 @@ bool TFattura_mask::datadoc_handler(TMask_field& f, KEY key) return f.error_box("La data del documento e' obbligatoria."); return TRUE; -} - +} bool TFattura_mask::codpag_handler(TMask_field& f, KEY key) { @@ -913,7 +913,12 @@ bool TPay_mask::descr_handler(TMask_field& f, KEY k) pm.set(id, d); if (pm.unassigned()) pm.set(S_DESCR, d); - } + } + + // Controlla che non sia vuoto insieme alla causale + if (f.dlg() == E_DESCR) + return TSaldaconto_app::descr_handler(f, k); + return TRUE; } @@ -981,6 +986,20 @@ HIDDEN void update_rate(TMask& m) } } +bool TSaldaconto_app::descr_handler(TMask_field& f, KEY key) +{ + bool ok = TRUE; + if ((key == K_TAB && f.focusdirty()) || key == K_ENTER) + { + if (f.empty() && f.mask().field(E_CODCAUS).empty()) + { + f.error_box("La descrizione e' obbligatoria in assenza della causale"); + ok = key == K_TAB; // Non bloccare sul tab + } + } + return ok; +} + bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k) { bool ok = TRUE; diff --git a/sc/sc1200.cpp b/sc/sc1200.cpp index 97956a0b9..f8330f27f 100755 --- a/sc/sc1200.cpp +++ b/sc/sc1200.cpp @@ -36,6 +36,8 @@ protected: // Applicat virtual bool menu(MENU_TAG m); protected: + static bool data_handler(TMask_field& f, KEY key); + void zap_file(int logicnum) const; bool zap_partite() const; int crea_partite(int anno_es, int anno_rif, int next_anno_es); @@ -46,6 +48,7 @@ public: virtual ~TCreatepart_app() {} }; +inline TCreatepart_app& app() { return (TCreatepart_app&)main_app(); } bool TCreatepart_app::create() { @@ -77,6 +80,42 @@ void TCreatepart_app::on_config_change() TPartita::carica_allineamento(); } +bool TCreatepart_app::data_handler(TMask_field& f, KEY key) +{ + TMask& m = f.mask(); + + bool ok = TRUE; + if ((key == K_TAB && (f.focusdirty() || !m.is_running())) || + key == K_ENTER) + { + const int anno = m.get_int(F_ANNO); + const TDate oggi(f.get()); + if (app()._esc.date2esc(oggi) != anno) + ok = f.error_box("La data non appartiene all'esercizio %d", anno); + + if (ok && key == K_TAB) + { + TString desc(50); + TEdit_field& dc = m.efield(F_DESCCL); + if (dc.empty() || !dc.dirty()) + { + desc = "Apertura clienti al "; desc << oggi; + dc.set(desc); + dc.set_dirty(FALSE); + } + + TEdit_field& df = m.efield(F_DESCFO); + if (df.empty() || !df.dirty()) + { + desc = "Apertura fornitori al "; desc << oggi; + df.set(desc); + df.set_dirty(FALSE); + } + } + } + return ok; +} + void TCreatepart_app::zap_file(int logicnum) const { TDir dir; @@ -139,6 +178,8 @@ char TCreatepart_app::is_clifo(int g, int c, long s, int& indbil) int TCreatepart_app::crea_partite(int anno_es, int anno_rif, int next_anno_es) { + TWait_cursor hourglass; + const bool check = anno_es != next_anno_es; TRelation saldi(LF_SALDI); @@ -150,8 +191,6 @@ int TCreatepart_app::crea_partite(int anno_es, int anno_rif, int next_anno_es) if (items == 0) return 0; - begin_wait(); - // Apre i files per usarli con l'oggetto TPartita TLocalisamfile partite(LF_PARTITE); TLocalisamfile scadenze(LF_SCADENZE); @@ -269,28 +308,27 @@ int TCreatepart_app::crea_partite(int anno_es, int anno_rif, int next_anno_es) prind.addstatus(1); } - end_wait(); return n_part; } bool TCreatepart_app::menu(MENU_TAG) { TMask m("sc1200a"); + m.set_handler(F_DATA, data_handler); - _desccl << "Apertura clienti al " << _today; - _descfo << "Apertura fornitori al " << _today; - - m.set(F_DESCCL, _desccl); - m.set(F_DESCFO, _descfo); - m.set(F_ANNO, _esc.last()); + int anno_es = _esc.last(); + m.set(F_ANNO, anno_es); + if (_esc.date2esc(_today) != anno_es) + _today = _esc[anno_es].inizio(); + m.set(F_DATA, _today); while (m.run() == K_ENTER) { - const int anno_es = m.get_int(F_ANNO); + anno_es = m.get_int(F_ANNO); + _today = m.get(F_DATA); _desccl = m.get(F_DESCCL); _descfo = m.get(F_DESCFO); - // sputtana tutto il saldaculo if (!zap_partite()) continue; diff --git a/sc/sc1200.h b/sc/sc1200.h index 53ea0bf10..167c31ea5 100755 --- a/sc/sc1200.h +++ b/sc/sc1200.h @@ -1,3 +1,4 @@ #define F_ANNO 101 -#define F_DESCCL 102 -#define F_DESCFO 103 +#define F_DATA 102 +#define F_DESCCL 103 +#define F_DESCFO 104 diff --git a/sc/sc1200a.uml b/sc/sc1200a.uml index 73ac9605a..e8cebb8ab 100755 --- a/sc/sc1200a.uml +++ b/sc/sc1200a.uml @@ -1,13 +1,12 @@ #include "sc1200.h" -PAGE "Apertura partite da saldi contabili" -1 -1 71 12 +PAGE "Apertura partite da saldi contabili" -1 -1 71 13 GROUPBOX DLG_NULL 69 6 BEGIN PROMPT 1 0 "" END - TEXT DLG_NULL BEGIN PROMPT 31 1 "@bATTENZIONE" @@ -25,7 +24,7 @@ END NUMBER F_ANNO 4 BEGIN - PROMPT 1 7 "Codice esercizio " + PROMPT 1 7 "Codice esercizio " FLAGS "Z" USE ESC INPUT CODTAB F_ANNO @@ -37,27 +36,29 @@ BEGIN WARNING "Anno di esercizio assente" END +DATE F_DATA +BEGIN + PROMPT 1 8 "Data dell'operazione " +END STRING F_DESCCL 40 BEGIN - PROMPT 1 8 "Descrizione clienti " - FLAGS "A" + PROMPT 1 9 "Descrizione clienti " END STRING F_DESCFO 40 BEGIN - PROMPT 1 9 "Descrizione fornitori " - FLAGS "A" + PROMPT 1 10 "Descrizione fornitori " END BUTTON DLG_OK 9 2 BEGIN - PROMPT -12 -1 "Conferma" + PROMPT -12 -1 "Conferma" END BUTTON DLG_QUIT 9 2 BEGIN - PROMPT -22 -1 "" + PROMPT -22 -1 "" END ENDPAGE diff --git a/sc/sc2100.cpp b/sc/sc2100.cpp index 6ef54d96f..37b831c8a 100755 --- a/sc/sc2100.cpp +++ b/sc/sc2100.cpp @@ -153,7 +153,7 @@ public: }; TEC_row::TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata) - : _num_prot(0), _num_reg(0), _salvo_buon_fine(FALSE) + : _salvo_buon_fine(FALSE) { _riga = row.get_int(PART_NRIGA); _rata = rata; @@ -261,13 +261,13 @@ void TEC_row::print_on(TPrint_section& body) TForm_item& descr = body.find_field(PEC_DESCR); - if (num_reg() > 0) // Riga di partita vera e propria (non totale parziale) + // Riga di partita vera e propria (non totale parziale) + if (rata() < RIGA_PAGAMENTO) { TString s(80); s = descr.prompt(); TEC_form::_form->change_magic_body(*this, s); descr.set(s); - } else descr.set(_descrizione); @@ -1274,7 +1274,7 @@ bool TStampaEC_application::print_selected() const char who = mask().get_who(); const int key = mask().get_key(); - // Filtra il cursore del form in mode che diventi uguale al cursor_sheet corrente + // Filtra il cursore del form in modo che diventi uguale al cursor_sheet corrente // Qui sarebbe bello copiarsi l'indice dell'altro cursore TCursor& fc = *form().cursor(); fc.setkey(key); @@ -1289,6 +1289,7 @@ bool TStampaEC_application::print_selected() const long items = c.items(); for (long i = 0; i < items; i++) + { if (print_all || s.checked(i)) { fc = i; // Muove il cursore alla posizione corrente @@ -1296,7 +1297,9 @@ bool TStampaEC_application::print_selected() if (ret < 0) analfabeti++; } - + if (printer().frozen()) + break; + } printer().close(); if (analfabeti > 0) @@ -1308,7 +1311,7 @@ bool TStampaEC_application::print_selected() int TStampaEC_application::print_ec() { - begin_wait(); + TWait_cursor hourglass; TEC_form& f = form(); @@ -1318,7 +1321,8 @@ int TStampaEC_application::print_ec() bool ok = TRUE; // make controllations per lingua profilo/CF - if ((f.lingua() == _lingua_ditta && !lincf.empty()) || f.lingua() != _lingua_ditta) + if ((f.lingua() == _lingua_ditta && !lincf.empty()) || + f.lingua() != _lingua_ditta) ok = lincf == f.lingua(); if (!ok) // Cliente analfabeta @@ -1351,32 +1355,29 @@ int TStampaEC_application::print_ec() xvt_statbar_set(status); do_events(); -// if (game.chiusa()) -// { - const TDate& dir = f.data_inizio_rischio(); - const TDate& dlo = f.data_limite_operazione(); - const TDate& dls = f.data_limite_scaduto(); - const TImporto saldo = game.calcola_saldo_al(f.in_valuta(), dlo, dls, dir); - if (saldo.is_zero()) - { - int r = 0; - if (stampa_chiuse) + const TDate& dir = f.data_inizio_rischio(); + const TDate& dlo = f.data_limite_operazione(); + const TDate& dls = f.data_limite_scaduto(); + const TImporto saldo = game.calcola_saldo_al(f.in_valuta(), dlo, dls, dir); + if (saldo.is_zero()) + { + int r = 0; + if (stampa_chiuse) + { + for (r = game.last(); r > 0 ; r = game.pred(r)) { - for (r = game.last(); r > 0 ; r = game.pred(r)) + const TRiga_partite& riga = game.riga(r); + if (riga.is_fattura()) { - const TRiga_partite& riga = game.riga(r); - if (riga.is_fattura()) - { - const TDate dd(riga.get(PART_DATADOC)); - if (dd >= data_chiuse) - break; - } - } - } - if (r == 0) - continue; - } -// } + const TDate dd(riga.get(PART_DATADOC)); + if (dd >= data_chiuse) + break; + } + } + } + if (r == 0) + continue; + } if (one_printed) { @@ -1388,7 +1389,10 @@ int TStampaEC_application::print_ec() if (printed) one_printed = TRUE; - partite.put(PART_NRIGA, 9999); + partite.put(PART_NRIGA, 9999); // Forza il posizionamento sull'ultima riga di partita + + if (printer().frozen()) + break; } if (one_printed) @@ -1404,7 +1408,6 @@ int TStampaEC_application::print_ec() } xvt_statbar_set(NULL); - end_wait(); return one_printed ? 1 : 0; } diff --git a/sc/sc2400.cpp b/sc/sc2400.cpp index 3e95fa9f4..6fcceefd8 100755 --- a/sc/sc2400.cpp +++ b/sc/sc2400.cpp @@ -67,6 +67,7 @@ bool TStampaSol_application::print_selected() const long items = c.items(); for (long i=0; i < items; i++) + { if (print_all || s.checked(i)) { fc= i; // muove il cursore alla posizione corrente @@ -75,7 +76,10 @@ bool TStampaSol_application::print_selected() if (ret < 0) analfabeti++; } - + + if (printer().frozen()) + break; + } printer().close(); if (analfabeti > 0) { @@ -175,6 +179,9 @@ int TStampaSol_application::print_sol() } partite.put(PART_NRIGA, 9999); + + if (printer().frozen()) + break; } if (one_printed) diff --git a/sc/sc2401.cpp b/sc/sc2401.cpp index 70e6e4198..715e3aa06 100755 --- a/sc/sc2401.cpp +++ b/sc/sc2401.cpp @@ -209,7 +209,8 @@ void TESSL_row::print_on(TPrint_section& body) TForm_item& causale = body.find_field(PEC_CODCAUS); causale.set(_causale); - if (_causale.not_empty() && _descrizione.empty()) { + if (_causale.not_empty() && _descrizione.empty()) + { TDecoder& causali = form.causali(); _descrizione = causali.decode(_causale); }