diff --git a/cg/cg0500.cpp b/cg/cg0500.cpp index e728962eb..057ebebb7 100755 --- a/cg/cg0500.cpp +++ b/cg/cg0500.cpp @@ -98,7 +98,7 @@ public: TMask& ss_mask() const { return _sheet->sheet_mask(); } 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 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") { 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(); 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.hide(F_TIPO_MOV_1); - if (app().saldaconto()) +// if (app().saldaconto()) 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()); } - app().mostra_campi(f); + app().mostra_campi(); app().fill_sheet(m); } return TRUE; @@ -371,7 +372,7 @@ bool TCaus_app::tipomov_hndl (TMask_field& f, KEY k) { if (k == K_SPACE) { - app().mostra_campi(f); + app().mostra_campi(); if (f.focusdirty()) 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(); - const int tpm = m.get_int(F_TIPO_MOV); - TString16 codreg = m.get(F_COD_REG); + TMask& m = curr_mask(); + + const TString& codreg = m.get(F_COD_REG); if (codreg.empty()) { m.hide(F_AUTO_FAT); @@ -417,21 +418,22 @@ bool TCaus_app::mostra_campi(TMask_field& f) m.hide(F_COD_CAUS_IM); + const int tpm = m.get_int(F_TIPO_MOV); switch (tpm) { case 0: - m.show(F_OP_FINE_ANNO); m.enable(F_OP_FINE_ANNO, m.insert_mode()); - m.show(F_COLL_CESP); - m.show(F_M_770); - if (saldaconto()) m.hide(F_MOV_VALU); + m.show(F_MOV_VALU, !saldaconto()); m.hide(F_MOV_SEZ); + m.show(F_M_770); + m.show(F_OP_FINE_ANNO); + m.show(F_COLL_CESP); break; case 3: case 5: case 6: - if (valuta()) m.show(F_MOV_VALU); - if (saldaconto()) m.show(F_MOV_SEZ); + m.show(F_MOV_VALU, valuta()); + m.show(F_MOV_SEZ, saldaconto()); m.show(F_M_770); m.hide(F_OP_FINE_ANNO); m.hide(F_COLL_CESP); @@ -444,8 +446,7 @@ bool TCaus_app::mostra_campi(TMask_field& f) { // codreg non vuoto m.hide(F_OP_FINE_ANNO); m.hide(F_MOV_SEZ); - if (valuta()) m.show(F_MOV_VALU); - // if (!saldaconto()) + m.show(F_MOV_VALU, valuta()); m.show(F_COD_CAUS_IM); m.show(F_AUTO_FAT); m.show(F_ALLEGAT); @@ -461,7 +462,7 @@ bool TCaus_app::cod_reg_hndl (TMask_field& f, KEY k) { if (k == K_TAB) { - app().mostra_campi(f); + app().mostra_campi(); if (f.focusdirty()) app().fill_sheet(f.mask()); return TRUE; } diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 430c9fe20..add83d876 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -103,6 +103,7 @@ TMask* TPrimanota_application::load_mask(int n) // add saldaconto TSheet_field& ps = (TSheet_field&)m->field(FS_RATESHEET); ps.set_notify(pag_notify); + m->set_handler(F_NUMRIF, numrif_handler); m->set_handler(FS_RATESHEET, pag_sheet_handler); m->set_handler(FS_RESET, reset_handler); m->set_handler(FS_NRATE, nrate_handler); diff --git a/cg/cg2100c.uml b/cg/cg2100c.uml index d7398a317..dc57ffcdb 100755 --- a/cg/cg2100c.uml +++ b/cg/cg2100c.uml @@ -214,13 +214,12 @@ BEGIN HELP "Numero finale del documento ripilogativo di protocollo IVA" FIELD UPROTIVA 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 STRING F_CODPAG 4 BEGIN PROMPT 60 9 "Pagamento " - HELP "Codice del pagamento concordato per il movimento" FIELD CODPAG FLAGS "UZ" USE %CPG @@ -231,6 +230,7 @@ BEGIN CHECKTYPE NORMAL ADD RUN ba3 -6 WARNING "Codice pagamento assente" + VALIDATE REQIF_FUNC 1 F_NUMRIF END STRING F_CLIFO 1 @@ -526,7 +526,8 @@ NUMBER F_ANNORIF 4 BEGIN PROMPT 50 15 "Rif.partita " FIELD LF_PARTITE->ANNO - HELP "Anno di riferimento partita" + VALIDATE REQIF_FUNC 1 F_NUMRIF + WARNING "Manca l'anno relativo al numero partita" END STRING F_NUMRIF 7 diff --git a/cg/cg2100s.uml b/cg/cg2100s.uml index c4568eaf3..74c82d953 100755 --- a/cg/cg2100s.uml +++ b/cg/cg2100s.uml @@ -118,7 +118,7 @@ END NUMBER S_RESIDUORATA 15 BEGIN - PROMPT 43 5 "Residuo rata " + PROMPT 48 5 "Residuo rata " PICTURE "." FLAGS "DRV" END @@ -157,7 +157,7 @@ END RADIOBUTTON S_SALDOACC 1 24 BEGIN - PROMPT 2 9 "" + PROMPT 1 9 "" FLAGS "Z" ITEM "A|Acconto" ITEM "S|Saldo" diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index b0d5a1199..509022f62 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -490,12 +490,12 @@ real TPrimanota_application::calcola_saldo() const switch (sbilancio.sign()) { 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); break; case -1: // L'avere supera il dare in valore assoluto m.reset(F_DARE); - m.set(F_AVERE, absbilancio.string()); + m.set(F_AVERE, absbilancio); break; default: // Sbilancio nullo m.reset(F_DARE); @@ -577,7 +577,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) const real valore = saldaconto.normalize().valore(); if (totdoc != valore) { - const TString16 td(totdoc.string(".")); + const TString td(totdoc.string(".")); const char* ss = valore.string("."); return f.error_box("Il totale documento inserito e' %s\n" "mentre i pagamenti ammontano a %s", (const char*)td, ss); @@ -1179,17 +1179,17 @@ else } -oldiva = imposta; -oldposiva = newposiva; - -TMask& m = app().curr_mask(); -if (r == 0) // Se cambio la prima riga ... - app().add_cgs_tot(m); // ... ricalcola conti + oldiva = imposta; + oldposiva = newposiva; - if (app().is_saldaconto() && m.page_enabled(2)) - app().set_scadenze(m); -} -return TRUE; + 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.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); m.set(F_ANNORIF, dd.year()); // copia data documento - // TBI modifica scadenze pagamento - if (app().pagamento() != NULL && !m.edit_mode()) + if (app().pagamento() != NULL && m.insert_mode()) 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()) - 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); 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); - if (s.not_empty()) - m.set(F_CODPAG, s, TRUE); + m.set(F_CODPAG, s, s.not_empty()); } 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) { 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 { @@ -1934,7 +1933,9 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key) 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()); if (app().npart_is_prot() && piva.not_empty()) diff --git a/cg/cg2102.h b/cg/cg2102.h index 5cb856ed4..fb15ddb67 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -78,7 +78,7 @@ class TPrimanota_application : public TRelation_application static bool datacomp_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 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 clifo_handler(TMask_field& f, KEY key); static bool totdoc_handler(TMask_field& f, KEY key); diff --git a/cg/cg2104.cpp b/cg/cg2104.cpp index 57337dbe1..3aeb549f7 100755 --- a/cg/cg2104.cpp +++ b/cg/cg2104.cpp @@ -176,6 +176,35 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key) 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) { 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 TString numpart(m.get(F_NUMRIF)); + TPartita* oldgame = partite().first(); TPartita* newgame = NULL; - if (anno > 0 && numpart.not_empty()) + + if (anno > 0 && !numpart.blank()) { real imponibile(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) { - const int primafatt = oldgame->prima_fattura(nreg); - if (primafatt > 0) + const int rigafatt = oldgame->prima_fattura(nreg); + if (rigafatt > 0) { 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?"); } if (sposta) - oldgame->sposta_riga(primafatt, *newgame); + oldgame->sposta_riga(rigafatt, *newgame); else { - oldgame->scollega_pagamenti(primafatt); - oldgame->rimuovi_riga(primafatt); + oldgame->scollega_pagamenti(rigafatt); + oldgame->rimuovi_riga(rigafatt); } oldgame->rewrite(); } else { - oldgame->sposta_riga(primafatt, *newgame); + oldgame->sposta_riga(rigafatt, *newgame); } } } - if (newgame != NULL) - newgame->write(); + if (newgame != NULL) // Se ho cancellato il numero partita ... + newgame->write(); // Salva nuova partita } diff --git a/cg/cg2105.cpp b/cg/cg2105.cpp index f325f2033..daca6b2fe 100755 --- a/cg/cg2105.cpp +++ b/cg/cg2105.cpp @@ -237,9 +237,9 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga) #ifndef __EXTRA__ TMask& cm = app().curr_mask(); val.get(cm, S_VALUTA, S_DATACAMBIO, S_CAMBIO); -#endif cerca_valuta(val); val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO); +#endif enable(-3, val.in_valuta()); set_handler(P_ANNO, annopart_handler); diff --git a/cg/cg21rata.uml b/cg/cg21rata.uml index 670321af0..b82f7f3f6 100755 --- a/cg/cg21rata.uml +++ b/cg/cg21rata.uml @@ -54,7 +54,7 @@ END STRING 106 1 BEGIN - PROMPT 21 5 "Ulter. class. " + PROMPT 24 5 "Ulteriore classific. " USE %CLR INPUT CODTAB[1,1] 105 SELECT INPUT CODTAB[2,2] 106 diff --git a/cg/pagament.cpp b/cg/pagament.cpp index aec8562f7..16ec30015 100755 --- a/cg/pagament.cpp +++ b/cg/pagament.cpp @@ -1252,8 +1252,6 @@ int TPagamento::remove(TTable& r) void TPagamento::set_rate_auto() { - main_app().begin_wait(); - // vedi rate esistenti e tipo prima rata // deve fare riferimento ad un tipo pagamento esistente // e sensato @@ -1261,7 +1259,10 @@ void TPagamento::set_rate_auto() 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 {