From efa0663940f8c14c23e5a71b22bd09d15937b240 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Fri, 11 Apr 2025 15:18:53 +0200 Subject: [PATCH] Patch level : 12.00 1388 Files correlati : cg0.exe ve0.exe Commento: Trasformazione occasionali in clienti/fornitori --- src/ve/ve0100o.h | 3 +- src/ve/ve0100o.uml | 41 +----- src/ve/velib06.cpp | 314 ++++++++++++++++++--------------------------- 3 files changed, 137 insertions(+), 221 deletions(-) diff --git a/src/ve/ve0100o.h b/src/ve/ve0100o.h index 2f6f6d706..c07a83b36 100755 --- a/src/ve/ve0100o.h +++ b/src/ve/ve0100o.h @@ -32,6 +32,7 @@ #define O_TEL3 127 #define O_TIPOCF 128 #define O_CODCF 129 -#define O_AGGCF 130 + +#define DLG_CLIFOR 150 #endif diff --git a/src/ve/ve0100o.uml b/src/ve/ve0100o.uml index 4f130070a..e314cfd6f 100755 --- a/src/ve/ve0100o.uml +++ b/src/ve/ve0100o.uml @@ -2,9 +2,15 @@ TOOLBAR "topbar" 0 0 0 2 +BUTTON DLG_CLIFOR 2 2 +BEGIN + PROMPT -13 1 "->~Cli/For" + PICTURE TOOL_EDIT +END + BUTTON DLG_OK 10 2 BEGIN - PROMPT -13 -1 "" + PROMPT -23 -1 "" END BUTTON DLG_CANCEL 10 2 @@ -286,11 +292,6 @@ BEGIN HELP "Numero telefonico terzo recapito" END -BUTTON DLG_ELABORA 12 2 -BEGIN - PROMPT 2 22 "Crea Cliente" -END - LIST O_TIPOCF 1 12 BEGIN PROMPT 17 22 "Tipo " @@ -303,37 +304,9 @@ END NUMBER O_CODCF 6 BEGIN PROMPT 41 22 "Codice " - USE LF_CLIFO - INPUT TIPOCF O_TIPOCF SELECT - INPUT CODCF O_CODCF - DISPLAY "Codice" CODCF - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Partita IVA@12" PAIV - DISPLAY "Partita IVA@16" COFI - OUTPUT O_TIPOCF TIPOCF - OUTPUT O_CODCF CODCF - CHECKTYPE NORMAL -END - -BOOLEAN O_AGGCF -BEGIN - PROMPT 17 23 "Aggiorna dati cliente" -END - -STRING DLG_NULL 50 32 -BEGIN - PROMPT 1 -1 "Ultimo aggiornamento " FLAGS "D" - FIELD UTENTE END -DATE DLG_NULL -BEGIN - PROMPT 60 -1 "" - FLAGS "D" - FIELD DATAAGG -END ENDPAGE ENDMASK - diff --git a/src/ve/velib06.cpp b/src/ve/velib06.cpp index ed4dd319b..36cc6519c 100755 --- a/src/ve/velib06.cpp +++ b/src/ve/velib06.cpp @@ -1,10 +1,13 @@ #include #include +#include #include #include #include +#include #include #include +#include #include #include #include @@ -153,6 +156,7 @@ TDocumento_mask::TDocumento_mask(const char* td) set_field_handler( F_DATADOCRIF, datadocrif_handler); set_field_handler( F_LIQDIFF, liqdiff_handler); set_field_handler(F_TIPO_SDI, tipodocsdi_handler); + set_field_handler( F_SHEET, sheet_handler); set_handler( DLG_ELABORA, elabora_handler ); set_handler( DLG_PRINT, print_handler ); @@ -163,6 +167,7 @@ TDocumento_mask::TDocumento_mask(const char* td) set_handler( DLG_BARCODE, barcode_handler ); const TPointer_array& handlers = tdoc.handlers(); + FOR_EACH_ARRAY_ITEM(handlers, r, riga) user_set_handler( r, (int)riga); @@ -474,6 +479,7 @@ TDocumento_mask::TDocumento_mask(const char* td) // Legge i colori personalizzati dal .ini gestito dalla TSelect_color_mask TString tmp; tmp << doc().tipo().mask_name() << "_0"; tmp.lower(); TConfig conf(CONFIG_GUI, tmp); + conf.write_protect(); FOR_EACH_ARRAY_ITEM(color_rules(), j, o) { @@ -511,12 +517,15 @@ int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y, { TEdit_field& fld = m.efield(dlg+i); int logic = lf; + if (logic == LF_FASI) { const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI); + if (fasinfo.parent() != 0) { const TMultilevel_code_info& parinfo = ca_multilevel_code_info(fasinfo.parent()); + if (i < parinfo.levels()) logic = fasinfo.parent(); } @@ -656,12 +665,17 @@ void TDocumento_mask::insert_anal_page() set_field_handler(_fsc_end, codfase_handler); } + //aggiunge campi per date di competenza (inizio e fine) add_static(DLG_NULL, newpage, TR("@bDate di competenza"), 2, y); - const TFixed_string f_datacomp = DOC_DATACOMP; - add_date(F_DATACOMP, newpage, "Inizio ", 30, y).set_field(f_datacomp); - const TFixed_string f_datafcomp = DOC_DATAFCOMP; - add_date(F_DATAFCOMP, newpage, "Fine ", 59, y).set_field(f_datafcomp); + + const TFixed_string f_datacomp = DOC_DATACOMP; + + add_date(F_DATACOMP, newpage, "Inizio ", 30, y).set_field(f_datacomp); + + const TFixed_string f_datafcomp = DOC_DATAFCOMP; + + add_date(F_DATAFCOMP, newpage, "Fine ", 59, y).set_field(f_datafcomp); set_field_handler(F_DATACOMP, datacomp_handler); //gestore del campo inizio competenza.. set_field_handler(F_DATAFCOMP, datafcomp_handler); //..e della fine competenza add_groupbox(DLG_NULL, newpage, TR("@bContabilità Analitica"), 1, 6, 78, y-4); @@ -849,7 +863,8 @@ TCond_vendita& TDocumento_mask::condv() const if (_condv == NULL) { TDocumento_mask* myself = (TDocumento_mask*)this; - myself->_condv = new TCond_vendita(myself, NULL); + + myself->_condv = new TCond_vendita(myself, nullptr); } return *_condv; } @@ -877,7 +892,8 @@ void TDocumento_mask::update_progs(bool stop_run) if (page == field_page || stop_run) { const TFieldref* recfld = mf.field(); - if (recfld != NULL) + + if (recfld != NULL) { const TString & name = recfld->name(); const TString& val = doc().get(name); @@ -957,6 +973,7 @@ bool TDocumento_mask::on_key(KEY key) TRelation r(LF_DOC); r.curr()=doc(); bool can_save = !doc().bloccato() && !doc().chiuso(); + if (can_save && ::user_can_write(&r)) { TMask_field& stato = field(F_STATO); @@ -965,11 +982,12 @@ bool TDocumento_mask::on_key(KEY key) enable(DLG_DELREC); xvtil_statbar_set(TR("Modifica")); doc().force_recalc(true); + } else warning_box("L'utente %s non puo' modificare questo documento", (const char*)user()); - return TRUE; + return true; } else if (key == K_SHIFT + K_F9) @@ -1380,6 +1398,7 @@ void TDocumento_mask::cli2mask(bool force_load) set(F_STATOCF, c.get(CLI_STATOCF)); check_field( F_CODINDSP ); } + const TString4 newcodval = get(F_CODVAL); short pos = id2pos(F_CAMBIO); @@ -1542,28 +1561,29 @@ void TDocumento_mask::doc2mask(bool reload_clifo, bool force_load, bool update) TMask_field& f = fld(p); const TFieldref* fr = f.field(); if (fr) - { - f.set(fr->read(doc())); - if (f.ghost() && !f.active()) - f.on_hit(); // Forza il MESSAGE COPY dei campi di testata come DOC_STATO - } + { + f.set(fr->read(doc())); + if (f.ghost() && !f.active()) + f.on_hit(); // Forza il MESSAGE COPY dei campi di testata come DOC_STATO + } // else // f.reset(); // Perché non lascio stare questi campi? } if (reload_clifo) - cli2mask(force_load); + cli2mask(force_load); else - { + { if (force_load) - { - check_field(F_CODCF); - check_field(F_CODINDSP); - } - } + { + check_field(F_CODCF); + check_field(F_CODINDSP); + } + } if (id2pos(F_IBAN_STATO) > 0) { const TString80 iban = doc().get(DOC_IBAN); + set(F_IBAN, iban); if (iban.full()) { @@ -1575,9 +1595,9 @@ void TDocumento_mask::doc2mask(bool reload_clifo, bool force_load, bool update) set(F_BBAN_ABI , iban.mid(5,5)); set(F_BBAN_CAB , iban.mid(10,5)); set(F_BBAN_CONTO, iban.mid(15,12)); - } + } else - { + { reset(F_IBAN_STATO); reset(F_IBAN_CHECK); reset(F_BBAN ); @@ -1585,16 +1605,16 @@ void TDocumento_mask::doc2mask(bool reload_clifo, bool force_load, bool update) reset(F_BBAN_ABI ); reset(F_BBAN_CAB ); reset(F_BBAN_CONTO); - } - } + } + } - TSheet_field& s = sfield(F_SHEET); + TSheet_field& s = sfield(F_SHEET); s.destroy(); const int righe = doc().physical_rows(); for (int i = 0; i < righe; i++) { - TRiga_documento & r = doc()[i + 1]; + TRiga_documento & r = doc()[i + 1]; doc()[i+1].autoload(s); s.check_row(i, 0x3); @@ -1656,6 +1676,7 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga) m->lfield(FR_TIPORIGA).replace_items(codes, values); int pos = m->id2pos(FR_CODART); + if (pos >= 0) { const TMask_field & f = m->fld(pos); @@ -1742,9 +1763,9 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga) } } m->set_handler(DLG_USER, link_handler); - // Quasi qualsiasi cosa analitica va bene const bool ca_active = _ges_ca && !(riga.is_descrizione() || riga.is_sconto() /*|| riga.is_omaggio()*/); + if (ca_active) { const int page = m->win2page(m->fld(m->fields()-1).parent()); // Calcolo bastardo dell'ultima pagina @@ -2164,42 +2185,38 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key ) } break; case K_CTRL + K_INS: - { - TRiga_documento& riga = doc[r + 1]; - TRectype& ven_rec = doc.clifor().vendite(); - TString8 s = ven_rec.get(CFV_CODMAG); + { + TRiga_documento& riga = doc[r + 1]; + TRectype& ven_rec = doc.clifor().vendite(); + TString8 s = ven_rec.get(CFV_CODMAG); const TTipo_riga_documento & t = riga.tipo(); - - if (s.full()) - { - s.left_just(3); - s << ven_rec.get(CFV_CODDEP); - } - else - { - s = m.get(F_CAUSMAG); - if (s.full()) - { - const TCausale_magazzino& c = cached_causale_magazzino(s); - if (!c.empty() && c.get_char("S10") > ' ') // Ignora magazzini non validi - s = c.get("S10"); - else - { - s = m._std_mag; - s.left_just(3); - s << m._std_dep; - } - } - } + + if (s.full()) + { + s.left_just(3); + s << ven_rec.get(CFV_CODDEP); + } + else + { + s = m.get(F_CAUSMAG); + if (s.full()) + { + const TCausale_magazzino& c = cached_causale_magazzino(s); + if (!c.empty() && c.get_char("S10") > ' ') // Ignora magazzini non validi + s = c.get("S10"); + else + { + s = m._std_mag; + s.left_just(3); + s << m._std_dep; + } + } + } if (s.full()) riga.put(RDOC_CODMAG, s); - - riga.autoload(ss); - ss.check_row(r); - t.set_defaults(ss, r + 1); m.highlight_row(r); - } - break; + } + break; case K_TAB: // ingresso nella riga if (!selecting && m.is_running()) { @@ -2214,6 +2231,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key ) const bool on = rdoc.get(RDOC_DACODNUM).full(); riga_mask.enable(DLG_USER, on); } + const bool merce = TRiga_documento::tipo(riga_mask.get(FR_TIPORIGA)).is_merce(); if (merce) @@ -2344,7 +2362,7 @@ bool TOccas_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) if (occas.read(_isequal) == NOERR) { autoload(occas); - field(O_BYMAIL).on_hit();; + field(O_BYMAIL).on_hit(); send_key(K_TAB, O_COMUNE); // Forza decodifica comuni send_key(K_TAB, O_COMUNENAS); } @@ -2361,40 +2379,38 @@ bool TOccas_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) return error_box(TR("E' necessario specificare il codice fiscale o la partita IVA")); } break; - case DLG_ELABORA: + case DLG_CLIFOR: if (e == fe_button) { - TToken_string key(get(O_TIPOCF)); - - key.add(get(O_COFI)); + TFilename temp; temp.temp("occ"); + TTransaction t(temp, LF_OCCAS); - const TRectype & cfcofi = cache().get(LF_CLIFO, key, 4); + t.set_executer(LF_OCCAS); + t.set_firm(main_app().get_firm()); + t.set_user(); + t.set_hostname(); + t.set_version(); + t.set_action(TRANSACTION_MODIFY); + t.set_mode(transaction_mode_automatic); + t.set_stop_on_error(true); + t.set_caller("ve0"); - set(O_AGGCF, true); - if (get(O_COFI).full() && cfcofi.full()) + t.set(OCC_CFPI, get(O_CODICE), -1, LF_OCCAS); + t.set(CLI_TIPOCF, get(O_TIPOCF), -1, LF_CLIFO); + t.write(); + if (t.execute()) { - clear(O_AGGCF); - set(O_CODCF, cfcofi.get(CLI_CODCF)); - } - else - { - if (get(O_PAIV).full()) - { - key = get(O_TIPOCF); - key.add(get(O_STATOPAIV)); - key.add(get(O_PAIV)); + t.read(); - const TRectype & cfpaiv = cache().get(LF_CLIFO, key, 5); + const long codcf = t.get_long(CLI_CODCF, -1, LF_CLIFO); - if (cfpaiv.full()) - { - clear(O_AGGCF); - set(O_CODCF, cfcofi.get(CLI_CODCF)); - } - } + set(O_CODCF, codcf); + stop_run(K_ENTER); } } - break; + break; + default: + break; } return true; } @@ -2402,6 +2418,7 @@ bool TOccas_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) bool TDocumento_mask::occas_handler( TMask_field& f, KEY key ) { TDocumento_mask & m = (TDocumento_mask &)f.mask(); + if ( key == K_SPACE && m.is_running( ) ) { TDocumento& doc = m.doc(); @@ -2418,94 +2435,22 @@ bool TDocumento_mask::occas_handler( TMask_field& f, KEY key ) } const TString& cf = occas_mask.get(O_COFI); + const TString& tipo = m.doc().get(DOC_TIPOCF); - if (cf.full() && atoi(cf.mid(9, 2)) > 40) + if (cf.full() && atoi(cf.smid(9, 2)) > 40) occas_mask.set(O_SESSO, "F"); - occas_mask.set(O_TIPOCF, m.doc().get(DOC_TIPOCF)); - - if (occas_mask.run() != K_ESC) + occas_mask.set(O_TIPOCF, tipo); +// Set propmt dei buttontool ? occas_mask.field(DLG_CLIFOR).set_prompt(tipo == "C" ? "Cliente" : "Fornitore"); + if (occas_mask.run() == K_ENTER) { long codcf = occas_mask.get_long(O_CODCF); - if (codcf != 0L || occas_mask.get_bool(O_AGGCF)) + if (codcf != 0L) { - TRectype clifor(LF_CLIFO); - - if (codcf == 0L) - { - clifor.put(CLI_TIPOCF, doc.get(DOC_TIPOCF)); - TCursor clifo(new TRelation(LF_CLIFO), "", 1, &clifor, &clifor); - const int items = clifo.items(); - - if (items > 0L) - codcf = clifo.last().get_long(CLI_CODCF); - codcf++; - clifor.zero(); - clifor.put(CLI_TIPOCF, doc.get(DOC_TIPOCF)); - clifor.put(CLI_CODCF, codcf); - - const int err = clifor.write(); - - if (err != NOERR) - return error_box(FR("Errore in creazione %s %ld n. %d"), doc.get(DOC_TIPOCF) == "C" ? "Cliente" : "Fornitore", codcf, err); - } - else - { - TToken_string key(doc.get(DOC_TIPOCF)); - - key.add(codcf); - - clifor = (TRectype &)cache().get(LF_CLIFO, key); - - if (clifor.empty()) - { - clifor.zero(); - clifor.put(CLI_TIPOCF, doc.get(DOC_TIPOCF)); - clifor.put(CLI_CODCF, codcf); - } - } - clifor.put(CLI_RAGSOC, occas_mask.get(O_RAGSOC)); - clifor.put(CLI_STATOCF, occas_mask.get(O_STATO)); - clifor.put(CLI_COMCF, occas_mask.get(O_COMUNE)); - clifor.put(CLI_CAPCF, occas_mask.get(O_CAP)); - clifor.put(CLI_INDCF, occas_mask.get(O_INDIRIZZO)); - clifor.put(CLI_CIVCF, occas_mask.get(O_NUMERO)); - clifor.put(CLI_COFI, occas_mask.get(O_COFI)); - clifor.put(CLI_STATOPAIV, occas_mask.get(O_STATOPAIV)); - clifor.put(CLI_PAIV, occas_mask.get(O_PAIV)); - clifor.put(CLI_SESSO, occas_mask.get(O_SESSO)); - clifor.put(CLI_DATANASC, occas_mask.get(O_DATANAS)); - clifor.put(CLI_STATONASC, occas_mask.get(O_STATONAS)); - clifor.put(CLI_COMNASC, occas_mask.get(O_COMUNENAS)); - clifor.put(CLI_LOCCF, occas_mask.get(O_LOCALITA)); - clifor.put(CLI_REFERENTE, occas_mask.get(O_REFERENTE)); - clifor.put(CLI_BYMAIL, occas_mask.get(O_BYMAIL)); - clifor.put(CLI_MAIL, occas_mask.get(O_MAIL)); - clifor.put(CLI_DOCMAIL, occas_mask.get(O_DOCMAIL)); - clifor.put(CLI_PEC, occas_mask.get(O_PEC)); - clifor.put(CLI_PTEL, occas_mask.get(O_PTEL)); - clifor.put(CLI_TEL, occas_mask.get(O_TEL)); - clifor.put(CLI_PTEL2, occas_mask.get(O_PTEL2)); - clifor.put(CLI_TEL2, occas_mask.get(O_TEL2)); - clifor.put(CLI_PTEL3, occas_mask.get(O_PTEL3)); - clifor.put(CLI_TEL3, occas_mask.get(O_TEL3)); - - const int err = clifor.rewrite(); - - if (err == NOERR) - { const TString pag = m.get(F_CODPAG); m.set(F_CODCF, (long)codcf, 0x3); m.set(F_CODPAG, pag, 0x3); - } - else - return error_box(FR("Errore in creazione aggiornamento %s %ld n. %d"), doc.get(DOC_TIPOCF) == "C" ? "Cliente" : "Fornitore", codcf, err); - - TLocalisamfile occ(LF_OCCAS); - - occ.put(OCC_CFPI, occas_mask.get(O_CODICE)); - occ.remove(); } else { @@ -2518,23 +2463,18 @@ bool TDocumento_mask::occas_handler( TMask_field& f, KEY key ) { const TMask_field& f = occas_mask.fld(i); const TFieldref* c = f.field(); - if (c) { const char* val = f.get(); c->write(val, occ); } } - -/* int err = occ.rewrite(); - - if (err != NOERR) - error_box(FR("Errore %d"), err);*/ + m.occ2mask(); } } f.set_focus( ); } - return TRUE; + return true; } bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key ) @@ -2551,7 +2491,6 @@ bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key ) const TCli_for& cli_for = d.clifor(true); // force reload if ( cli_for.get_bool(CLI_SOSPESO) ) return f.error_box( "Il codice '%ld' e' sospeso e non puo' essere utilizzato", atol(f.get())); - m.cli2mask(); if (m.id2pos(F_CODCONT) >= 0) @@ -2574,7 +2513,7 @@ bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key ) } else d.zero(DOC_OCFPI); - } + } return true; } @@ -2678,6 +2617,7 @@ void TLista_elaborazioni::read() for (int err = eld.first(); err == NOERR; err = eld.next()) { TElaborazione* el = NULL; + switch (eld.curr().get_int("I0")) { case _esterna : @@ -2724,6 +2664,7 @@ int TLista_elaborazioni::select(TString_array & result, const char * tipo_inizia for (TElaborazione* el = (TElaborazione*)_elab->get(); el != NULL; el = (TElaborazione*)_elab->get()) { bool ok = false; + if ((tipo_iniziale && *tipo_iniziale) && (stato_iniziale && *stato_iniziale)) { for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++) @@ -2752,7 +2693,7 @@ TElaborazione& TLista_elaborazioni::operator[](const char * key) const void TLista_elaborazioni::update() { - delete _elab; _elab = NULL; + safe_delete(_elab); read(); } @@ -3289,9 +3230,7 @@ void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const TString if (anno <= 2000 && codnum.full()) // In assenza di anno azzero CODNUM che è già nel filtro (4-9-2014) rec.zero(DOC_CODNUM); } - - if (_cursor != NULL) - delete _cursor; + safe_delete(_cursor); _cursor = new TCursor(_relation, filtro, key, &rec, &rec); if (_art_filter.full()) _cursor->set_filterfunction(doc_article_filter); @@ -3616,6 +3555,7 @@ int TElabora_mask::update_list() if (codes != f.get_codes()) f.replace_items(codes, descrs); + const TElaborazione* e = curr_elab(); if (e != NULL && e->tipo() == _consegna_ordini) show(-GRP_ART); @@ -3833,9 +3773,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione) const bool enable_group_doc = e != NULL && e->tipo() != _generazione_effetti && e->tipo() != _contabilizzazione; show(-GRP_DOC, enable_group_doc); - enable(DLG_SELECT, aggiungi_doc_att && enable_group_doc); // Attiva la selezione multipla se possibile - if (e != NULL) { if (aggiungi_doc_att) @@ -3976,6 +3914,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione) const char tipocf = get(F_TIPOCF_ELAB)[0]; const TString& codnum = get(F_CODNUM_ELAB); const bool allow_zero_cf = tipocf == 'F' && aggiungi_doc_att && codnum.full() && e->tipo() == _consegna_ordini; + _tree.set_cursor(tipocf, get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), codnum, filter, allow_zero_cf); efield(F_NDOC_ELAB).browse()->replace_cursor(_tree.get_cursor()); @@ -4084,10 +4023,11 @@ bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key ) { m.mask2doc(); const bool processed = selection->elabora(); + do_checks |= processed; if (m.doc().stato() != stato_iniziale) - break; + break; if (processed) { @@ -4189,6 +4129,7 @@ bool TDocumento_mask::call_handler( TMask_field& f, KEY key) { const short id = f.dlg(); CONTROL_HANDLER h = (CONTROL_HANDLER) _handlers.objptr(id); + if (h != NULL) return h(f, key); return true; @@ -4201,15 +4142,16 @@ bool TDocumento_mask::universal_handler( TMask_field& f, KEY key) if (ok && key == K_TAB && f.focusdirty()) { - const TFieldref* fr = f.field(); + const TFieldref* fr = f.field(); + if (fr != NULL && (fr->file() == 0 || fr->file() == LF_DOC)) fr->write(f.get(), m.doc()); const int page = f.page(); + if (m.is_calculated_page(page)) m.update_progs(); } - return ok; } @@ -4777,14 +4719,14 @@ void TDocumento_mask::update_cartacei() TString catdoc; if (g != nullptr) - { + { TDocumento& curr_doc = doc(); const TCausale * c = curr_doc.get_caus_cont(); if (c != nullptr) - { - if (c->iva() != nessuna_iva) { + if (c->iva() != nessuna_iva) + { const TString& tipodoc = c->tipo_doc(); TClasse_doc * cat = categorie_doc().find_causcont(c->codice()); // Cerco se ho un record che abbia specificata quella caus. contabile @@ -4792,10 +4734,10 @@ void TDocumento_mask::update_cartacei() cat = categorie_doc().find_tipodoc(tipodoc); if (cat != nullptr) catdoc = cat->catdoc(); - } - } + } + } g->set_catdoc(catdoc); - } + } } ///////////////////////////////////////////////////////////