Patch level : 10.0 no patch
Files correlati : pl0002 Ricompilazione Demo : [ ] Commento : Corretta l'importazione delle anagrafiche git-svn-id: svn://10.65.10.50/branches/R_10_00@21758 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9bd9ea8f61
commit
19a848f5de
149
ps/pl0002100.cpp
149
ps/pl0002100.cpp
@ -8,6 +8,7 @@
|
||||
#include <progind.h>
|
||||
#include <reprint.h>
|
||||
#include <reputils.h>
|
||||
#include <tabmod.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <clifo.h>
|
||||
@ -35,6 +36,14 @@ public:
|
||||
virtual bool trasferisci();
|
||||
};
|
||||
|
||||
class TLif_clifo_ca_sedi : public TLif_transfer
|
||||
{
|
||||
protected:
|
||||
TISAM_recordset clifo(const char* ragsoc, const int key = 1) const;
|
||||
const long cerca_codf(const char* ragsoc) const;
|
||||
public:
|
||||
virtual bool trasferisci();
|
||||
};
|
||||
|
||||
class TLif_contratti : public TLif_transfer
|
||||
{
|
||||
@ -86,9 +95,20 @@ bool TLif_clifo_co_clifor::trasferisci()
|
||||
TString16 codcab = get_str("cod_agenzia1"); codcab.lpad(5,'0');
|
||||
TString80 iban = get_str("sig_iban1"); iban << get_str("sig_bban1");
|
||||
|
||||
const TString4 codspmezzo = get_str("cod_mezzo_trasp");
|
||||
const TString4 codlist = get_str("cod_listino");
|
||||
const TString4 percprovv = get_str("cod_catprovvi");
|
||||
const TString8 codag = get_str("cod_agente");
|
||||
const bool addbolli = get_str("flg_addebito_bollo")[0] == '0' ? false : true;
|
||||
const long percspinc = get_str("flg_addebito_spese")[0] == '0' ? 0L : 100;
|
||||
const TString4 codporto = get_str("cod_porto");
|
||||
|
||||
TString8 codcli;
|
||||
codcli.format("%04d", codcf); codcli << "00";
|
||||
|
||||
rec.zero();
|
||||
rec.put(CLI_TIPOCF, tipocf);
|
||||
rec.put(CLI_CODCF, codcf);
|
||||
rec.put(CLI_CODCF, codcli);
|
||||
rec.put(CLI_CODPAG, condpag);
|
||||
rec.put(CLI_FIDO, fido);
|
||||
rec.put(CLI_SOSPESO, sospeso == '0' ? false : true);
|
||||
@ -96,14 +116,27 @@ bool TLif_clifo_co_clifor::trasferisci()
|
||||
rec.put(CLI_CODCAB, codcab);
|
||||
rec.put(CLI_IBAN, iban);
|
||||
|
||||
cfv_rec.zero();
|
||||
cfv_rec.put(CFV_TIPOCF, tipocf);
|
||||
cfv_rec.put(CFV_CODCF, codcli);
|
||||
cfv_rec.put(CFV_CODSPMEZZO, codspmezzo);
|
||||
cfv_rec.put(CFV_CODLIST, codlist);
|
||||
cfv_rec.put(CFV_PERCPROVV, percprovv);
|
||||
cfv_rec.put(CFV_CODAG, codag);
|
||||
cfv_rec.put(CFV_ADDBOLLI, addbolli);
|
||||
cfv_rec.put(CFV_PERCSPINC, percspinc);
|
||||
cfv_rec.put(CFV_CODPORTO, codporto);
|
||||
|
||||
aggiorna_record(rec, lista_campi);
|
||||
if (test_write(clienti))
|
||||
{
|
||||
TString msg;
|
||||
msg << TR("Inserito cliente ") << " '" << tipocf << "\' -> "
|
||||
<< codcf << " - " << rec.get(CLI_RAGSOC);
|
||||
<< codcli << " - " << rec.get(CLI_RAGSOC);
|
||||
log(msg);
|
||||
}
|
||||
aggiorna_record(cfv_rec, lista_campi);
|
||||
test_write(cfven);
|
||||
}
|
||||
cfven.close();
|
||||
clienti.close();
|
||||
@ -128,26 +161,25 @@ bool TLif_clifo_ca_anagrafiche::trasferisci()
|
||||
clienti.open(_lock);
|
||||
TRectype& rec = clienti.curr();
|
||||
|
||||
TSystemisamfile cfven(LF_CFVEN);
|
||||
cfven.open(_lock);
|
||||
TRectype& cfv_rec = cfven.curr();
|
||||
|
||||
TLif_iterator hi(this);
|
||||
while (++hi)
|
||||
{
|
||||
const long codcf = get_long("cod_anagra");
|
||||
|
||||
TString8 codcli;
|
||||
codcli.format("%04d", codcf); codcli << "00";
|
||||
|
||||
char tipocf = 'C';
|
||||
rec.zero();
|
||||
rec.put(CLI_TIPOCF, tipocf);
|
||||
rec.put(CLI_CODCF, codcf);
|
||||
rec.put(CLI_CODCF, codcli);
|
||||
int err = rec.read(clienti);
|
||||
if(err != NOERR)
|
||||
{
|
||||
tipocf = 'F';
|
||||
rec.zero();
|
||||
rec.put(CLI_TIPOCF, tipocf);
|
||||
rec.put(CLI_CODCF, codcf);
|
||||
rec.put(CLI_CODCF, codcli);
|
||||
err = rec.read(clienti);
|
||||
}
|
||||
|
||||
@ -166,7 +198,7 @@ bool TLif_clifo_ca_anagrafiche::trasferisci()
|
||||
const long cap = get_long("cod_cap_fis");
|
||||
|
||||
rec.put(CLI_TIPOCF, tipocf);
|
||||
rec.put(CLI_CODCF, codcf);
|
||||
rec.put(CLI_CODCF, codcli);
|
||||
rec.put(CLI_STATOCF, stato);
|
||||
rec.put(CLI_RAGSOC, ragsoc);
|
||||
rec.put(CLI_TIPOPERS, tpper == 0L ? 'G' : 'F');
|
||||
@ -189,11 +221,82 @@ bool TLif_clifo_ca_anagrafiche::trasferisci()
|
||||
}
|
||||
}
|
||||
}
|
||||
cfven.close();
|
||||
clienti.close();
|
||||
return write_enabled();
|
||||
}
|
||||
|
||||
// trasferisce la terza parte dei clienti
|
||||
bool TLif_clifo_ca_sedi::trasferisci()
|
||||
{
|
||||
TString query =
|
||||
"SELECT * "
|
||||
"FROM dbo.CA_SEDI";
|
||||
|
||||
TRecordset& recset = create_recordset(query);
|
||||
TConfig& ini = config();
|
||||
|
||||
TString_array lista_campi;
|
||||
ini.list_variables(lista_campi, true, "CA_SEDI", true);
|
||||
|
||||
TSystemisamfile clienti(LF_CLIFO);
|
||||
clienti.open(_lock);
|
||||
TRectype& rec = clienti.curr();
|
||||
|
||||
TSystemisamfile cfven(LF_CFVEN);
|
||||
cfven.open(_lock);
|
||||
TRectype& cfv_rec = cfven.curr();
|
||||
|
||||
TLif_iterator hi(this);
|
||||
while (++hi)
|
||||
{
|
||||
TString8 codcf; codcf.format("%04d", get_long("cod_anagra_sede"));
|
||||
TString4 codsede; codsede.format("%02d", get_long("cdn_sede"));
|
||||
TString8 codcli; codcli << codcf << codsede;
|
||||
TString8 codcont; codcont << codcf << "00";
|
||||
|
||||
TToken_string key;
|
||||
key.add('C');
|
||||
key.add(codcont);
|
||||
|
||||
const TRectype& clifo_cache = cache().get(LF_CLIFO, key);
|
||||
const TRectype& cfven_cache = cache().get(LF_CFVEN, key);
|
||||
|
||||
rec.zero(); rec = clifo_cache;
|
||||
cfv_rec.zero(); cfv_rec = cfven_cache;
|
||||
|
||||
|
||||
const TString80 ragsoc = get_str("des_sede");
|
||||
const TString80 indirizzo = get_str("des_indir");
|
||||
const TString80 localita = get_str("des_localita");
|
||||
const long cap = get_long("cod_cap");
|
||||
const TString4 prov = get_str("sig_prov");
|
||||
//const TString16 tel = get_str("sig_tel");
|
||||
const TString16 cofi = "";
|
||||
const TString paiv = "";
|
||||
const TString8 fatt_a = codcont;
|
||||
|
||||
rec.put(CLI_CODCF, codcli);
|
||||
rec.put(CLI_RAGSOC, ragsoc);
|
||||
rec.put(CLI_INDCF, indirizzo);
|
||||
rec.put(CLI_LOCCF, localita);
|
||||
rec.put(CLI_CAPCF, cap);
|
||||
//rec.put(CLI_TEL, tel);
|
||||
rec.put(CLI_COFI, cofi);
|
||||
rec.put(CLI_PAIV, paiv);
|
||||
rec.put(CLI_CODCFFATT, fatt_a);
|
||||
|
||||
cfv_rec.put(CFV_CODCF, codcli);
|
||||
|
||||
aggiorna_record(rec, lista_campi);
|
||||
test_write(clienti);
|
||||
test_write(cfven);
|
||||
}
|
||||
clienti.close();
|
||||
cfven.close();
|
||||
return write_enabled();
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TLif_contratti
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -226,25 +329,31 @@ bool TLif_contratti::trasferisci()
|
||||
|
||||
while (++hi)
|
||||
{
|
||||
const long codcf = get_long("cod_clifor");
|
||||
TString8 tmp; tmp << codcf;
|
||||
if(!contratti.is_key(tmp))
|
||||
const long codcf = get_long("cod_clifor");
|
||||
const long codsed = get_long("cdn_sede");
|
||||
|
||||
TString8 cod_anagra_sede; cod_anagra_sede.format("%04d", codcf);
|
||||
TString4 cdn_sede; cdn_sede.format("%02d", codsed);
|
||||
|
||||
TString8 codcli; codcli << cod_anagra_sede << cdn_sede;
|
||||
|
||||
if(!contratti.is_key(codcli))
|
||||
{
|
||||
TDate dadata(get_str("dat_inizio"));
|
||||
bool inbolla = get_str("flg_nonriportaddt")[0] == 'N' ? false : true;
|
||||
|
||||
|
||||
trec.zero();
|
||||
trec.put(LVCONDV_CODCF, codcf);
|
||||
trec.put(LVCONDV_CODCF, codcli);
|
||||
trec.put(LVCONDV_CODCONT, 1);
|
||||
trec.put(LVCONDV_DATAIN, dadata);
|
||||
trec.put(LVCONDV_STPRZBOL, inbolla);
|
||||
test_write(condv);
|
||||
contratti.add(tmp, tmp);
|
||||
contratti.add(codcli, codcli);
|
||||
}
|
||||
|
||||
rrec.zero();
|
||||
grec.zero();
|
||||
rrec.put(LVRCONDV_CODCF, codcf);
|
||||
rrec.put(LVRCONDV_CODCF, codcli);
|
||||
rrec.put(LVRCONDV_CODCONT, 1);
|
||||
|
||||
const real dotin(get_str("qta_iniziale"));
|
||||
@ -253,7 +362,7 @@ bool TLif_contratti::trasferisci()
|
||||
|
||||
grec.put(CLIFOGIAC_ANNOES, anno);
|
||||
grec.put(CLIFOGIAC_TIPOCF, 'C');
|
||||
grec.put(CLIFOGIAC_CODCF, codcf);
|
||||
grec.put(CLIFOGIAC_CODCF, codcli);
|
||||
grec.put(CLIFOGIAC_INDSPED, 0);
|
||||
grec.put(CLIFOGIAC_CODART, codart);
|
||||
grec.put(CLIFOGIAC_NRIGA, 1);
|
||||
@ -410,6 +519,10 @@ void TImportazione_lif_msk::trasferisci()
|
||||
pc1.init(TR("Clienti / Fornitori"), query_header2, log);
|
||||
go_on = pc1.trasferisci();
|
||||
|
||||
TLif_clifo_ca_sedi pc2;
|
||||
pc2.init(TR("Sedi"), query_header2, log);
|
||||
go_on = pc2.trasferisci();
|
||||
|
||||
book.add(log);
|
||||
rep_to_print = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user