git-svn-id: svn://10.65.10.50/branches/R_10_00@23054 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8425102391
commit
d27ef67a40
@ -10,17 +10,6 @@
|
|||||||
|
|
||||||
bool THardy_transaction::is_server() const
|
bool THardy_transaction::is_server() const
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
bool i_am_server = false;
|
|
||||||
TConfig config(CONFIG_INSTALL, "Main");
|
|
||||||
const int type = config.get_int("Type");
|
|
||||||
if (type == 2)
|
|
||||||
{
|
|
||||||
const TFilename study = config.get("Study");
|
|
||||||
i_am_server = xvt_fsys_is_fixed_drive(study) != 0;
|
|
||||||
}
|
|
||||||
return i_am_server;
|
|
||||||
*/
|
|
||||||
static int nType = -1;
|
static int nType = -1;
|
||||||
if (nType < 0)
|
if (nType < 0)
|
||||||
nType = ini_get_int(CONFIG_INSTALL, "Main", "Type", 1);
|
nType = ini_get_int(CONFIG_INSTALL, "Main", "Type", 1);
|
||||||
|
@ -63,10 +63,8 @@ int ordina_upload(const TObject** o1, const TObject** o2)
|
|||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
class THardy_upload_recordset : public THardy_recordset
|
class THardy_upload_recordset : public THardy_recordset
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
virtual TRecnotype new_rec(const char* trc);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual TRecnotype new_rec(const char* trc);
|
||||||
THardy_upload_recordset(const TFilename& filename);
|
THardy_upload_recordset(const TFilename& filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -102,7 +100,7 @@ THardy_upload_recordset::THardy_upload_recordset(const TFilename& filename)
|
|||||||
add_trc_field("SU", "nDDT", T_N, 23, 5);
|
add_trc_field("SU", "nDDT", T_N, 23, 5);
|
||||||
add_trc_field("SU", "nFATT", T_N, 28, 5);
|
add_trc_field("SU", "nFATT", T_N, 28, 5);
|
||||||
add_trc_field("SU", "nBOLLA", T_N, 33, 5);
|
add_trc_field("SU", "nBOLLA", T_N, 33, 5);
|
||||||
add_trc_field("SU", "NomeAgente", T_X, 38, 30); //x
|
add_trc_field("SU", "NomeAgente", T_X, 38,30); //x
|
||||||
|
|
||||||
//Tipo record TF
|
//Tipo record TF
|
||||||
//--------------
|
//--------------
|
||||||
@ -693,7 +691,7 @@ void TUpload2Campo::elabora_SI(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
TEsercizi_contabili esc;
|
TEsercizi_contabili esc;
|
||||||
const int annoes = esc.date2esc(data_incasso);
|
const int annoes = esc.date2esc(data_incasso);
|
||||||
const int anno = datareg.year();
|
const int anno = datareg.year();
|
||||||
const long numdoc = recset.get("NumeroFattura").as_int();
|
const long ndoc = recset.get("NumeroFattura").as_int();
|
||||||
const TString& str_datadoc = recset.get("DataFattura").as_string();
|
const TString& str_datadoc = recset.get("DataFattura").as_string();
|
||||||
const TDate datadoc = upload_format_date6(str_datadoc);
|
const TDate datadoc = upload_format_date6(str_datadoc);
|
||||||
const TString4 tipodoc = recset.get("TipoDocumento").as_string();
|
const TString4 tipodoc = recset.get("TipoDocumento").as_string();
|
||||||
@ -719,8 +717,9 @@ void TUpload2Campo::elabora_SI(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
log.log(2, msg);
|
log.log(2, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
TConfig config(CONFIG_DITTA, "ha");
|
//TConfig config(CONFIG_DITTA, "ha");
|
||||||
const TString& codcaus = config.get("InpCausale");
|
//const TString& codcaus = config.get("InpCausale");
|
||||||
|
const TString8 codcaus = ini_get_string(CONFIG_DITTA, "ha", "InpCausale");
|
||||||
const TCausale caus(codcaus, anno);
|
const TCausale caus(codcaus, anno);
|
||||||
|
|
||||||
TMovimentoPN mov;
|
TMovimentoPN mov;
|
||||||
@ -732,13 +731,13 @@ void TUpload2Campo::elabora_SI(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
descr << "Incasso. Cliente: " << codcf << " - Agente: " << codice_agente;
|
descr << "Incasso. Cliente: " << codcf << " - Agente: " << codice_agente;
|
||||||
head.put(MOV_DESCR, descr);
|
head.put(MOV_DESCR, descr);
|
||||||
|
|
||||||
head.put(MOV_ANNOES, annoes);
|
head.put(MOV_ANNOES, annoes);
|
||||||
head.put(MOV_DATADOC, datadoc);
|
head.put(MOV_DATADOC, datadoc);
|
||||||
head.put(MOV_NUMDOC, numdoc);
|
head.put(MOV_NUMDOC, ndoc);
|
||||||
head.put(MOV_TIPODOC, tipodoc);
|
head.put(MOV_TIPODOC, tipodoc);
|
||||||
head.put(MOV_TIPOMOV, caus.tipomov());
|
head.put(MOV_TIPOMOV, caus.tipomov());
|
||||||
head.put(MOV_ANNOIVA, anno);
|
head.put(MOV_ANNOIVA, anno);
|
||||||
head.put(MOV_TOTDOC, incasso);
|
head.put(MOV_TOTDOC, incasso);
|
||||||
|
|
||||||
long numreg = 999999L;
|
long numreg = 999999L;
|
||||||
|
|
||||||
@ -986,7 +985,7 @@ void TUpload2Campo::elabora_BR(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
|
|
||||||
void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log)
|
void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log)
|
||||||
{
|
{
|
||||||
char rec_tipodoc = recset.get(DOC_TIPODOC).as_string()[0];
|
const char rec_tipodoc = recset.get(DOC_TIPODOC).as_string()[0];
|
||||||
//i documenti di vendita annullati vanno ignorati
|
//i documenti di vendita annullati vanno ignorati
|
||||||
if (rec_tipodoc == 'A' || rec_tipodoc == 'N' || rec_tipodoc <= ' ')
|
if (rec_tipodoc == 'A' || rec_tipodoc == 'N' || rec_tipodoc <= ' ')
|
||||||
return;
|
return;
|
||||||
@ -1022,11 +1021,9 @@ void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
//2b) numerazione documento
|
//2b) numerazione documento
|
||||||
//il codnum dipende dal tipo documento del terminale (F,B,O...) e dal codice del terminale
|
//il codnum dipende dal tipo documento del terminale (F,B,O...) e dal codice del terminale
|
||||||
//se tipo 'V' va cambiato in tipo 'B' in quanto le bolle valorizzate sono normali bolle in Campo
|
//se tipo 'V' va cambiato in tipo 'B' in quanto le bolle valorizzate sono normali bolle in Campo
|
||||||
|
const char key_td = rec_tipodoc == 'V' ? 'B' : rec_tipodoc;
|
||||||
TString4 codnum;
|
TString4 codnum;
|
||||||
if (rec_tipodoc == 'V')
|
codnum << key_td << codice_terminale;
|
||||||
rec_tipodoc = 'B';
|
|
||||||
|
|
||||||
codnum << rec_tipodoc << codice_terminale;
|
|
||||||
const TString& numerazione = cache().get("%NUM", codnum, "CODTAB");
|
const TString& numerazione = cache().get("%NUM", codnum, "CODTAB");
|
||||||
if (numerazione != codnum)
|
if (numerazione != codnum)
|
||||||
{
|
{
|
||||||
@ -1054,7 +1051,7 @@ void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
|
|
||||||
//dato il codice cliente sul recordset (stringa di 6) risale al codice di Campo (long di 6) stabilendo..
|
//dato il codice cliente sul recordset (stringa di 6) risale al codice di Campo (long di 6) stabilendo..
|
||||||
//..eventuali relazioni con i clienti nuovi (con '*') importati nei record VC all'inizio della procedura
|
//..eventuali relazioni con i clienti nuovi (con '*') importati nei record VC all'inizio della procedura
|
||||||
const TString& str_codcf = recset.get(DOC_CODCF).as_string();
|
const TString8 str_codcf = recset.get(DOC_CODCF).as_string();
|
||||||
long codcf = check_cliente(str_codcf, log);
|
long codcf = check_cliente(str_codcf, log);
|
||||||
|
|
||||||
doc.put(DOC_CODCF, codcf);
|
doc.put(DOC_CODCF, codcf);
|
||||||
@ -1173,7 +1170,7 @@ void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
for (int j = 0; ; j++)
|
for (int j = 0; ; j++)
|
||||||
{
|
{
|
||||||
const real curr_aliq_iva = config.get("IVAaliquota", NULL, j);
|
const real curr_aliq_iva = config.get("IVAaliquota", NULL, j);
|
||||||
if (curr_aliq_iva == ZERO)
|
if (curr_aliq_iva.is_zero())
|
||||||
break;
|
break;
|
||||||
if (curr_aliq_iva.integer() == aliquota_iva)
|
if (curr_aliq_iva.integer() == aliquota_iva)
|
||||||
{
|
{
|
||||||
@ -1218,6 +1215,27 @@ void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
msg.insert("Controllato documento: ", 0);
|
msg.insert("Controllato documento: ", 0);
|
||||||
log.log(0, msg);
|
log.log(0, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!incasso.is_zero() && rec_tipodoc == 'V') // Incasso su bolla valorizzata
|
||||||
|
{
|
||||||
|
const TRecnotype old_pos = recset.current_row();
|
||||||
|
recset.new_rec("SI");
|
||||||
|
recset.set("CodiceTerminale", codice_terminale);
|
||||||
|
recset.set("CodiceCliente", str_codcf);
|
||||||
|
TString16 numfatt; numfatt.format("%ld/%02d", ndoc, atoi(codice_terminale));
|
||||||
|
recset.set("NumeroFattura", numfatt);
|
||||||
|
recset.set("DataFattura", hd_format_date6(datadoc));
|
||||||
|
recset.set("ImportoIncassato", real(incasso * CENTO));
|
||||||
|
recset.set("DataIncasso", hd_format_date6(datadoc));
|
||||||
|
TString16 partita; partita.format("%04d-%4ld/%02d", datadoc.year(), ndoc, atoi(codice_terminale));
|
||||||
|
recset.set("Partita", partita);
|
||||||
|
recset.set("TipoDocumento", "V");
|
||||||
|
recset.set("DataEmissione", hd_format_date6(datadoc));
|
||||||
|
recset.move_to(old_pos);
|
||||||
|
|
||||||
|
msg.format("Generazione anticipo di %s su bolla valorizzata %s", incasso.stringa(0, 2), (const char*)partita);
|
||||||
|
log.log(0, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1384,12 +1402,12 @@ void TUpload2Campo::elabora(const TMask& mask, TLog_report& log)
|
|||||||
n_files_d--;
|
n_files_d--;
|
||||||
}
|
}
|
||||||
|
|
||||||
TProgind pi(n_files_d, TR("Acquisizione files in corso..."), true, true);
|
TProgress_monitor pi(n_files_d, TR("Acquisizione upload in corso..."));
|
||||||
|
|
||||||
//scandisce i files uno ad uno
|
//scandisce i files uno ad uno
|
||||||
for (int i = 0; i < n_files_d; i++)
|
for (int i = 0; i < n_files_d; i++)
|
||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
if (!pi.add_status())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const TFilename curr_fname = src_files_list.row(i);
|
const TFilename curr_fname = src_files_list.row(i);
|
||||||
@ -1403,15 +1421,10 @@ void TUpload2Campo::elabora(const TMask& mask, TLog_report& log)
|
|||||||
recset.sort(ordina_upload);
|
recset.sort(ordina_upload);
|
||||||
|
|
||||||
TString msg;
|
TString msg;
|
||||||
#ifdef DBG
|
|
||||||
msg << "D:/dati/hardy/" << "cazzone_" << curr_fname.name_only() << ".txt";
|
|
||||||
recset.save_as(msg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//creazione progind e log
|
//creazione progind e log
|
||||||
msg.cut(0);
|
|
||||||
msg << "Elaborazione file " << curr_fname << " in corso...";
|
msg << "Elaborazione file " << curr_fname << " in corso...";
|
||||||
TProgind pi(items, msg, true, true);
|
TProgress_monitor pi(items, msg);
|
||||||
|
|
||||||
msg.cut(0);
|
msg.cut(0);
|
||||||
msg << "File " << curr_fname.name();
|
msg << "File " << curr_fname.name();
|
||||||
@ -1432,7 +1445,7 @@ void TUpload2Campo::elabora(const TMask& mask, TLog_report& log)
|
|||||||
//giro su tutti i record del terribile recordset per l'acquisizione dei dati
|
//giro su tutti i record del terribile recordset per l'acquisizione dei dati
|
||||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
if (!pi.add_status())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//acquisizione tipo record da riga corrente del file di input
|
//acquisizione tipo record da riga corrente del file di input
|
||||||
|
@ -110,7 +110,7 @@ TObject* TCodArtEsselungaUM_cache::key2obj(const char* key)
|
|||||||
if (key && *key)
|
if (key && *key)
|
||||||
{
|
{
|
||||||
TToken_string code(key);
|
TToken_string code(key);
|
||||||
TString80 codart; code.get(0, codart);
|
TCodice_articolo codart; code.get(0, codart);
|
||||||
if (codart.full())
|
if (codart.full())
|
||||||
{
|
{
|
||||||
const TString& codcf = ini_get_string(CONFIG_DITTA, "ha", "Esselunga_CodEsselunga");
|
const TString& codcf = ini_get_string(CONFIG_DITTA, "ha", "Esselunga_CodEsselunga");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user