From 85810eb4788264d810d7e0b384e2d284ad209703 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 6 May 1997 12:33:10 +0000 Subject: [PATCH] cg0200.cpp Corretta gestione codice fiscale duplicato cg1.cpp Aggiunto exit a fine programma cg1300.cpp Aggiustata indentazione cg2100.cpp Corretto show/hide bottone pro/rata cg2102.cpp Aggiunta segnalazione di causale errata Migliorata proposta automatica del conto cliente cg2105.cpp Potenziato controllo sul conto per gestione saldaconto cg2106.cpp Controllo piu' sucuro sul pro/rata per movimenti pura iva cg3200.cpp Corretti handler su conti e sottoconti *.uml Corrette ricerche per descrizione saldacon.cpp Tolto a capo di troppo git-svn-id: svn://10.65.10.50/trunk@4324 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0200.cpp | 10 ++++---- cg/cg1.cpp | 2 +- cg/cg1300.cpp | 68 ++++++++++++++++++++++++------------------------- cg/cg2100.cpp | 40 ++++++++++++++++------------- cg/cg2102.cpp | 37 +++++++++++++++++---------- cg/cg2105.cpp | 22 ++++++++++++---- cg/cg2106.cpp | 2 +- cg/cg3200.cpp | 46 ++++++++++++++++----------------- cg/cg4200a.uml | 2 +- cg/cg4700a.uml | 2 +- cg/cg5100a.uml | 1 + cg/saldacon.cpp | 3 +-- 12 files changed, 130 insertions(+), 105 deletions(-) diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index b8c7a3894..d81af0715 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -123,7 +123,7 @@ HIDDEN bool no_dup_fis(TMask_field& f, KEY key) if (msk.query_mode() || !f.to_check(key)) return TRUE; TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ; - if ( f.get().not_empty() && !clifo.empty() ) + if ( !f.empty() && !clifo.empty() ) { clifo.zero() ; const char t1 = msk.get(F_TIPOCF)[0] ; @@ -134,13 +134,13 @@ HIDDEN bool no_dup_fis(TMask_field& f, KEY key) clifo.read() ; clifo.setkey(1) ; const char t = clifo.get_char(CLI_TIPOCF); - const TFixed_string s = clifo.get(CLI_CODCF); - const TFixed_string s1(msk.get(F_CODCF)); + const long s = clifo.get_long(CLI_CODCF); + const long s1 = msk.get_long(F_CODCF); if (clifo.good() && (t1 != t || s1 != s)) { - f.error_box("Codice fiscale gia' utilizzato per il codice : %c/%s", - t, (const char*) s); + f.error_box("Codice fiscale gia' utilizzato per il codice : %c/%ld", + t, s); return FALSE; } } diff --git a/cg/cg1.cpp b/cg/cg1.cpp index 842712b41..8ce6fb70a 100755 --- a/cg/cg1.cpp +++ b/cg/cg1.cpp @@ -30,7 +30,7 @@ int main(int argc,char** argv) default: error_box(usage, argv[0]); break; } - + exit(n < 0); // Altrimenti non esce mai! return n < 0; } diff --git a/cg/cg1300.cpp b/cg/cg1300.cpp index d6ae09902..71d13e1bb 100755 --- a/cg/cg1300.cpp +++ b/cg/cg1300.cpp @@ -127,38 +127,38 @@ int cg1300(int argc, char* argv[]) a.run(argc, argv, "Aggiornamento tipo attivita' su movimenti iva"); } break; - case 'I': - { - TAgg_opintra a; - a.run(argc, argv, "Aggiornamento flag op. intracomunitarie"); - } - break; - case 'T': - { - TAgg_tconto a; - a.run(argc, argv, "Aggiornamento tipo conto"); - } - break; - case 'P': - { - TAgg_nprot a; - a.run(argc, argv,"Rinumerazione numero di protocollo"); - } - break; - case 'C': - { - TAgg_codatt a; - a.run(argc, argv,"Aggiornamento codice attivita'"); - } - break; - case 'E': - { - TAgg_codes a; - a.run(argc, argv,"Aggiornamento codice esercizio"); - } - break; - default: - break; -} -return TRUE; + case 'I': + { + TAgg_opintra a; + a.run(argc, argv, "Aggiornamento flag op. intracomunitarie"); + } + break; + case 'T': + { + TAgg_tconto a; + a.run(argc, argv, "Aggiornamento tipo conto"); + } + break; + case 'P': + { + TAgg_nprot a; + a.run(argc, argv,"Rinumerazione numero di protocollo"); + } + break; + case 'C': + { + TAgg_codatt a; + a.run(argc, argv,"Aggiornamento codice attivita'"); + } + break; + case 'E': + { + TAgg_codes a; + a.run(argc, argv,"Aggiornamento codice esercizio"); + } + break; + default: + break; + } + return TRUE; } diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index de85243e2..07b2178de 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -653,7 +653,9 @@ void TPrimanota_application::init_insert_mode(TMask& m) { set_pagamento(NULL,NULL); // Annulla gestione rate } - + + m.hide(F_ADJUST_PRORATA); // Non puo' esistere un pro-rata errato! + _saldi.reset(); // Inizializza saldi if (_incasso->_step == 1) @@ -670,13 +672,31 @@ void TPrimanota_application::init_modify_mode(TMask& m) { init_mask(m); // Inizializzazione standard calcola_saldo(); // Verifica eventuali sbilanci contabili + + TSheet_field& cg = cgs(); + if (iva() == iva_acquisti && // Se iva acquisti e ... + cg.shown() && // ... se non e' sola iva ... + !test_prorata()) // ... allora controlla prorata + { + m.show(F_ADJUST_PRORATA); + m.set_handler(F_ADJUST_PRORATA, prorata_handler); + + warning_box("Questo movimento e' stato registrato con una percentuale\n" + "prorata non compatibile con quella corrente:\n" + "Premere il bottone di correzione automatica delle righe."); + } + else + { + m.set_handler(F_ADJUST_PRORATA, NULL); + m.hide(F_ADJUST_PRORATA); + } + // Determina se il movimento e' stato trasferito da AS/400: // praticamente controlla che non ci sia nessun tipo movimento sulle righe contabili. _as400 = FALSE; if (is_saldaconto() || iva() != nessuna_iva) { - TSheet_field& cg = cgs(); if (cg.items() > 0) { _as400 = TRUE; @@ -817,22 +837,6 @@ int TPrimanota_application::read(TMask& m) } } - - if (_iva == iva_acquisti && !test_prorata()) - { - m.show(F_ADJUST_PRORATA); - m.set_handler(F_ADJUST_PRORATA, prorata_handler); - - warning_box("Questo movimento e' stato registrato con una percentuale\n" - "prorata non compatibile con quella corrente:\n" - "Premere il bottone di correzione automatica delle righe."); - } - else - { - m.set_handler(F_ADJUST_PRORATA, NULL); - m.hide(F_ADJUST_PRORATA); - } - return _rel->status(); } diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index a829fa2b3..77662ff0e 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -1526,7 +1526,6 @@ bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key) return TRUE; } - bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k) { if (!suspended_handler(f, k)) @@ -1569,6 +1568,7 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key) if (key == K_TAB && f.to_check(key, TRUE)) { TPrimanota_application& a = app(); + TMask& m = f.mask(); a._skip_giornale_check = FALSE; a._skip_bollato_check = FALSE; @@ -1602,26 +1602,22 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key) "si desidera continuare ugualmente?"); } - TMask& m = f.mask(); - - // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9 - m.set(F_DATAREG, mov.get(MOV_DATAREG), TRUE); - // DATACOMP new way - // m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE); - m.set(F_CODCAUS, mov.get(MOV_CODCAUS)); - if (ok) { + // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9 + m.set(F_DATAREG, mov.get(MOV_DATAREG), TRUE); + // DATACOMP new way + // m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE); + m.set(F_CODCAUS, mov.get(MOV_CODCAUS)); + f.set_focusdirty(FALSE); ok = m.stop_run(K_AUTO_ENTER); } else { + m.reset(F_NUMREG); if (a.lnflag()) - { - m.reset(F_NUMREG); m.stop_run(K_FORCE_CLOSE); - } } return ok; } @@ -1659,7 +1655,9 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key) } } else - return FALSE; + { + return error_box("Causale non presente in archivio"); + } } return TRUE; @@ -1952,10 +1950,21 @@ void TPrimanota_application::add_cgs_tot(TMask& m) if (riga_totale >= 0) { TToken_string& rowt = ss.row(riga_totale); + gruppo = rowt.get_int(3); conto = rowt.get_int(); + const long oldcode = rowt.get_long(); + if (corri) - codice = rowt.get_long(); + codice = oldcode; // I corrispettivi non hanno un cliente in testata + else + { + if (m.insert_mode()) // Errore MI3567: se cambio cliente ripesca conto + { + if (codice != oldcode) // Se cambia il codice cliente ... + gruppo = conto = 0; // ... forza il ricalcolo del gruppo-conto + } + } } TBill nuovo(gruppo, conto, codice, tipo); diff --git a/cg/cg2105.cpp b/cg/cg2105.cpp index 48b0b0f92..f34db5055 100755 --- a/cg/cg2105.cpp +++ b/cg/cg2105.cpp @@ -77,7 +77,7 @@ protected: const TRiga_partite* cerca_prima_riga() const; void aggiorna_valuta(const TValuta& val); - void aggiorna_sorelle(const TRiga_partite& part) const; +// void aggiorna_sorelle(const TRiga_partite& part) const; public: TSheet_field& partite() const { return (TSheet_field&)field(P_PARTITE); } @@ -162,6 +162,7 @@ TPay_mask::TPay_mask(const TGame_mask& parent, int mod) set_handler(E_DATADOC, datadoc_handler); set_handler(E_NUMDOC, numdoc_handler); set_handler(E_SEZIONE, sezione_handler); + set_handler(E_TOTALE, TSaldaconto_app::totale_handler); if (app().gestione_valuta()) { @@ -1403,9 +1404,16 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k) TSheet_field& ss = gm.scadenze(); const int rs = ss.selected(); // Memorizza la riga corrente + const int rt = ss.items(); // Memorizza numero righe correnti + gm.fill_partite(); // Aggiorna elenco partite - if (rs < ss.items()) // Se esiste ancora ... - ss.select(rs); // ... riporta la selezione sulla riga corrente + + const int rn = ss.items(); // Memorizza nuovo numero righe + if (rs < rn) // Se esiste ancora ... + { + const bool scroll = rn > rt; // Scrolla solo se aggiungo righe + ss.select(rs, scroll); // ... riporta la selezione sulla riga corrente + } gm._changed = TRUE; } } @@ -1629,6 +1637,10 @@ void TGame_mask::update_saldo_clifo() add_importo(r, imp); r.add("Saldo "); append_conto(r); + + COLOR back, fore; + app().type2colors('T', back, fore); + partite().set_back_and_fore_color(back, fore, i); } long TGame_mask::number_distance(const char* k, const char* n) const @@ -1835,8 +1847,8 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga) TBill b(gruppo, conto, sottoconto, tipo); // Legge il conto della riga selezionata // Esci se il conto della riga cliente non e' valido - if (!b.ok()) - return m.field(CG_SOTTOCONTO).error_box("Conto incompleto"); + if (!b.ok() || !b.find()) + return m.field(CG_SOTTOCONTO).error_box("Conto assente"); // Aggiorna conto sulla riga contabile b.add_to(cgs().row(riga), 3, 0x0); diff --git a/cg/cg2106.cpp b/cg/cg2106.cpp index 08f48d7fc..eee849b3d 100755 --- a/cg/cg2106.cpp +++ b/cg/cg2106.cpp @@ -273,7 +273,7 @@ void TPrimanota_application::set_colors() bool TPrimanota_application::test_prorata() { - if (iva() != iva_acquisti) + if (iva() != iva_acquisti || !cgs().shown()) return TRUE; bool esistono_righe_senza_tipo_detrazione = FALSE; diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index adc25239d..ce866c4c4 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -230,7 +230,7 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key) return f.warning_box("Manca il GRUPPO"); } - if ( key == K_TAB && f.mask().is_running()) + if (key == K_F2 /* key == K_TAB */ && f.mask().is_running()) { TString ds; if (id == F_SOTTOCINI_CONTO) @@ -409,19 +409,20 @@ bool TMastrini_application::gruppo_hnd (TMask_field& f, KEY k) bool TMastrini_application::contoi_hnd (TMask_field& f, KEY k) { - if (k == K_TAB && f.focusdirty() && f.mask().is_running()) + if (k == K_TAB && f.focusdirty()) { + TMask& m = f.mask(); TLocalisamfile pconti (LF_PCON); TString ds; - const short id = f.dlg(); - int gruppo = f.mask().get_int(F_GRUPPOINI); - int conto = f.mask().get_int(id); + const short id = f.dlg(); + const int gruppo = m.get_int(F_GRUPPOINI); + const int conto = m.get_int(id); if (gruppo != 0 && conto != 0) { bool warning; - char tipomsk = f.mask().get(F_TIPOCF_INI)[0]; + char tipomsk = m.get(F_TIPOCF_INI)[0]; pconti.zero(); pconti.put(PCN_GRUPPO, gruppo) ; @@ -443,9 +444,9 @@ bool TMastrini_application::contoi_hnd (TMask_field& f, KEY k) warning = TRUE; } - f.mask().set(F_DESCRINI_CLIENTE, ds); - f.mask().set(F_DESCRINI_FORN, ds); - f.mask().set(F_DESCRINI_CONTO, ds); + m.set(F_DESCRINI_CLIENTE, ds); + m.set(F_DESCRINI_FORN, ds); + m.set(F_DESCRINI_CONTO, ds); if (warning) return f.warning_box("Conto inesistente"); @@ -453,9 +454,9 @@ bool TMastrini_application::contoi_hnd (TMask_field& f, KEY k) else { ds = ""; - f.mask().set(F_DESCRINI_CLIENTE, ds); - f.mask().set(F_DESCRINI_FORN, ds); - f.mask().set(F_DESCRINI_CONTO, ds); + m.set(F_DESCRINI_CLIENTE, ds); + m.set(F_DESCRINI_FORN, ds); + m.set(F_DESCRINI_CONTO, ds); } } @@ -3888,23 +3889,22 @@ const char* TMastrini_application::descrizione_sottoconto() // o di quella dello spreadsheet della seconda pagina void TMastrini_application::set_handlers(TMask* msk) const { -/* Guy: Provo a non usarli e uso i check normali + msk->set_handler(F_DATAINI, data_inizio); + msk->set_handler(F_DATAFINE, data_fine); + msk->set_handler(F_GRUPPOFINE, gruppo_hnd); + msk->set_handler(F_CONTOINI_CONTO, contoi_hnd); + msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd); + msk->set_handler(F_CONTOINI_FORN, contoi_hnd); + msk->set_handler(F_CONTOFINE_CONTO, contof_hnd); + msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd); + msk->set_handler(F_CONTOFINE_FORN, contof_hnd); + msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini); msk->set_handler(F_SOTTOCINI_FORN, sottoc_handler_ini); msk->set_handler(F_SOTTOCFINE_CONTO, sottoc_handler_fine); msk->set_handler(F_SOTTOCFINE_CLIENTE, sottoc_handler_fine); msk->set_handler(F_SOTTOCFINE_FORN, sottoc_handler_fine); -*/ - msk->set_handler(F_DATAINI, data_inizio); - msk->set_handler(F_DATAFINE, data_fine); - msk->set_handler(F_GRUPPOFINE, gruppo_hnd); - msk->set_handler(F_CONTOINI_CONTO, contoi_hnd); - msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd); - msk->set_handler(F_CONTOINI_FORN, contoi_hnd); - msk->set_handler(F_CONTOFINE_CONTO, contof_hnd); - msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd); - msk->set_handler(F_CONTOFINE_FORN, contof_hnd); } // Copia i parametri della prima pagina in una nuova riga dello spreadsheet diff --git a/cg/cg4200a.uml b/cg/cg4200a.uml index e31f9863b..6afb361dd 100755 --- a/cg/cg4200a.uml +++ b/cg/cg4200a.uml @@ -39,7 +39,7 @@ BEGIN USE LF_NDITTE KEY 2 CHECKTYPE NORMAL INPUT RAGSOC F_DFROMFIRM - DISPLAY "Ragione sociale @50" RAGSOC + DISPLAY "Ragione sociale @60" RAGSOC DISPLAY "Codice" CODDITTA COPY OUTPUT F_FROMFIRM HELP "Ragione sociale della ditta da cui prelevare i dati" diff --git a/cg/cg4700a.uml b/cg/cg4700a.uml index 9914b9b40..7acae7fc4 100755 --- a/cg/cg4700a.uml +++ b/cg/cg4700a.uml @@ -55,7 +55,7 @@ BEGIN KEY 1 USE LF_NDITTE KEY 2 INPUT RAGSOC F_RAGSOC - DISPLAY "Ragione sociale@50" RAGSOC + DISPLAY "Ragione sociale@60" RAGSOC DISPLAY "Ditta" CODDITTA COPY OUTPUT F_CODDITTA WARNING "Ditta assente" diff --git a/cg/cg5100a.uml b/cg/cg5100a.uml index 9f925a434..400881349 100755 --- a/cg/cg5100a.uml +++ b/cg/cg5100a.uml @@ -145,6 +145,7 @@ BEGIN HELP "Indicare se si desidera il dettaglio riga clienti/fornitori in gestione pagamenti" FIELD DtCfPg GROUP GROUP_SALDACONTO + FLAGS "H" // Per ora Vladimiro non lo vuole END BOOLEAN CHK_RIFPRO diff --git a/cg/saldacon.cpp b/cg/saldacon.cpp index eeea5464f..cbd58b548 100755 --- a/cg/saldacon.cpp +++ b/cg/saldacon.cpp @@ -1246,8 +1246,7 @@ bool TPartita::esiste(int nriga, int nrata, int nrigp) const return _unassigned.exist(nrigp); const bool esiste_riga = _part.exist(nriga); - if (!esiste_riga || nrata <= - 0) // Riga non esistente o rata nulla + if (!esiste_riga || nrata <= 0) // Riga non esistente o rata nulla return esiste_riga; const TRiga_partite& r = riga(nriga);