Patch level :10.0 470
Files correlati : Ricompilazione Demo : [ ] Commento :migliorata la riattribuzione campi conai; adesso converte anche anamag e non si fa fregare dai codagg1/2 scritti alla organo di riproduzione maschile di canide git-svn-id: svn://10.65.10.50/trunk@19443 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ee69db4a49
commit
e8af18a686
69
ba/bacnv.cpp
69
ba/bacnv.cpp
@ -195,6 +195,9 @@ public:
|
||||
void convert_clifo_privati();
|
||||
void convert_pcon_ivd();
|
||||
void convert_profile(const char * profile_name);
|
||||
//roba per conai
|
||||
void convert_conai_anamag();
|
||||
void convert_conai_rdoc();
|
||||
void convert_conai_righe();
|
||||
|
||||
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
||||
@ -2183,19 +2186,61 @@ void TConversione_archivi::convert_profile(const char* profile_name)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Converte le righe documento in modo da riassegnare i campi CONAI
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void TConversione_archivi::convert_conai_righe()
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Converte le righe documento e anamag in modo da riassegnare i campi CONAI
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void TConversione_archivi::convert_conai_anamag()
|
||||
{
|
||||
TConfig ditta(CONFIG_DITTA, "ve");
|
||||
TString_array conai_default_vals;
|
||||
const char* conai_default_names[CONAI_CLASSES] = {"CONAI_DEFAULT_ACC", "CONAI_DEFAULT_ALL", "CONAI_DEFAULT_CAR",
|
||||
"CONAI_DEFAULT_LEG", "CONAI_DEFAULT_PLA", "CONAI_DEFAULT_VET"};
|
||||
const char* conai_default_values[CONAI_CLASSES] = {"AC99", "AL99", "CA40", "LE99", "PL12", "VE99"};
|
||||
|
||||
FOR_EACH_CONAI_CLASS(cc)
|
||||
{
|
||||
const TString& conai_cat = ditta.get(conai_default_names[cc], NULL, -1, conai_default_values[cc]);
|
||||
conai_default_vals.add(conai_cat);
|
||||
}
|
||||
|
||||
//prende solo le righe che hanno un peso conai di carta e/o plastica
|
||||
TISAM_recordset anamag("USE ANAMAG\nSELECT (CONCAR>0)||(CONPLA>0)\n");
|
||||
const long anamag_items = anamag.items();
|
||||
|
||||
TProgind pi(anamag_items, "Gestione anagrafica articoli...", false);
|
||||
for (bool ok = anamag.move_first(); ok; ok = anamag.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
|
||||
//prende i pesi conai su ciascuna riga
|
||||
FOR_EACH_CONAI_CLASS(cc)
|
||||
{
|
||||
const char* peso_name = conai_peso_name(cc, LF_ANAMAG);
|
||||
const real peso = anamag.get(peso_name).as_real();
|
||||
//se peso conai > 0, deve scrivere il codice conai nel campo CONAISC
|
||||
if (peso > ZERO)
|
||||
{
|
||||
const char* sottocat = conai_sottocat_name(cc, LF_ANAMAG);
|
||||
TFieldref fr(sottocat, LF_ANAMAG);
|
||||
fr.write(conai_default_vals.row(cc), anamag.cursor()->curr());
|
||||
}
|
||||
}
|
||||
anamag.cursor()->relation()->rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TConversione_archivi::convert_conai_rdoc()
|
||||
{
|
||||
//deve considerare tutte le righe documento che abbiano almeno uno tra codagg1 e codagg2 compilato
|
||||
TString query;
|
||||
query << "USE RDOC\n";
|
||||
query << "SELECT (CODAGG1?=\"??\")||(CODAGG2?=\"????\")";
|
||||
query << "SELECT (BETWEEN(CODAGG1,\"AC\",\"VE\"))||(BETWEEN(CODAGG2,\"AC01\",\"VE99\"))";
|
||||
TISAM_recordset righedoc(query);
|
||||
const long righedoc_items = righedoc.items();
|
||||
|
||||
TProgind pi(righedoc_items, "Ricostruzione righe CONAI...", false);
|
||||
TProgind pi(righedoc_items, "Ricostruzione righe documento...", false);
|
||||
|
||||
//ci vuole un TVariable_rectype perchè il TRectype non ha campi virtuali!
|
||||
TVariable_rectype rdoc(LF_RIGHEDOC);
|
||||
@ -2203,7 +2248,8 @@ void TConversione_archivi::convert_conai_righe()
|
||||
for (bool ok = righedoc.move_first(); ok; ok = righedoc.move_next())
|
||||
{
|
||||
//deve prendere dalla riga il valore di codagg2 e confrontarlo con una delle nuove sottocategorie conai
|
||||
pi.addstatus(1);
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
rdoc = righedoc.cursor()->curr();
|
||||
TString4 codagg2 = rdoc.get(RDOC_CODAGG2);
|
||||
TString4 codagg1 = rdoc.get(RDOC_CODAGG1);
|
||||
@ -2238,6 +2284,15 @@ void TConversione_archivi::convert_conai_righe()
|
||||
}
|
||||
}
|
||||
|
||||
void TConversione_archivi::convert_conai_righe()
|
||||
{
|
||||
//gestione del file anamag
|
||||
convert_conai_anamag();
|
||||
|
||||
//gestione delle righedoc
|
||||
convert_conai_rdoc();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Programma di conversione archivi speciale
|
||||
|
@ -123,7 +123,7 @@ Flags = ""
|
||||
Item_01 = "Riattribuzione codice allegato", "bacnv 21", ""
|
||||
Item_02 = "Aggiornamento IV direttiva CEE", "bacnv 22", ""
|
||||
Item_03 = "Aggiornamento profili documento personalizzati", "bacnv 23", ""
|
||||
Item_04 = "Riattribuzione campi CONAI in righe documento", "bacnv 24", ""
|
||||
Item_04 = "Riattribuzione campi CONAI", "bacnv 24", ""
|
||||
|
||||
[MENU_PREFERITI]
|
||||
Caption = "Preferiti"
|
||||
|
Loading…
x
Reference in New Issue
Block a user