From f7b7eeebbfbbf657d8954df21742f6bf99a6bc47 Mon Sep 17 00:00:00 2001 From: francescofucarino Date: Wed, 11 Nov 2020 12:36:52 +0100 Subject: [PATCH] Modifiche necessarie per trasformare pdflib.xll come predefinita per tutto, rimuovendo la dll di debug. Ribattezzo in FI inclusi ed FE esclusi per chiarezza nel codice. F9lib totali ed imposte come real da stringhe --- src/cg/cg0.cpp | 6 ++-- src/cg/cg2100.cpp | 2 +- src/cg/cg2102.cpp | 58 +++++++++++++++++++++++++++++++++++++++ src/cg/cg2102.h | 7 ++++- src/cg/cg2105.cpp | 8 +++++- src/f9/f90100.cpp | 28 +++++++++++-------- src/f9/f90100.h | 2 +- src/f9/f90100c.h | 24 ++++++++-------- src/f9/f90100c.uml | 24 ++++++++-------- src/f9/f90100d.h | 30 ++++++++++---------- src/f9/f90100d.uml | 32 ++++++++++----------- src/f9/f9lib.h | 6 ++-- src/f9/f9lib01.cpp | 3 +- src/f9/f9lib02.cpp | 14 +++------- src/pdf/pdflib/pdflibdl.c | 3 ++ 15 files changed, 158 insertions(+), 89 deletions(-) diff --git a/src/cg/cg0.cpp b/src/cg/cg0.cpp index 5ac704161..2d6cc8f33 100755 --- a/src/cg/cg0.cpp +++ b/src/cg/cg0.cpp @@ -12,9 +12,9 @@ int main(int argc, char** argv) case 3: cg0400(argc,argv); break; // Progressivi IVA case 4: cg0500(argc,argv); break; // Causali contabili case 5: cg0600(argc,argv); break; // Tabelle contabili - case 6: cg0700(argc, argv); break; // Clienti/Fornitori occasionali - case 7: cg0800(argc, argv); break; // Stampa progressivi IVA avanzata - default: cg0100(argc,argv); break; // Piano dei conti + case 6: cg0700(argc, argv); break; // Clienti/Fornitori occasionali + case 7: cg0800(argc, argv); break; // Stampa progressivi IVA avanzata + default: cg0100(argc,argv); break; // Piano dei conti } return 0; } diff --git a/src/cg/cg2100.cpp b/src/cg/cg2100.cpp index 285957389..943b1b130 100755 --- a/src/cg/cg2100.cpp +++ b/src/cg/cg2100.cpp @@ -2482,7 +2482,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query) msk.set(FS_RECALC, ""); set_scad_f1(msk); } - + insert_part_scad(ini); } if (_f1_liq && msk.find_by_id(F_DIFFERITA) != nullptr) { diff --git a/src/cg/cg2102.cpp b/src/cg/cg2102.cpp index 9120e84e1..3af91ed85 100755 --- a/src/cg/cg2102.cpp +++ b/src/cg/cg2102.cpp @@ -4001,6 +4001,52 @@ void TPrimanota_application::riporta_dati_f1(TMask& cg_msk, const shared_ptrget_datadoc()); } +void TPrimanota_application::insert_part_scad(TConfig& ini) +{ + vector rif_doc; + int i = 0; + ini.set_paragraph("23"); + + // Carico nel vettore + while(true) + { + TToken_string doc("", '|'); + TString str; str << ini.get("NUMLINEA", nullptr, i, "NULL"); + if (str != "NULL") + { + doc.add(str); + doc.add(ini.get("DOCRIF", nullptr, i, "NULL")); + doc.add(ini.get("DATADOCRIF", nullptr, i, "NULL")); + + rif_doc.insert(rif_doc.end(), doc); + i++; + } + else + break; + } + + // Agganciare alla partita del documento di riferimento + if(!rif_doc.empty()) + { + is_f1() = true; + + TString query; query << "USE MOV\nSELECT (DATADOC==#DATADOC)"; + TISAM_recordset rec(query); + rec.set_var("#DATADOC", TVariant(TDate(rif_doc[0].get(2)))); + TString part; + do + { + if (rec.get(MOV_NUMDOC).as_string() == "73/001") + { + part = rec.get(MOV_PROTIVA).as_string(); + break; + } + } while (rec.move_next()); + + num_doc_rif() = part; + } +} + bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key) { TMask& cg_msk = f.mask(); @@ -4459,3 +4505,15 @@ TPro_msk::TPro_msk(TMask& cg_msk) : TAutomask("cg2100t"), _riporta(false), _codf set(F_DATESEARCH, TDate(TODAY)); _righe_iva.clear(); } + +bool& is_f1() +{ + static bool is_f1 = false; + return is_f1; +} + +TString& num_doc_rif() +{ + static TString num_doc_rif_partite = -1; + return num_doc_rif_partite; +} \ No newline at end of file diff --git a/src/cg/cg2102.h b/src/cg/cg2102.h index f21456f98..e5604b119 100755 --- a/src/cg/cg2102.h +++ b/src/cg/cg2102.h @@ -178,11 +178,14 @@ class TPrimanota_application : public TRelation_application static bool quadratura_handler(TMask_field& f, KEY k); // Bottone quadratura per ATS + // Gestione F1 + static void write_righe_iva_f1(TMask& cg_msk, const shared_ptr& msk); static bool write_scad_f1(const TMask& cg_msk, const shared_ptr& msk); static void write_clifo(TMask& cg_msk, const shared_ptr& msk); static void set_totale(TMask& cg_msk, const shared_ptr& msk); static void riporta_dati_f1(TMask& cg_msk, const shared_ptr& msk); + void insert_part_scad(TConfig& ini); // Handlers per aggancio FPPRO // Bottone per maschera FPPRO static bool fppro_mask(TMask_field& f, KEY key); @@ -190,7 +193,6 @@ class TPrimanota_application : public TRelation_application static bool is_collegato(TMask_field& f); static void fppromask_set_handl(TMask* msk); static void load_list(TMask* msk, KEY k); - static void f1_init_modify(TMask& m, const TRectype& mov); void reset_sheet_row(TSheet_field& s, int n); @@ -483,6 +485,9 @@ public: TPro_msk(TMask& cg_msk); }; +bool& is_f1(); +TString& num_doc_rif(); + #ifndef __EXTRA__ inline TPrimanota_application& app() { return (TPrimanota_application&)main_app(); } diff --git a/src/cg/cg2105.cpp b/src/cg/cg2105.cpp index 2fb5940a3..b1a7a9e08 100755 --- a/src/cg/cg2105.cpp +++ b/src/cg/cg2105.cpp @@ -907,7 +907,13 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) TToken_string& row = partite.row(r); const int anno = row.get_int(0); // Anno partita - const TNumero_partita num = row.get(); // Numero partita + TNumero_partita num = row.get(); // Numero partita + if(is_f1()) + { + TNumero_partita prev = num; + if ((num = num_doc_rif()) == -1) + num = prev; + } gm.set(P_ANNO, anno); // Aggiorna campi di ricerca gm.set(P_NUMERO, num); diff --git a/src/f9/f90100.cpp b/src/f9/f90100.cpp index b8f10d6aa..26f343c4d 100644 --- a/src/f9/f90100.cpp +++ b/src/f9/f90100.cpp @@ -155,9 +155,13 @@ int TEstrai_mask::estrai() // Leggo i movimenti e li carico nell'estrazione. ///////////// TString query; - query << "SELECT * FROM MOV WHERE DATAREG>=" << dataini.date2ansi() << " AND DATAREG<=" << dataend.date2ansi() << ";"; - TSQL_recordset mov(query); +// query << "SELECT * FROM MOV WHERE DATAREG>=" << dataini.date2ansi() << " AND DATAREG<=" << dataend.date2ansi() << ";"; + query = "USE MOV KEY 2"; + query << "\nFROM DATAREG=" << dataini.date2ansi() << "\nTO DATAREG=" << dataend.date2ansi(); + // query = "USE MOV\n" << "SELECT BETWEEN(DATAREG," << dataini.date2ansi() "," << dataend.date2ansi() << ")"; + // query << "\nFROM DATAREG=" << dataini.date2ansi() << "\nTO DATAREG=" << dataend.date2ansi(); + TISAM_recordset mov(query); TProgress_monitor* progr = new TProgress_monitor(mov.items(), "Acquisizione movimenti", false); TLocalisamfile clifo(LF_CLIFO); const TipoIVA tipo = tipodoc == 'A' ? iva_acquisti : iva_vendite; @@ -892,7 +896,7 @@ bool TControllo_mask::on_field_event(TOperable_field& o, TField_event e, long jo TSheet_field& sf = sfield(S_CONTROLLO); TToken_string& row = sf.row(sf.selected()); TRectype mov(LF_MOV); - mov.put(MOV_NUMREG, row.get(sf.cid2index(F_NUMREG))); + mov.put(MOV_NUMREG, row.get(sf.cid2index(F_CNUMREG))); if (open_mov(mov)) fill(); } @@ -999,7 +1003,7 @@ bool TApri_estr_msk::on_field_event(TOperable_field& o, TField_event e, long jol TSheet_field& sf = sfield(S_INCL); TToken_string& row = sf.row(sf.selected()); TRectype mov(LF_MOV); - mov.put(MOV_NUMREG, row.get(sf.cid2index(F_NUMREG))); + mov.put(MOV_NUMREG, row.get(sf.cid2index(FI_NUMREG))); open_mov(mov); } break; @@ -1023,9 +1027,9 @@ bool TApri_estr_msk::inall_handler() const { TSheet_field& sf = sfield(S_INCL); sf.hide(); - const bool active = *sf.row(0).get(cid2index(F_IESCLUDI)) == 'S'; + const bool active = *sf.row(0).get(cid2index(FI_IESCLUDI)) == 'S'; FOR_EACH_SHEET_ROW(sf, nr, row) - row->add(active ? "N" : "S", cid2index(F_IESCLUDI)); + row->add(active ? "N" : "S", cid2index(FI_IESCLUDI)); sf.force_update(); sf.show(); return true; @@ -1045,7 +1049,7 @@ bool TApri_estr_msk::inselect_handler() const sel_esclusi = !sel_esclusi; field(B_IESCL).enable(sel_esclusi); field(B_IALLESCL).enable(sel_esclusi); - sfield(S_INCL).enable_column(cid2index(F_IESCLUDI), sel_esclusi); + sfield(S_INCL).enable_column(cid2index(FI_IESCLUDI), sel_esclusi); sfield(S_INCL).force_update(); return true; } @@ -1061,9 +1065,9 @@ void TApri_estr_msk::conferma_esclusi() const FOR_EACH_SHEET_ROW(sf, nr, row) { TLocalisamfile movs(LF_MOV); - movs.put(MOV_NUMREG, row->get_int(cid2index(F_NUMREG))); + movs.put(MOV_NUMREG, row->get_int(cid2index(FI_NUMREG))); movs.read(); - if (*row->get(cid2index(F_IESCLUDI)) == 'S') + if (*row->get(cid2index(FI_IESCLUDI)) == 'S') { const TDate today(TODAY); TToken_string stato("", ';'); @@ -1072,14 +1076,14 @@ void TApri_estr_msk::conferma_esclusi() const stato.add("X"); movs.put(MOV_ELABF9, stato); movs.rewrite(); - row->add("X", cid2index(F_IESCLUSO)); + row->add("X", cid2index(FI_IESCLUSO)); } else { if (movs.get(MOV_ELABF9).full()) { movs.put(MOV_ELABF9, ""); - row->add("", cid2index(F_IESCLUSO)); + row->add("", cid2index(FI_IESCLUSO)); movs.rewrite(); } } @@ -1476,7 +1480,7 @@ bool TF9_app::mov_handler_escl(TMask_field& f, KEY key) TSheet_field& sf = esclusi_mask().sfield(S_ESCL); TToken_string& row = sf.row(sf.selected()); TRectype mov(LF_MOV); - mov.put(MOV_NUMREG, row.get(sf.cid2index(F_NUMREG))); + mov.put(MOV_NUMREG, row.get(sf.cid2index(FE_NUMREG))); return open_mov(mov); } diff --git a/src/f9/f90100.h b/src/f9/f90100.h index f86fe9f51..7407c6d29 100644 --- a/src/f9/f90100.h +++ b/src/f9/f90100.h @@ -195,7 +195,7 @@ class TControllo_mask : public TAutomask bool on_field_event(TOperable_field& o, TField_event e, long jolly) override; public: - explicit TControllo_mask(const char* codsoc, const char* id_estr, bool esclusi = false); + TControllo_mask(const char* codsoc, const char* id_estr, bool esclusi = false); }; class TApri_estr_msk : public TAutomask diff --git a/src/f9/f90100c.h b/src/f9/f90100c.h index d17636feb..6e6486825 100644 --- a/src/f9/f90100c.h +++ b/src/f9/f90100c.h @@ -3,15 +3,15 @@ #define B_ESTRAI 203 // Elenco movimenti esclusi -#define F_SEL 101 -#define F_NUMREG 102 -#define F_DATAREG 103 -#define F_DATADOC 104 -#define F_CODCAUS 105 -#define F_MESELIQ 106 -#define F_NUMDOC 107 -#define F_IMPTOTDOC 108 -#define F_FORN 109 -#define F_RAGSOC 110 -#define F_PROTIVA 111 -#define F_DESCR 112 \ No newline at end of file +#define FE_SEL 101 +#define FE_NUMREG 102 +#define FE_DATAREG 103 +#define FE_DATADOC 104 +#define FE_CODCAUS 105 +#define FE_MESELIQ 106 +#define FE_NUMDOC 107 +#define FE_IMPTOTDOC 108 +#define FE_FORN 109 +#define FE_RAGSOC 110 +#define FE_PROTIVA 111 +#define FE_DESCR 112 \ No newline at end of file diff --git a/src/f9/f90100c.uml b/src/f9/f90100c.uml index 4c914d9ca..b51b6902d 100644 --- a/src/f9/f90100c.uml +++ b/src/f9/f90100c.uml @@ -53,72 +53,72 @@ ENDMASK PAGE "Mov Esclusi" -1 -1 78 13 -BOOLEAN F_SEL +BOOLEAN FE_SEL BEGIN PROMPT 1 1 "" END -NUMERIC F_NUMREG 7 +NUMERIC FE_NUMREG 7 BEGIN PROMPT 1 1 "" FLAGS "D" END -DATA F_DATAREG +DATA FE_DATAREG BEGIN PROMPT 1 1 "" FLAGS "D" END -DATA F_DATADOC +DATA FE_DATADOC BEGIN PROMPT 1 1 "" FLAGS "D" END -STRING F_CODCAUS 3 +STRING FE_CODCAUS 3 BEGIN PROMPT 1 1 "" FLAGS "D" END -NUMERIC F_MESELIQ 2 +NUMERIC FE_MESELIQ 2 BEGIN PROMPT 1 1 "" FLAGS "D" END -STRING F_NUMDOC 50 +STRING FE_NUMDOC 50 BEGIN PROMPT 1 1 "" FLAGS "D" END -NUMERIC F_IMPTOTDOC 15 2 +NUMERIC FE_IMPTOTDOC 15 2 BEGIN PROMPT 1 1 "" FLAGS "D" END -NUMERIC F_FORN 6 +NUMERIC FE_FORN 6 BEGIN PROMPT 1 1 "" FLAGS "D" END -STRING F_RAGSOC 80 +STRING FE_RAGSOC 80 BEGIN PROMPT 1 1 "" FLAGS "D" END -STRING F_PROTIVA 10 +STRING FE_PROTIVA 10 BEGIN PROMPT 1 1 "" FLAGS "D" END -STRING F_DESCR 50 +STRING FE_DESCR 50 BEGIN PROMPT 1 1 "" FLAGS "D" diff --git a/src/f9/f90100d.h b/src/f9/f90100d.h index de144045e..44d367b83 100644 --- a/src/f9/f90100d.h +++ b/src/f9/f90100d.h @@ -14,21 +14,21 @@ #define S_RES 301 // Elenco movimenti inclusi -#define F_SEL 101 -#define F_NUMREG 102 -#define F_DATAREG 103 -#define F_DATADOC 104 -#define F_CODCAUS 105 -#define F_TIPOMOV 106 -#define F_MESELIQ 107 -#define F_NUMDOC 108 -#define F_IMPTOTDOC 109 -#define F_FORN 110 -#define F_RAGSOC 111 -#define F_PROTIVA 112 -#define F_DESCR 113 -#define F_IESCLUDI 114 -#define F_IESCLUSO 115 +#define FI_SEL 101 +#define FI_NUMREG 102 +#define FI_DATAREG 103 +#define FI_DATADOC 104 +#define FI_CODCAUS 105 +#define FI_TIPOMOV 106 +#define FI_MESELIQ 107 +#define FI_NUMDOC 108 +#define FI_IMPTOTDOC 109 +#define FI_FORN 110 +#define FI_RAGSOC 111 +#define FI_PROTIVA 112 +#define FI_DESCR 113 +#define FI_IESCLUDI 114 +#define FI_IESCLUSO 115 // Elenco risultato movimenti (S_RES) #define F_RSEL 101 diff --git a/src/f9/f90100d.uml b/src/f9/f90100d.uml index 551b32d03..a21813e81 100644 --- a/src/f9/f90100d.uml +++ b/src/f9/f90100d.uml @@ -158,84 +158,84 @@ ENDMASK PAGE "Mov Inclusi" -1 -1 78 13 -BOOLEAN F_SEL +BOOLEAN FI_SEL BEGIN PROMPT 1 1 "" END -NUMERIC F_NUMREG 7 +NUMERIC FI_NUMREG 7 BEGIN PROMPT 1 2 "" FLAGS "D" END -DATA F_DATAREG +DATA FI_DATAREG BEGIN PROMPT 1 3 "" FLAGS "D" END -DATA F_DATADOC +DATA FI_DATADOC BEGIN PROMPT 1 4 "" FLAGS "D" END -STRING F_CODCAUS 3 +STRING FI_CODCAUS 3 BEGIN PROMPT 1 5 "" FLAGS "D" END -STRING F_TIPOMOV 3 +STRING FI_TIPOMOV 3 BEGIN PROMPT 1 6 "" FLAGS "D" END -NUMERIC F_MESELIQ 2 +NUMERIC FI_MESELIQ 2 BEGIN PROMPT 1 7 "" FLAGS "D" END -STRING F_NUMDOC 50 +STRING FI_NUMDOC 50 BEGIN PROMPT 1 8 "" FLAGS "D" END -NUMERIC F_IMPTOTDOC 15 2 +NUMERIC FI_IMPTOTDOC 15 2 BEGIN PROMPT 1 9 "" FLAGS "D" END -NUMERIC F_FORN 6 +NUMERIC FI_FORN 6 BEGIN PROMPT 1 10 "" FLAGS "D" END -STRING F_RAGSOC 80 +STRING FI_RAGSOC 80 BEGIN PROMPT 1 11 "" FLAGS "D" END -STRING F_PROTIVA 10 +STRING FI_PROTIVA 10 BEGIN PROMPT 1 12 "" FLAGS "D" END -STRING F_DESCR 50 +STRING FI_DESCR 50 BEGIN PROMPT 1 13 "" FLAGS "D" END -LIST F_IESCLUDI 2 +LIST FI_IESCLUDI 2 BEGIN PROMPT 1 1 "Escludi" ITEM "|" @@ -244,7 +244,7 @@ BEGIN FLAGS "D" END -BOOLEAN F_IESCLUSO +BOOLEAN FI_IESCLUSO BEGIN PROMPT 1 1 "ESCLUSO" FLAG "D" @@ -281,7 +281,7 @@ ENDMASK PAGE "Risultato estratti" -1 -1 78 13 -BOOLEAN F_SEL +BOOLEAN F_RSEL BEGIN PROMPT 1 1 "" FLAGS "D" diff --git a/src/f9/f9lib.h b/src/f9/f9lib.h index c72ee653b..9cee82cd8 100644 --- a/src/f9/f9lib.h +++ b/src/f9/f9lib.h @@ -528,9 +528,9 @@ class TProspetto_recset final : public TSQL_recordset TString* _regacq; TString* _protivaacq; TString* _dataregacq; - TString* _totale; - TString* _totimponibile; - TString* _totimposta; + real _totale; + real _totimponibile; + real _totimposta; static void format_string(TString& str_out, const TString& str) { str_out.cut(0) << "'" << check_str(str) << "'"; } static void format_string(TString& str_out, const char* str) { format_string(str_out, TString(str)); } diff --git a/src/f9/f9lib01.cpp b/src/f9/f9lib01.cpp index 6d9ab9c90..79b7b9726 100644 --- a/src/f9/f9lib01.cpp +++ b/src/f9/f9lib01.cpp @@ -261,8 +261,7 @@ bool TEstrazione::is_doc_xml(const TLocalisamfile& mov) clifo.put(CLI_CODCF, codcf); clifo.read(); const TString& statopaiv = clifo.get(CLI_STATOPAIV); - return (IS_ITALIANO(statopaiv)) - && clifo.get(CLI_COMCF) != "B513"; // Campione d'Italia + return (IS_ITALIANO(statopaiv)) && clifo.get(CLI_COMCF) != "B513"; // Campione d'Italia } bool TEstrazione::find_movcoll(const int numreg, _Out_ TString& numreg_rev_vend) diff --git a/src/f9/f9lib02.cpp b/src/f9/f9lib02.cpp index b15108ca6..833c4a79c 100644 --- a/src/f9/f9lib02.cpp +++ b/src/f9/f9lib02.cpp @@ -412,9 +412,6 @@ TProspetto_recset::TProspetto_recset(const char* numreg_acq, const char* numreg_ _regacq = new TString; _protivaacq = new TString; _dataregacq = new TString; - _totale = new TString; - _totimponibile = new TString; - _totimposta = new TString; // In modo da dare la possibilita' a SQLite di caricare le tabelle di campo, // altrimenti con tutte le join e from concatenate non ce la fa e fallirebbe. @@ -487,9 +484,9 @@ TProspetto_recset::TProspetto_recset(const char* numreg_acq, const char* numreg_ get_sum_imponibile_imposta(numreg_ven, s_imponibili, s_imposte); - format_string(*_totale, TString() << s_imponibili + s_imposte); - format_string(*_totimponibile, s_imponibili.stringa()); - format_string(*_totimposta, s_imposte.stringa()); + _totale= s_imponibili + s_imposte; + _totimponibile= s_imponibili; + _totimposta= s_imposte; TString sql; sql << "SELECT COD, CODTAB, S0, R0,\n" "B.GRUPPO, B.CONTO, B.SOTTOCONTO, B.DESCR,\n" @@ -500,7 +497,7 @@ TProspetto_recset::TProspetto_recset(const char* numreg_acq, const char* numreg_ << *_codforn << " AS CODFORN, " << *_ragsocforn << " AS RAGSOCFORN, " << *_addrforn << " AS ADDRFORN, " << *_capforn << " AS CAPFORN, " << *_cittaforn << " AS CITTAFORN, " << *_provinforn << " AS PROVINFORN, " << *_partivaforn << " AS PARTIVAFORN,\n" << *_totdoc << " AS TOTDOC,\n" << *_regacq << " AS REGACQ, " << *_protivaacq << " AS PROTIVAACQ, " << *_dataregacq << " AS DATAREGACQ,\n" - << *_totale << " AS TOTALE, " << *_totimponibile << " AS TOTIMPONIBILE, " << *_totimposta << " AS TOTIMPOSTA\n" + << _totale << " AS TOTALE, " << _totimponibile << " AS TOTIMPONIBILE, " << _totimposta << " AS TOTIMPOSTA\n" "FROM(\n" "\n" " SELECT PCON.GRUPPO, PCON.CONTO, PCON.SOTTOCONTO, PCON.DESCR,\n" @@ -547,9 +544,6 @@ TProspetto_recset::~TProspetto_recset() delete _regacq; delete _protivaacq; delete _dataregacq; - delete _totale; - delete _totimponibile; - delete _totimposta; } diff --git a/src/pdf/pdflib/pdflibdl.c b/src/pdf/pdflib/pdflibdl.c index 9328c6289..45e0a075d 100755 --- a/src/pdf/pdflib/pdflibdl.c +++ b/src/pdf/pdflib/pdflibdl.c @@ -35,12 +35,15 @@ #include #include #undef WIN32_LEAN_AND_MEAN +#define PDF_DLLNAME "pdflib.dll" +/* #ifdef NDEBUG #define PDF_DLLNAME "pdflib.dll" #else #define PDF_DLLNAME "pdflibd.dll" #endif +*/ static void * pdf_dlopen(const char *filename)