From 9bfbd8a4ad1bbe041dbe2d68a0442ca580775a7a Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 17 Oct 2003 08:28:05 +0000 Subject: [PATCH] Patch level : 2.0 604 Files correlati : cg0.exe cg0500a.msk cg2.exe cg2100s.msk Ricompilazione Demo : [ ] Commento : CM20044 Causale senza tipo documento e con tipo movimento fattura. Mi propone la pagina delle scandenze completamente vuota pur avendo indicato il codice pagamento in testata. La seguente pagina riconosce il pagamento solo se clicco sul botone di reset. CM20045 Causale senza tipo documento e con tipo movimento nota di credito. Mi lascia registrare in prima nota senza portarmi nella gestione partite per chiudere le eventuali fatture.Come faccio ? ATTENZIONE: eliminata possibilita' di creare note di credito senza tipo documento CM20046 Causale senza tipo documento e con tipo movimento fattura o nota di credito. In prima nota non viene mai controllato il totale della testata presente nel campo "Voci per saldaconto" con quanto viene indicato poi nelle righe. CM20047 Causale senza tipo documento e con tipo movimento fattura/nota di credito. Se inserisco una registrazione con tipo movimento nota credito e passo successivamente ad una registrazione con causale con tipo movimento fattura, pur mettendo il codice di pagamento, la procedura non propone la pagina delle scadenze.Questo non accade se esco dalla prima nota dopo la registrazione della nota credito e rientro per registrare la fattura. CM20048 Inserisco un pagamento a fronte di un movimento nato da causale senza tipo documento e tipo movimento fattura. Se in testa indico il numero e la data del documento va tutto bene fino a che non seleziono la rata che intendo pagare, ma quando do conferma nella finestra del pagamento, la procedura mi riporta nella maschera della prima nota senza passare da quella delle partite. Solo cliccando di nuovo su conferma, la procedura mi apre la maschera delle partite. Se non indico i riferimenti del documento sulla testata della registrazione, va tutto bene. git-svn-id: svn://10.65.10.50/trunk@11508 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0500.cpp | 4 ++-- cg/cg0500a.uml | 1 - cg/cg2100.cpp | 2 +- cg/cg2100p.uml | 2 +- cg/cg2100s.uml | 2 +- cg/cg2102.cpp | 35 +++++++++++++++++++++++------------ cg/cg2102.h | 2 +- cg/cg2104.cpp | 34 ++++++++++++++++++---------------- cg/cglib04.cpp | 26 ++++++++------------------ 9 files changed, 55 insertions(+), 53 deletions(-) diff --git a/cg/cg0500.cpp b/cg/cg0500.cpp index c1df49633..f36e6da6e 100755 --- a/cg/cg0500.cpp +++ b/cg/cg0500.cpp @@ -329,7 +329,7 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k) // per vedere, per es., se il registro scritto nella causale esiste ancora if (k == K_TAB) { - const TString16 val(f.get()); + const TString& val = f.get(); TMask& m = f.mask(); TEdit_field& field_reg = m.efield(F_COD_REG); @@ -356,7 +356,7 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k) } // Ma davvero esiste il registro ? - const TString16 codreg(field_reg.get()); + const TString& codreg = field_reg.get(); if (codreg.not_empty()) { TRegistro registro(codreg, app().anno_iva()); diff --git a/cg/cg0500a.uml b/cg/cg0500a.uml index e51c334ed..49006524d 100755 --- a/cg/cg0500a.uml +++ b/cg/cg0500a.uml @@ -160,7 +160,6 @@ BEGIN FIELD TIPOMOV ITEM " |Nessuno" MESSAGE COPY,F_TIPO_MOV ITEM "1|Fattura" MESSAGE COPY,F_TIPO_MOV - ITEM "2|Nota credito" MESSAGE COPY,F_TIPO_MOV ITEM "3|Incasso/pagamento " MESSAGE COPY,F_TIPO_MOV ITEM "5|Insoluto" MESSAGE COPY,F_TIPO_MOV ITEM "6|Pagamento insoluto" MESSAGE COPY,F_TIPO_MOV diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 11b096f6f..e15c39185 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -86,7 +86,6 @@ TMask* TPrimanota_application::load_mask(int n) m->set_handler(F_OCCASEDIT, occas_handler); m->set_handler(F_SOLAIVA, solaiva_handler); m->set_handler(F_SHEETIVA, iva_handler); - m->set_handler(F_CODPAG, codpag_handler); TSheet_field& is = m->sfield(F_SHEETIVA); is.set_notify(iva_notify); @@ -130,6 +129,7 @@ TMask* TPrimanota_application::load_mask(int n) m->set_handler(SK_DATACAMBIO, datacambio_handler); m->set_handler(SK_CAMBIO, cambio_handler); m->set_handler(SK_TOTDOCVAL, totdocval_handler); + m->set_handler(F_CODPAG, codpag_handler); TSheet_field& cg = m->sfield(F_SHEETCG); cg.set_notify(cg_notify); diff --git a/cg/cg2100p.uml b/cg/cg2100p.uml index 5ca1f9ed7..e864c6871 100755 --- a/cg/cg2100p.uml +++ b/cg/cg2100p.uml @@ -1,6 +1,6 @@ #include "cg2100p.h" -TOOLBAR "" 0 20 0 2 +TOOLBAR "" 0 -2 0 2 BUTTON DLG_OK 10 2 BEGIN diff --git a/cg/cg2100s.uml b/cg/cg2100s.uml index 73cd69000..56e02f4d6 100755 --- a/cg/cg2100s.uml +++ b/cg/cg2100s.uml @@ -2,7 +2,7 @@ #ifndef NO_TOOLBAR -TOOLBAR "" 0 20 0 2 +TOOLBAR "" 0 -2 0 2 BUTTON DLG_OK 10 2 BEGIN diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 70477fbc3..b51a2d247 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -275,7 +275,7 @@ void TPrimanota_application::set_cgs_imp(int n, const TImporto& imp) // Legge l'importo della riga n e lo ritorna col segno dovuto // Certified 100% -TImporto TPrimanota_application::get_cgs_imp(int n) +TImporto TPrimanota_application::get_cgs_imp(int n) const { TSheet_field& s = cgs(); @@ -524,7 +524,6 @@ HIDDEN bool can_remove(TToken_string& s) return yes; } - void TPrimanota_application::cgs_pack() { TSheet_field& s = cgs(); @@ -555,16 +554,14 @@ void TPrimanota_application::cgs_pack() bool TPrimanota_application::ci_sono_importi() const { - TString_array& rows = cgs().rows_array(); - for (int i = 0; i < rows.items(); i++) + const int rows = cgs().items(); + for (int i = 0; i < rows; i++) { - TToken_string& r = rows.row(i); - const real dare(r.get(0)); - if (dare != ZERO) return TRUE; - const real avere(r.get()); - if (avere != ZERO) return TRUE; + const TImporto imp = get_cgs_imp(i); + if (!imp.is_zero()) + return true; } - return FALSE; + return false; } real TPrimanota_application::calcola_saldo() const @@ -824,7 +821,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) if (fatt || nota) { TBill contocf; - if (a.cerca_conto_cf(contocf) < 0) + const int riga_cf = a.cerca_conto_cf(contocf); + if (riga_cf < 0) { TString msg(80); msg = TR("Non esiste una riga contabile riferita al "); msg << (contocf.tipo() == 'C' ? TR("cliente") : TR("fornitore")) << ' '; @@ -2783,10 +2781,10 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key) { bool ok = TRUE; TMask& m = f.mask(); + TPrimanota_application& a = app(); if (key == K_TAB && f.focusdirty()) { - TPrimanota_application& a = app(); a.gioca_cambi(); if (a.iva() != nessuna_iva) @@ -2820,6 +2818,19 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key) totlit.string(TRUE)); } } + + if (a.iva() == nessuna_iva && a.is_fattura()) + { + TBill bill; + const int riga_cf = a.cerca_conto_cf(bill); + if (riga_cf >= 0) + { + TImporto imp = a.get_cgs_imp(riga_cf); + if (imp.valore() != m.get_real(F_TOTALE)) + ok = f.error_box(FR("Il totale documento non corrisponde alla riga %d:\ndovrebbe essere %s"), + riga_cf+1, imp.valore().string()); + } + } } return ok; diff --git a/cg/cg2102.h b/cg/cg2102.h index f6a75c6b5..b2e2de59c 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -306,7 +306,7 @@ public: TSheet_field& ivas() const; TSheet_field& pags() const; TString_array& pag_rows() { return _pag_rows; } - TImporto get_cgs_imp(int n); + TImporto get_cgs_imp(int n) const; TPrimanota_application(); virtual ~TPrimanota_application() { } diff --git a/cg/cg2104.cpp b/cg/cg2104.cpp index fc773ce8a..fe3b421f4 100755 --- a/cg/cg2104.cpp +++ b/cg/cg2104.cpp @@ -315,33 +315,35 @@ bool TPrimanota_application::tipopag_handler(TMask_field& f, KEY key) bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key) { - bool ok = TRUE; + bool ok = true; TMask& m = f.mask(); TPrimanota_application& a = app(); const bool set_scad = a.is_fattura() && m.page_enabled(2); // E' attiva pagina 3 if (key == K_ENTER) { - if (set_scad && f.get().empty()) + if (set_scad && f.empty()) { - f.error_box(TR("Il codice di pagamento e' obbligatorio!")); + ok = f.error_box(TR("Il codice di pagamento e' obbligatorio!")); - const char typ = a.clifo(); - const long cod = m.get_long(typ == 'C' ? F_CLIENTE : F_FORNITORE); - - TLocalisamfile clifo(LF_CLIFO); - clifo.put(CLI_TIPOCF, typ); - clifo.put(CLI_CODCF, cod); - if (clifo.read() == NOERR) + // Nella maschera iva cerco di reperirlo dal cliente + if (m.id2pos(F_CLIENTE) > 0) { - const TString& cp = clifo.get(CLI_CODPAG); - if (cp.not_empty()) + const char typ = a.clifo(); + const long cod = m.get_long(typ == 'C' ? F_CLIENTE : F_FORNITORE); + TLocalisamfile clifo(LF_CLIFO); + clifo.put(CLI_TIPOCF, typ); + clifo.put(CLI_CODCF, cod); + if (clifo.read() == NOERR) { - f.set(cp); - key = K_TAB; - } + const TString& cp = clifo.get(CLI_CODPAG); + if (cp.not_empty()) + { + f.set(cp); + key = K_TAB; + } + } } - ok = FALSE; } } diff --git a/cg/cglib04.cpp b/cg/cglib04.cpp index 699fea5ee..805a960a5 100755 --- a/cg/cglib04.cpp +++ b/cg/cglib04.cpp @@ -23,21 +23,6 @@ const int RIC_SIZE = 512; const char* const tracciato_AS = "cgtrc.ini"; const char* const tracciato_PC = "cgtrcpc.ini"; -HIDDEN TString TEMP; - -//ritorna falso se la causale non e' significativa -/* - - -bool look_causale (const char* codcaus) -{ - const TFixed_string caus(codcaus); - if (caus == "000") - return FALSE; - return !caus.blank(); -} -*/ - bool format_if_zero(TString& field, int len) { if (real::is_natural(field)) @@ -990,7 +975,7 @@ const char* TTransfer_file::numero_civico(TString& indirizzo) { int i,j; - TEMP = ""; + TString& TEMP = get_tmp_string(); i = indirizzo.find(','); // Cerca prima la virgola if (i >= 0) // se la trova restituisce la prima parola dopo di essa @@ -1030,7 +1015,8 @@ const char* TTransfer_file::cerca_comune_cap(const TString& field, const TString const TString80 dencom(localita); TString16 cap(field); - TEMP.cut(0); + TString& TEMP = get_tmp_string(); + if (cap[2] == '1') { cap.cut(3); @@ -5275,8 +5261,10 @@ int pack(bool vis, int num, TString& name) const char* converti (TString& data_AS400,bool anno_di_quattro) { + TString& TEMP = get_tmp_string(); + if (data_AS400 == "000000" || data_AS400 == "00000000") - return TEMP = ""; + return TEMP; if (anno_di_quattro) { @@ -5295,6 +5283,8 @@ const char* converti (TString& data_AS400,bool anno_di_quattro) const char* riconverti (TString& data_PC,bool anno_di_quattro) { + TString& TEMP = get_tmp_string(); + if (anno_di_quattro) { TEMP = data_PC.mid(6,4);