From 5f21b8706a71fa419f9892bd1500d67d45c360d4 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 6 May 2013 08:51:47 +0000 Subject: [PATCH] Corretta gestione DNINST git-svn-id: svn://10.65.10.50/branches/R_10_00@22849 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba2400.cpp | 9 +++--- ba/ba2800a.uml | 6 ++-- ba/bacnv.cpp | 74 ++++++++++++++++++++++++++++++++------------------ 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/ba/ba2400.cpp b/ba/ba2400.cpp index 95aaa5168..9992b163b 100755 --- a/ba/ba2400.cpp +++ b/ba/ba2400.cpp @@ -144,25 +144,24 @@ public: bool TForm_printer::create() { - TString16 cod_prof; TApplication::create(); if (argc() < 3) return error_box("Specificare il nome del profilo di stampa"); - TFilename form(argv(2)); form.ext("frm");form.upper(); + TFilename form(argv(2)); form.ext("frm"); form.lower(); long code=0; if (argc() == 4) code = atol(argv(3)); if (!fexist(form)) - return error_box(FR("Il profilo %s non esiste"), (const char*)form); + return cantread_box(form); form.ext(""); _tabcom = new TLocalisamfile(LF_TABCOM); - cod_prof.format("%05ld",code); + TString8 cod_prof; cod_prof.format("%05ld",code); TTab_form f(form, (code != 0) ? cod_prof : ""); f.print(); stop_run(); - return TRUE; + return true; } bool TForm_printer::destroy() diff --git a/ba/ba2800a.uml b/ba/ba2800a.uml index b42a770db..2972dc5d1 100644 --- a/ba/ba2800a.uml +++ b/ba/ba2800a.uml @@ -152,7 +152,7 @@ ENDPAGE ENDMASK -PAGE "Informazioni" -1 -1 60 10 +PAGE "Informazioni" -1 -1 62 10 NUMBER F_NUMBER 5 BEGIN @@ -253,12 +253,12 @@ END DATE F_ATACCESS BEGIN - PROMPT 28 6 "Ultimo aggiornamento " + PROMPT 27 6 "Ultimo aggiornamento " END NUMBER F_ATYEAR 4 BEGIN - PROMPT 2 7 "Numero versione " + PROMPT 1 8 "Anno " END ENDPAGE diff --git a/ba/bacnv.cpp b/ba/bacnv.cpp index 20fe50a60..a265d112a 100755 --- a/ba/bacnv.cpp +++ b/ba/bacnv.cpp @@ -2239,6 +2239,8 @@ void TConversione_archivi::convert_conai_anamag() void TConversione_archivi::convert_conai_rdoc() { + TFast_isamfile f(LF_RIGHEDOC); + //deve considerare tutte le righe documento che abbiano almeno uno tra codagg1 e codagg2 compilato TString query; query << "USE RDOC\n"; @@ -2246,7 +2248,7 @@ void TConversione_archivi::convert_conai_rdoc() TISAM_recordset righedoc(query); const long righedoc_items = righedoc.items(); - TProgind pi(righedoc_items, "Ricostruzione righe documento...", false); + TProgind pi(righedoc_items, TR("Ricostruzione righe documento..."), false); //ci vuole un TVariable_rectype perchè il TRectype non ha campi virtuali! TVariable_rectype rdoc(LF_RIGHEDOC); @@ -2257,36 +2259,54 @@ void TConversione_archivi::convert_conai_rdoc() if (!pi.addstatus(1)) break; rdoc = righedoc.cursor()->curr(); - TString4 codagg2 = rdoc.get(RDOC_CODAGG2); - TString4 codagg1 = rdoc.get(RDOC_CODAGG1); - //se codagg2 non è 4 caratteri o è cazzato (<4) oppure non c'entra un cavolo (>4); quindi deve considerare.. - //..codagg1; se codagg1 è lungo 2 va bene lui - if (codagg2.len() < 4 && codagg1.len() == 2) - { - codagg2 = codagg1; - codagg2 << "99"; - } - //per prima cosa sistema i codici categoria - //quale è la classe conai? (plastica,carta,vetro,ecc.??) - const TCONAI_class cc = conai_str2class(codagg2); - //come si chiama il campo virtuale su rdoc in cui anrà inserito il codice categoria? - const char* csn = conai_sottocat_name(cc); - //noto il campo di destinazione ci mette il codice corretto - rdoc.put(csn, codagg2); - rdoc.zero(RDOC_CODAGG1); - rdoc.zero(RDOC_CODAGG2); - //adesso tocca ai pesi conai - real qtagg1 = rdoc.get_real(RDOC_QTAGG1); - //la classe è sempre quella di prima;il campo virtuale no - const char* cpn = conai_peso_name(cc); - //noto il campo di destinazione ci mette il peso conai - rdoc.put(cpn, qtagg1); - rdoc.zero(RDOC_QTAGG1); + TString4 codagg1 = rdoc.get(RDOC_CODAGG1); + TString4 codagg2 = rdoc.get(RDOC_CODAGG2); + if (codagg1.full() || codagg2.full()) + { + //se codagg2 non è 4 caratteri o è cazzato (<4) oppure non c'entra un cavolo (>4); quindi deve considerare.. + //..codagg1; se codagg1 è lungo 2 va bene lui + if (codagg2.len() < 4 && codagg1.len() == 2) + { + codagg2 = codagg1; + codagg2 << "99"; + } + //per prima cosa sistema i codici categoria + //quale è la classe conai? (plastica,carta,vetro,ecc.??) + const TCONAI_class cc = conai_str2class(codagg2); + //come si chiama il campo virtuale su rdoc in cui anrà inserito il codice categoria? + const char* csn = conai_sottocat_name(cc); + //noto il campo di destinazione ci mette il codice corretto + rdoc.put(csn, codagg2); + rdoc.zero(RDOC_CODAGG1); + rdoc.zero(RDOC_CODAGG2); + + //adesso tocca ai pesi conai + const real qtagg1 = rdoc.get_real(RDOC_QTAGG1); + if (!qtagg1.is_zero()) + { + //la classe è sempre quella di prima;il campo virtuale no + const char* cpn = conai_peso_name(cc); + //noto il campo di destinazione ci mette il peso conai + rdoc.put(cpn, qtagg1); + rdoc.zero(RDOC_QTAGG1); + } + } + + const real qtagg3 = rdoc.get(RDOC_QTAGG3); + if (!qtagg3.is_zero()) + { + rdoc.put("NUMFOGLI", qtagg3); + rdoc.zero(RDOC_QTAGG3); + } //scrittura finale del record - TLocalisamfile f(LF_RIGHEDOC); int err = rdoc.rewrite(f); + if (err != NOERR) + { + cantwrite_box(f.description()); + break; + } } }