Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Corretta importazione clienti/agenti Hardy git-svn-id: svn://10.65.10.50/branches/R_10_00@21171 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7c27eeb97b
commit
f1a956c591
@ -177,7 +177,7 @@ void TIni2Txt::genera_cliente_var_txt(TConfig& ini)
|
||||
|
||||
const long codcf = ini.get_long(CLI_CODCF);
|
||||
//il codice terminale è il codagente legato al cliente
|
||||
clienti.set("CodiceTerminale", find_codag(codcf));
|
||||
clienti.set("CodiceTerminale", hd_find_codag(codcf));
|
||||
|
||||
clienti.set("Segno", segno);
|
||||
clienti.set("CodiceCliente", codcf);
|
||||
@ -229,7 +229,7 @@ void TIni2Txt::genera_cliente_var_txt(TConfig& ini)
|
||||
//------------------
|
||||
ini.set_paragraph("17");
|
||||
const TString& str_sconto = ini.get(CFV_SCONTO);
|
||||
clienti.set("ScontoFineFattura", find_sconto(str_sconto));
|
||||
clienti.set("ScontoFineFattura", hd_find_sconto(str_sconto));
|
||||
|
||||
|
||||
TString4 assfis = ini.get(CFV_ASSFIS);
|
||||
@ -291,7 +291,7 @@ void TIni2Txt::genera_riga_listino_var_txt(TConfig& ini)
|
||||
|
||||
//sconto
|
||||
const TString& str_sconto = ini.get(RCONDV_SCONTO);
|
||||
riga_listino.set(RCONDV_SCONTO, find_sconto(str_sconto));
|
||||
riga_listino.set(RCONDV_SCONTO, hd_find_sconto(str_sconto));
|
||||
|
||||
} //for(int r=1;;...
|
||||
|
||||
@ -331,7 +331,7 @@ void TIni2Txt::genera_prodotto_var_txt(TConfig& ini)
|
||||
|
||||
//sconto
|
||||
const TString& str_sconto = ini.get(ANAMAG_SCONTO);
|
||||
prodotto.set(ANAMAG_SCONTO, find_sconto(str_sconto));
|
||||
prodotto.set(ANAMAG_SCONTO, hd_find_sconto(str_sconto));
|
||||
|
||||
//campi da umart (49) (per ora una sola riga)
|
||||
//-------------------------------------------
|
||||
@ -449,18 +449,18 @@ void TIni2Txt::genera_sospeso_var_txt(TConfig& ini, TString_array& ini_paragraph
|
||||
|
||||
//riempie il record da esportare
|
||||
const long codcf = ini.get_long(PART_SOTTOCONTO);
|
||||
const TString& codage = find_codag(codcf);
|
||||
const TString& codage = hd_find_codag(codcf);
|
||||
sospeso.set("CodiceTerminale", codage);
|
||||
sospeso.set("Segno", segno);
|
||||
sospeso.set("CodiceCliente", codcf);
|
||||
sospeso.set("NumeroFattura", numfatt);
|
||||
sospeso.set("DataFattura", format_data_6(datadoc));
|
||||
sospeso.set("DataFattura", hd_format_date6(datadoc));
|
||||
residuo *= CENTO;
|
||||
residuo.round();
|
||||
sospeso.set("ImportoResiduo", residuo);
|
||||
imp_rata.round();
|
||||
sospeso.set("ImpOriginalDoc", imp_rata);
|
||||
sospeso.set("DataScadenza", format_data_6(data_rata));
|
||||
sospeso.set("DataScadenza", hd_format_date6(data_rata));
|
||||
sospeso.set("TipoDocumento", "F");
|
||||
}
|
||||
} //if (find_part_key(ini, ini_paragraphs, LF_SCADENZE...
|
||||
|
@ -222,7 +222,7 @@ void TFile2Txt::genera_clienti_txt(const long da_codcli)
|
||||
|
||||
|
||||
const TString& str_sconto = archivio_clienti.get(CFV_SCONTO).as_string();
|
||||
clienti.set("ScontoFineFattura", find_sconto(str_sconto));
|
||||
clienti.set("ScontoFineFattura", hd_find_sconto(str_sconto));
|
||||
|
||||
TString80 ntel = archivio_clienti.get(CLI_PTEL).as_string();
|
||||
ntel << archivio_clienti.get(CLI_TEL).as_string();
|
||||
@ -286,16 +286,16 @@ void TFile2Txt::genera_sospesi_txt()
|
||||
|
||||
//e vai che riempiamo i campi
|
||||
const long codcf = rec_part.get_long(PART_SOTTOCONTO); //riprendiamo il codcf come long
|
||||
const TString& codage = find_codag(codcf);
|
||||
const TString& codage = hd_find_codag(codcf);
|
||||
sospesi.set("CodiceTerminale", codage);
|
||||
sospesi.set("CodiceCliente", codcf);
|
||||
const TString& ndoc = rec_part.get(PART_NUMDOC);
|
||||
sospesi.set("NumeroFattura", ndoc);
|
||||
const TDate datadoc = rec_part.get_date(PART_DATADOC);
|
||||
sospesi.set("DataFattura", format_data_6(datadoc));
|
||||
sospesi.set("DataFattura", hd_format_date6(datadoc));
|
||||
sospesi.set("ImportoResiduo", residuo.valore());
|
||||
sospesi.set("ImpOriginalDoc", doc.valore());
|
||||
sospesi.set("DataScadenza", format_data_6(datascad));
|
||||
sospesi.set("DataScadenza", hd_format_date6(datascad));
|
||||
TString16 cod_partita;
|
||||
cod_partita << rec_part.get_int(PART_ANNO) << "-" << rec_part.get(PART_NUMPART);
|
||||
sospesi.set("Partita", cod_partita);
|
||||
@ -345,7 +345,7 @@ void TFile2Txt::genera_righelistini_txt()
|
||||
righe_listini.set(RCONDV_PREZZO, prezzo.integer());
|
||||
|
||||
const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
|
||||
righe_listini.set(RCONDV_SCONTO, find_sconto(str_sconto));
|
||||
righe_listini.set(RCONDV_SCONTO, hd_find_sconto(str_sconto));
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("listini");
|
||||
@ -374,19 +374,19 @@ void TFile2Txt::genera_contratti_txt()
|
||||
righe_contratti.new_rec("");
|
||||
|
||||
const long codcf = archivio_rcondv.get(CONDV_CODCF).as_int();
|
||||
righe_contratti.set("CodiceTerminale", find_codag(codcf));
|
||||
righe_contratti.set("CodiceTerminale", hd_find_codag(codcf));
|
||||
righe_contratti.set(RCONDV_CODRIGA, archivio_rcondv.get(RCONDV_CODRIGA));
|
||||
real prezzo = archivio_rcondv.get(RCONDV_PREZZO).as_real();
|
||||
prezzo *= 1000;
|
||||
prezzo.round();
|
||||
righe_contratti.set(RCONDV_PREZZO, prezzo.integer());
|
||||
const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
|
||||
righe_contratti.set(RCONDV_SCONTO, find_sconto(str_sconto));
|
||||
righe_contratti.set(RCONDV_SCONTO, hd_find_sconto(str_sconto));
|
||||
|
||||
TDate dataini = archivio_rcondv.get("CONDV.VALIN").as_date();
|
||||
righe_contratti.set(CONDV_VALIN, format_data_8(dataini));
|
||||
righe_contratti.set(CONDV_VALIN, hd_format_date8(dataini));
|
||||
TDate datafine = archivio_rcondv.get("CONDV.VALFIN").as_date();
|
||||
righe_contratti.set(CONDV_VALFIN, format_data_8(datafine));
|
||||
righe_contratti.set(CONDV_VALFIN, hd_format_date8(datafine));
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("particolari");
|
||||
@ -453,7 +453,7 @@ void TFile2Txt::genera_prodotti_txt()
|
||||
|
||||
prodotti.set(UMART_UM, archivio_anamag.get("UMART.UM"));
|
||||
const TString& str_sconto = archivio_anamag.get(ANAMAG_SCONTO).as_string();
|
||||
prodotti.set(ANAMAG_SCONTO, find_sconto(str_sconto));
|
||||
prodotti.set(ANAMAG_SCONTO, hd_find_sconto(str_sconto));
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("prodotti");
|
||||
|
@ -863,7 +863,7 @@ bool THardy_clienti::trasferisci_clienti()
|
||||
{
|
||||
// costruisco la chiave
|
||||
const TString& key = get_str("IdConto");
|
||||
const long codcf = get_codcf(key);
|
||||
const long codcf = hd_key2cli(key);
|
||||
if (codcf > 0)
|
||||
{
|
||||
rec.zero();
|
||||
@ -872,11 +872,11 @@ bool THardy_clienti::trasferisci_clienti()
|
||||
// ricerca comune
|
||||
const TString8 cap = get_str("IdCap"); //cap
|
||||
TString80 loc = get_str("Localita"); //località
|
||||
const TString8 com = cap2comune(cap,loc); //codice comune
|
||||
const TString8 stato = get_str("IdNazione"); //stato
|
||||
const TString4 com = cap2comune(cap,loc); //codice comune
|
||||
const TString4 stato = get_str("IdNazione"); //stato
|
||||
|
||||
rec.put(CLI_CAPCF, cap);
|
||||
if (com.full() && !com.blank())
|
||||
if (com.full())
|
||||
{
|
||||
rec.put(CLI_COMCF, com); //se riesce la CAP2COMUNE, inserisco il codice comune
|
||||
loc = "";
|
||||
@ -928,12 +928,17 @@ bool THardy_clienti::trasferisci_clienti()
|
||||
bool THardy_clienti::is_piva_doppia(const long codcf)
|
||||
{
|
||||
TToken_string tok; tok.add("C"); tok.add(codcf);
|
||||
const TString& statopaiv = cache().get(LF_CLIFO, tok, CLI_STATOPAIV);
|
||||
const TString& paiv = cache().get(LF_CLIFO, tok, CLI_PAIV);
|
||||
TISAM_recordset clifo("USE CLIFO KEY 5\nSELECT (CODCF > 200000)&&(CODCF < 300000)\nFROM TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV\nTO TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV");
|
||||
const TRectype& cli = cache().get(LF_CLIFO, tok);
|
||||
const TString& statopaiv = cli.get(CLI_STATOPAIV);
|
||||
const TString& paiv = cli.get(CLI_PAIV);
|
||||
|
||||
TISAM_recordset clifo("USE CLIFO KEY 5\n"
|
||||
"SELECT (CODCF>200000)&&(CODCF<300000)\n"
|
||||
"FROM TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV\n"
|
||||
"TO TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV");
|
||||
clifo.set_var("#STATOPAIV", TVariant(statopaiv));
|
||||
clifo.set_var("#PAIV", TVariant(paiv));
|
||||
return (clifo.items() > 1);
|
||||
return (clifo.items() > 1); // Spiegare??????????
|
||||
}
|
||||
|
||||
// restituisce il codice indirizzo di spedizione da usare per inserimento record
|
||||
@ -978,23 +983,22 @@ bool THardy_clienti::trasferisci_destinazioni()
|
||||
{
|
||||
// costruisco la chiave
|
||||
const TString& key = get_str("IdConto");
|
||||
const long codcf = get_codcf(key);
|
||||
const long codcf = hd_key2cli(key);
|
||||
rec.zero();
|
||||
rec.put(CLI_TIPOCF, "C");
|
||||
rec.put(CLI_CODCF, codcf);
|
||||
bool good = clifo.read() == NOERR;
|
||||
if (good)
|
||||
{
|
||||
bool doppio = is_piva_doppia(codcf);
|
||||
if (codcf > 200000 && codcf < 300000 && doppio)
|
||||
if (codcf > 200000 && codcf < 300000 && is_piva_doppia(codcf))
|
||||
{
|
||||
// cambio dati tra clienti e destinazione
|
||||
|
||||
// ricerca comune
|
||||
const TString8 cap = get_str("IdCap"); //cap
|
||||
TString80 loc = get_str("Localita"); //località
|
||||
const TString8 com = cap2comune(cap,loc); //codice comune
|
||||
const TString8 stato = get_str("IdNazione"); //stato
|
||||
const TString4 com = cap2comune(cap,loc); //codice comune
|
||||
const TString4 stato = get_str("IdNazione"); //stato
|
||||
|
||||
rec.put(CLI_CAPCF, cap);
|
||||
if (com.full() && !com.blank())
|
||||
@ -1014,7 +1018,7 @@ bool THardy_clienti::trasferisci_destinazioni()
|
||||
if (test_write(clifo))
|
||||
{
|
||||
TString msg;
|
||||
msg << TR("Modificato cliente ") << " '" << key << '\'' << TR("con codice ") << codcf ;
|
||||
msg << TR("Modificato cliente ") << " '" << key << '\'' << TR(" con codice ") << codcf ;
|
||||
log(msg);
|
||||
}
|
||||
}
|
||||
@ -1051,7 +1055,7 @@ bool THardy_clienti::trasferisci_destinazioni()
|
||||
// THardy_fornitori
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
long THardy_clienti::get_codcf(const TString& key) const
|
||||
long THardy_fornitori::key2forn(const TString& key) const
|
||||
{
|
||||
const long codcf = atol(key.mid(3,6));
|
||||
return codcf;
|
||||
@ -1076,7 +1080,7 @@ bool THardy_fornitori::trasferisci()
|
||||
while (++hi)
|
||||
{
|
||||
const TString& key = get_str("IdConto");
|
||||
const long codcf = get_codcf(key);
|
||||
const long codcf = key2forn(key);
|
||||
if (codcf > 0)
|
||||
{
|
||||
rec.zero();
|
||||
@ -1085,11 +1089,11 @@ bool THardy_fornitori::trasferisci()
|
||||
// ricerca comune
|
||||
const TString8 cap = get_str("IdCap"); //cap
|
||||
TString80 loc = get_str("Localita"); //località
|
||||
const TString8 com = cap2comune(cap,loc); //codice comune
|
||||
const TString8 stato = get_str("IdNazione"); //stato
|
||||
const TString4 com = cap2comune(cap,loc); //codice comune
|
||||
const TString4 stato = get_str("IdNazione"); //stato
|
||||
|
||||
rec.put(CLI_CAPCF, cap);
|
||||
if (com.full() && !com.blank())
|
||||
if (com.full())
|
||||
{
|
||||
rec.put(CLI_COMCF, com); //se riesce la CAP2COMUNE, inserisco il codice comune
|
||||
loc = "";
|
||||
|
@ -202,14 +202,16 @@ protected:
|
||||
int get_next_key_indsped(const char tipocf, const long codcf) const;
|
||||
bool trasferisci_clienti();
|
||||
bool trasferisci_destinazioni();
|
||||
long get_codcf(const TString& key) const;
|
||||
|
||||
public:
|
||||
virtual bool trasferisci();
|
||||
};
|
||||
|
||||
class THardy_fornitori : public THardy_clienti
|
||||
class THardy_fornitori : public THardy_transfer
|
||||
{
|
||||
protected:
|
||||
long key2forn(const TString& key) const;
|
||||
|
||||
public:
|
||||
virtual bool trasferisci();
|
||||
};
|
||||
|
34
ha/halib.cpp
34
ha/halib.cpp
@ -355,32 +355,33 @@ TEsporta_pagamenti_recordset::TEsporta_pagamenti_recordset(int rec_length)
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Metodi di utility
|
||||
/////////////////////////////////////////////////////////////
|
||||
real find_sconto(const TString& str_sconto)
|
||||
real hd_find_sconto(const TString& str_sconto)
|
||||
{
|
||||
TString goodexp;
|
||||
real val_perc;
|
||||
if (str_sconto.full())
|
||||
{
|
||||
TString goodexp;
|
||||
if (scontoexpr2perc(str_sconto, false, goodexp, val_perc))
|
||||
{
|
||||
val_perc = CENTO - (val_perc * CENTO);
|
||||
val_perc *= CENTO;
|
||||
val_perc.round();
|
||||
}
|
||||
}
|
||||
return val_perc;
|
||||
}
|
||||
|
||||
|
||||
const TString& find_codag(const long codcf)
|
||||
// Trova il codice agente Hardy (lungo 3) del cliente Campo
|
||||
const TString& hd_find_codag(long codcf)
|
||||
{
|
||||
TToken_string key_cfven;
|
||||
key_cfven.add("C");
|
||||
key_cfven.add(codcf);
|
||||
const TRectype& rec_cfven = cache().get(LF_CFVEN, key_cfven);
|
||||
TString8 codag = rec_cfven.get(CFV_CODAG);
|
||||
TString8 key_cfven;
|
||||
key_cfven.format("C|%ld", codcf);
|
||||
const TString& codag = cache().get(LF_CFVEN, key_cfven, CFV_CODAG);
|
||||
return codag.right(3); //il loro codagente è lungo 3!!!
|
||||
}
|
||||
|
||||
//il dio dei programmatori ci perdoni!
|
||||
const TString& format_data_8(const TDate& data)
|
||||
const TString& hd_format_date8(const TDate& data)
|
||||
{
|
||||
const int day = data.day();
|
||||
const int month = data.month();
|
||||
@ -390,7 +391,7 @@ const TString& format_data_8(const TDate& data)
|
||||
return str_data;
|
||||
}
|
||||
|
||||
const TString& format_data_6(const TDate& data)
|
||||
const TString& hd_format_date6(const TDate& data)
|
||||
{
|
||||
const int day = data.day();
|
||||
const int month = data.month();
|
||||
@ -401,22 +402,19 @@ const TString& format_data_6(const TDate& data)
|
||||
}
|
||||
|
||||
// determina codice cliente campo a partire da codice hardy in base alle regole dettatemi da Robbi
|
||||
const long get_codcf(const TString& key)
|
||||
|
||||
long hd_key2cli(const TString& key)
|
||||
{
|
||||
long codcf = 0;
|
||||
const long cod_hardy = atol(key.mid(3,6));
|
||||
const char first = key[0];
|
||||
long cod_hardy = atoi(key.mid(3,6));
|
||||
long codcf = 0;
|
||||
switch (first)
|
||||
{
|
||||
case 'H':
|
||||
{
|
||||
codcf = 130000+cod_hardy;
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
{
|
||||
codcf = 140000+cod_hardy;
|
||||
}
|
||||
break;
|
||||
case '0':
|
||||
{
|
||||
|
13
ha/halib.h
13
ha/halib.h
@ -211,14 +211,11 @@ public:
|
||||
TEsporta_pagamenti_recordset(int rec_length = 27);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//metodi di utility
|
||||
//----------------------------------------------------------
|
||||
real find_sconto(const TString& str_sconto);
|
||||
const TString& find_codag(const long codcf);
|
||||
const TString& format_data_8(const TDate& data);
|
||||
const TString& format_data_6(const TDate& data);
|
||||
const long get_codcf(const TString& key);
|
||||
real hd_find_sconto(const TString& str_sconto);
|
||||
const TString& hd_find_codag(long codcf); // Da cliente campo ad agente Hardy ("007")
|
||||
const TString& hd_format_date8(const TDate& data);
|
||||
const TString& hd_format_date6(const TDate& data);
|
||||
long hd_key2cli(const TString& key);
|
||||
|
Loading…
x
Reference in New Issue
Block a user